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>
27 #include "hintids.hxx"
28 #include "ndhints.hxx"
29 #include "SwNumberTreeTypes.hxx"
30 #include "IDocumentContentOperations.hxx"
31 #include "modeltoviewhelper.hxx"
33 #include <sfx2/Metadatable.hxx>
46 class TransliterationWrapper
;
55 class SwTextInputField
;
57 class SwUndoTransliterate
;
59 struct SwConversionArgs
;
60 class SwInterHyphInfo
;
62 class SwGrammarMarkUp
;
64 struct SwParaIdleData_Impl
;
65 enum class ExpandMode
;
67 namespace sw
{ namespace mark
{ enum class RestoreMode
; } }
69 namespace com
{ namespace sun
{ namespace star
{
71 template < class > class Sequence
;
73 namespace text
{ class XTextContent
; }
76 typedef std::set
< sal_Int32
> SwSoftPageBreakList
;
78 /// SwTextNode is a paragraph in the document model.
79 class SW_DLLPUBLIC SwTextNode
80 : public SwContentNode
81 , public ::sfx2::Metadatable
83 friend class SwContentNode
;
84 /// For creating the first TextNode.
85 friend class SwDoc
; ///< CTOR and AppendTextNode()
87 friend class SwTextFrame
;
88 friend class SwScriptInfo
;
90 /** May be 0. It is only then not 0 if it contains hard attributes.
91 Therefore: never access directly! */
92 std::unique_ptr
<SwpHints
> m_pSwpHints
;
94 mutable std::unique_ptr
<SwNodeNum
> mpNodeNum
; ///< Numbering for this paragraph.
95 mutable std::unique_ptr
<SwNodeNum
> mpNodeNumRLHidden
; ///< Numbering for this paragraph (hidden redlines)
99 SwParaIdleData_Impl
* m_pParaIdleData_Impl
;
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;
109 mutable bool m_bLastOutlineState
: 1;
112 bool mbEmptyListStyleSetDueToSetOutlineLevelAttr
;
114 /** boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or
115 <ResetAllAttr(..)> method is running.
116 Needed to avoid duplicate handling of attribute change actions. */
117 bool mbInSetOrResetAttr
;
119 std::unique_ptr
< OUString
> m_pNumStringCache
;
121 css::uno::WeakReference
<css::text::XTextContent
> m_wXParagraph
;
123 // DrawingLayer FillAttributes in a preprocessed form for primitive usage
124 drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes
;
126 SAL_DLLPRIVATE
SwTextNode( const SwNodeIndex
&rWhere
, SwTextFormatColl
*pTextColl
,
127 const SfxItemSet
* pAutoAttr
= nullptr );
129 /// Copies the attributes at nStart to pDest.
130 SAL_DLLPRIVATE
void CopyAttr( SwTextNode
*pDest
, const sal_Int32 nStart
, const sal_Int32 nOldPos
);
132 SAL_DLLPRIVATE SwTextNode
* MakeNewTextNode( const SwNodeIndex
&, bool bNext
= true,
133 bool bChgFollow
= true );
135 SAL_DLLPRIVATE
void CutImpl(
136 SwTextNode
* const pDest
, const SwIndex
& rDestStart
,
137 const SwIndex
& rStart
, /*const*/ sal_Int32 nLen
,
138 const bool bUpdate
= true );
140 /// Move all comprising hard attributes to the AttrSet of the paragraph.
141 SAL_DLLPRIVATE
void MoveTextAttr_To_AttrSet(); // Called by SplitNode.
143 /// Create the specific AttrSet.
144 SAL_DLLPRIVATE
virtual void NewAttrSet( SwAttrPool
& ) override
;
146 /// Optimization: Asking for information about hidden characters at SwScriptInfo
147 /// updates these flags.
148 bool IsCalcHiddenCharFlags() const
149 { return m_bRecalcHiddenCharFlags
; }
150 void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara
, bool bNewContainsHiddenChars
) const
152 m_bHiddenCharsHidePara
= bNewHiddenCharsHidePara
;
153 m_bContainsHiddenChars
= bNewContainsHiddenChars
;
154 m_bRecalcHiddenCharFlags
= false;
157 SAL_DLLPRIVATE
void CalcHiddenCharFlags() const;
159 SAL_DLLPRIVATE
void SetLanguageAndFont( const SwPaM
&rPaM
,
160 LanguageType nLang
, sal_uInt16 nLangWhichId
,
161 const vcl::Font
*pFont
, sal_uInt16 nFontWhichId
);
163 /// Start: Data collected during idle time
165 SAL_DLLPRIVATE
void InitSwParaStatistics( bool bNew
);
167 inline void TryDeleteSwpHints();
169 SAL_DLLPRIVATE
void impl_FormatToTextAttr(const SfxItemSet
& i_rAttrSet
);
171 const SwTextInputField
* GetOverlappingInputField( const SwTextAttr
& rTextAttr
) const;
173 void DelFrames_TextNodePart();
176 enum class WrongState
{ TODO
, PENDING
, DONE
};
178 bool IsWordCountDirty() const;
179 WrongState
GetWrongDirty() const;
180 bool IsWrongDirty() const;
181 bool IsGrammarCheckDirty() const;
182 bool IsSmartTagDirty() const;
183 bool IsAutoCompleteWordDirty() const;
184 void SetWordCountDirty( bool bNew
) const;
185 void SetWrongDirty(WrongState eNew
) const;
186 void SetGrammarCheckDirty( bool bNew
) const;
187 void SetSmartTagDirty( bool bNew
) const;
188 void SetAutoCompleteWordDirty( bool bNew
) const;
189 void SetWrong( SwWrongList
* pNew
, bool bDelete
= true );
190 SwWrongList
* GetWrong();
191 const SwWrongList
* GetWrong() const;
192 void SetGrammarCheck( SwGrammarMarkUp
* pNew
, bool bDelete
= true );
193 SwGrammarMarkUp
* GetGrammarCheck();
194 // return SwWrongList because *function pointer* return values aren't covariant
195 SwWrongList
const* GetGrammarCheck() const;
196 void SetSmartTags( SwWrongList
* pNew
, bool bDelete
= true );
197 SwWrongList
* GetSmartTags();
198 SwWrongList
const* GetSmartTags() const;
199 void TryCharSetExpandToNum(const SfxItemSet
& pCharSet
);
201 /// End: Data collected during idle time
204 /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
205 virtual void SwClientNotify( const SwModify
&, const SfxHint
& ) override
;
208 using SwContentNode::GetAttr
;
210 const OUString
& GetText() const { return m_Text
; }
212 // returns the maximum number of characters that can still be added to the node
213 inline sal_Int32
GetSpaceLeft() const;
215 /// getters for SwpHints
216 inline SwpHints
&GetSwpHints();
217 inline const SwpHints
&GetSwpHints() const;
218 SwpHints
*GetpSwpHints() { return m_pSwpHints
.get(); }
219 const SwpHints
*GetpSwpHints() const { return m_pSwpHints
.get(); }
220 bool HasHints() const { return m_pSwpHints
!= nullptr; }
221 inline SwpHints
&GetOrCreateSwpHints();
223 virtual ~SwTextNode() override
;
225 virtual sal_Int32
Len() const override
;
228 void GetMinMaxSize( sal_uLong nIndex
, sal_uLong
& rMin
, sal_uLong
&rMax
, sal_uLong
&rAbs
) const;
230 /// overriding to handle change of certain paragraph attributes
231 virtual bool SetAttr( const SfxPoolItem
& ) override
;
232 virtual bool SetAttr( const SfxItemSet
& rSet
) override
;
233 virtual bool ResetAttr( sal_uInt16 nWhich1
, sal_uInt16 nWhich2
= 0 ) override
;
234 virtual bool ResetAttr( const std::vector
<sal_uInt16
>& rWhichArr
) override
;
235 virtual sal_uInt16
ResetAllAttr() override
;
237 /// insert text content
238 /// @param rStr text to insert; in case it does not fit into the capacity
239 /// of the node, the longest prefix that fits is inserted
240 /// @return the prefix of rStr that was actually inserted
241 OUString
InsertText( const OUString
& rStr
, const SwIndex
& rIdx
,
242 const SwInsertFlags nMode
243 = SwInsertFlags::DEFAULT
);
245 /** delete text content
246 ATTENTION: must not be called with a range that overlaps the start of
247 an attribute with both extent and dummy char
249 void EraseText ( const SwIndex
&rIdx
, const sal_Int32 nCount
= SAL_MAX_INT32
,
250 const SwInsertFlags nMode
= SwInsertFlags::DEFAULT
);
252 /** delete all attributes.
253 If neither pSet nor nWhich is given, delete all attributes (except
254 refmarks, toxmarks, meta) in range.
255 @param rIdx start position
256 @param nLen range in which attributes will be deleted
257 @param pSet if not 0, delete only attributes contained in pSet
258 @param nWhich if not 0, delete only attributes with matching which
259 @param bInclRefToxMark
260 refmarks, toxmarks, and metas will be ignored unless this is true
261 ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
262 @param bExactRange From the attributes included in the range, delete
263 only the ones which have exactly same range. Don't delete the ones
264 which are simply included in the range.
268 const sal_Int32 nLen
,
269 const sal_uInt16 nWhich
= 0,
270 const SfxItemSet
* pSet
= nullptr,
271 const bool bInclRefToxMark
= false,
272 const bool bExactRange
= false );
275 // Delete text attribute (needs to be deregistered at Pool!)
276 void DestroyAttr( SwTextAttr
* pAttr
);
278 // delete all attributes from SwpHintsArray.
279 void ClearSwpHintsArr( bool bDelFields
);
281 /// initialize the hints after file loading (which takes shortcuts)
282 void FileLoadedInitHints();
284 /// Insert pAttr into hints array. @return true iff inserted successfully
285 bool InsertHint( SwTextAttr
* const pAttr
,
286 const SetAttrMode nMode
= SetAttrMode::DEFAULT
);
287 /// create new text attribute from rAttr and insert it
288 /// @return inserted hint; 0 if not sure the hint is inserted
289 SwTextAttr
* InsertItem( SfxPoolItem
& rAttr
,
290 const sal_Int32 nStart
, const sal_Int32 nEnd
,
291 const SetAttrMode nMode
= SetAttrMode::DEFAULT
);
293 /** Set these attributes at TextNode. If the whole range is comprised
294 set them only in AutoAttrSet (SwContentNode::SetAttr). */
295 bool SetAttr( const SfxItemSet
& rSet
,
296 sal_Int32 nStt
, sal_Int32 nEnd
,
297 const SetAttrMode nMode
= SetAttrMode::DEFAULT
,
298 SwTextAttr
**ppNewTextAttr
= nullptr);
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 GetParaAttr( SfxItemSet
& rSet
, sal_Int32 nStt
, sal_Int32 nEnd
,
307 const bool bOnlyTextAttr
= false,
308 const bool bGetFromChrFormat
= true,
309 const bool bMergeIndentValuesOfNumRule
= false,
310 SwRootFrame
const* pLayout
= nullptr) const;
312 /// Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
313 void FormatToTextAttr( SwTextNode
* pNd
);
315 /// delete all attributes of type nWhich at nStart (opt. end nEnd)
316 void DeleteAttributes( const sal_uInt16 nWhich
,
317 const sal_Int32 nStart
, const sal_Int32 nEnd
= 0 );
318 /// delete the attribute pTextAttr
319 void DeleteAttribute ( SwTextAttr
* const pTextAttr
);
321 /** Actions on text and attributes.
322 introduce optional parameter to control, if all attributes have to be copied. */
323 void CopyText( SwTextNode
* const pDest
,
324 const SwIndex
&rStart
,
325 const sal_Int32 nLen
,
326 const bool bForceCopyOfAllAttrs
);
327 void CopyText( SwTextNode
* const pDest
,
328 const SwIndex
&rDestStart
,
329 const SwIndex
&rStart
,
331 const bool bForceCopyOfAllAttrs
= false );
333 void CutText(SwTextNode
* const pDest
,
334 const SwIndex
& rStart
, const sal_Int32 nLen
);
335 inline void CutText(SwTextNode
* const pDest
, const SwIndex
&rDestStart
,
336 const SwIndex
& rStart
, const sal_Int32 nLen
);
338 /// replace nDelLen characters at rStart with rText
339 /// in case the replacement does not fit, it is partially inserted up to
340 /// the capacity of the node
341 void ReplaceText( const SwIndex
& rStart
, const sal_Int32 nDelLen
,
342 const OUString
& rText
);
343 void ReplaceTextOnly( sal_Int32 nPos
, sal_Int32 nLen
,
344 const OUString
& rText
,
345 const css::uno::Sequence
<sal_Int32
>& rOffsets
);
347 /// Virtual methods from ContentNode.
348 virtual SwContentFrame
*MakeFrame( SwFrame
* ) override
;
349 SwTextNode
* SplitContentNode(const SwPosition
&,
350 std::function
<void (SwTextNode
*, sw::mark::RestoreMode
)> const* pContentIndexRestore
);
351 virtual SwContentNode
*JoinNext() override
;
354 SwContentNode
*AppendNode( const SwPosition
& );
356 /// When appropriate set DontExpand-flag at INet or character styles respectively.
357 bool DontExpandFormat( const SwIndex
& rIdx
, bool bFlag
= true,
358 bool bFormatToTextAttributes
= true );
360 enum GetTextAttrMode
{
361 DEFAULT
, /// DEFAULT: (Start <= nIndex < End)
362 EXPAND
, /// EXPAND : (Start < nIndex <= End)
363 PARENT
, /// PARENT : (Start < nIndex < End)
366 /** get the innermost text attribute covering position nIndex.
367 @param nWhich only attribute with this id is returned.
368 @param eMode the predicate for matching (@see GetTextAttrMode).
370 ATTENTION: this function is not well-defined for those
371 hints of which several may cover a single position, like
372 RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
374 SwTextAttr
*GetTextAttrAt(
375 sal_Int32
const nIndex
,
376 sal_uInt16
const nWhich
,
377 enum GetTextAttrMode
const eMode
= DEFAULT
) const;
379 /** get the innermost text attributes covering position nIndex.
380 @param nWhich only attributes with this id are returned.
381 @param eMode the predicate for matching (@see GetTextAttrMode).
383 std::vector
<SwTextAttr
*> GetTextAttrsAt(
384 sal_Int32
const nIndex
,
385 sal_uInt16
const nWhich
) const;
387 /** get the text attribute at position nIndex which owns
388 the dummy character CH_TXTATR_* at that position, if one exists.
389 @param nIndex the position in the text
390 @param nWhich if different from RES_TXTATR_END, return only
391 attribute with given which id
392 @return the text attribute at nIndex of type nWhich, if it exists
394 SwTextAttr
*GetTextAttrForCharAt(
395 const sal_Int32 nIndex
,
396 const sal_uInt16 nWhich
= RES_TXTATR_END
) const;
398 SwTextField
* GetFieldTextAttrAt(
399 const sal_Int32 nIndex
,
400 const bool bIncludeInputFieldAtStart
= false ) const;
402 bool Spell(SwSpellArgs
*);
403 bool Convert( SwConversionArgs
& );
405 inline SwTextFormatColl
*GetTextColl() const;
406 virtual SwFormatColl
*ChgFormatColl( SwFormatColl
* ) override
;
407 void ChgTextCollUpdateNum( const SwTextFormatColl
* pOld
,
408 const SwTextFormatColl
* pNew
);
410 /** Copy collection with all auto formats to dest-node.
411 The latter might be in another document!
412 (Method in ndcopy.cxx!!). */
413 void CopyCollFormat( SwTextNode
& rDestNd
);
415 // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
418 Returns numbering rule of this text node.
420 @param bInParent search in parent attributes, too
422 @return numbering rule of this text node or NULL if none is set
424 SwNumRule
*GetNumRule(bool bInParent
= true) const;
426 const SwNodeNum
* GetNum(SwRootFrame
const* pLayout
= nullptr) const;
427 void DoNum(std::function
<void (SwNodeNum
&)> const&);
429 SwNumberTree::tNumberVector
GetNumberVector(SwRootFrame
const* pLayout
= nullptr) const;
432 Returns if this text node is an outline.
434 @retval true this text node is an outline
437 bool IsOutline() const;
439 bool IsOutlineStateChanged() const;
441 void UpdateOutlineState();
444 Notify this textnode that its numbering rule has changed.
448 /** Returns outline of numbering string
450 Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control,
451 if the prefix and the suffix strings have to been included or not.
453 @param _bInclPrefixAndSuffixStrings
454 optional input parameter - boolean indicating, if the prefix and the
455 suffix strings have to been included or not. default value = <true>
457 @param _nRestrictToThisLevel
458 optional input parameter - unsigned integer indicating the maximum outline
459 level to which the output string must be restricted to. Default value is
462 OUString
GetNumString( const bool _bInclPrefixAndSuffixStrings
= true,
463 const unsigned int _nRestrictToThisLevel
= MAXLEVEL
,
464 SwRootFrame
const* pLayout
= nullptr) 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( std::shared_ptr
<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(SwRootFrame
const* pLayout
= nullptr) 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 an 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() const { 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 IsSymbolAt(sal_Int32 nBegin
) const; // In itratr.cxx.
666 virtual SwContentNode
* MakeCopy(SwDoc
*, const SwNodeIndex
&, bool bNewFrames
) 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( SwRootFrame
const* pLayout
,
679 const sal_Int32 nIdx
= 0,
680 const sal_Int32 nLen
= -1,
681 const bool bWithNum
= false,
682 const bool bAddSpaceAfterListLabelStr
= false,
683 const bool bWithSpacesForLevel
= false,
684 const ExpandMode eAdditionalMode
= ExpandMode::ExpandFootnote
) const;
685 bool CopyExpandText( SwTextNode
& rDestNd
, const SwIndex
* pDestIdx
,
686 sal_Int32 nIdx
, sal_Int32 nLen
,
687 SwRootFrame
const* pLayout
,
688 bool bWithNum
= false, bool bWithFootnote
= true,
689 bool bReplaceTabsWithSpaces
= false ) const;
691 OUString
GetRedlineText() const;
693 /** @return actual count of initial chars for initial-function.
694 If nWishLen == 0 that of first word. */
695 sal_Int32
GetDropLen(sal_Int32 nWishLen
) const;
697 /// Passes back info needed on the dropcap dimensions
698 bool GetDropSize(int& rFontHeight
, int& rDropHeight
, int& rDropDescent
) const;
700 /// Hidden Paragraph Field:
701 bool CalcHiddenParaField()
702 { return m_pSwpHints
&& m_pSwpHints
->CalcHiddenParaField(); }
703 /// set CalcVisible flags
704 void SetCalcHiddenParaField()
705 { if (m_pSwpHints
) m_pSwpHints
->SetCalcHiddenParaField(); }
707 /// is the paragraph visible?
708 bool IsHiddenByParaField() const
709 { return m_pSwpHints
&& m_pSwpHints
->IsHiddenByParaField(); }
711 int FieldCanHideParaWeight(SwFieldIds eFieldId
) const
713 return GetDoc()->FieldCanHideParaWeight(eFieldId
);
715 bool FieldHidesPara(const SwField
& rField
) const
716 { return GetDoc()->FieldHidesPara(rField
); }
718 /// Hidden Paragraph Field:
720 bool HasHiddenCharAttribute( bool bWholePara
) const
722 if ( m_bRecalcHiddenCharFlags
)
723 CalcHiddenCharFlags();
724 return bWholePara
? m_bHiddenCharsHidePara
: m_bContainsHiddenChars
;
727 void SetCalcHiddenCharFlags() const
728 { m_bRecalcHiddenCharFlags
= true; }
730 /** @return if the node is hidden due to
732 2. HiddenCharAttribute
735 bool IsHidden() const;
738 /// override SwIndexReg
740 SwIndex
const & rPos
,
741 const sal_Int32 nChangeLen
,
742 const bool bNegative
= false,
743 const bool bDelete
= false ) override
;
745 /// change text to Upper/Lower/Hiragana/Katakana/...
746 void TransliterateText( utl::TransliterationWrapper
& rTrans
,
747 sal_Int32 nStart
, sal_Int32 nEnd
,
748 SwUndoTransliterate
* pUndo
);
750 /// count words in given range - returns true if we refreshed out count
751 bool CountWords( SwDocStat
& rStat
, sal_Int32 nStart
, sal_Int32 nEnd
) const;
753 /** Checks some global conditions like loading or destruction of document
754 to economize notifications */
755 bool IsNotificationEnabled() const;
757 /// Checks a temporary notification blocker and the global conditions of IsNotificationEnabled()
758 bool IsNotifiable() const;
760 void SetListRestart( bool bRestart
);
761 bool IsListRestart() const;
763 void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum
);
764 bool HasAttrListRestartValue() const;
765 SwNumberTree::tSwNumTreeNumber
GetAttrListRestartValue() const;
766 SwNumberTree::tSwNumTreeNumber
GetActualListStartValue() const;
768 void SetCountedInList( bool bCounted
);
769 bool IsCountedInList() const;
772 void AddToListRLHidden();
773 void RemoveFromList();
774 void RemoveFromListRLHidden();
775 bool IsInList() const;
777 bool IsFirstOfNumRule(SwRootFrame
const& rLayout
) const;
779 SAL_DLLPRIVATE
css::uno::WeakReference
<css::text::XTextContent
> const& GetXParagraph() const
780 { return m_wXParagraph
; }
781 SAL_DLLPRIVATE
void SetXParagraph(css::uno::Reference
<css::text::XTextContent
> const& xParagraph
)
782 { m_wXParagraph
= xParagraph
; }
784 /// sfx2::Metadatable
785 virtual ::sfx2::IXmlIdRegistry
& GetRegistry() override
;
786 virtual bool IsInClipboard() const override
;
787 virtual bool IsInUndo() const override
;
788 virtual bool IsInContent() const override
;
789 virtual css::uno::Reference
< css::rdf::XMetadatable
> MakeUnoObject() override
;
791 bool IsCollapse() const;
793 virtual void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
795 sal_uInt32
GetRsid( sal_Int32 nStt
, sal_Int32 nEnd
) const;
796 sal_uInt32
GetParRsid() const;
798 bool CompareRsid( const SwTextNode
&rTextNode
, sal_Int32 nStt1
, sal_Int32 nStt2
) const;
799 bool CompareParRsid( const SwTextNode
&rTextNode
) const;
801 // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
802 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr
getSdrAllFillAttributesHelper() const override
;
804 /// In MS Word, the font underline setting of the paragraph end position won't affect the formatting of numbering, so we ignore it
805 static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich
);
808 inline SwpHints
& SwTextNode::GetSwpHints()
810 assert( m_pSwpHints
);
813 inline const SwpHints
&SwTextNode::GetSwpHints() const
815 assert( m_pSwpHints
);
819 inline SwpHints
& SwTextNode::GetOrCreateSwpHints()
823 m_pSwpHints
.reset(new SwpHints(*this));
828 inline void SwTextNode::TryDeleteSwpHints()
830 if ( m_pSwpHints
&& m_pSwpHints
->CanBeDeleted() )
836 inline SwTextFormatColl
* SwTextNode::GetTextColl() const
838 return static_cast<SwTextFormatColl
*>(const_cast<SwModify
*>(GetRegisteredIn()));
841 /// Inline methods from Node.hxx
842 inline SwTextNode
*SwNode::GetTextNode()
844 return SwNodeType::Text
== m_nNodeType
? static_cast<SwTextNode
*>(this) : nullptr;
847 inline const SwTextNode
*SwNode::GetTextNode() const
849 return SwNodeType::Text
== m_nNodeType
? static_cast<const SwTextNode
*>(this) : nullptr;
853 SwTextNode::CutText(SwTextNode
* const pDest
, const SwIndex
& rDestStart
,
854 const SwIndex
& rStart
, const sal_Int32 nLen
)
856 CutImpl( pDest
, rDestStart
, rStart
, nLen
);
859 inline sal_Int32
SwTextNode::GetSpaceLeft() const
861 // do not fill the String up to the max - need to be able to have a
862 // SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1
863 const sal_Int32 TXTNODE_MAX
= SAL_MAX_INT32
- 2;
864 return TXTNODE_MAX
-m_Text
.getLength();
869 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */