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