update credits
[LibreOffice.git] / sw / inc / ndtxt.hxx
blob8e41570f6df2feac14ffc3c67e997bb16741be85
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef SW_NDTXT_HXX
20 #define SW_NDTXT_HXX
22 #include <cppuhelper/weakref.hxx>
24 #include "swdllapi.h"
25 #include <node.hxx>
26 #include <hintids.hxx>
27 #include <ndhints.hxx>
28 #include <modeltoviewhelper.hxx>
29 #include <SwNumberTreeTypes.hxx>
30 #include <IDocumentContentOperations.hxx>
31 #include <osl/diagnose.h>
33 #include <sfx2/Metadatable.hxx>
35 #include <vector>
36 #include <set>
38 class SfxHint;
39 class SwNumRule;
40 class SwNodeNum;
41 class SwList;
42 class SvxLRSpaceItem;
44 namespace utl {
45 class TransliterationWrapper;
48 class SwTxtFmtColl;
49 class SwCntntFrm;
50 class SwTxtFld; ///< For GetTxtFld().
51 class SfxItemSet;
52 class SwUndoTransliterate;
54 struct SwSpellArgs; ///< for Spell(), splargs.hxx
55 struct SwConversionArgs; ///< for Convert(), splargs.hxx
56 class SwInterHyphInfo; ///< for Hyphenate(), splargs.hxx
57 class SwWrongList; ///< For OnlineSpelling.
58 class SwGrammarMarkUp;
59 class OutputDevice;
60 class SwScriptInfo;
61 struct SwDocStat;
62 struct SwParaIdleData_Impl;
64 namespace com { namespace sun { namespace star {
65 namespace uno {
66 template < class > class Sequence;
68 namespace text { class XTextContent; }
69 } } }
71 typedef std::set< xub_StrLen > SwSoftPageBreakList;
73 // do not fill the String up to the max - need to be able to have a
74 // SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1
75 // (also STRING_LEN is often used for "not found")
76 const xub_StrLen TXTNODE_MAX = STRING_LEN - 2;
78 /// SwTxtNode is a paragraph in the document model.
79 class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
82 /// For creating the first TextNode.
83 friend class SwDoc; ///< CTOR and AppendTxtNode()
84 friend class SwNodes;
85 friend class SwTxtFrm;
86 friend class SwScriptInfo;
88 /** May be 0. It is only then not 0 if it contains hard attributes.
89 Therefore: never access directly! */
90 SwpHints *m_pSwpHints;
92 mutable SwNodeNum* mpNodeNum; ///< Numbering for this paragraph.
94 OUString m_Text;
96 SwParaIdleData_Impl* m_pParaIdleData_Impl;
98 /** Some of the chars this para are hidden. Paragraph has to be reformatted
99 on changing the view to print preview. */
100 mutable bool m_bContainsHiddenChars : 1;
101 /// The whole paragraph is hidden because of the hidden text attribute
102 mutable bool m_bHiddenCharsHidePara : 1;
103 /// The last two flags have to be recalculated if this flag is set:
104 mutable bool m_bRecalcHiddenCharFlags : 1;
106 mutable bool m_bLastOutlineState : 1;
107 bool m_bNotifiable;
109 /// sal_uInt8 nOutlineLevel; //#outline level, removed by zhaojianwei.
110 bool mbEmptyListStyleSetDueToSetOutlineLevelAttr;
112 /** boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or
113 <ResetAllAttr(..)> method is running.
114 Needed to avoid duplicate handling of attribute change actions. */
115 bool mbInSetOrResetAttr;
117 /// pointer to the list, to whose the text node is added to
118 SwList* mpList;
120 ::std::auto_ptr< OUString > m_pNumStringCache;
122 ::com::sun::star::uno::WeakReference<
123 ::com::sun::star::text::XTextContent> m_wXParagraph;
125 SW_DLLPRIVATE SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl,
126 const SfxItemSet* pAutoAttr = 0 );
128 /// Copies the attributes at nStart to pDest.
129 SW_DLLPRIVATE void CopyAttr( SwTxtNode *pDest, const xub_StrLen nStart, const xub_StrLen nOldPos);
131 SW_DLLPRIVATE SwTxtNode* _MakeNewTxtNode( const SwNodeIndex&, sal_Bool bNext = sal_True,
132 sal_Bool bChgFollow = sal_True );
134 SW_DLLPRIVATE void CutImpl(
135 SwTxtNode * const pDest, const SwIndex & rDestStart,
136 const SwIndex & rStart, /*const*/ xub_StrLen nLen,
137 const bool bUpdate = true );
139 /// Move all comprising hard attributes to the AttrSet of the paragraph.
140 SW_DLLPRIVATE void MoveTxtAttr_To_AttrSet(); // Called by SplitNode.
142 /// Create the specific AttrSet.
143 SW_DLLPRIVATE virtual void NewAttrSet( SwAttrPool& );
145 SW_DLLPRIVATE void Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt,
146 xub_StrLen nEndPos, sal_Bool bExpandFlds ) const;
148 /// Optimization: Asking for information about hidden characters at SwScriptInfo
149 /// updates these flags.
150 inline bool IsCalcHiddenCharFlags() const
151 { return m_bRecalcHiddenCharFlags; }
152 inline void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const
154 m_bHiddenCharsHidePara = bNewHiddenCharsHidePara;
155 m_bContainsHiddenChars = bNewContainsHiddenChars;
156 m_bRecalcHiddenCharFlags = false;
159 SW_DLLPRIVATE void CalcHiddenCharFlags() const;
161 SW_DLLPRIVATE SwNumRule * _GetNumRule(sal_Bool bInParent = sal_True) const;
163 SW_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM,
164 LanguageType nLang, sal_uInt16 nLangWhichId,
165 const Font *pFont, sal_uInt16 nFontWhichId );
168 /// Start: Data collected during idle time
170 SW_DLLPRIVATE void SetParaNumberOfWords( sal_uLong nTmpWords ) const;
171 SW_DLLPRIVATE sal_uLong GetParaNumberOfWords() const;
172 SW_DLLPRIVATE void SetParaNumberOfAsianWords( sal_uLong nTmpAsianWords ) const;
173 SW_DLLPRIVATE sal_uLong GetParaNumberOfAsianWords() const;
174 SW_DLLPRIVATE void SetParaNumberOfChars( sal_uLong nTmpChars ) const;
175 SW_DLLPRIVATE sal_uLong GetParaNumberOfChars() const;
176 SW_DLLPRIVATE void SetParaNumberOfCharsExcludingSpaces( sal_uLong nTmpChars ) const;
177 SW_DLLPRIVATE sal_uLong GetParaNumberOfCharsExcludingSpaces() const;
178 SW_DLLPRIVATE void InitSwParaStatistics( bool bNew );
180 /** create number for this text node, if not already existing
182 @return number of this node
184 SwNodeNum* CreateNum() const;
186 inline void TryDeleteSwpHints();
188 SW_DLLPRIVATE void impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet);
190 public:
191 bool IsWordCountDirty() const;
192 bool IsWrongDirty() const;
193 bool IsGrammarCheckDirty() const;
194 bool IsSmartTagDirty() const; ///< SMARTTAGS
195 bool IsAutoCompleteWordDirty() const;
196 void SetWordCountDirty( bool bNew ) const;
197 void SetWrongDirty( bool bNew ) const;
198 void SetGrammarCheckDirty( bool bNew ) const;
199 void SetSmartTagDirty( bool bNew ) const; ///< SMARTTAGS
200 void SetAutoCompleteWordDirty( bool bNew ) const;
201 void SetWrong( SwWrongList* pNew, bool bDelete = true );
202 SwWrongList* GetWrong();
203 const SwWrongList* GetWrong() const;
204 void SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete = true );
205 SwGrammarMarkUp* GetGrammarCheck();
206 /// SMARTTAGS
207 void SetSmartTags( SwWrongList* pNew, bool bDelete = true );
208 SwWrongList* GetSmartTags();
209 bool TryCharSetExpandToNum(const SfxItemSet& pCharSet);
212 /// End: Data collected during idle time
214 protected:
215 /// for hanging TxtFmtCollections somewhere else (Outline-Numbering!)
216 virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
217 virtual void SwClientNotify( const SwModify&, const SfxHint& );
219 public:
220 using SwCntntNode::GetAttr;
222 const OUString& GetTxt() const { return m_Text; }
224 /// getters for SwpHints
225 inline SwpHints &GetSwpHints();
226 inline const SwpHints &GetSwpHints() const;
227 inline SwpHints *GetpSwpHints() { return m_pSwpHints; }
228 inline const SwpHints *GetpSwpHints() const { return m_pSwpHints; }
229 inline bool HasHints() const { return m_pSwpHints ? true : false; }
230 inline SwpHints &GetOrCreateSwpHints();
232 virtual ~SwTxtNode();
234 virtual xub_StrLen Len() const;
236 /// Is in itratr.
237 void GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong &rAbs,
238 OutputDevice* pOut = 0 ) const;
240 /// overriding to handle change of certain paragraph attributes
241 virtual sal_Bool SetAttr( const SfxPoolItem& );
242 virtual sal_Bool SetAttr( const SfxItemSet& rSet );
243 virtual sal_Bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
244 virtual sal_Bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr );
245 virtual sal_uInt16 ResetAllAttr();
247 /// insert text content
248 /// @param rStr text to insert; in case it does not fit into the limit of
249 /// TXTNODE_MAX, the longest prefix that fits is inserted
250 /// @return the prefix of rStr that was actually inserted
251 OUString InsertText( const XubString & rStr, const SwIndex & rIdx,
252 const enum IDocumentContentOperations::InsertFlags nMode
253 = IDocumentContentOperations::INS_DEFAULT );
255 /** delete text content
256 ATTENTION: must not be called with a range that overlaps the start of
257 an attribute with both extent and dummy char
259 void EraseText ( const SwIndex &rIdx, const xub_StrLen nCount = STRING_LEN,
260 const enum IDocumentContentOperations::InsertFlags nMode
261 = IDocumentContentOperations::INS_DEFAULT );
263 /** delete all attributes.
264 If neither pSet nor nWhich is given, delete all attributes (except
265 refmarks, toxmarks, meta) in range.
266 @param rIdx start position
267 @param nLen range in which attributes will be deleted
268 @param pSet if not 0, delete only attributes contained in pSet
269 @param nWhich if not 0, delete only attributes with matching which
270 @param bInclRefToxMark
271 refmarks, toxmarks, and metas will be ignored unless this is true
272 ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
274 void RstAttr( const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich = 0,
275 const SfxItemSet* pSet = 0, sal_Bool bInclRefToxMark = sal_False );
276 void GCAttr();
278 // Delete text attribute (needs to be deregistered at Pool!)
279 void DestroyAttr( SwTxtAttr* pAttr );
281 // delete all attributes from SwpHintsArray.
282 void ClearSwpHintsArr( bool bDelFields );
284 /// Insert pAttr into hints array. @return true iff inserted successfully
285 bool InsertHint( SwTxtAttr * const pAttr,
286 const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
287 /// create new text attribute from rAttr and insert it
288 /// @return inserted hint; 0 if not sure the hint is inserted
289 SwTxtAttr* InsertItem( SfxPoolItem& rAttr,
290 const xub_StrLen nStart, const xub_StrLen nEnd,
291 const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
293 /** Set these attributes at TextNode. If the whole range is comprised
294 set them only in AutoAttrSet (SwCntntNode::SetAttr). */
295 sal_Bool SetAttr( const SfxItemSet& rSet,
296 xub_StrLen nStt, xub_StrLen nEnd,
297 const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
298 /** Query the attributes of textnode over the range.
299 Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
300 If <bMergeIndentValuesOfNumRule> == sal_True, the indent attributes of
301 the corresponding list level of an applied list style is merged into
302 the requested item set as a LR-SPACE item, if <bOnlyTxtAttr> == sal_False,
303 corresponding node has not its own indent attributes and the
304 position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT. */
305 sal_Bool GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
306 sal_Bool bOnlyTxtAttr = sal_False,
307 sal_Bool bGetFromChrFmt = sal_True,
308 const bool bMergeIndentValuesOfNumRule = false ) const;
310 /// Convey attributes of an AttrSet (AutoFmt) to SwpHintsArray.
311 void FmtToTxtAttr( SwTxtNode* pNd );
313 /// delete all attributes of type nWhich at nStart (opt. end nEnd)
314 void DeleteAttributes( const sal_uInt16 nWhich,
315 const xub_StrLen nStart, const xub_StrLen nEnd = 0 );
316 /// delete the attribute pTxtAttr
317 void DeleteAttribute ( SwTxtAttr * const pTxtAttr );
319 /** Actions on text and attributes.
320 introduce optional parameter to control, if all attributes have to be copied. */
321 void CopyText( SwTxtNode * const pDest,
322 const SwIndex &rStart,
323 const xub_StrLen nLen,
324 const bool bForceCopyOfAllAttrs = false );
325 void CopyText( SwTxtNode * const pDest,
326 const SwIndex &rDestStart,
327 const SwIndex &rStart,
328 xub_StrLen nLen,
329 const bool bForceCopyOfAllAttrs = false );
331 void CutText(SwTxtNode * const pDest,
332 const SwIndex & rStart, const xub_StrLen nLen);
333 inline void CutText(SwTxtNode * const pDest, const SwIndex &rDestStart,
334 const SwIndex & rStart, const xub_StrLen nLen);
336 /// replace nDelLen characters at rStart with rText
337 /// in case the replacement does not fit, it is partially inserted up to
338 /// TXTNODE_MAX
339 void ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen,
340 const XubString& rText );
341 void ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, const XubString& rText,
342 const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets );
344 /// Virtual methods from CntntNode.
345 virtual SwCntntFrm *MakeFrm( SwFrm* );
346 virtual SwCntntNode *SplitCntntNode( const SwPosition & );
347 virtual SwCntntNode *JoinNext();
348 virtual SwCntntNode *JoinPrev();
350 SwCntntNode *AppendNode( const SwPosition & );
352 /// When appropriate set DontExpand-flag at INet or character styles respectively.
353 bool DontExpandFmt( const SwIndex& rIdx, bool bFlag = true,
354 bool bFmtToTxtAttributes = true );
356 enum GetTxtAttrMode {
357 DEFAULT, /// DEFAULT: (Start < nIndex <= End)
358 EXPAND, /// EXPAND : (Start <= nIndex < End)
359 PARENT, /// PARENT : (Start < nIndex < End)
362 /** get the innermost text attribute covering position nIndex.
363 @param nWhich only attribute with this id is returned.
364 @param eMode the predicate for matching (@see GetTxtAttrMode).
366 ATTENTION: this function is not well-defined for those
367 hints of which several may cover a single position, like
368 RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
370 SwTxtAttr *GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
371 enum GetTxtAttrMode const eMode = DEFAULT) const;
373 /** get the innermost text attributes covering position nIndex.
374 @param nWhich only attributes with this id are returned.
375 @param eMode the predicate for matching (@see GetTxtAttrMode).
377 ::std::vector<SwTxtAttr *> GetTxtAttrsAt(xub_StrLen const nIndex,
378 RES_TXTATR const nWhich,
379 enum GetTxtAttrMode const eMode = DEFAULT) const;
381 /** get the text attribute at position nIndex which owns
382 the dummy character CH_TXTATR_* at that position, if one exists.
383 @param nIndex the position in the text
384 @param nWhich if different from RES_TXTATR_END, return only
385 attribute with given which id
386 @return the text attribute at nIndex of type nWhich, if it exists
388 SwTxtAttr *GetTxtAttrForCharAt( const xub_StrLen nIndex,
389 const RES_TXTATR nWhich = RES_TXTATR_END ) const;
391 XubString GetCurWord(xub_StrLen) const;
392 sal_uInt16 Spell(SwSpellArgs*);
393 sal_uInt16 Convert( SwConversionArgs & );
395 inline SwTxtFmtColl *GetTxtColl() const;
396 virtual SwFmtColl *ChgFmtColl( SwFmtColl* );
397 void _ChgTxtCollUpdateNum( const SwTxtFmtColl* pOld,
398 const SwTxtFmtColl* pNew );
400 /** Copy collection with all auto formats to dest-node.
401 The latter might be in an other document!
402 (Method in ndcopy.cxx!!). */
403 void CopyCollFmt( SwTxtNode& rDestNd );
405 //const SwNodeNum* _GetNodeNum() const { return pNdNum; }
408 // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
412 Returns numbering rule of this text node.
414 @param bInParent serach in parent attributes, too
416 @return numbering rule of this text node or NULL if none is set
418 SwNumRule *GetNumRule(sal_Bool bInParent = sal_True) const;
420 inline const SwNodeNum* GetNum() const
422 return mpNodeNum;
425 SwNumberTree::tNumberVector GetNumberVector() const;
428 Returns if this text node is an outline.
430 @retval true this text node is an outline
431 @retval false else
433 bool IsOutline() const;
435 bool IsOutlineStateChanged() const;
437 void UpdateOutlineState();
439 /** Returns if this text node may be numbered.
441 A text node may be numbered if
442 - it has no SwNodeNum
443 - it has a SwNodeNum and it has a numbering rule and the according
444 SwNumFmt defines a numbering type that is an enumeration.
446 @retval sal_True this text node may be numbered
447 @retval sal_False else
449 //sal_Bool MayBeNumbered() const;
452 Notify this textnode that its numbering rule has changed.
454 void NumRuleChgd();
456 /** Returns outline of numbering string
458 Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control,
459 if the prefix and the suffix strings have to been included or not.
461 @param _bInclPrefixAndSuffixStrings
462 optional input parameter - boolean indicating, if the prefix and the
463 suffix strings have to been included or not. default value = <true>
465 @param _nRestrictToThisLevel
466 optional input parameter - unsigned integer indicating the maximum outline
467 level to which the output string must be restricted to. Default value is
468 MAXLEVEL
470 XubString GetNumString( const bool _bInclPrefixAndSuffixStrings = true, const unsigned int _nRestrictToThisLevel = MAXLEVEL ) const;
473 Returns the additional indents of this text node and its numbering.
475 @param bTxtLeft ???
477 @return additional indents
479 long GetLeftMarginWithNum( sal_Bool bTxtLeft = sal_False ) const;
482 Returns the combined first line indent of this text node and
483 its numbering.
485 @param the first line indent of this text node taking the
486 numbering into account (return parameter)
488 @retval sal_True this node has SwNodeNum and has numbering rule
489 @retval sal_False else
491 sal_Bool GetFirstLineOfsWithNum( short& rFirstOffset ) const;
493 SwTwips GetAdditionalIndentForStartingNewList() const;
495 void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const;
497 /** return left margin for tab stop position calculation
499 Needed for text formatting
500 Method considers new list level attributes, which also can provide a left margin value
502 @author OD
504 long GetLeftMarginForTabCalculation() const;
506 /** Returns if this text node has a number.
508 This text node has a number if it has a SwNodeNum and a
509 numbering rule and the numbering format specified for the
510 level of the SwNodeNum is of an enumeration type.
512 @retval sal_True This text node has a number.
513 @retval sal_False else
515 sal_Bool HasNumber() const;
517 /** Returns if this text node has a bullet.
519 This text node has a bullet if it has a SwNodeNum and a
520 numbering rule and the numbering format specified for the
521 level of the SwNodeNum is of a bullet type.
523 @retval sal_True This text node has a bullet.
524 @retval sal_False else
526 sal_Bool HasBullet() const;
528 /** Returns is this text node is numbered.
530 This node is numbered if it has a SwNodeNum and it has a
531 numbering rule and has not a hidden SwNodeNum.
533 ATTENTION: Returns sal_True even if the SwNumFmt has type
534 SVX_NUM_NUMBER_NONE.
536 @retval sal_True This node is numbered.
537 @retval sal_False else
539 sal_Bool IsNumbered() const;
541 /** Returns if this text node has a marked label.
543 @retval true This text node has a marked label.
544 @retval false else
546 bool HasMarkedLabel() const;
548 /** Sets the list level of this text node.
550 Side effect, when the text node is a list item:
551 The text node's representation in the list tree (<SwNodeNum> instance)
552 is updated.
554 @param nLevel level to set
556 void SetAttrListLevel(int nLevel);
558 bool HasAttrListLevel() const;
560 int GetAttrListLevel() const;
562 /** Returns the actual list level of this text node, when it is a list item
564 @return the actual list level of this text node, if it is a list item,
565 -1 otherwise
567 int GetActualListLevel() const;
570 Returns outline level of this text node.
572 If a text node has an outline number (i.e. it has an SwNodeNum
573 and a outline numbering rule) the outline level is the level of
574 this SwNodeNum.
576 If a text node has no outline number and has a paragraph style
577 attached the outline level is the outline level of the
578 paragraph style.
580 Otherwise the text node has no outline level (NO_NUMBERING).
582 NOTE: The outline level of text nodes is subject to change. The
583 plan is to have an SwTxtNode::nOutlineLevel member that is
584 updated from a paragraph style upon appliance of that paragraph
585 style.
587 @return outline level or NO_NUMBERING if there is no outline level
589 int GetAttrOutlineLevel() const;//#OutlineLevel,added by zhaojianwei
592 Sets the out line level *at* a text node.
594 @param nLevel the level to be set
596 If the text node has an outline number the level is set at the
597 outline number.
599 If the text node has no outline number but has a paragraph
600 style applied the outline level is set at the paragraph style.
602 NOTE: This is subject to change, see GetOutlineLevel.
604 void SetAttrOutlineLevel(int nLevel);//#OutlineLevel,added by zhaojianwei
606 bool IsEmptyListStyleDueToSetOutlineLevelAttr();
607 void SetEmptyListStyleDueToSetOutlineLevelAttr();
608 void ResetEmptyListStyleDueToResetOutlineLevelAttr();
611 Returns the width of leading tabs/blanks in this paragraph.
612 This space will be converted into numbering indent if the paragraph
613 is set to be numbered.
615 @return the width of the leading whitespace
617 sal_uInt16 GetWidthOfLeadingTabs() const;
620 Returns if the paragraph has a visible numbering or bullet.
621 This includes all kinds of numbering/bullet/outlines.
622 Note: This function returns false, if the numbering format is
623 SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
625 @return sal_True if the paragraph has a visible numbering/bullet/outline
627 bool HasVisibleNumberingOrBullet() const;
629 void SetListId( const String sListId );
630 String GetListId() const;
632 /** Determines, if the list level indent attributes can be applied to the
633 paragraph.
635 The list level indents can be applied to the paragraph under the one
636 of following conditions:
637 - the list style is directly applied to the paragraph and the paragraph
638 has no own indent attributes.
639 - the list style is applied to the paragraph through one of its paragraph
640 styles, the paragraph has no own indent attributes and on the paragraph
641 style hierarchy from the paragraph to the paragraph style with the
642 list style no indent attributes are found.
644 @author OD
646 @return boolean
648 bool AreListLevelIndentsApplicable() const;
650 /** Retrieves the list tab stop position, if the paragraph's list level defines
651 one and this list tab stop has to merged into the tap stops of the paragraph
653 @author OD
655 @param nListTabStopPosition
656 output parameter - containing the list tab stop position
658 @return boolean - indicating, if a list tab stop position is provided
660 bool GetListTabStopPosition( long& nListTabStopPosition ) const;
662 /** Retrieves the character following the list label, if the paragraph's
663 list level defines one.
665 @author OD
667 @return XubString - the list tab stop position
669 XubString GetLabelFollowedBy() const;
672 // END OF BULLET/NUMBERING/OUTLINE STUFF:
675 void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
677 sal_uInt16 GetLang( const xub_StrLen nBegin, const xub_StrLen nLen = 0,
678 sal_uInt16 nScript = 0 ) const;
680 /// in ndcopy.cxx
681 sal_Bool IsSymbol( const xub_StrLen nBegin ) const; // In itratr.cxx.
682 virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
684 /// Interactive hyphenation: we find TxtFrm and call its CalcHyph.
685 sal_Bool Hyphenate( SwInterHyphInfo &rHyphInf );
686 void DelSoftHyph( const xub_StrLen nStart, const xub_StrLen nEnd );
688 /** add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
689 when <bWithNum = true> that a space is inserted after the string for
690 the list label.
691 add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
692 spaces are inserted in front of the expanded text string depending on
693 the list level. */
694 XubString GetExpandTxt( const xub_StrLen nIdx = 0,
695 const xub_StrLen nLen = STRING_LEN,
696 const bool bWithNum = false,
697 const bool bAddSpaceAfterListLabelStr = false,
698 const bool bWithSpacesForLevel = false ) const;
699 sal_Bool GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx = 0,
700 xub_StrLen nIdx = 0, xub_StrLen nLen = STRING_LEN,
701 sal_Bool bWithNum = sal_False, sal_Bool bWithFtn = sal_True,
702 sal_Bool bReplaceTabsWithSpaces = sal_False ) const;
704 XubString GetRedlineTxt( xub_StrLen nIdx = 0,
705 xub_StrLen nLen = STRING_LEN,
706 sal_Bool bExpandFlds = sal_False,
707 sal_Bool bWithNum = sal_False ) const;
709 /** @return actual count of initial chars for initial-function.
710 If nWishLen == 0 that of first word. */
711 sal_uInt16 GetDropLen( sal_uInt16 nWishLen) const;
713 /// Passes back info needed on the dropcap dimensions
714 bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const;
716 /// Hidden Paragraph Field:
717 inline bool CalcHiddenParaField()
718 { return m_pSwpHints ? m_pSwpHints->CalcHiddenParaField() : false; }
719 /// set CalcVisible flags
720 inline void SetCalcHiddenParaField()
721 { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); }
723 /// is the paragraph visible?
724 inline bool HasHiddenParaField() const
725 { return m_pSwpHints ? m_pSwpHints->HasHiddenParaField() : false; }
728 /// Hidden Paragraph Field:
730 inline bool HasHiddenCharAttribute( bool bWholePara ) const
732 if ( m_bRecalcHiddenCharFlags )
733 CalcHiddenCharFlags();
734 return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars;
737 inline void SetCalcHiddenCharFlags() const
738 { m_bRecalcHiddenCharFlags = true; }
741 /** @return if the node is hidden due to
742 1. HiddenParaField
743 2. HiddenCharAttribute
744 3. HiddenSection */
746 bool IsHidden() const;
748 TYPEINFO(); // fuer rtti
750 /// override SwIndexReg
751 virtual void Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
752 const bool bNegative = false, const bool bDelete = false );
754 /// change text to Upper/Lower/Hiragana/Katagana/...
755 void TransliterateText( utl::TransliterationWrapper& rTrans,
756 xub_StrLen nStart, xub_StrLen nEnd,
757 SwUndoTransliterate* pUndo = 0 );
759 /// count words in given range - returns true if we refreshed out count
760 bool CountWords( SwDocStat& rStat, xub_StrLen nStart, xub_StrLen nEnd ) const;
762 /** Checks some global conditions like loading or destruction of document
763 to economize notifications */
764 bool IsNotificationEnabled() const;
766 /// Checks a temporary notification blocker and the global conditons of IsNotificationEnabled()
767 bool IsNotifiable() const;
769 void SetListRestart( bool bRestart );
770 bool IsListRestart() const;
772 void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
773 bool HasAttrListRestartValue() const;
774 SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const;
775 SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const;
777 void SetCountedInList( bool bCounted );
778 bool IsCountedInList() const;
780 void AddToList();
781 void RemoveFromList();
782 bool IsInList() const;
784 bool IsFirstOfNumRule() const;
786 sal_uInt16 GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) const;
788 SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
789 ::com::sun::star::text::XTextContent> const& GetXParagraph() const
790 { return m_wXParagraph; }
791 SW_DLLPRIVATE void SetXParagraph(::com::sun::star::uno::Reference<
792 ::com::sun::star::text::XTextContent> const& xParagraph)
793 { m_wXParagraph = xParagraph; }
795 /// sfx2::Metadatable
796 virtual ::sfx2::IXmlIdRegistry& GetRegistry();
797 virtual bool IsInClipboard() const;
798 virtual bool IsInUndo() const;
799 virtual bool IsInContent() const;
800 virtual ::com::sun::star::uno::Reference<
801 ::com::sun::star::rdf::XMetadatable > MakeUnoObject();
803 bool IsCollapse() const;
805 virtual void dumpAsXml( xmlTextWriterPtr writer = NULL );
807 sal_uInt32 GetRsid( xub_StrLen nStt, xub_StrLen nEnd ) const;
808 sal_uInt32 GetParRsid() const;
810 bool CompareRsid( const SwTxtNode &rTxtNode, xub_StrLen nStt1, xub_StrLen nStt2,
811 xub_StrLen nEnd1 = 0, xub_StrLen nEnd2 = 0 ) const;
812 bool CompareParRsid( const SwTxtNode &rTxtNode ) const;
814 DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode)
817 //-----------------------------------------------------------------------------
819 inline SwpHints & SwTxtNode::GetSwpHints()
821 OSL_ASSERT( m_pSwpHints );
822 return *m_pSwpHints;
824 inline const SwpHints &SwTxtNode::GetSwpHints() const
826 OSL_ASSERT( m_pSwpHints );
827 return *m_pSwpHints;
830 inline SwpHints& SwTxtNode::GetOrCreateSwpHints()
832 if ( !m_pSwpHints )
834 m_pSwpHints = new SwpHints;
836 return *m_pSwpHints;
839 inline void SwTxtNode::TryDeleteSwpHints()
841 if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() )
843 DELETEZ( m_pSwpHints );
847 inline SwTxtFmtColl* SwTxtNode::GetTxtColl() const
849 return static_cast<SwTxtFmtColl*>(const_cast<SwModify*>(GetRegisteredIn()));
852 /// Inline methods from Node.hxx
853 inline SwTxtNode *SwNode::GetTxtNode()
855 return ND_TEXTNODE == nNodeType ? static_cast<SwTxtNode*>(this) : 0;
858 inline const SwTxtNode *SwNode::GetTxtNode() const
860 return ND_TEXTNODE == nNodeType ? static_cast<const SwTxtNode*>(this) : 0;
863 inline void
864 SwTxtNode::CutText(SwTxtNode * const pDest, const SwIndex & rDestStart,
865 const SwIndex & rStart, const xub_StrLen nLen)
867 CutImpl( pDest, rDestStart, rStart, nLen, true );
870 #endif
872 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */