xref: /trunk/main/sw/inc/ndtxt.hxx (revision 39acede3)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SW_NDTXT_HXX
25 #define SW_NDTXT_HXX
26 
27 #include <cppuhelper/weakref.hxx>
28 
29 #include "swdllapi.h"
30 #include <error.h>
31 #include <node.hxx>
32 #include <hintids.hxx>
33 #include <ndhints.hxx>
34 #include <errhdl.hxx>
35 #include <modeltoviewhelper.hxx>
36 #include <SwNumberTreeTypes.hxx>
37 #include <IDocumentContentOperations.hxx>
38 
39 #include <sfx2/Metadatable.hxx>
40 
41 #include <vector>
42 #include <set>
43 
44 class SfxHint;
45 class SwNumRule;
46 class SwNodeNum;
47 class SwList;
48 class SvxLRSpaceItem;
49 
50 namespace utl {
51 	class TransliterationWrapper;
52 }
53 
54 class SwTxtFmtColl;
55 class SwCntntFrm;
56 class SwTxtFld;
57 class SwTxtInputFld;
58 class SfxItemSet;
59 class SwUndoTransliterate;
60 
61 
62 struct SwSpellArgs; // for Spell(), splargs.hxx
63 struct SwConversionArgs; // for Convert(), splargs.hxx
64 class SwInterHyphInfo; // for Hyphenate(), splargs.hxx
65 class SwWrongList; // for OnlineSpelling
66 class SwGrammarMarkUp;
67 class OutputDevice;
68 class SwScriptInfo;
69 struct SwDocStat;
70 struct SwParaIdleData_Impl;
71 
72 namespace com { namespace sun { namespace star {
73 	namespace uno {
74 		template < class > class Sequence;
75 	}
76 	namespace text { class XTextContent; }
77 } } }
78 
79 typedef std::set< xub_StrLen > SwSoftPageBreakList;
80 
81 // --------------------
82 // SwTxtNode
83 // --------------------
84 class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
85 {
86 
87 	// fuer das Erzeugen des ersten TextNode
88 	friend class SwDoc; 		// CTOR und AppendTxtNode()
89 	friend class SwNodes;
90 	friend class SwTxtFrm;
91 	friend class SwScriptInfo;
92 
93 	//Kann 0 sein, nur dann nicht 0 wenn harte Attribute drin stehen.
94 	//Also niemals direkt zugreifen!
95 	SwpHints    *m_pSwpHints;
96 
97 	mutable SwNodeNum* mpNodeNum; // Numerierung fuer diesen Absatz
98 	XubString   m_Text;
99 
100 	SwParaIdleData_Impl* m_pParaIdleData_Impl;
101 
102 	// Some of the chars this para are hidden. Paragraph has to be reformatted
103 	// on changing the view to print preview.
104 	mutable bool m_bContainsHiddenChars : 1;
105 	// The whole paragraph is hidden because of the hidden text attribute
106 	mutable bool m_bHiddenCharsHidePara : 1;
107 	// The last two flags have to be recalculated if this flag is set:
108 	mutable bool m_bRecalcHiddenCharFlags : 1;
109 
110 	mutable bool m_bLastOutlineState : 1;
111 	bool m_bNotifiable;
112 
113 	// sal_uInt8 nOutlineLevel; //#outline level, removed by zhaojianwei.
114 
115 	bool mbEmptyListStyleSetDueToSetOutlineLevelAttr;
116 
117 	// boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or
118 	// <ResetAllAttr(..)> method is running.
119 	// Needed to avoid duplicate handling of attribute change actions.
120 	bool mbInSetOrResetAttr;
121 	// pointer to the list, to whose the text node is added to
122 	SwList* mpList;
123 	/// #i111677# cached expansion (for clipboard)
124 	::std::auto_ptr< ::rtl::OUString > m_pNumStringCache;
125 
126 	::com::sun::star::uno::WeakReference<
127 		::com::sun::star::text::XTextContent> m_wXParagraph;
128 
129 	//UUUU DrawingLayer FillAttributes in a preprocessed form for primitive usage
130 	drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes;
131 
132     SW_DLLPRIVATE SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl,
133                              const SfxItemSet* pAutoAttr = 0 );
134 
135 	// Kopiert die Attribute an nStart nach pDest.
136 	SW_DLLPRIVATE void CopyAttr( SwTxtNode *pDest, const xub_StrLen nStart, const xub_StrLen nOldPos);
137 
138 	SW_DLLPRIVATE SwTxtNode* _MakeNewTxtNode( const SwNodeIndex&, sal_Bool bNext = sal_True,
139 								sal_Bool bChgFollow = sal_True );
140 
141     SW_DLLPRIVATE void CutImpl(
142           SwTxtNode * const pDest, const SwIndex & rDestStart,
143           const SwIndex & rStart, /*const*/ xub_StrLen nLen,
144           const bool bUpdate = true );
145 
146 	// Verlagere alles umfassende harte Attribute in den AttrSet des Absatzes
147 	SW_DLLPRIVATE void MoveTxtAttr_To_AttrSet(); // wird von SplitNode gerufen.
148 
149 	// lege den spz. AttrSet an
150 	SW_DLLPRIVATE virtual void NewAttrSet( SwAttrPool& );
151 
152 	SW_DLLPRIVATE void Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt,
153 						xub_StrLen nEndPos, sal_Bool bExpandFlds ) const;
154 
155     // Optimization: Asking for information about hidden characters at SwScriptInfo
156     // updates these flags.
IsCalcHiddenCharFlags() const157     inline bool IsCalcHiddenCharFlags() const
158         { return m_bRecalcHiddenCharFlags; }
SetHiddenCharAttribute(bool bNewHiddenCharsHidePara,bool bNewContainsHiddenChars) const159     inline void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const
160     {
161         m_bHiddenCharsHidePara = bNewHiddenCharsHidePara;
162         m_bContainsHiddenChars = bNewContainsHiddenChars;
163         m_bRecalcHiddenCharFlags = false;
164     }
165 
166     SW_DLLPRIVATE void CalcHiddenCharFlags() const;
167 
168     SW_DLLPRIVATE SwNumRule * _GetNumRule(sal_Bool bInParent = sal_True) const;
169 
170     SW_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM,
171             LanguageType nLang, sal_uInt16 nLangWhichId,
172             const Font *pFont,  sal_uInt16 nFontWhichId );
173 
174     //
175     // Start: Data collected during idle time
176     //
177     SW_DLLPRIVATE void SetParaNumberOfWords( sal_uLong nTmpWords ) const;
178     SW_DLLPRIVATE sal_uLong GetParaNumberOfWords() const;
179     SW_DLLPRIVATE void SetParaNumberOfChars( sal_uLong nTmpChars ) const;
180     SW_DLLPRIVATE sal_uLong GetParaNumberOfChars() const;
181     SW_DLLPRIVATE void InitSwParaStatistics( bool bNew );
182 
183     /** create number for this text node, if not already existing
184 
185         @return number of this node
186     */
187     SwNodeNum* CreateNum() const;
188 
189     inline void TryDeleteSwpHints();
190 
191     SW_DLLPRIVATE void impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet);
192 
193     const SwTxtInputFld* GetOverlappingInputFld( const SwTxtAttr& rTxtAttr ) const;
194 
195 public:
196 	//Bug 120881:Modify here for Directly Page Numbering
197 	bool HasPageNumberField();
198 	//Bug 120881(End)
199     bool IsWordCountDirty() const;
200     bool IsWrongDirty() const;
201     bool IsGrammarCheckDirty() const;
202     bool IsSmartTagDirty() const; // SMARTTAGS
203     bool IsAutoCompleteWordDirty() const;
204     void SetWordCountDirty( bool bNew ) const;
205     void SetWrongDirty( bool bNew ) const;
206     void SetGrammarCheckDirty( bool bNew ) const;
207     void SetSmartTagDirty( bool bNew ) const; // SMARTTAGS
208     void SetAutoCompleteWordDirty( bool bNew ) const;
209     void SetWrong( SwWrongList* pNew, bool bDelete = true );
210     SwWrongList* GetWrong();
211     const SwWrongList* GetWrong() const;
212     void SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete = true );
213     SwGrammarMarkUp* GetGrammarCheck();
214     // SMARTTAGS
215     void SetSmartTags( SwWrongList* pNew, bool bDelete = true );
216     SwWrongList* GetSmartTags();
217 	//Modify here for #119405, by easyfan, 2012-05-24
218 	bool TryCharSetExpandToNum(const SfxItemSet& pCharSet);
219 	//End of modification, by easyfan
220 
221 	//
222 	// End: Data collected during idle time
223 	//
224 protected:
225 	// fuers Umhaengen der TxtFmtCollections (Outline-Nummerierung!!)
226 	virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
227 	virtual void SwClientNotify( const SwModify&, const SfxHint& );
228 
229 public:
230 	using SwCntntNode::GetAttr;
231 
GetTxt() const232 	const String& GetTxt() const { return m_Text; }
233 
234 	// getters for SwpHints
235 	inline       SwpHints &GetSwpHints();
236 	inline const SwpHints &GetSwpHints() const;
GetpSwpHints()237 	inline       SwpHints *GetpSwpHints()       { return m_pSwpHints; }
GetpSwpHints() const238 	inline const SwpHints *GetpSwpHints() const { return m_pSwpHints; }
HasHints() const239 	inline       bool   HasHints() const { return m_pSwpHints ? true : false; }
240 	inline       SwpHints &GetOrCreateSwpHints();
241 
242 	virtual ~SwTxtNode();
243 
244 	virtual xub_StrLen Len() const;
245 
246 	// steht in itratr
247 	void GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong &rAbs,
248 						OutputDevice* pOut = 0 ) const;
249 
250     // overriding to handle change of certain paragraph attributes
251     virtual sal_Bool SetAttr( const SfxPoolItem& );
252     virtual sal_Bool SetAttr( const SfxItemSet& rSet );
253     virtual sal_Bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
254     virtual sal_Bool ResetAttr( const SvUShorts& rWhichArr );
255     virtual sal_uInt16 ResetAllAttr();
256 
257     /// insert text content
258     void InsertText( const XubString & rStr, const SwIndex & rIdx,
259                      const enum IDocumentContentOperations::InsertFlags nMode
260                          = IDocumentContentOperations::INS_DEFAULT );
261 
262     /** delete text content
263         ATTENTION: must not be called with a range that overlaps the start of
264                    an attribute with both extent and dummy char
265      */
266     void EraseText ( const SwIndex &rIdx, const xub_StrLen nCount = STRING_LEN,
267                      const enum IDocumentContentOperations::InsertFlags nMode
268                          = IDocumentContentOperations::INS_DEFAULT );
269 
270     /** delete all attributes.
271         If neither pSet nor nWhich is given, delete all attributes (except
272         refmarks, toxmarks, meta) in range.
273         @param rIdx     start position
274         @param nLen     range in which attributes will be deleted
275         @param pSet     if not 0, delete only attributes contained in pSet
276         @param nWhich   if not 0, delete only attributes with matching which
277         @param bInclRefToxMark
278             refmarks, toxmarks, and metas will be ignored unless this is true
279         ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
280      */
281     void RstTxtAttr(
282         const SwIndex &rIdx,
283         const xub_StrLen nLen,
284         const sal_uInt16 nWhich = 0,
285         const SfxItemSet* pSet = 0,
286         const sal_Bool bInclRefToxMark = sal_False );
287 	void	GCAttr();
288 
289 	// loesche das Text-Attribut (muss beim Pool abgemeldet werden!)
290 	void 	DestroyAttr( SwTxtAttr* pAttr );
291 
292     // loesche alle Attribute aus dem SwpHintsArray.
293     void    ClearSwpHintsArr( bool bDelFields );
294 
295     /// Insert pAttr into hints array. @return true if inserted successfully
296     bool    InsertHint( SwTxtAttr * const pAttr,
297                   const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
298     /// create new text attribute from rAttr and insert it
299     /// @return     inserted hint; 0 if not sure the hint is inserted
300     SwTxtAttr* InsertItem( SfxPoolItem& rAttr,
301                   const xub_StrLen nStart, const xub_StrLen nEnd,
302                   const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
303 
304     // setze diese Attribute am TextNode. Wird der gesamte Bereich umspannt,
305     // dann setze sie nur im AutoAttrSet (SwCntntNode:: SetAttr)
306     sal_Bool SetAttr(
307         const SfxItemSet& rSet,
308         const xub_StrLen nStt,
309         const xub_StrLen nEnd,
310         const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
311 
312     // erfrage die Attribute vom TextNode ueber den Bereich
313     // Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
314     // If <bMergeIndentValuesOfNumRule> == sal_True, the indent attributes of
315     // the corresponding list level of an applied list style is merged into
316     // the requested item set as a LR-SPACE item, if <bOnlyTxtAttr> == sal_False,
317     // corresponding node has not its own indent attributes and the
318     // position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT.
319     sal_Bool GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
320                   sal_Bool bOnlyTxtAttr = sal_False,
321                   sal_Bool bGetFromChrFmt = sal_True,
322                   const bool bMergeIndentValuesOfNumRule = false ) const;
323     // <--
324 
325 	// uebertrage Attribute eines AttrSets ( AutoFmt ) in das SwpHintsArray
326 	void FmtToTxtAttr( SwTxtNode* pNd );
327 
328     /// delete all attributes of type nWhich at nStart (opt. end nEnd)
329     void DeleteAttributes( const sal_uInt16 nWhich,
330                   const xub_StrLen nStart, const xub_StrLen nEnd = 0 );
331     /// delete the attribute pTxtAttr
332     void DeleteAttribute ( SwTxtAttr * const pTxtAttr );
333 
334 	// Aktionen auf Text und Attributen
335     // introduce optional parameter to control, if all attributes have to be copied.
336     void CopyText( SwTxtNode * const pDest,
337                const SwIndex &rStart,
338                const xub_StrLen nLen,
339                const bool bForceCopyOfAllAttrs = false );
340     void CopyText( SwTxtNode * const pDest,
341                const SwIndex &rDestStart,
342                const SwIndex &rStart,
343                xub_StrLen nLen,
344                const bool bForceCopyOfAllAttrs = false );
345 
346     void        CutText(SwTxtNode * const pDest,
347                     const SwIndex & rStart, const xub_StrLen nLen);
348     inline void CutText(SwTxtNode * const pDest, const SwIndex &rDestStart,
349                     const SwIndex & rStart, const xub_StrLen nLen);
350 
351     /// replace nDelLen characters at rStart with rText
352     void ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen,
353             const XubString& rText );
354 	void ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, const XubString& rText,
355 					const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets );
356 
357 	// virtuelle Methoden aus dem CntntNode
358 	virtual SwCntntFrm *MakeFrm( SwFrm* );
359     virtual SwCntntNode *SplitCntntNode( const SwPosition & );
360 	virtual SwCntntNode *JoinNext();
361 	virtual SwCntntNode *JoinPrev();
362 
363 	SwCntntNode *AppendNode( const SwPosition & );
364 
365 	// setze ggf. das DontExpand-Flag an INet bzw. Zeichenvorlagen
366     sal_Bool DontExpandFmt( const SwIndex& rIdx, bool bFlag = true,
367 						sal_Bool bFmtToTxtAttributes = sal_True );
368 
369     enum GetTxtAttrMode {
370         DEFAULT,    /// DEFAULT: (Start <= nIndex <  End)
371         EXPAND,     /// EXPAND : (Start <  nIndex <= End)
372         PARENT,     /// PARENT : (Start <  nIndex <  End)
373     };
374 
375     /** get the innermost text attribute covering position nIndex.
376         @param nWhich   only attribute with this id is returned.
377         @param eMode    the predicate for matching (@see GetTxtAttrMode).
378 
379         ATTENTION: this function is not well-defined for those
380         hints of which several may cover a single position, like
381         RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
382      */
383     SwTxtAttr *GetTxtAttrAt(
384         xub_StrLen const nIndex,
385         RES_TXTATR const nWhich,
386         enum GetTxtAttrMode const eMode = DEFAULT ) const;
387 
388     /** get the innermost text attributes covering position nIndex.
389         @param nWhich   only attributes with this id are returned.
390         @param eMode    the predicate for matching (@see GetTxtAttrMode).
391      */
392     ::std::vector<SwTxtAttr *> GetTxtAttrsAt(
393         xub_StrLen const nIndex,
394         RES_TXTATR const nWhich,
395         enum GetTxtAttrMode const eMode = DEFAULT ) const;
396 
397     /** get the text attribute at position nIndex which owns
398         the dummy character CH_TXTATR_* at that position, if one exists.
399         @param nIndex   the position in the text
400         @param nWhich   if different from RES_TXTATR_END, return only
401                         attribute with given which id
402         @return the text attribute at nIndex of type nWhich, if it exists
403     */
404     SwTxtAttr *GetTxtAttrForCharAt(
405         const xub_StrLen nIndex,
406         const RES_TXTATR nWhich = RES_TXTATR_END ) const;
407 
408     SwTxtFld* GetFldTxtAttrAt(
409         const xub_StrLen nIndex,
410         const bool bIncludeInputFldAtStart = false ) const;
411 
412 	// Aktuelles Wort zurueckliefern
413 	XubString GetCurWord(xub_StrLen) const;
414 	sal_uInt16 Spell(SwSpellArgs*);
415 	sal_uInt16 Convert( SwConversionArgs & );
416 
417 	inline SwTxtFmtColl *GetTxtColl() const;
418 	virtual SwFmtColl *ChgFmtColl( SwFmtColl* );
419 	void _ChgTxtCollUpdateNum( const SwTxtFmtColl* pOld,
420 								const SwTxtFmtColl* pNew );
421 
422 	// kopiere die Collection mit allen Autoformaten zum Dest-Node
423 	// dieser kann auch in einem anderen Dokument stehen!
424 	// (Methode steht im ndcopy.cxx!!)
425 	void CopyCollFmt( SwTxtNode& rDestNd );
426 
427     //
428     // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
429     //
430 
431     /**
432        Returns numbering rule of this text node.
433 
434        @param bInParent     search in parent attributes, too
435 
436        @return numbering rule of this text node or NULL if none is set
437      */
438     SwNumRule *GetNumRule(sal_Bool bInParent = sal_True) const;
439 
GetNum() const440     inline const SwNodeNum* GetNum() const
441     {
442         return mpNodeNum;
443     }
444 
445     SwNumberTree::tNumberVector GetNumberVector() const;
446 
447     /**
448        Returns if this text node is an outline.
449 
450        @retval true      this text node is an outline
451        @retval false     else
452      */
453     bool IsOutline() const;
454 
455     bool IsOutlineStateChanged() const;
456 
457     void UpdateOutlineState();
458 
459     /**
460        Notify this textnode that its numbering rule has changed.
461      */
462     void NumRuleChgd();
463 
464     /** Returns outline of numbering string
465 
466         Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control,
467         if the prefix and the suffix strings have to been included or not.
468 
469         @param _bInclPrefixAndSuffixStrings
470         optional input parameter - boolean indicating, if the prefix and the
471         suffix strings have to been included or not. default value = <true>
472 
473         @param _nRestrictToThisLevel
474         optional input parameter - unsigned integer indicating the maximum outline
475         level to which the output string must be restricted to. Default value is
476         MAXLEVEL
477     */
478     XubString GetNumString( const bool _bInclPrefixAndSuffixStrings = true, const unsigned int _nRestrictToThisLevel = MAXLEVEL ) const;
479 
480     /**
481        Returns the additional indents of this text node and its numbering.
482 
483        @param bTxtLeft  ???
484 
485        @return additional indents
486      */
487      long GetLeftMarginWithNum( sal_Bool bTxtLeft = sal_False ) const;
488 
489     /**
490        Returns the combined first line indent of this text node and
491        its numbering.
492 
493        @param the first line indent of this text node taking the
494                numbering into account (return parameter)
495 
496        @retval sal_True   this node has SwNodeNum and has numbering rule
497        @retval sal_False  else
498      */
499     sal_Bool GetFirstLineOfsWithNum( short& rFirstOffset ) const;
500 
501     SwTwips GetAdditionalIndentForStartingNewList() const;
502 
503     // --> OD 2008-12-02 #i96772#
504     void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const;
505     // <--
506 
507     /** return left margin for tab stop position calculation
508 
509         OD 2008-06-30 #i91133#
510         Needed for text formatting
511         Method considers new list level attributes, which also can provide a left margin value
512 
513         @author OD
514     */
515     long GetLeftMarginForTabCalculation() const;
516 
517     /** -> #i29560
518         Returns if this text node has a number.
519 
520         This text node has a number if it has a SwNodeNum and a
521         numbering rule and the numbering format specified for the
522         level of the SwNodeNum is of an enumeration type.
523 
524         @retval sal_True    This text node has a number.
525         @retval sal_False   else
526      */
527     sal_Bool HasNumber() const;
528 
529     /** -> #i29560
530         Returns if this text node has a bullet.
531 
532         This text node has a bullet if it has a SwNodeNum and a
533         numbering rule and the numbering format specified for the
534         level of the SwNodeNum is of a bullet type.
535 
536         @retval sal_True    This text node has a bullet.
537         @retval sal_False   else
538      */
539     sal_Bool HasBullet() const;
540 
541     /** -> #i27615#
542         Returns is this text node is numbered.
543 
544         This node is numbered if it has a SwNodeNum and it has a
545         numbering rule and has not a hidden SwNodeNum.
546 
547         ATTENTION: Returns sal_True even if the SwNumFmt has type
548         SVX_NUM_NUMBER_NONE.
549 
550         @retval sal_True      This node is numbered.
551         @retval sal_False     else
552      */
553     sal_Bool IsNumbered() const;
554 
555     /** -> #i27615#
556         Returns if this text node has a marked label.
557 
558         @retval true       This text node has a marked label.
559         @retval false      else
560      */
561     bool HasMarkedLabel() const;
562 
563     /** Sets the list level of this text node.
564 
565         Side effect, when the text node is a list item:
566         The text node's representation in the list tree (<SwNodeNum> instance)
567         is updated.
568 
569         @param nLevel level to set
570     */
571     void SetAttrListLevel(int nLevel);
572 
573     bool HasAttrListLevel() const;
574 
575     int GetAttrListLevel() const;
576 
577     /** Returns the actual list level of this text node, when it is a list item
578 
579         @return the actual list level of this text node, if it is a list item,
580                -1 otherwise
581     */
582     int GetActualListLevel() const;
583 
584     /**
585        Returns outline level of this text node.
586 
587        If a text node has an outline number (i.e. it has an SwNodeNum
588        and a outline numbering rule) the outline level is the level of
589        this SwNodeNum.
590 
591        If a text node has no outline number and has a paragraph style
592        attached the outline level is the outline level of the
593        paragraph style.
594 
595        Otherwise the text node has no outline level (NO_NUMBERING).
596 
597        NOTE: The outline level of text nodes is subject to change. The
598        plan is to have an SwTxtNode::nOutlineLevel member that is
599        updated from a paragraph style upon appliance of that paragraph
600        style.
601 
602        @return outline level or NO_NUMBERING if there is no outline level
603      */
604     int GetAttrOutlineLevel() const;
605 
606     /**
607        Sets the out line level *at* a text node.
608 
609        @param nLevel     the level to be set
610 
611        If the text node has an outline number the level is set at the
612        outline number.
613 
614        If the text node has no outline number but has a paragraph
615        style applied the outline level is set at the paragraph style.
616 
617        NOTE: This is subject to change, see GetOutlineLevel.
618      */
619       void SetAttrOutlineLevel(int nLevel);
620 
621     bool IsEmptyListStyleDueToSetOutlineLevelAttr();
622     void SetEmptyListStyleDueToSetOutlineLevelAttr();
623     void ResetEmptyListStyleDueToResetOutlineLevelAttr();
624 
625 
626     /**
627        Returns the width of leading tabs/blanks in this paragraph.
628        This space will be converted into numbering indent if the paragraph
629        is set to be numbered.
630 
631        @return     the width of the leading whitespace
632      */
633     sal_uInt16 GetWidthOfLeadingTabs() const;
634 
635 
636     /**
637        Returns if the paragraph has a visible numbering or bullet.
638        This includes all kinds of numbering/bullet/outlines.
639        Note: This function returns false, if the numbering format is
640        SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
641 
642        @return     sal_True if the paragraph has a visible numbering/bullet/outline
643      */
644     bool HasVisibleNumberingOrBullet() const;
645 
646     void SetListId( const String sListId );
647     String GetListId() const;
648 
649     /** Determines, if the list level indent attributes can be applied to the
650         paragraph.
651 
652         The list level indents can be applied to the paragraph under the one
653         of following conditions:
654         - the list style is directly applied to the paragraph and the paragraph
655           has no own indent attributes.
656         - the list style is applied to the paragraph through one of its paragraph
657           styles, the paragraph has no own indent attributes and on the paragraph
658           style hierarchy from the paragraph to the paragraph style with the
659           list style no indent attributes are found.
660 
661         @author OD
662 
663         @return boolean
664     */
665     bool AreListLevelIndentsApplicable() const;
666 
667     /** Retrieves the list tab stop position, if the paragraph's list level defines
668         one and this list tab stop has to merged into the tap stops of the paragraph
669 
670         @author OD
671 
672         @param nListTabStopPosition
673         output parameter - containing the list tab stop position
674 
675         @return boolean - indicating, if a list tab stop position is provided
676     */
677     bool GetListTabStopPosition( long& nListTabStopPosition ) const;
678 
679     /** Retrieves the character following the list label, if the paragraph's
680         list level defines one.
681 
682         @author OD
683 
684         @return XubString - the list tab stop position
685     */
686     XubString GetLabelFollowedBy() const;
687 
688     //
689     // END OF BULLET/NUMBERING/OUTLINE STUFF:
690     //
691 
692     void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
693 
694     sal_uInt16 GetLang( const xub_StrLen nBegin, const xub_StrLen nLen = 0,
695                     sal_uInt16 nScript = 0 ) const;
696 
697     // steht in ndcopy.cxx
698 	sal_Bool IsSymbol( const xub_StrLen nBegin ) const;	// steht in itratr.cxx
699 	virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
700 
701 	// interaktive Trennung: wir finden den TxtFrm und rufen sein CalcHyph
702 	sal_Bool Hyphenate( SwInterHyphInfo &rHyphInf );
703 	void DelSoftHyph( const xub_StrLen nStart, const xub_StrLen nEnd );
704 
705     // --> OD 2007-11-15 #i83479#
706     // add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
707     // when <bWithNum = true> that a space is inserted after the string for
708     // the list label.
709     // add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
710     // spaces are inserted in front of the expanded text string depending on
711     // the list level.
712 	XubString GetExpandTxt( const xub_StrLen nIdx = 0,
713                             const xub_StrLen nLen = STRING_LEN,
714                             const bool bWithNum = false,
715                             const bool bAddSpaceAfterListLabelStr = false,
716                             const bool bWithSpacesForLevel = false ) const;
717     // <--
718 	sal_Bool GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx = 0,
719 						xub_StrLen nIdx = 0, xub_StrLen nLen = STRING_LEN,
720                        sal_Bool bWithNum = sal_False, sal_Bool bWithFtn = sal_True,
721                        sal_Bool bReplaceTabsWithSpaces = sal_False ) const;
722 
723     /*
724      *
725      */
726     const ModelToViewHelper::ConversionMap*
727             BuildConversionMap( rtl::OUString& rExpandText ) const;
728 
729 	XubString GetRedlineTxt( xub_StrLen nIdx = 0,
730 						  xub_StrLen nLen = STRING_LEN,
731 						  sal_Bool bExpandFlds = sal_False,
732 						  sal_Bool bWithNum = sal_False ) const;
733 	//Liefert fuer die Initalfunktion tatsaechliche Anzahl der Initialzeichen
734 	//bei nWishLen == 0 die des ersten Wortes
735 	sal_uInt16 GetDropLen( sal_uInt16 nWishLen) const;
736 
737     // Passes back info needed on the dropcap dimensions
738     bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const;
739 
740     // Hidden Paragraph Field:
CalcHiddenParaField()741     inline bool CalcHiddenParaField()
742         { return m_pSwpHints ? m_pSwpHints->CalcHiddenParaField() : false; }
743     // set CalcVisible flags
SetCalcHiddenParaField()744     inline void SetCalcHiddenParaField()
745         { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); }
746 
747     // is the paragraph visible?
HasHiddenParaField() const748     inline bool HasHiddenParaField() const
749         { return m_pSwpHints ? m_pSwpHints->HasHiddenParaField() : false; }
750 
751     //
752     // Hidden Paragraph Field:
753     //
HasHiddenCharAttribute(bool bWholePara) const754     inline bool HasHiddenCharAttribute( bool bWholePara ) const
755     {
756         if ( m_bRecalcHiddenCharFlags )
757             CalcHiddenCharFlags();
758         return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars;
759     }
760 
SetCalcHiddenCharFlags() const761     inline void SetCalcHiddenCharFlags() const
762         { m_bRecalcHiddenCharFlags = true; }
763 
764 // --> FME 2004-06-08 #i12836# enhanced pdf
765     //
766     // Returns if the node is hidden due to
767     // 1. HiddenParaField
768     // 2. HiddenCharAttribute
769     // 3. HiddenSection
770     //
771     bool IsHidden() const;
772 // <--
773 
774 	TYPEINFO();	// fuer rtti
775 
776     // override SwIndexReg
777     virtual void Update(
778         SwIndex const & rPos,
779         const xub_StrLen nChangeLen,
780         const bool bNegative = false,
781         const bool bDelete = false );
782 
783 	// change text to Upper/Lower/Hiragana/Katagana/...
784 	void TransliterateText( utl::TransliterationWrapper& rTrans,
785 							xub_StrLen nStart, xub_StrLen nEnd,
786 							SwUndoTransliterate* pUndo = 0 );
787 
788     // count words in given range
789     void CountWords( SwDocStat& rStat, xub_StrLen nStart, xub_StrLen nEnd ) const;
790 
791     // Checks some global conditions like loading or destruction of document
792     // to economize notifications
793     bool IsNotificationEnabled() const;
794 
795     // Checks a temporary notification blocker and the global conditions of IsNotificationEnabled()
796     bool IsNotifiable() const;
797 
798     void SetListRestart( bool bRestart );
799     bool IsListRestart() const;
800 
801     void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
802     bool HasAttrListRestartValue() const;
803     SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const;
804     SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const;
805 
806     void SetCountedInList( bool bCounted );
807     bool IsCountedInList() const;
808 
809     void AddToList();
810     void RemoveFromList();
811     bool IsInList() const;
812 
813     bool IsFirstOfNumRule() const;
814 
815 	sal_uInt16 GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) const;
816 
817     SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
GetXParagraph() const818         ::com::sun::star::text::XTextContent> const& GetXParagraph() const
819             { return m_wXParagraph; }
SetXParagraph(::com::sun::star::uno::Reference<::com::sun::star::text::XTextContent> const & xParagraph)820     SW_DLLPRIVATE void SetXParagraph(::com::sun::star::uno::Reference<
821                     ::com::sun::star::text::XTextContent> const& xParagraph)
822             { m_wXParagraph = xParagraph; }
823 
824     // sfx2::Metadatable
825     virtual ::sfx2::IXmlIdRegistry& GetRegistry();
826     virtual bool IsInClipboard() const;
827     virtual bool IsInUndo() const;
828     virtual bool IsInContent() const;
829     virtual ::com::sun::star::uno::Reference<
830         ::com::sun::star::rdf::XMetadatable > MakeUnoObject();
831 
832     DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode)
833 
834     //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
835     virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
836 };
837 
838 //-----------------------------------------------------------------------------
839 
GetSwpHints()840 inline SwpHints & SwTxtNode::GetSwpHints()
841 {
842     ASSERT_ID( m_pSwpHints, ERR_NOHINTS);
843     return *m_pSwpHints;
844 }
GetSwpHints() const845 inline const SwpHints &SwTxtNode::GetSwpHints() const
846 {
847     ASSERT_ID( m_pSwpHints, ERR_NOHINTS);
848     return *m_pSwpHints;
849 }
850 
GetOrCreateSwpHints()851 inline SwpHints& SwTxtNode::GetOrCreateSwpHints()
852 {
853     if ( !m_pSwpHints )
854     {
855         m_pSwpHints = new SwpHints;
856     }
857     return *m_pSwpHints;
858 }
859 
TryDeleteSwpHints()860 inline void SwTxtNode::TryDeleteSwpHints()
861 {
862     if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() )
863     {
864         DELETEZ( m_pSwpHints );
865     }
866 }
867 
GetTxtColl() const868 inline SwTxtFmtColl* SwTxtNode::GetTxtColl() const
869 {
870     return static_cast<SwTxtFmtColl*>(const_cast<SwModify*>(GetRegisteredIn()));
871 }
872 
873 // fuer den IBM-Compiler nicht inlinen wg. 42876
874 #ifndef ICC
875 // Inline Methoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
GetTxtNode()876 inline       SwTxtNode   *SwNode::GetTxtNode()
877 {
878 	 return ND_TEXTNODE == nNodeType ? static_cast<SwTxtNode*>(this) : 0;
879 }
GetTxtNode() const880 inline const SwTxtNode   *SwNode::GetTxtNode() const
881 {
882 	 return ND_TEXTNODE == nNodeType ? static_cast<const SwTxtNode*>(this) : 0;
883 }
884 #endif
885 
886 inline void
CutText(SwTxtNode * const pDest,const SwIndex & rDestStart,const SwIndex & rStart,const xub_StrLen nLen)887 SwTxtNode::CutText(SwTxtNode * const pDest, const SwIndex & rDestStart,
888                     const SwIndex & rStart, const xub_StrLen nLen)
889 {
890     CutImpl( pDest, rDestStart, rStart, nLen, true );
891 }
892 
893 #endif
894