bump product version to 5.0.4.1
[LibreOffice.git] / sw / inc / ndtxt.hxx
blob87abad95107138e765553492a112b247c3aae457
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 INCLUDED_SW_INC_NDTXT_HXX
20 #define INCLUDED_SW_INC_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>
32 #include <sfx2/Metadatable.hxx>
34 #include <vector>
35 #include <set>
37 class SfxHint;
38 class SwNumRule;
39 class SwNodeNum;
40 class SwList;
41 class SvxLRSpaceItem;
43 namespace utl {
44 class TransliterationWrapper;
47 class SwTextFormatColl;
48 class SwContentFrm;
49 class SwTextField;
50 class SwTextInputField;
51 class SfxItemSet;
52 class SwUndoTransliterate;
53 struct SwSpellArgs;
54 struct SwConversionArgs;
55 class SwInterHyphInfo;
56 class SwWrongList;
57 class SwGrammarMarkUp;
58 class OutputDevice;
59 class SwScriptInfo;
60 struct SwDocStat;
61 struct SwParaIdleData_Impl;
63 namespace com { namespace sun { namespace star {
64 namespace uno {
65 template < class > class Sequence;
67 namespace text { class XTextContent; }
68 } } }
70 typedef std::set< sal_Int32 > SwSoftPageBreakList;
72 /// SwTextNode is a paragraph in the document model.
73 class SW_DLLPUBLIC SwTextNode: public SwContentNode, public ::sfx2::Metadatable
75 friend class SwContentNode;
76 /// For creating the first TextNode.
77 friend class SwDoc; ///< CTOR and AppendTextNode()
78 friend class SwNodes;
79 friend class SwTextFrm;
80 friend class SwScriptInfo;
82 /** May be 0. It is only then not 0 if it contains hard attributes.
83 Therefore: never access directly! */
84 SwpHints *m_pSwpHints;
86 mutable SwNodeNum* mpNodeNum; ///< Numbering for this paragraph.
88 OUString m_Text;
90 SwParaIdleData_Impl* m_pParaIdleData_Impl;
92 /** Some of the chars this para are hidden. Paragraph has to be reformatted
93 on changing the view to print preview. */
94 mutable bool m_bContainsHiddenChars : 1;
95 /// The whole paragraph is hidden because of the hidden text attribute
96 mutable bool m_bHiddenCharsHidePara : 1;
97 /// The last two flags have to be recalculated if this flag is set:
98 mutable bool m_bRecalcHiddenCharFlags : 1;
100 mutable bool m_bLastOutlineState : 1;
101 bool m_bNotifiable;
103 bool mbEmptyListStyleSetDueToSetOutlineLevelAttr;
105 /** boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or
106 <ResetAllAttr(..)> method is running.
107 Needed to avoid duplicate handling of attribute change actions. */
108 bool mbInSetOrResetAttr;
110 /// pointer to the list, to whose the text node is added to
111 SwList* mpList;
113 ::std::unique_ptr< OUString > m_pNumStringCache;
115 ::com::sun::star::uno::WeakReference<
116 ::com::sun::star::text::XTextContent> m_wXParagraph;
118 //UUUU DrawingLayer FillAttributes in a preprocessed form for primitive usage
119 drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes;
121 SAL_DLLPRIVATE SwTextNode( const SwNodeIndex &rWhere, SwTextFormatColl *pTextColl,
122 const SfxItemSet* pAutoAttr = 0 );
124 /// Copies the attributes at nStart to pDest.
125 SAL_DLLPRIVATE void CopyAttr( SwTextNode *pDest, const sal_Int32 nStart, const sal_Int32 nOldPos);
127 SAL_DLLPRIVATE SwTextNode* _MakeNewTextNode( const SwNodeIndex&, bool bNext = true,
128 bool bChgFollow = true );
130 SAL_DLLPRIVATE void CutImpl(
131 SwTextNode * const pDest, const SwIndex & rDestStart,
132 const SwIndex & rStart, /*const*/ sal_Int32 nLen,
133 const bool bUpdate = true );
135 /// Move all comprising hard attributes to the AttrSet of the paragraph.
136 SAL_DLLPRIVATE void MoveTextAttr_To_AttrSet(); // Called by SplitNode.
138 /// Create the specific AttrSet.
139 SAL_DLLPRIVATE virtual void NewAttrSet( SwAttrPool& ) SAL_OVERRIDE;
141 /// Optimization: Asking for information about hidden characters at SwScriptInfo
142 /// updates these flags.
143 inline bool IsCalcHiddenCharFlags() const
144 { return m_bRecalcHiddenCharFlags; }
145 inline void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const
147 m_bHiddenCharsHidePara = bNewHiddenCharsHidePara;
148 m_bContainsHiddenChars = bNewContainsHiddenChars;
149 m_bRecalcHiddenCharFlags = false;
152 SAL_DLLPRIVATE void CalcHiddenCharFlags() const;
154 SAL_DLLPRIVATE SwNumRule * _GetNumRule(bool bInParent = true) const;
156 SAL_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM,
157 LanguageType nLang, sal_uInt16 nLangWhichId,
158 const vcl::Font *pFont, sal_uInt16 nFontWhichId );
160 /// Start: Data collected during idle time
162 SAL_DLLPRIVATE void SetParaNumberOfWords( sal_uLong nTmpWords ) const;
163 SAL_DLLPRIVATE sal_uLong GetParaNumberOfWords() const;
164 SAL_DLLPRIVATE void SetParaNumberOfAsianWords( sal_uLong nTmpAsianWords ) const;
165 SAL_DLLPRIVATE sal_uLong GetParaNumberOfAsianWords() const;
166 SAL_DLLPRIVATE void SetParaNumberOfChars( sal_uLong nTmpChars ) const;
167 SAL_DLLPRIVATE sal_uLong GetParaNumberOfChars() const;
168 SAL_DLLPRIVATE void SetParaNumberOfCharsExcludingSpaces( sal_uLong nTmpChars ) const;
169 SAL_DLLPRIVATE sal_uLong GetParaNumberOfCharsExcludingSpaces() const;
170 SAL_DLLPRIVATE void InitSwParaStatistics( bool bNew );
172 /** create number for this text node, if not already existing
174 @return number of this node
176 SwNodeNum* CreateNum() const;
178 inline void TryDeleteSwpHints();
180 SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet);
182 const SwTextInputField* GetOverlappingInputField( const SwTextAttr& rTextAttr ) const;
184 void DelFrms_TextNodePart();
186 public:
187 enum class WrongState { TODO, PENDING, DONE };
189 bool IsWordCountDirty() const;
190 WrongState GetWrongDirty() const;
191 bool IsWrongDirty() const;
192 bool IsGrammarCheckDirty() const;
193 bool IsSmartTagDirty() const;
194 bool IsAutoCompleteWordDirty() const;
195 void SetWordCountDirty( bool bNew ) const;
196 void SetWrongDirty(WrongState eNew) const;
197 void SetGrammarCheckDirty( bool bNew ) const;
198 void SetSmartTagDirty( bool bNew ) const;
199 void SetAutoCompleteWordDirty( bool bNew ) const;
200 void SetWrong( SwWrongList* pNew, bool bDelete = true );
201 SwWrongList* GetWrong();
202 const SwWrongList* GetWrong() const;
203 void SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete = true );
204 SwGrammarMarkUp* GetGrammarCheck();
205 void SetSmartTags( SwWrongList* pNew, bool bDelete = true );
206 SwWrongList* GetSmartTags();
207 bool TryCharSetExpandToNum(const SfxItemSet& pCharSet);
209 /// End: Data collected during idle time
211 protected:
212 /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
213 virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
214 virtual void SwClientNotify( const SwModify&, const SfxHint& ) SAL_OVERRIDE;
216 public:
217 using SwContentNode::GetAttr;
219 const OUString& GetText() const { return m_Text; }
221 // returns the maximum number of characters that can still be added to the node
222 inline sal_Int32 GetSpaceLeft() const;
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 != nullptr; }
230 inline SwpHints &GetOrCreateSwpHints();
232 virtual ~SwTextNode();
234 virtual sal_Int32 Len() const SAL_OVERRIDE;
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 bool SetAttr( const SfxPoolItem& ) SAL_OVERRIDE;
242 virtual bool SetAttr( const SfxItemSet& rSet ) SAL_OVERRIDE;
243 virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ) SAL_OVERRIDE;
244 virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr ) SAL_OVERRIDE;
245 virtual sal_uInt16 ResetAllAttr() SAL_OVERRIDE;
247 /// insert text content
248 /// @param rStr text to insert; in case it does not fit into the capacity
249 /// of the node, the longest prefix that fits is inserted
250 /// @return the prefix of rStr that was actually inserted
251 OUString InsertText( const OUString & rStr, const SwIndex & rIdx,
252 const SwInsertFlags nMode
253 = SwInsertFlags::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 sal_Int32 nCount = SAL_MAX_INT32,
260 const SwInsertFlags nMode = SwInsertFlags::DEFAULT );
262 /** delete all attributes.
263 If neither pSet nor nWhich is given, delete all attributes (except
264 refmarks, toxmarks, meta) in range.
265 @param rIdx start position
266 @param nLen range in which attributes will be deleted
267 @param pSet if not 0, delete only attributes contained in pSet
268 @param nWhich if not 0, delete only attributes with matching which
269 @param bInclRefToxMark
270 refmarks, toxmarks, and metas will be ignored unless this is true
271 ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
272 @param bExactRange From the attributes included in the range, delete
273 only the ones which have exactly same range. Don't delete the ones
274 which are simply included in the range.
276 void RstTextAttr(
277 const SwIndex &rIdx,
278 const sal_Int32 nLen,
279 const sal_uInt16 nWhich = 0,
280 const SfxItemSet* pSet = 0,
281 const bool bInclRefToxMark = false,
282 const bool bExactRange = false );
283 void GCAttr();
285 // Delete text attribute (needs to be deregistered at Pool!)
286 void DestroyAttr( SwTextAttr* pAttr );
288 // delete all attributes from SwpHintsArray.
289 void ClearSwpHintsArr( bool bDelFields );
291 /// initialize the hints after file loading (which takes shortcuts)
292 void FileLoadedInitHints();
294 /// Insert pAttr into hints array. @return true iff inserted successfully
295 bool InsertHint( SwTextAttr * const pAttr,
296 const SetAttrMode nMode = SetAttrMode::DEFAULT );
297 /// create new text attribute from rAttr and insert it
298 /// @return inserted hint; 0 if not sure the hint is inserted
299 SwTextAttr* InsertItem( SfxPoolItem& rAttr,
300 const sal_Int32 nStart, const sal_Int32 nEnd,
301 const SetAttrMode nMode = SetAttrMode::DEFAULT );
303 /** Set these attributes at TextNode. If the whole range is comprised
304 set them only in AutoAttrSet (SwContentNode::SetAttr). */
305 bool SetAttr( const SfxItemSet& rSet,
306 sal_Int32 nStt, sal_Int32 nEnd,
307 const SetAttrMode nMode = SetAttrMode::DEFAULT );
308 /** Query the attributes of textnode over the range.
309 Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
310 If <bMergeIndentValuesOfNumRule> == 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 <bOnlyTextAttr> == 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 bool GetAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
316 const bool bOnlyTextAttr = false,
317 const bool bGetFromChrFormat = true,
318 const bool bMergeIndentValuesOfNumRule = false ) const;
320 /// Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
321 void FormatToTextAttr( SwTextNode* pNd );
323 /// delete all attributes of type nWhich at nStart (opt. end nEnd)
324 void DeleteAttributes( const sal_uInt16 nWhich,
325 const sal_Int32 nStart, const sal_Int32 nEnd = 0 );
326 /// delete the attribute pTextAttr
327 void DeleteAttribute ( SwTextAttr * const pTextAttr );
329 /** Actions on text and attributes.
330 introduce optional parameter to control, if all attributes have to be copied. */
331 void CopyText( SwTextNode * const pDest,
332 const SwIndex &rStart,
333 const sal_Int32 nLen,
334 const bool bForceCopyOfAllAttrs = false );
335 void CopyText( SwTextNode * const pDest,
336 const SwIndex &rDestStart,
337 const SwIndex &rStart,
338 sal_Int32 nLen,
339 const bool bForceCopyOfAllAttrs = false );
341 void CutText(SwTextNode * const pDest,
342 const SwIndex & rStart, const sal_Int32 nLen);
343 inline void CutText(SwTextNode * const pDest, const SwIndex &rDestStart,
344 const SwIndex & rStart, const sal_Int32 nLen);
346 /// replace nDelLen characters at rStart with rText
347 /// in case the replacement does not fit, it is partially inserted up to
348 /// the capacity of the node
349 void ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen,
350 const OUString & rText );
351 void ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
352 const OUString& rText,
353 const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets );
355 /// Virtual methods from ContentNode.
356 virtual SwContentFrm *MakeFrm( SwFrm* ) SAL_OVERRIDE;
357 virtual SwContentNode *SplitContentNode( const SwPosition & ) SAL_OVERRIDE;
358 virtual SwContentNode *JoinNext() SAL_OVERRIDE;
359 virtual SwContentNode *JoinPrev() SAL_OVERRIDE;
361 SwContentNode *AppendNode( const SwPosition & );
363 /// When appropriate set DontExpand-flag at INet or character styles respectively.
364 bool DontExpandFormat( const SwIndex& rIdx, bool bFlag = true,
365 bool bFormatToTextAttributes = true );
367 enum GetTextAttrMode {
368 DEFAULT, /// DEFAULT: (Start <= nIndex < End)
369 EXPAND, /// EXPAND : (Start < nIndex <= End)
370 PARENT, /// PARENT : (Start < nIndex < End)
373 /** get the innermost text attribute covering position nIndex.
374 @param nWhich only attribute with this id is returned.
375 @param eMode the predicate for matching (@see GetTextAttrMode).
377 ATTENTION: this function is not well-defined for those
378 hints of which several may cover a single position, like
379 RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
381 SwTextAttr *GetTextAttrAt(
382 sal_Int32 const nIndex,
383 RES_TXTATR const nWhich,
384 enum GetTextAttrMode const eMode = DEFAULT ) const;
386 /** get the innermost text attributes covering position nIndex.
387 @param nWhich only attributes with this id are returned.
388 @param eMode the predicate for matching (@see GetTextAttrMode).
390 ::std::vector<SwTextAttr *> GetTextAttrsAt(
391 sal_Int32 const nIndex,
392 RES_TXTATR const nWhich,
393 enum GetTextAttrMode const eMode = DEFAULT ) const;
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
402 SwTextAttr *GetTextAttrForCharAt(
403 const sal_Int32 nIndex,
404 const RES_TXTATR nWhich = RES_TXTATR_END ) const;
406 SwTextField* GetFieldTextAttrAt(
407 const sal_Int32 nIndex,
408 const bool bIncludeInputFieldAtStart = false ) const;
410 OUString GetCurWord(sal_Int32) const;
411 bool Spell(SwSpellArgs*);
412 bool Convert( SwConversionArgs & );
414 inline SwTextFormatColl *GetTextColl() const;
415 virtual SwFormatColl *ChgFormatColl( SwFormatColl* ) SAL_OVERRIDE;
416 void _ChgTextCollUpdateNum( const SwTextFormatColl* pOld,
417 const SwTextFormatColl* pNew );
419 /** Copy collection with all auto formats to dest-node.
420 The latter might be in an other document!
421 (Method in ndcopy.cxx!!). */
422 void CopyCollFormat( SwTextNode& rDestNd );
424 // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
427 Returns numbering rule of this text node.
429 @param bInParent serach in parent attributes, too
431 @return numbering rule of this text node or NULL if none is set
433 SwNumRule *GetNumRule(bool bInParent = true) const;
435 inline const SwNodeNum* GetNum() const
437 return mpNodeNum;
440 SwNumberTree::tNumberVector GetNumberVector() const;
443 Returns if this text node is an outline.
445 @retval true this text node is an outline
446 @retval false else
448 bool IsOutline() const;
450 bool IsOutlineStateChanged() const;
452 void UpdateOutlineState();
455 Notify this textnode that its numbering rule has changed.
457 void NumRuleChgd();
459 /** Returns outline of numbering string
461 Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control,
462 if the prefix and the suffix strings have to been included or not.
464 @param _bInclPrefixAndSuffixStrings
465 optional input parameter - boolean indicating, if the prefix and the
466 suffix strings have to been included or not. default value = <true>
468 @param _nRestrictToThisLevel
469 optional input parameter - unsigned integer indicating the maximum outline
470 level to which the output string must be restricted to. Default value is
471 MAXLEVEL
473 OUString GetNumString( const bool _bInclPrefixAndSuffixStrings = true,
474 const unsigned int _nRestrictToThisLevel = MAXLEVEL ) const;
477 Returns the additional indents of this text node and its numbering.
479 @param bTextLeft ???
481 @return additional indents
483 long GetLeftMarginWithNum( bool bTextLeft = false ) const;
486 Returns the combined first line indent of this text node and
487 its numbering.
489 @param the first line indent of this text node taking the
490 numbering into account (return parameter)
492 @retval true this node has SwNodeNum and has numbering rule
493 @retval false else
495 bool GetFirstLineOfsWithNum( short& rFirstOffset ) const;
497 SwTwips GetAdditionalIndentForStartingNewList() const;
499 void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const;
501 /** return left margin for tab stop position calculation
503 Needed for text formatting
504 Method considers new list level attributes, which also can provide a left margin value
506 long GetLeftMarginForTabCalculation() const;
508 /** Returns if this text node has a number.
510 This text node has a number if it has a SwNodeNum and a
511 numbering rule and the numbering format specified for the
512 level of the SwNodeNum is of an enumeration type.
514 @retval true This text node has a number.
515 @retval false else
517 bool HasNumber() const;
519 /** Returns if this text node has a bullet.
521 This text node has a bullet if it has a SwNodeNum and a
522 numbering rule and the numbering format specified for the
523 level of the SwNodeNum is of a bullet type.
525 @retval true This text node has a bullet.
526 @retval false else
528 bool HasBullet() const;
530 /** Returns is this text node is numbered.
532 This node is numbered if it has a SwNodeNum and it has a
533 numbering rule and has not a hidden SwNodeNum.
535 ATTENTION: Returns true even if the SwNumFormat has type
536 SVX_NUM_NUMBER_NONE.
538 @retval true This node is numbered.
539 @retval false else
541 bool IsNumbered() const;
543 /** Returns if this text node has a marked label.
545 @retval true This text node has a marked label.
546 @retval false else
548 bool HasMarkedLabel() const;
550 /** Sets the list level of this text node.
552 Side effect, when the text node is a list item:
553 The text node's representation in the list tree (<SwNodeNum> instance)
554 is updated.
556 @param nLevel level to set
558 void SetAttrListLevel(int nLevel);
560 bool HasAttrListLevel() const;
562 int GetAttrListLevel() const;
564 /** Returns the actual list level of this text node, when it is a list item
566 @return the actual list level of this text node, if it is a list item,
567 -1 otherwise
569 int GetActualListLevel() const;
572 Returns outline level of this text node.
574 If a text node has an outline number (i.e. it has an SwNodeNum
575 and a outline numbering rule) the outline level is the level of
576 this SwNodeNum.
578 If a text node has no outline number and has a paragraph style
579 attached the outline level is the outline level of the
580 paragraph style.
582 Otherwise the text node has no outline level (NO_NUMBERING).
584 NOTE: The outline level of text nodes is subject to change. The
585 plan is to have an SwTextNode::nOutlineLevel member that is
586 updated from a paragraph style upon appliance of that paragraph
587 style.
589 @return outline level or NO_NUMBERING if there is no outline level
591 int GetAttrOutlineLevel() const;
594 Sets the out line level *at* a text node.
596 @param nLevel the level to be set
598 If the text node has an outline number the level is set at the
599 outline number.
601 If the text node has no outline number but has a paragraph
602 style applied the outline level is set at the paragraph style.
604 NOTE: This is subject to change, see GetOutlineLevel.
606 void SetAttrOutlineLevel(int nLevel);
608 bool IsEmptyListStyleDueToSetOutlineLevelAttr() { return mbEmptyListStyleSetDueToSetOutlineLevelAttr;}
609 void SetEmptyListStyleDueToSetOutlineLevelAttr();
610 void ResetEmptyListStyleDueToResetOutlineLevelAttr();
613 Returns the width of leading tabs/blanks in this paragraph.
614 This space will be converted into numbering indent if the paragraph
615 is set to be numbered.
617 @return the width of the leading whitespace
619 SwTwips GetWidthOfLeadingTabs() const;
622 Returns if the paragraph has a visible numbering or bullet.
623 This includes all kinds of numbering/bullet/outlines.
624 Note: This function returns false, if the numbering format is
625 SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
627 @return true if the paragraph has a visible numbering/bullet/outline
629 bool HasVisibleNumberingOrBullet() const;
631 void SetListId(OUString const& rListId);
632 OUString GetListId() const;
634 /** Determines, if the list level indent attributes can be applied to the
635 paragraph.
637 The list level indents can be applied to the paragraph under the one
638 of following conditions:
639 - the list style is directly applied to the paragraph and the paragraph
640 has no own indent attributes.
641 - the list style is applied to the paragraph through one of its paragraph
642 styles, the paragraph has no own indent attributes and on the paragraph
643 style hierarchy from the paragraph to the paragraph style with the
644 list style no indent attributes are found.
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 @param nListTabStopPosition
654 output parameter - containing the list tab stop position
656 @return boolean - indicating, if a list tab stop position is provided
658 bool GetListTabStopPosition( long& nListTabStopPosition ) const;
660 /** Retrieves the character following the list label, if the paragraph's
661 list level defines one.
663 @return the list tab stop position as string
665 OUString GetLabelFollowedBy() const;
667 // END OF BULLET/NUMBERING/OUTLINE STUFF:
669 void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
671 sal_uInt16 GetLang( const sal_Int32 nBegin, const sal_Int32 nLen = 0,
672 sal_uInt16 nScript = 0 ) const;
674 /// in ndcopy.cxx
675 bool IsSymbol( const sal_Int32 nBegin ) const; // In itratr.cxx.
676 virtual SwContentNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const SAL_OVERRIDE;
678 /// Interactive hyphenation: we find TextFrm and call its CalcHyph.
679 bool Hyphenate( SwInterHyphInfo &rHyphInf );
680 void DelSoftHyph( const sal_Int32 nStart, const sal_Int32 nEnd );
682 /** add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
683 when <bWithNum = true> that a space is inserted after the string for
684 the list label.
685 add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
686 spaces are inserted in front of the expanded text string depending on
687 the list level. */
688 OUString GetExpandText( const sal_Int32 nIdx = 0,
689 const sal_Int32 nLen = -1,
690 const bool bWithNum = false,
691 const bool bAddSpaceAfterListLabelStr = false,
692 const bool bWithSpacesForLevel = false,
693 const bool bWithFootnote = true ) const;
694 bool GetExpandText( SwTextNode& rDestNd, const SwIndex* pDestIdx = 0,
695 sal_Int32 nIdx = 0, sal_Int32 nLen = -1,
696 bool bWithNum = false, bool bWithFootnote = true,
697 bool bReplaceTabsWithSpaces = false ) const;
699 OUString GetRedlineText( sal_Int32 nIdx = 0,
700 sal_Int32 nLen = SAL_MAX_INT32,
701 bool bExpandFields = false,
702 bool bWithNum = false ) const;
704 /** @return actual count of initial chars for initial-function.
705 If nWishLen == 0 that of first word. */
706 sal_Int32 GetDropLen(sal_Int32 nWishLen) const;
708 /// Passes back info needed on the dropcap dimensions
709 bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const;
711 /// Hidden Paragraph Field:
712 inline bool CalcHiddenParaField()
713 { return m_pSwpHints && m_pSwpHints->CalcHiddenParaField(); }
714 /// set CalcVisible flags
715 inline void SetCalcHiddenParaField()
716 { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); }
718 /// is the paragraph visible?
719 inline bool HasHiddenParaField() const
720 { return m_pSwpHints && m_pSwpHints->HasHiddenParaField(); }
722 /// Hidden Paragraph Field:
724 inline bool HasHiddenCharAttribute( bool bWholePara ) const
726 if ( m_bRecalcHiddenCharFlags )
727 CalcHiddenCharFlags();
728 return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars;
731 inline void SetCalcHiddenCharFlags() const
732 { m_bRecalcHiddenCharFlags = true; }
734 /** @return if the node is hidden due to
735 1. HiddenParaField
736 2. HiddenCharAttribute
737 3. HiddenSection */
739 bool IsHidden() const;
741 TYPEINFO_OVERRIDE(); // fuer rtti
743 /// override SwIndexReg
744 virtual void Update(
745 SwIndex const & rPos,
746 const sal_Int32 nChangeLen,
747 const bool bNegative = false,
748 const bool bDelete = false ) SAL_OVERRIDE;
750 /// change text to Upper/Lower/Hiragana/Katagana/...
751 void TransliterateText( utl::TransliterationWrapper& rTrans,
752 sal_Int32 nStart, sal_Int32 nEnd,
753 SwUndoTransliterate* pUndo = 0 );
755 /// count words in given range - returns true if we refreshed out count
756 bool CountWords( SwDocStat& rStat, sal_Int32 nStart, sal_Int32 nEnd ) const;
758 /** Checks some global conditions like loading or destruction of document
759 to economize notifications */
760 bool IsNotificationEnabled() const;
762 /// Checks a temporary notification blocker and the global conditons of IsNotificationEnabled()
763 bool IsNotifiable() const;
765 void SetListRestart( bool bRestart );
766 bool IsListRestart() const;
768 void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
769 bool HasAttrListRestartValue() const;
770 SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const;
771 SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const;
773 void SetCountedInList( bool bCounted );
774 bool IsCountedInList() const;
776 void AddToList();
777 void RemoveFromList();
778 bool IsInList() const;
780 bool IsFirstOfNumRule() const;
782 sal_uInt16 GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd ) const;
784 SAL_DLLPRIVATE ::com::sun::star::uno::WeakReference<
785 ::com::sun::star::text::XTextContent> const& GetXParagraph() const
786 { return m_wXParagraph; }
787 SAL_DLLPRIVATE void SetXParagraph(::com::sun::star::uno::Reference<
788 ::com::sun::star::text::XTextContent> const& xParagraph)
789 { m_wXParagraph = xParagraph; }
791 /// sfx2::Metadatable
792 virtual ::sfx2::IXmlIdRegistry& GetRegistry() SAL_OVERRIDE;
793 virtual bool IsInClipboard() const SAL_OVERRIDE;
794 virtual bool IsInUndo() const SAL_OVERRIDE;
795 virtual bool IsInContent() const SAL_OVERRIDE;
796 virtual ::com::sun::star::uno::Reference<
797 ::com::sun::star::rdf::XMetadatable > MakeUnoObject() SAL_OVERRIDE;
799 bool IsCollapse() const;
801 virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
803 sal_uInt32 GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const;
804 sal_uInt32 GetParRsid() const;
806 bool CompareRsid( const SwTextNode &rTextNode, sal_Int32 nStt1, sal_Int32 nStt2,
807 sal_Int32 nEnd1 = 0, sal_Int32 nEnd2 = 0 ) const;
808 bool CompareParRsid( const SwTextNode &rTextNode ) const;
810 DECL_FIXEDMEMPOOL_NEWDEL(SwTextNode)
812 //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
813 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const SAL_OVERRIDE;
815 /// In MS Word, the font underline setting of the paragraph end position wont affect the formatting of numbering, so we ignore it
816 static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich);
819 inline SwpHints & SwTextNode::GetSwpHints()
821 assert( m_pSwpHints );
822 return *m_pSwpHints;
824 inline const SwpHints &SwTextNode::GetSwpHints() const
826 assert( m_pSwpHints );
827 return *m_pSwpHints;
830 inline SwpHints& SwTextNode::GetOrCreateSwpHints()
832 if ( !m_pSwpHints )
834 m_pSwpHints = new SwpHints;
836 return *m_pSwpHints;
839 inline void SwTextNode::TryDeleteSwpHints()
841 if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() )
843 DELETEZ( m_pSwpHints );
847 inline SwTextFormatColl* SwTextNode::GetTextColl() const
849 return static_cast<SwTextFormatColl*>(const_cast<SwModify*>(GetRegisteredIn()));
852 /// Inline methods from Node.hxx
853 inline SwTextNode *SwNode::GetTextNode()
855 return ND_TEXTNODE == nNodeType ? static_cast<SwTextNode*>(this) : 0;
858 inline const SwTextNode *SwNode::GetTextNode() const
860 return ND_TEXTNODE == nNodeType ? static_cast<const SwTextNode*>(this) : 0;
863 inline void
864 SwTextNode::CutText(SwTextNode * const pDest, const SwIndex & rDestStart,
865 const SwIndex & rStart, const sal_Int32 nLen)
867 CutImpl( pDest, rDestStart, rStart, nLen, true );
870 inline sal_Int32 SwTextNode::GetSpaceLeft() const
872 // do not fill the String up to the max - need to be able to have a
873 // SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1
874 const sal_Int32 TXTNODE_MAX = SAL_MAX_INT32 - 2;
875 return TXTNODE_MAX-m_Text.getLength();
878 #endif
880 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */