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