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