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