xref: /aoo4110/main/sw/inc/ndtxt.hxx (revision b1cdbd2c)
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.
IsCalcHiddenCharFlags() const153     inline bool IsCalcHiddenCharFlags() const
154         { return m_bRecalcHiddenCharFlags; }
SetHiddenCharAttribute(bool bNewHiddenCharsHidePara,bool bNewContainsHiddenChars) const155     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 
GetTxt() const228     const String& GetTxt() const { return m_Text; }
229 
230     // getters for SwpHints
231     inline       SwpHints &GetSwpHints();
232     inline const SwpHints &GetSwpHints() const;
GetpSwpHints()233     inline       SwpHints *GetpSwpHints()       { return m_pSwpHints; }
GetpSwpHints() const234     inline const SwpHints *GetpSwpHints() const { return m_pSwpHints; }
HasHints() const235     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 
GetNum() const436     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;
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 SetAttrOutlineLevel(int nLevel);
616 
617     bool IsEmptyListStyleDueToSetOutlineLevelAttr();
618     void SetEmptyListStyleDueToSetOutlineLevelAttr();
619     void ResetEmptyListStyleDueToResetOutlineLevelAttr();
620 
621 
622     /**
623        Returns the width of leading tabs/blanks in this paragraph.
624        This space will be converted into numbering indent if the paragraph
625        is set to be numbered.
626 
627        @return     the width of the leading whitespace
628      */
629     sal_uInt16 GetWidthOfLeadingTabs() const;
630 
631 
632     /**
633        Returns if the paragraph has a visible numbering or bullet.
634        This includes all kinds of numbering/bullet/outlines.
635        Note: This function returns false, if the numbering format is
636        SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
637 
638        @return     sal_True if the paragraph has a visible numbering/bullet/outline
639      */
640     bool HasVisibleNumberingOrBullet() const;
641 
642     void SetListId( const String sListId );
643     String GetListId() const;
644 
645     /** Determines, if the list level indent attributes can be applied to the
646         paragraph.
647 
648         The list level indents can be applied to the paragraph under the one
649         of following conditions:
650         - the list style is directly applied to the paragraph and the paragraph
651           has no own indent attributes.
652         - the list style is applied to the paragraph through one of its paragraph
653           styles, the paragraph has no own indent attributes and on the paragraph
654           style hierarchy from the paragraph to the paragraph style with the
655           list style no indent attributes are found.
656 
657         @author OD
658 
659         @return boolean
660     */
661     bool AreListLevelIndentsApplicable() const;
662 
663     /** Retrieves the list tab stop position, if the paragraph's list level defines
664         one and this list tab stop has to merged into the tap stops of the paragraph
665 
666         @author OD
667 
668         @param nListTabStopPosition
669         output parameter - containing the list tab stop position
670 
671         @return boolean - indicating, if a list tab stop position is provided
672     */
673     bool GetListTabStopPosition( long& nListTabStopPosition ) const;
674 
675     /** Retrieves the character following the list label, if the paragraph's
676         list level defines one.
677 
678         @author OD
679 
680         @return XubString - the list tab stop position
681     */
682     XubString GetLabelFollowedBy() const;
683 
684     //
685     // END OF BULLET/NUMBERING/OUTLINE STUFF:
686     //
687 
688     void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
689 
690     sal_uInt16 GetLang( const xub_StrLen nBegin, const xub_StrLen nLen = 0,
691                     sal_uInt16 nScript = 0 ) const;
692 
693     // steht in ndcopy.cxx
694 	sal_Bool IsSymbol( const xub_StrLen nBegin ) const;	// steht in itratr.cxx
695 	virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
696 
697 	// interaktive Trennung: wir finden den TxtFrm und rufen sein CalcHyph
698 	sal_Bool Hyphenate( SwInterHyphInfo &rHyphInf );
699 	void DelSoftHyph( const xub_StrLen nStart, const xub_StrLen nEnd );
700 
701     // --> OD 2007-11-15 #i83479#
702     // add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
703     // when <bWithNum = true> that a space is inserted after the string for
704     // the list label.
705     // add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
706     // spaces are inserted in front of the expanded text string depending on
707     // the list level.
708 	XubString GetExpandTxt( const xub_StrLen nIdx = 0,
709                             const xub_StrLen nLen = STRING_LEN,
710                             const bool bWithNum = false,
711                             const bool bAddSpaceAfterListLabelStr = false,
712                             const bool bWithSpacesForLevel = false ) const;
713     // <--
714 	sal_Bool GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx = 0,
715 						xub_StrLen nIdx = 0, xub_StrLen nLen = STRING_LEN,
716                        sal_Bool bWithNum = sal_False, sal_Bool bWithFtn = sal_True,
717                        sal_Bool bReplaceTabsWithSpaces = sal_False ) const;
718 
719     /*
720      *
721      */
722     const ModelToViewHelper::ConversionMap*
723             BuildConversionMap( rtl::OUString& rExpandText ) const;
724 
725 	XubString GetRedlineTxt( xub_StrLen nIdx = 0,
726 						  xub_StrLen nLen = STRING_LEN,
727 						  sal_Bool bExpandFlds = sal_False,
728 						  sal_Bool bWithNum = sal_False ) const;
729 	//Liefert fuer die Initalfunktion tatsaechliche Anzahl der Initialzeichen
730 	//bei nWishLen == 0 die des ersten Wortes
731 	sal_uInt16 GetDropLen( sal_uInt16 nWishLen) const;
732 
733     // Passes back info needed on the dropcap dimensions
734     bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const;
735 
736     // Hidden Paragraph Field:
CalcHiddenParaField()737     inline bool CalcHiddenParaField()
738         { return m_pSwpHints ? m_pSwpHints->CalcHiddenParaField() : false; }
739     // set CalcVisible flags
SetCalcHiddenParaField()740     inline void SetCalcHiddenParaField()
741         { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); }
742 
743     // is the paragraph visible?
HasHiddenParaField() const744     inline bool HasHiddenParaField() const
745         { return m_pSwpHints ? m_pSwpHints->HasHiddenParaField()  : false; }
746 
747     //
748     // Hidden Paragraph Field:
749     //
HasHiddenCharAttribute(bool bWholePara) const750     inline bool HasHiddenCharAttribute( bool bWholePara ) const
751     {
752         if ( m_bRecalcHiddenCharFlags )
753             CalcHiddenCharFlags();
754         return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars;
755     }
756 
SetCalcHiddenCharFlags() const757     inline void SetCalcHiddenCharFlags() const
758         { m_bRecalcHiddenCharFlags = true; }
759 
760 // --> FME 2004-06-08 #i12836# enhanced pdf
761     //
762     // Returns if the node is hidden due to
763     // 1. HiddenParaField
764     // 2. HiddenCharAttribute
765     // 3. HiddenSection
766     //
767     bool IsHidden() const;
768 // <--
769 
770 	TYPEINFO();	// fuer rtti
771 
772     // override SwIndexReg
773     virtual void Update(
774         SwIndex const & rPos,
775         const xub_StrLen nChangeLen,
776         const bool bNegative = false,
777         const bool bDelete = false );
778 
779 	// change text to Upper/Lower/Hiragana/Katagana/...
780 	void TransliterateText( utl::TransliterationWrapper& rTrans,
781 							xub_StrLen nStart, xub_StrLen nEnd,
782 							SwUndoTransliterate* pUndo = 0 );
783 
784     // count words in given range
785     void CountWords( SwDocStat& rStat, xub_StrLen nStart, xub_StrLen nEnd ) const;
786 
787     // Checks some global conditions like loading or destruction of document
788     // to economize notifications
789     bool IsNotificationEnabled() const;
790 
791     // Checks a temporary notification blocker and the global conditons of IsNotificationEnabled()
792     bool IsNotifiable() const;
793 
794     void SetListRestart( bool bRestart );
795     bool IsListRestart() const;
796 
797     void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
798     bool HasAttrListRestartValue() const;
799     SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const;
800     SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const;
801 
802     void SetCountedInList( bool bCounted );
803     bool IsCountedInList() const;
804 
805     void AddToList();
806     void RemoveFromList();
807     bool IsInList() const;
808 
809     bool IsFirstOfNumRule() const;
810 
811 	sal_uInt16 GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) const;
812 
813     SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
GetXParagraph() const814         ::com::sun::star::text::XTextContent> const& GetXParagraph() const
815             { return m_wXParagraph; }
SetXParagraph(::com::sun::star::uno::Reference<::com::sun::star::text::XTextContent> const & xParagraph)816     SW_DLLPRIVATE void SetXParagraph(::com::sun::star::uno::Reference<
817                     ::com::sun::star::text::XTextContent> const& xParagraph)
818             { m_wXParagraph = xParagraph; }
819 
820     // sfx2::Metadatable
821     virtual ::sfx2::IXmlIdRegistry& GetRegistry();
822     virtual bool IsInClipboard() const;
823     virtual bool IsInUndo() const;
824     virtual bool IsInContent() const;
825     virtual ::com::sun::star::uno::Reference<
826         ::com::sun::star::rdf::XMetadatable > MakeUnoObject();
827 
828     DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode)
829 };
830 
831 //-----------------------------------------------------------------------------
832 
GetSwpHints()833 inline SwpHints & SwTxtNode::GetSwpHints()
834 {
835     ASSERT_ID( m_pSwpHints, ERR_NOHINTS);
836     return *m_pSwpHints;
837 }
GetSwpHints() const838 inline const SwpHints &SwTxtNode::GetSwpHints() const
839 {
840     ASSERT_ID( m_pSwpHints, ERR_NOHINTS);
841     return *m_pSwpHints;
842 }
843 
GetOrCreateSwpHints()844 inline SwpHints& SwTxtNode::GetOrCreateSwpHints()
845 {
846     if ( !m_pSwpHints )
847     {
848         m_pSwpHints = new SwpHints;
849     }
850     return *m_pSwpHints;
851 }
852 
TryDeleteSwpHints()853 inline void SwTxtNode::TryDeleteSwpHints()
854 {
855     if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() )
856     {
857         DELETEZ( m_pSwpHints );
858     }
859 }
860 
GetTxtColl() const861 inline SwTxtFmtColl* SwTxtNode::GetTxtColl() const
862 {
863     return static_cast<SwTxtFmtColl*>(const_cast<SwModify*>(GetRegisteredIn()));
864 }
865 
866 // fuer den IBM-Compiler nicht inlinen wg. 42876
867 #ifndef ICC
868 // Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
GetTxtNode()869 inline       SwTxtNode   *SwNode::GetTxtNode()
870 {
871 	 return ND_TEXTNODE == nNodeType ? static_cast<SwTxtNode*>(this) : 0;
872 }
GetTxtNode() const873 inline const SwTxtNode   *SwNode::GetTxtNode() const
874 {
875 	 return ND_TEXTNODE == nNodeType ? static_cast<const SwTxtNode*>(this) : 0;
876 }
877 #endif
878 
879 inline void
CutText(SwTxtNode * const pDest,const SwIndex & rDestStart,const SwIndex & rStart,const xub_StrLen nLen)880 SwTxtNode::CutText(SwTxtNode * const pDest, const SwIndex & rDestStart,
881                     const SwIndex & rStart, const xub_StrLen nLen)
882 {
883     CutImpl( pDest, rDestStart, rStart, nLen, true );
884 }
885 
886 #endif
887