1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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>
45 class TransliterationWrapper
;
48 class SwTextFormatColl
;
51 class SwTextInputField
;
53 class SwUndoTransliterate
;
55 struct SwConversionArgs
;
56 class SwInterHyphInfo
;
58 class SwGrammarMarkUp
;
62 struct SwParaIdleData_Impl
;
64 namespace com
{ namespace sun
{ namespace star
{
66 template < class > class Sequence
;
68 namespace text
{ class XTextContent
; }
71 typedef std::set
< sal_Int32
> SwSoftPageBreakList
;
73 /// SwTextNode is a paragraph in the document model.
74 class SW_DLLPUBLIC SwTextNode
: public SwContentNode
, public ::sfx2::Metadatable
76 friend class SwContentNode
;
77 /// For creating the first TextNode.
78 friend class SwDoc
; ///< CTOR and AppendTextNode()
80 friend class SwTextFrame
;
81 friend class SwScriptInfo
;
83 /** May be 0. It is only then not 0 if it contains hard attributes.
84 Therefore: never access directly! */
85 SwpHints
*m_pSwpHints
;
87 mutable SwNodeNum
* mpNodeNum
; ///< Numbering for this paragraph.
91 SwParaIdleData_Impl
* m_pParaIdleData_Impl
;
93 /** Some of the chars this para are hidden. Paragraph has to be reformatted
94 on changing the view to print preview. */
95 mutable bool m_bContainsHiddenChars
: 1;
96 /// The whole paragraph is hidden because of the hidden text attribute
97 mutable bool m_bHiddenCharsHidePara
: 1;
98 /// The last two flags have to be recalculated if this flag is set:
99 mutable bool m_bRecalcHiddenCharFlags
: 1;
101 mutable bool m_bLastOutlineState
: 1;
104 bool mbEmptyListStyleSetDueToSetOutlineLevelAttr
;
106 /** boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or
107 <ResetAllAttr(..)> method is running.
108 Needed to avoid duplicate handling of attribute change actions. */
109 bool mbInSetOrResetAttr
;
111 /// pointer to the list, to whose the text node is added to
114 std::unique_ptr
< OUString
> m_pNumStringCache
;
116 css::uno::WeakReference
<css::text::XTextContent
> m_wXParagraph
;
118 // 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
= nullptr );
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
& ) override
;
141 /// Optimization: Asking for information about hidden characters at SwScriptInfo
142 /// updates these flags.
143 bool IsCalcHiddenCharFlags() const
144 { return m_bRecalcHiddenCharFlags
; }
145 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
) 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 InitSwParaStatistics( bool bNew
);
164 /** create number for this text node, if not already existing
166 @return number of this node
168 SwNodeNum
* CreateNum() const;
170 inline void TryDeleteSwpHints();
172 SAL_DLLPRIVATE
void impl_FormatToTextAttr(const SfxItemSet
& i_rAttrSet
);
174 const SwTextInputField
* GetOverlappingInputField( const SwTextAttr
& rTextAttr
) const;
176 void DelFrames_TextNodePart();
179 enum class WrongState
{ TODO
, PENDING
, DONE
};
181 bool IsWordCountDirty() const;
182 WrongState
GetWrongDirty() const;
183 bool IsWrongDirty() const;
184 bool IsGrammarCheckDirty() const;
185 bool IsSmartTagDirty() const;
186 bool IsAutoCompleteWordDirty() const;
187 void SetWordCountDirty( bool bNew
) const;
188 void SetWrongDirty(WrongState eNew
) const;
189 void SetGrammarCheckDirty( bool bNew
) const;
190 void SetSmartTagDirty( bool bNew
) const;
191 void SetAutoCompleteWordDirty( bool bNew
) const;
192 void SetWrong( SwWrongList
* pNew
, bool bDelete
= true );
193 SwWrongList
* GetWrong();
194 const SwWrongList
* GetWrong() const;
195 void SetGrammarCheck( SwGrammarMarkUp
* pNew
, bool bDelete
= true );
196 SwGrammarMarkUp
* GetGrammarCheck();
197 void SetSmartTags( SwWrongList
* pNew
, bool bDelete
= true );
198 SwWrongList
* GetSmartTags();
199 bool TryCharSetExpandToNum(const SfxItemSet
& pCharSet
);
201 /// End: Data collected during idle time
204 /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
205 virtual void Modify( const SfxPoolItem
*, const SfxPoolItem
* ) override
;
206 virtual void SwClientNotify( const SwModify
&, const SfxHint
& ) override
;
209 using SwContentNode::GetAttr
;
211 const OUString
& GetText() const { return m_Text
; }
213 // returns the maximum number of characters that can still be added to the node
214 inline sal_Int32
GetSpaceLeft() const;
216 /// getters for SwpHints
217 inline SwpHints
&GetSwpHints();
218 inline const SwpHints
&GetSwpHints() const;
219 SwpHints
*GetpSwpHints() { return m_pSwpHints
; }
220 const SwpHints
*GetpSwpHints() const { return m_pSwpHints
; }
221 bool HasHints() const { return m_pSwpHints
!= nullptr; }
222 inline SwpHints
&GetOrCreateSwpHints();
224 virtual ~SwTextNode() override
;
226 virtual sal_Int32
Len() const override
;
229 void GetMinMaxSize( sal_uLong nIndex
, sal_uLong
& rMin
, sal_uLong
&rMax
, sal_uLong
&rAbs
) const;
231 /// overriding to handle change of certain paragraph attributes
232 virtual bool SetAttr( const SfxPoolItem
& ) override
;
233 virtual bool SetAttr( const SfxItemSet
& rSet
) override
;
234 virtual bool ResetAttr( sal_uInt16 nWhich1
, sal_uInt16 nWhich2
= 0 ) override
;
235 virtual bool ResetAttr( const std::vector
<sal_uInt16
>& rWhichArr
) override
;
236 virtual sal_uInt16
ResetAllAttr() override
;
238 /// insert text content
239 /// @param rStr text to insert; in case it does not fit into the capacity
240 /// of the node, the longest prefix that fits is inserted
241 /// @return the prefix of rStr that was actually inserted
242 OUString
InsertText( const OUString
& rStr
, const SwIndex
& rIdx
,
243 const SwInsertFlags nMode
244 = SwInsertFlags::DEFAULT
);
246 /** delete text content
247 ATTENTION: must not be called with a range that overlaps the start of
248 an attribute with both extent and dummy char
250 void EraseText ( const SwIndex
&rIdx
, const sal_Int32 nCount
= SAL_MAX_INT32
,
251 const SwInsertFlags nMode
= SwInsertFlags::DEFAULT
);
253 /** delete all attributes.
254 If neither pSet nor nWhich is given, delete all attributes (except
255 refmarks, toxmarks, meta) in range.
256 @param rIdx start position
257 @param nLen range in which attributes will be deleted
258 @param pSet if not 0, delete only attributes contained in pSet
259 @param nWhich if not 0, delete only attributes with matching which
260 @param bInclRefToxMark
261 refmarks, toxmarks, and metas will be ignored unless this is true
262 ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
263 @param bExactRange From the attributes included in the range, delete
264 only the ones which have exactly same range. Don't delete the ones
265 which are simply included in the range.
269 const sal_Int32 nLen
,
270 const sal_uInt16 nWhich
= 0,
271 const SfxItemSet
* pSet
= nullptr,
272 const bool bInclRefToxMark
= false,
273 const bool bExactRange
= false );
276 // Delete text attribute (needs to be deregistered at Pool!)
277 void DestroyAttr( SwTextAttr
* pAttr
);
279 // delete all attributes from SwpHintsArray.
280 void ClearSwpHintsArr( bool bDelFields
);
282 /// initialize the hints after file loading (which takes shortcuts)
283 void FileLoadedInitHints();
285 /// Insert pAttr into hints array. @return true iff inserted successfully
286 bool InsertHint( SwTextAttr
* const pAttr
,
287 const SetAttrMode nMode
= SetAttrMode::DEFAULT
);
288 /// create new text attribute from rAttr and insert it
289 /// @return inserted hint; 0 if not sure the hint is inserted
290 SwTextAttr
* InsertItem( SfxPoolItem
& rAttr
,
291 const sal_Int32 nStart
, const sal_Int32 nEnd
,
292 const SetAttrMode nMode
= SetAttrMode::DEFAULT
);
294 /** Set these attributes at TextNode. If the whole range is comprised
295 set them only in AutoAttrSet (SwContentNode::SetAttr). */
296 bool SetAttr( const SfxItemSet
& rSet
,
297 sal_Int32 nStt
, sal_Int32 nEnd
,
298 const SetAttrMode nMode
= SetAttrMode::DEFAULT
);
299 /** Query the attributes of textnode over the range.
300 Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
301 If <bMergeIndentValuesOfNumRule> == true, the indent attributes of
302 the corresponding list level of an applied list style is merged into
303 the requested item set as a LR-SPACE item, if <bOnlyTextAttr> == false,
304 corresponding node has not its own indent attributes and the
305 position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT. */
306 bool GetAttr( SfxItemSet
& rSet
, sal_Int32 nStt
, sal_Int32 nEnd
,
307 const bool bOnlyTextAttr
= false,
308 const bool bGetFromChrFormat
= true,
309 const bool bMergeIndentValuesOfNumRule
= false ) const;
311 /// Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
312 void FormatToTextAttr( SwTextNode
* pNd
);
314 /// delete all attributes of type nWhich at nStart (opt. end nEnd)
315 void DeleteAttributes( const sal_uInt16 nWhich
,
316 const sal_Int32 nStart
, const sal_Int32 nEnd
= 0 );
317 /// delete the attribute pTextAttr
318 void DeleteAttribute ( SwTextAttr
* const pTextAttr
);
320 /** Actions on text and attributes.
321 introduce optional parameter to control, if all attributes have to be copied. */
322 void CopyText( SwTextNode
* const pDest
,
323 const SwIndex
&rStart
,
324 const sal_Int32 nLen
,
325 const bool bForceCopyOfAllAttrs
);
326 void CopyText( SwTextNode
* const pDest
,
327 const SwIndex
&rDestStart
,
328 const SwIndex
&rStart
,
330 const bool bForceCopyOfAllAttrs
= false );
332 void CutText(SwTextNode
* const pDest
,
333 const SwIndex
& rStart
, const sal_Int32 nLen
);
334 inline void CutText(SwTextNode
* const pDest
, const SwIndex
&rDestStart
,
335 const SwIndex
& rStart
, const sal_Int32 nLen
);
337 /// replace nDelLen characters at rStart with rText
338 /// in case the replacement does not fit, it is partially inserted up to
339 /// the capacity of the node
340 void ReplaceText( const SwIndex
& rStart
, const sal_Int32 nDelLen
,
341 const OUString
& rText
);
342 void ReplaceTextOnly( sal_Int32 nPos
, sal_Int32 nLen
,
343 const OUString
& rText
,
344 const css::uno::Sequence
<sal_Int32
>& rOffsets
);
346 /// Virtual methods from ContentNode.
347 virtual SwContentFrame
*MakeFrame( SwFrame
* ) override
;
348 virtual SwContentNode
*SplitContentNode( const SwPosition
& ) override
;
349 virtual SwContentNode
*JoinNext() override
;
350 virtual void JoinPrev() override
;
352 SwContentNode
*AppendNode( const SwPosition
& );
354 /// When appropriate set DontExpand-flag at INet or character styles respectively.
355 bool DontExpandFormat( const SwIndex
& rIdx
, bool bFlag
= true,
356 bool bFormatToTextAttributes
= true );
358 enum GetTextAttrMode
{
359 DEFAULT
, /// DEFAULT: (Start <= nIndex < End)
360 EXPAND
, /// EXPAND : (Start < nIndex <= End)
361 PARENT
, /// PARENT : (Start < nIndex < End)
364 /** get the innermost text attribute covering position nIndex.
365 @param nWhich only attribute with this id is returned.
366 @param eMode the predicate for matching (@see GetTextAttrMode).
368 ATTENTION: this function is not well-defined for those
369 hints of which several may cover a single position, like
370 RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
372 SwTextAttr
*GetTextAttrAt(
373 sal_Int32
const nIndex
,
374 RES_TXTATR
const nWhich
,
375 enum GetTextAttrMode
const eMode
= DEFAULT
) const;
377 /** get the innermost text attributes covering position nIndex.
378 @param nWhich only attributes with this id are returned.
379 @param eMode the predicate for matching (@see GetTextAttrMode).
381 std::vector
<SwTextAttr
*> GetTextAttrsAt(
382 sal_Int32
const nIndex
,
383 RES_TXTATR
const nWhich
) const;
385 /** get the text attribute at position nIndex which owns
386 the dummy character CH_TXTATR_* at that position, if one exists.
387 @param nIndex the position in the text
388 @param nWhich if different from RES_TXTATR_END, return only
389 attribute with given which id
390 @return the text attribute at nIndex of type nWhich, if it exists
392 SwTextAttr
*GetTextAttrForCharAt(
393 const sal_Int32 nIndex
,
394 const RES_TXTATR nWhich
= RES_TXTATR_END
) const;
396 SwTextField
* GetFieldTextAttrAt(
397 const sal_Int32 nIndex
,
398 const bool bIncludeInputFieldAtStart
= false ) const;
400 OUString
GetCurWord(sal_Int32
) const;
401 bool Spell(SwSpellArgs
*);
402 bool Convert( SwConversionArgs
& );
404 inline SwTextFormatColl
*GetTextColl() const;
405 virtual SwFormatColl
*ChgFormatColl( SwFormatColl
* ) override
;
406 void ChgTextCollUpdateNum( const SwTextFormatColl
* pOld
,
407 const SwTextFormatColl
* pNew
);
409 /** Copy collection with all auto formats to dest-node.
410 The latter might be in an other document!
411 (Method in ndcopy.cxx!!). */
412 void CopyCollFormat( SwTextNode
& rDestNd
);
414 // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
417 Returns numbering rule of this text node.
419 @param bInParent search in parent attributes, too
421 @return numbering rule of this text node or NULL if none is set
423 SwNumRule
*GetNumRule(bool bInParent
= true) const;
425 const SwNodeNum
* GetNum() const
430 SwNumberTree::tNumberVector
GetNumberVector() const;
433 Returns if this text node is an outline.
435 @retval true this text node is an outline
438 bool IsOutline() const;
440 bool IsOutlineStateChanged() const;
442 void UpdateOutlineState();
445 Notify this textnode that its numbering rule has changed.
449 /** Returns outline of numbering string
451 Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control,
452 if the prefix and the suffix strings have to been included or not.
454 @param _bInclPrefixAndSuffixStrings
455 optional input parameter - boolean indicating, if the prefix and the
456 suffix strings have to been included or not. default value = <true>
458 @param _nRestrictToThisLevel
459 optional input parameter - unsigned integer indicating the maximum outline
460 level to which the output string must be restricted to. Default value is
463 OUString
GetNumString( const bool _bInclPrefixAndSuffixStrings
= true,
464 const unsigned int _nRestrictToThisLevel
= MAXLEVEL
) const;
467 Returns the additional indents of this text node and its numbering.
471 @return additional indents
473 long GetLeftMarginWithNum( bool bTextLeft
= false ) const;
476 Returns the combined first line indent of this text node and
479 @param the first line indent of this text node taking the
480 numbering into account (return parameter)
482 @retval true this node has SwNodeNum and has numbering rule
485 bool GetFirstLineOfsWithNum( short& rFirstOffset
) const;
487 SwTwips
GetAdditionalIndentForStartingNewList() const;
489 void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem
& o_rLRSpaceItem
) const;
491 /** return left margin for tab stop position calculation
493 Needed for text formatting
494 Method considers new list level attributes, which also can provide a left margin value
496 long GetLeftMarginForTabCalculation() const;
498 /** Returns if this text node has a number.
500 This text node has a number if it has a SwNodeNum and a
501 numbering rule and the numbering format specified for the
502 level of the SwNodeNum is of an enumeration type.
504 @retval true This text node has a number.
507 bool HasNumber() const;
509 /** Returns if this text node has a bullet.
511 This text node has a bullet if it has a SwNodeNum and a
512 numbering rule and the numbering format specified for the
513 level of the SwNodeNum is of a bullet type.
515 @retval true This text node has a bullet.
518 bool HasBullet() const;
520 /** Returns is this text node is numbered.
522 This node is numbered if it has a SwNodeNum and it has a
523 numbering rule and has not a hidden SwNodeNum.
525 ATTENTION: Returns true even if the SwNumFormat has type
528 @retval true This node is numbered.
531 bool IsNumbered() const;
533 /** Returns if this text node has a marked label.
535 @retval true This text node has a marked label.
538 bool HasMarkedLabel() const;
540 /** Sets the list level of this text node.
542 Side effect, when the text node is a list item:
543 The text node's representation in the list tree (<SwNodeNum> instance)
546 @param nLevel level to set
548 void SetAttrListLevel(int nLevel
);
550 bool HasAttrListLevel() const;
552 int GetAttrListLevel() const;
554 /** Returns the actual list level of this text node, when it is a list item
556 @return the actual list level of this text node, if it is a list item,
559 int GetActualListLevel() const;
562 Returns outline level of this text node.
564 If a text node has an outline number (i.e. it has an SwNodeNum
565 and a outline numbering rule) the outline level is the level of
568 If a text node has no outline number and has a paragraph style
569 attached the outline level is the outline level of the
572 Otherwise the text node has no outline level (NO_NUMBERING).
574 NOTE: The outline level of text nodes is subject to change. The
575 plan is to have an SwTextNode::nOutlineLevel member that is
576 updated from a paragraph style upon appliance of that paragraph
579 @return outline level or NO_NUMBERING if there is no outline level
581 int GetAttrOutlineLevel() const;
584 Sets the out line level *at* a text node.
586 @param nLevel the level to be set
588 If the text node has an outline number the level is set at the
591 If the text node has no outline number but has a paragraph
592 style applied the outline level is set at the paragraph style.
594 NOTE: This is subject to change, see GetOutlineLevel.
596 void SetAttrOutlineLevel(int nLevel
);
598 bool IsEmptyListStyleDueToSetOutlineLevelAttr() { return mbEmptyListStyleSetDueToSetOutlineLevelAttr
;}
599 void SetEmptyListStyleDueToSetOutlineLevelAttr();
600 void ResetEmptyListStyleDueToResetOutlineLevelAttr();
603 Returns the width of leading tabs/blanks in this paragraph.
604 This space will be converted into numbering indent if the paragraph
605 is set to be numbered.
607 @return the width of the leading whitespace
609 SwTwips
GetWidthOfLeadingTabs() const;
612 Returns if the paragraph has a visible numbering or bullet.
613 This includes all kinds of numbering/bullet/outlines.
614 Note: This function returns false, if the numbering format is
615 SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
617 @return true if the paragraph has a visible numbering/bullet/outline
619 bool HasVisibleNumberingOrBullet() const;
621 void SetListId(OUString
const& rListId
);
622 OUString
GetListId() const;
624 /** Determines, if the list level indent attributes can be applied to the
627 The list level indents can be applied to the paragraph under the one
628 of following conditions:
629 - the list style is directly applied to the paragraph and the paragraph
630 has no own indent attributes.
631 - the list style is applied to the paragraph through one of its paragraph
632 styles, the paragraph has no own indent attributes and on the paragraph
633 style hierarchy from the paragraph to the paragraph style with the
634 list style no indent attributes are found.
638 bool AreListLevelIndentsApplicable() const;
640 /** Retrieves the list tab stop position, if the paragraph's list level defines
641 one and this list tab stop has to merged into the tap stops of the paragraph
643 @param nListTabStopPosition
644 output parameter - containing the list tab stop position
646 @return boolean - indicating, if a list tab stop position is provided
648 bool GetListTabStopPosition( long& nListTabStopPosition
) const;
650 /** Retrieves the character following the list label, if the paragraph's
651 list level defines one.
653 @return the list tab stop position as string
655 OUString
GetLabelFollowedBy() const;
657 // END OF BULLET/NUMBERING/OUTLINE STUFF:
659 void fillSoftPageBreakList( SwSoftPageBreakList
& rBreak
) const;
661 LanguageType
GetLang( const sal_Int32 nBegin
, const sal_Int32 nLen
= 0,
662 sal_uInt16 nScript
= 0 ) const;
665 bool IsSymbol( const sal_Int32 nBegin
) const; // In itratr.cxx.
666 virtual SwContentNode
* MakeCopy( SwDoc
*, const SwNodeIndex
& ) const override
;
668 /// Interactive hyphenation: we find TextFrame and call its CalcHyph.
669 bool Hyphenate( SwInterHyphInfo
&rHyphInf
);
670 void DelSoftHyph( const sal_Int32 nStart
, const sal_Int32 nEnd
);
672 /** add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
673 when <bWithNum = true> that a space is inserted after the string for
675 add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
676 spaces are inserted in front of the expanded text string depending on
678 OUString
GetExpandText( const sal_Int32 nIdx
= 0,
679 const sal_Int32 nLen
= -1,
680 const bool bWithNum
= false,
681 const bool bAddSpaceAfterListLabelStr
= false,
682 const bool bWithSpacesForLevel
= false,
683 const bool bWithFootnote
= true ) const;
684 bool GetExpandText( SwTextNode
& rDestNd
, const SwIndex
* pDestIdx
,
685 sal_Int32 nIdx
, sal_Int32 nLen
,
686 bool bWithNum
= false, bool bWithFootnote
= true,
687 bool bReplaceTabsWithSpaces
= false ) const;
689 OUString
GetRedlineText() const;
691 /** @return actual count of initial chars for initial-function.
692 If nWishLen == 0 that of first word. */
693 sal_Int32
GetDropLen(sal_Int32 nWishLen
) const;
695 /// Passes back info needed on the dropcap dimensions
696 bool GetDropSize(int& rFontHeight
, int& rDropHeight
, int& rDropDescent
) const;
698 /// Hidden Paragraph Field:
699 bool CalcHiddenParaField()
700 { return m_pSwpHints
&& m_pSwpHints
->CalcHiddenParaField(); }
701 /// set CalcVisible flags
702 void SetCalcHiddenParaField()
703 { if (m_pSwpHints
) m_pSwpHints
->SetCalcHiddenParaField(); }
705 /// is the paragraph visible?
706 bool HasHiddenParaField() const
707 { return m_pSwpHints
&& m_pSwpHints
->HasHiddenParaField(); }
709 /// Hidden Paragraph Field:
711 bool HasHiddenCharAttribute( bool bWholePara
) const
713 if ( m_bRecalcHiddenCharFlags
)
714 CalcHiddenCharFlags();
715 return bWholePara
? m_bHiddenCharsHidePara
: m_bContainsHiddenChars
;
718 void SetCalcHiddenCharFlags() const
719 { m_bRecalcHiddenCharFlags
= true; }
721 /** @return if the node is hidden due to
723 2. HiddenCharAttribute
726 bool IsHidden() const;
729 /// override SwIndexReg
731 SwIndex
const & rPos
,
732 const sal_Int32 nChangeLen
,
733 const bool bNegative
= false,
734 const bool bDelete
= false ) override
;
736 /// change text to Upper/Lower/Hiragana/Katagana/...
737 void TransliterateText( utl::TransliterationWrapper
& rTrans
,
738 sal_Int32 nStart
, sal_Int32 nEnd
,
739 SwUndoTransliterate
* pUndo
);
741 /// count words in given range - returns true if we refreshed out count
742 bool CountWords( SwDocStat
& rStat
, sal_Int32 nStart
, sal_Int32 nEnd
) const;
744 /** Checks some global conditions like loading or destruction of document
745 to economize notifications */
746 bool IsNotificationEnabled() const;
748 /// Checks a temporary notification blocker and the global conditions of IsNotificationEnabled()
749 bool IsNotifiable() const;
751 void SetListRestart( bool bRestart
);
752 bool IsListRestart() const;
754 void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum
);
755 bool HasAttrListRestartValue() const;
756 SwNumberTree::tSwNumTreeNumber
GetAttrListRestartValue() const;
757 SwNumberTree::tSwNumTreeNumber
GetActualListStartValue() const;
759 void SetCountedInList( bool bCounted
);
760 bool IsCountedInList() const;
763 void RemoveFromList();
764 bool IsInList() const;
766 bool IsFirstOfNumRule() const;
768 sal_uInt16
GetScalingOfSelectedText( sal_Int32 nStt
, sal_Int32 nEnd
) const;
770 SAL_DLLPRIVATE
css::uno::WeakReference
<css::text::XTextContent
> const& GetXParagraph() const
771 { return m_wXParagraph
; }
772 SAL_DLLPRIVATE
void SetXParagraph(css::uno::Reference
<css::text::XTextContent
> const& xParagraph
)
773 { m_wXParagraph
= xParagraph
; }
775 /// sfx2::Metadatable
776 virtual ::sfx2::IXmlIdRegistry
& GetRegistry() override
;
777 virtual bool IsInClipboard() const override
;
778 virtual bool IsInUndo() const override
;
779 virtual bool IsInContent() const override
;
780 virtual css::uno::Reference
< css::rdf::XMetadatable
> MakeUnoObject() override
;
782 bool IsCollapse() const;
784 virtual void dumpAsXml(struct _xmlTextWriter
* pWriter
) const override
;
786 sal_uInt32
GetRsid( sal_Int32 nStt
, sal_Int32 nEnd
) const;
787 sal_uInt32
GetParRsid() const;
789 bool CompareRsid( const SwTextNode
&rTextNode
, sal_Int32 nStt1
, sal_Int32 nStt2
) const;
790 bool CompareParRsid( const SwTextNode
&rTextNode
) const;
792 DECL_FIXEDMEMPOOL_NEWDEL(SwTextNode
)
794 // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
795 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr
getSdrAllFillAttributesHelper() const override
;
797 /// In MS Word, the font underline setting of the paragraph end position won't affect the formatting of numbering, so we ignore it
798 static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich
);
801 inline SwpHints
& SwTextNode::GetSwpHints()
803 assert( m_pSwpHints
);
806 inline const SwpHints
&SwTextNode::GetSwpHints() const
808 assert( m_pSwpHints
);
812 inline SwpHints
& SwTextNode::GetOrCreateSwpHints()
816 m_pSwpHints
= new SwpHints
;
821 inline void SwTextNode::TryDeleteSwpHints()
823 if ( m_pSwpHints
&& m_pSwpHints
->CanBeDeleted() )
825 DELETEZ( m_pSwpHints
);
829 inline SwTextFormatColl
* SwTextNode::GetTextColl() const
831 return static_cast<SwTextFormatColl
*>(const_cast<SwModify
*>(GetRegisteredIn()));
834 /// Inline methods from Node.hxx
835 inline SwTextNode
*SwNode::GetTextNode()
837 return SwNodeType::Text
== m_nNodeType
? static_cast<SwTextNode
*>(this) : nullptr;
840 inline const SwTextNode
*SwNode::GetTextNode() const
842 return SwNodeType::Text
== m_nNodeType
? static_cast<const SwTextNode
*>(this) : nullptr;
846 SwTextNode::CutText(SwTextNode
* const pDest
, const SwIndex
& rDestStart
,
847 const SwIndex
& rStart
, const sal_Int32 nLen
)
849 CutImpl( pDest
, rDestStart
, rStart
, nLen
);
852 inline sal_Int32
SwTextNode::GetSpaceLeft() const
854 // do not fill the String up to the max - need to be able to have a
855 // SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1
856 const sal_Int32 TXTNODE_MAX
= SAL_MAX_INT32
- 2;
857 return TXTNODE_MAX
-m_Text
.getLength();
862 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */