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