lok: avoid expensive fetching of a property.
[LibreOffice.git] / sw / inc / ndtxt.hxx
blobf83bab3cebba71b1916f9924b2becdffc2d5f5cb
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 "IDocumentContentOperations.hxx"
26 #include "SwNumberTreeTypes.hxx"
27 #include "hintids.hxx"
28 #include "modeltoviewhelper.hxx"
29 #include "ndhints.hxx"
30 #include "node.hxx"
31 #include "paratr.hxx"
33 #include <sfx2/Metadatable.hxx>
34 #include <o3tl/sorted_vector.hxx>
35 #include <memory>
36 #include <vector>
37 #include <functional>
39 class SfxHint;
40 class SwNumRule;
41 class SwNodeNum;
42 class SvxLRSpaceItem;
44 namespace utl {
45 class TransliterationWrapper;
47 namespace vcl
49 class Font;
52 class SwContentFrame;
53 class SwTextField;
54 class SwTextInputField;
55 class SfxItemSet;
56 class SwUndoTransliterate;
57 struct SwSpellArgs;
58 struct SwConversionArgs;
59 class SwInterHyphInfo;
60 class SwWrongList;
61 class SwGrammarMarkUp;
62 struct SwDocStat;
63 struct SwParaIdleData_Impl;
64 enum class ExpandMode;
65 enum class SwFieldIds : sal_uInt16;
66 class SwField;
68 namespace sw::mark { enum class RestoreMode; }
70 namespace com::sun::star {
71 namespace uno {
72 template < class > class Sequence;
74 namespace text { class XTextContent; }
77 typedef o3tl::sorted_vector< sal_Int32 > SwSoftPageBreakList;
79 /// SwTextNode is a paragraph in the document model.
80 class SW_DLLPUBLIC SwTextNode final
81 : public SwContentNode
82 , public ::sfx2::Metadatable
83 , public sw::FormatDropDefiner
85 friend class SwContentNode;
86 /// For creating the first TextNode.
87 friend class SwDoc; ///< CTOR and AppendTextNode()
88 friend class SwNodes;
89 friend class SwTextFrame;
90 friend class SwScriptInfo;
92 /** May be 0. It is only then not 0 if it contains hard attributes.
93 Therefore: never access directly! */
94 std::unique_ptr<SwpHints> m_pSwpHints;
96 mutable std::unique_ptr<SwNodeNum> mpNodeNum; ///< Numbering for this paragraph.
97 mutable std::unique_ptr<SwNodeNum> mpNodeNumRLHidden; ///< Numbering for this paragraph (hidden redlines)
99 OUString m_Text;
101 SwParaIdleData_Impl* m_pParaIdleData_Impl;
103 /** Some of the chars this para are hidden. Paragraph has to be reformatted
104 on changing the view to print preview. */
105 mutable bool m_bContainsHiddenChars : 1;
106 /// The whole paragraph is hidden because of the hidden text attribute
107 mutable bool m_bHiddenCharsHidePara : 1;
108 /// The last two flags have to be recalculated if this flag is set:
109 mutable bool m_bRecalcHiddenCharFlags : 1;
111 mutable bool m_bLastOutlineState : 1;
112 bool m_bNotifiable;
114 bool mbEmptyListStyleSetDueToSetOutlineLevelAttr;
116 /** boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or
117 <ResetAllAttr(..)> method is running.
118 Needed to avoid duplicate handling of attribute change actions. */
119 bool mbInSetOrResetAttr;
121 std::unique_ptr< OUString > m_pNumStringCache;
123 css::uno::WeakReference<css::text::XTextContent> m_wXParagraph;
125 // DrawingLayer FillAttributes in a preprocessed form for primitive usage
126 drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes;
128 SAL_DLLPRIVATE SwTextNode( const SwNodeIndex &rWhere, SwTextFormatColl *pTextColl,
129 const SfxItemSet* pAutoAttr = nullptr );
130 virtual void SwClientNotify( const SwModify&, const SfxHint& ) override;
131 /// Copies the attributes at nStart to pDest.
132 SAL_DLLPRIVATE void CopyAttr( SwTextNode *pDest, const sal_Int32 nStart, const sal_Int32 nOldPos);
134 SAL_DLLPRIVATE SwTextNode* MakeNewTextNode( const SwNodeIndex&, bool bNext = true,
135 bool bChgFollow = true );
137 SAL_DLLPRIVATE void CutImpl(
138 SwTextNode * const pDest, const SwIndex & rDestStart,
139 const SwIndex & rStart, /*const*/ sal_Int32 nLen,
140 const bool bUpdate = true );
142 /// Move all comprising hard attributes to the AttrSet of the paragraph.
143 SAL_DLLPRIVATE void MoveTextAttr_To_AttrSet(); // Called by SplitNode.
145 /// Create the specific AttrSet.
146 SAL_DLLPRIVATE virtual void NewAttrSet( SwAttrPool& ) override;
148 /// Optimization: Asking for information about hidden characters at SwScriptInfo
149 /// updates these flags.
150 bool IsCalcHiddenCharFlags() const
151 { return m_bRecalcHiddenCharFlags; }
152 void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const
154 m_bHiddenCharsHidePara = bNewHiddenCharsHidePara;
155 m_bContainsHiddenChars = bNewContainsHiddenChars;
156 m_bRecalcHiddenCharFlags = false;
159 SAL_DLLPRIVATE void CalcHiddenCharFlags() const;
161 SAL_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM,
162 LanguageType nLang, sal_uInt16 nLangWhichId,
163 const vcl::Font *pFont, sal_uInt16 nFontWhichId );
165 /// Start: Data collected during idle time
167 SAL_DLLPRIVATE void InitSwParaStatistics( bool bNew );
169 inline void TryDeleteSwpHints();
171 SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet);
173 const SwTextInputField* GetOverlappingInputField( const SwTextAttr& rTextAttr ) const;
175 void DelFrames_TextNodePart();
177 public:
178 enum class WrongState { TODO, PENDING, DONE };
180 bool IsWordCountDirty() const;
181 WrongState GetWrongDirty() const;
182 bool IsWrongDirty() const;
183 bool IsGrammarCheckDirty() const;
184 bool IsSmartTagDirty() const;
185 bool IsAutoCompleteWordDirty() const;
186 void SetWordCountDirty( bool bNew ) const;
187 void SetWrongDirty(WrongState eNew) const;
188 void SetGrammarCheckDirty( bool bNew ) const;
189 void SetSmartTagDirty( bool bNew ) const;
190 void SetAutoCompleteWordDirty( bool bNew ) const;
191 void SetWrong( SwWrongList* pNew, bool bDelete = true );
192 SwWrongList* GetWrong();
193 const SwWrongList* GetWrong() const;
194 void SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete = true );
195 SwGrammarMarkUp* GetGrammarCheck();
196 // return SwWrongList because *function pointer* return values aren't covariant
197 SwWrongList const* GetGrammarCheck() const;
198 void SetSmartTags( SwWrongList* pNew, bool bDelete = true );
199 SwWrongList* GetSmartTags();
200 SwWrongList const* GetSmartTags() const;
201 void TryCharSetExpandToNum(const SfxItemSet& pCharSet);
203 /// End: Data collected during idle time
206 public:
207 using SwContentNode::GetAttr;
208 /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
209 void TriggerNodeUpdate(const sw::LegacyModifyHint&);
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.get(); }
220 const SwpHints *GetpSwpHints() const { return m_pSwpHints.get(); }
221 bool HasHints() const { return m_pSwpHints != nullptr; }
222 inline SwpHints &GetOrCreateSwpHints();
224 virtual ~SwTextNode() override;
226 virtual sal_Int32 Len() const override;
228 /// Is in itratr.
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.
267 void RstTextAttr(
268 const SwIndex &rIdx,
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 );
274 void GCAttr();
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 SwTextAttr **ppNewTextAttr = nullptr);
300 /** Query the attributes of textnode over the range.
301 Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
302 If <bMergeIndentValuesOfNumRule> == true, the indent attributes of
303 the corresponding list level of an applied list style is merged into
304 the requested item set as a LR-SPACE item, if <bOnlyTextAttr> == false,
305 corresponding node has not its own indent attributes and the
306 position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT. */
307 bool GetParaAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
308 const bool bOnlyTextAttr = false,
309 const bool bGetFromChrFormat = true,
310 const bool bMergeIndentValuesOfNumRule = false,
311 SwRootFrame const* pLayout = nullptr) const;
313 /// Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
314 void FormatToTextAttr( SwTextNode* pNd );
316 /// delete all attributes of type nWhich at nStart (opt. end nEnd)
317 void DeleteAttributes( const sal_uInt16 nWhich,
318 const sal_Int32 nStart, const sal_Int32 nEnd = 0 );
319 /// delete the attribute pTextAttr
320 void DeleteAttribute ( SwTextAttr * const pTextAttr );
322 /** Actions on text and attributes.
323 introduce optional parameter to control, if all attributes have to be copied. */
324 void CopyText( SwTextNode * const pDest,
325 const SwIndex &rStart,
326 const sal_Int32 nLen,
327 const bool bForceCopyOfAllAttrs );
328 void CopyText( SwTextNode * const pDest,
329 const SwIndex &rDestStart,
330 const SwIndex &rStart,
331 sal_Int32 nLen,
332 const bool bForceCopyOfAllAttrs = false );
334 void CutText(SwTextNode * const pDest,
335 const SwIndex & rStart, const sal_Int32 nLen);
336 inline void CutText(SwTextNode * const pDest, const SwIndex &rDestStart,
337 const SwIndex & rStart, const sal_Int32 nLen);
339 /// replace nDelLen characters at rStart with rText
340 /// in case the replacement does not fit, it is partially inserted up to
341 /// the capacity of the node
342 void ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen,
343 const OUString & rText );
344 void ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
345 const OUString& rText,
346 const css::uno::Sequence<sal_Int32>& rOffsets );
348 /// Virtual methods from ContentNode.
349 virtual SwContentFrame *MakeFrame( SwFrame* ) override;
350 SwTextNode * SplitContentNode(const SwPosition &,
351 std::function<void (SwTextNode *, sw::mark::RestoreMode)> const* pContentIndexRestore);
352 virtual SwContentNode *JoinNext() override;
353 void JoinPrev();
355 SwContentNode *AppendNode( const SwPosition & );
357 /// When appropriate set DontExpand-flag at INet or character styles respectively.
358 bool DontExpandFormat( const SwIndex& rIdx, bool bFlag = true,
359 bool bFormatToTextAttributes = true );
361 enum GetTextAttrMode {
362 DEFAULT, /// DEFAULT: (Start <= nIndex < End)
363 EXPAND, /// EXPAND : (Start < nIndex <= End)
364 PARENT, /// PARENT : (Start < nIndex < End)
367 /** get the innermost text attribute covering position nIndex.
368 @param nWhich only attribute with this id is returned.
369 @param eMode the predicate for matching (@see GetTextAttrMode).
371 ATTENTION: this function is not well-defined for those
372 hints of which several may cover a single position, like
373 RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
375 SwTextAttr *GetTextAttrAt(
376 sal_Int32 const nIndex,
377 sal_uInt16 const nWhich,
378 enum GetTextAttrMode const eMode = DEFAULT ) const;
380 /** get the innermost text attributes covering position nIndex.
381 @param nWhich only attributes with this id are returned.
382 @param eMode the predicate for matching (@see GetTextAttrMode).
384 std::vector<SwTextAttr *> GetTextAttrsAt(
385 sal_Int32 const nIndex,
386 sal_uInt16 const nWhich ) const;
388 /** get the text attribute at position nIndex which owns
389 the dummy character CH_TXTATR_* at that position, if one exists.
390 @param nIndex the position in the text
391 @param nWhich if different from RES_TXTATR_END, return only
392 attribute with given which id
393 @return the text attribute at nIndex of type nWhich, if it exists
395 SwTextAttr *GetTextAttrForCharAt(
396 const sal_Int32 nIndex,
397 const sal_uInt16 nWhich = RES_TXTATR_END ) const;
399 SwTextField* GetFieldTextAttrAt(
400 const sal_Int32 nIndex,
401 const bool bIncludeInputFieldAtStart = false ) const;
403 bool Spell(SwSpellArgs*);
404 bool Convert( SwConversionArgs & );
406 inline SwTextFormatColl *GetTextColl() const;
407 virtual SwFormatColl *ChgFormatColl( SwFormatColl* ) override;
408 void ChgTextCollUpdateNum( const SwTextFormatColl* pOld,
409 const SwTextFormatColl* pNew );
411 /** Copy collection with all auto formats to dest-node.
412 The latter might be in another document!
413 (Method in ndcopy.cxx!!). */
414 void CopyCollFormat(SwTextNode& rDestNd, bool bUndoForChgFormatColl = true);
416 // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
419 Returns numbering rule of this text node.
421 @param bInParent search in parent attributes, too
423 @return numbering rule of this text node or NULL if none is set
425 SwNumRule *GetNumRule(bool bInParent = true) const;
427 const SwNodeNum* GetNum(SwRootFrame const* pLayout = nullptr) const;
428 void DoNum(std::function<void (SwNodeNum &)> const&);
430 SwNumberTree::tNumberVector GetNumberVector(SwRootFrame const* pLayout = nullptr) const;
433 Returns if this text node is an outline.
435 @retval true this text node is an outline
436 @retval false else
438 bool IsOutline() const;
440 bool IsOutlineStateChanged() const;
442 void UpdateOutlineState();
445 Notify this textnode that its numbering rule has changed.
447 void NumRuleChgd();
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
461 MAXLEVEL
463 OUString GetNumString( const bool _bInclPrefixAndSuffixStrings = true,
464 const unsigned int _nRestrictToThisLevel = MAXLEVEL,
465 SwRootFrame const* pLayout = nullptr) const;
468 Returns the additional indents of this text node and its numbering.
470 @param bTextLeft ???
472 @return additional indents
474 tools::Long GetLeftMarginWithNum( bool bTextLeft = false ) const;
477 Returns the combined first line indent of this text node and
478 its numbering.
480 @param the first line indent of this text node taking the
481 numbering into account (return parameter)
483 @retval true this node has SwNodeNum and has numbering rule
484 @retval false else
486 bool GetFirstLineOfsWithNum( short& rFirstOffset ) const;
488 SwTwips GetAdditionalIndentForStartingNewList() const;
490 void ClearLRSpaceItemDueToListLevelIndents( std::shared_ptr<SvxLRSpaceItem>& o_rLRSpaceItem ) const;
492 /** return left margin for tab stop position calculation
494 Needed for text formatting
495 Method considers new list level attributes, which also can provide a left margin value
497 tools::Long GetLeftMarginForTabCalculation() const;
499 /** Returns if this text node has a number.
501 This text node has a number if it has a SwNodeNum and a
502 numbering rule and the numbering format specified for the
503 level of the SwNodeNum is of an enumeration type.
505 @retval true This text node has a number.
506 @retval false else
508 bool HasNumber() const;
510 /** Returns if this text node has a bullet.
512 This text node has a bullet if it has a SwNodeNum and a
513 numbering rule and the numbering format specified for the
514 level of the SwNodeNum is of a bullet type.
516 @retval true This text node has a bullet.
517 @retval false else
519 bool HasBullet() const;
521 /** Returns is this text node is numbered.
523 This node is numbered if it has a SwNodeNum and it has a
524 numbering rule and has not a hidden SwNodeNum.
526 ATTENTION: Returns true even if the SwNumFormat has type
527 SVX_NUM_NUMBER_NONE.
529 @retval true This node is numbered.
530 @retval false else
532 bool IsNumbered(SwRootFrame const* pLayout = nullptr) const;
534 /** Returns if this text node has a marked label.
536 @retval true This text node has a marked label.
537 @retval false else
539 bool HasMarkedLabel() const;
541 /** Sets the list level of this text node.
543 Side effect, when the text node is a list item:
544 The text node's representation in the list tree (<SwNodeNum> instance)
545 is updated.
547 @param nLevel level to set
549 void SetAttrListLevel(int nLevel);
551 bool HasAttrListLevel() const;
553 int GetAttrListLevel() const;
555 /** Returns the actual list level of this text node, when it is a list item
557 @return the actual list level of this text node, if it is a list item,
558 -1 otherwise
560 int GetActualListLevel() const;
563 Returns outline level of this text node.
565 If a text node has an outline number (i.e. it has an SwNodeNum
566 and an outline numbering rule) the outline level is the level of
567 this SwNodeNum.
569 If a text node has no outline number and has a paragraph style
570 attached the outline level is the outline level of the
571 paragraph style.
573 Otherwise the text node has no outline level (NO_NUMBERING).
575 NOTE: The outline level of text nodes is subject to change. The
576 plan is to have an SwTextNode::nOutlineLevel member that is
577 updated from a paragraph style upon appliance of that paragraph
578 style.
580 @return outline level or NO_NUMBERING if there is no outline level
582 int GetAttrOutlineLevel() const;
585 Sets the out line level *at* a text node.
587 @param nLevel the level to be set
589 If the text node has an outline number the level is set at the
590 outline number.
592 If the text node has no outline number but has a paragraph
593 style applied the outline level is set at the paragraph style.
595 NOTE: This is subject to change, see GetOutlineLevel.
597 void SetAttrOutlineLevel(int nLevel);
600 * @brief GetAttrOutlineContentVisible
601 * @param bOutlineContentVisibleAttr the value stored in RES_PARATR_GRABBAG for 'OutlineContentVisibleAttr'
602 * @return true if 'OutlineContentVisibleAttr' is found in RES_PARATR_GRABBAG
604 bool GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr);
605 void SetAttrOutlineContentVisible(bool bVisible);
607 bool IsEmptyListStyleDueToSetOutlineLevelAttr() const { return mbEmptyListStyleSetDueToSetOutlineLevelAttr;}
608 void SetEmptyListStyleDueToSetOutlineLevelAttr();
609 void ResetEmptyListStyleDueToResetOutlineLevelAttr();
612 Returns the width of leading tabs/blanks in this paragraph.
613 This space will be converted into numbering indent if the paragraph
614 is set to be numbered.
616 @return the width of the leading whitespace
618 SwTwips GetWidthOfLeadingTabs() const;
621 Returns if the paragraph has a visible numbering or bullet.
622 This includes all kinds of numbering/bullet/outlines.
623 Note: This function returns false, if the numbering format is
624 SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
626 @return true if the paragraph has a visible numbering/bullet/outline
628 bool HasVisibleNumberingOrBullet() const;
630 void SetListId(OUString const& rListId);
631 OUString GetListId() const;
633 /** Determines, if the list level indent attributes can be applied to the
634 paragraph.
636 The list level indents can be applied to the paragraph under the one
637 of following conditions:
638 - the list style is directly applied to the paragraph and the paragraph
639 has no own indent attributes.
640 - the list style is applied to the paragraph through one of its paragraph
641 styles, the paragraph has no own indent attributes and on the paragraph
642 style hierarchy from the paragraph to the paragraph style with the
643 list style no indent attributes are found.
645 @return boolean
647 bool AreListLevelIndentsApplicable() const;
649 /** Retrieves the list tab stop position, if the paragraph's list level defines
650 one and this list tab stop has to merged into the tap stops of the paragraph
652 @param nListTabStopPosition
653 output parameter - containing the list tab stop position
655 @return boolean - indicating, if a list tab stop position is provided
657 bool GetListTabStopPosition( tools::Long& nListTabStopPosition ) const;
659 /** Retrieves the character following the list label, if the paragraph's
660 list level defines one.
662 @return the list tab stop position as string
664 OUString GetLabelFollowedBy() const;
666 // END OF BULLET/NUMBERING/OUTLINE STUFF:
668 void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
670 LanguageType GetLang( const sal_Int32 nBegin, const sal_Int32 nLen = 0,
671 sal_uInt16 nScript = 0 ) const;
673 /// in ndcopy.cxx
674 bool IsSymbolAt(sal_Int32 nBegin) const; // In itratr.cxx.
675 virtual SwContentNode* MakeCopy(SwDoc&, const SwNodeIndex&, bool bNewFrames) const override;
677 /// Interactive hyphenation: we find TextFrame and call its CalcHyph.
678 bool Hyphenate( SwInterHyphInfo &rHyphInf );
679 void DelSoftHyph( const sal_Int32 nStart, const sal_Int32 nEnd );
681 /** add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
682 when <bWithNum = true> that a space is inserted after the string for
683 the list label.
684 add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
685 spaces are inserted in front of the expanded text string depending on
686 the list level. */
687 OUString GetExpandText( SwRootFrame const* pLayout,
688 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 ExpandMode eAdditionalMode = ExpandMode::ExpandFootnote) const;
694 bool CopyExpandText( SwTextNode& rDestNd, const SwIndex* pDestIdx,
695 sal_Int32 nIdx, sal_Int32 nLen,
696 SwRootFrame const* pLayout,
697 bool bWithNum = false, bool bWithFootnote = true,
698 bool bReplaceTabsWithSpaces = false ) const;
700 OUString GetRedlineText() const;
702 /** @return actual count of initial chars for initial-function.
703 If nWishLen == 0 that of first word. */
704 sal_Int32 GetDropLen(sal_Int32 nWishLen) const;
706 /// Passes back info needed on the dropcap dimensions
707 bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const;
709 /// Hidden Paragraph Field:
710 bool CalcHiddenParaField()
711 { return m_pSwpHints && m_pSwpHints->CalcHiddenParaField(); }
712 /// set CalcVisible flags
713 void SetCalcHiddenParaField()
714 { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); }
716 /// is the paragraph visible?
717 bool IsHiddenByParaField() const
718 { return m_pSwpHints && m_pSwpHints->IsHiddenByParaField(); }
720 /// Hidden Paragraph Field:
722 bool HasHiddenCharAttribute( bool bWholePara ) const
724 if ( m_bRecalcHiddenCharFlags )
725 CalcHiddenCharFlags();
726 return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars;
729 void SetCalcHiddenCharFlags() const
730 { m_bRecalcHiddenCharFlags = true; }
732 /** @return if the node is hidden due to
733 1. HiddenParaField
734 2. HiddenCharAttribute
735 3. HiddenSection */
737 bool IsHidden() const;
740 /// override SwIndexReg
741 virtual void Update(
742 SwIndex const & rPos,
743 const sal_Int32 nChangeLen,
744 const bool bNegative = false,
745 const bool bDelete = false ) override;
747 /// change text to Upper/Lower/Hiragana/Katakana/...
748 void TransliterateText( utl::TransliterationWrapper& rTrans,
749 sal_Int32 nStart, sal_Int32 nEnd,
750 SwUndoTransliterate* pUndo );
752 /// count words in given range - returns true if we refreshed out count
753 bool CountWords( SwDocStat& rStat, sal_Int32 nStart, sal_Int32 nEnd ) const;
755 /** Checks some global conditions like loading or destruction of document
756 to economize notifications */
757 bool IsNotificationEnabled() const;
759 /// Checks a temporary notification blocker and the global conditions of IsNotificationEnabled()
760 bool IsNotifiable() const;
762 void SetListRestart( bool bRestart );
763 bool IsListRestart() const;
765 void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
766 bool HasAttrListRestartValue() const;
767 SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const;
768 SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const;
770 void SetCountedInList( bool bCounted );
771 bool IsCountedInList() const;
773 void AddToList();
774 void AddToListRLHidden();
775 void RemoveFromList();
776 void RemoveFromListRLHidden();
777 bool IsInList() const;
779 bool IsFirstOfNumRule(SwRootFrame const& rLayout) const;
781 SAL_DLLPRIVATE css::uno::WeakReference<css::text::XTextContent> const& GetXParagraph() const
782 { return m_wXParagraph; }
783 SAL_DLLPRIVATE void SetXParagraph(css::uno::Reference<css::text::XTextContent> const& xParagraph)
784 { m_wXParagraph = xParagraph; }
786 /// sfx2::Metadatable
787 virtual ::sfx2::IXmlIdRegistry& GetRegistry() override;
788 virtual bool IsInClipboard() const override;
789 virtual bool IsInUndo() const override;
790 virtual bool IsInContent() const override;
791 virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override;
793 bool IsCollapse() const;
795 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
797 sal_uInt32 GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const;
798 sal_uInt32 GetParRsid() const;
800 bool CompareRsid( const SwTextNode &rTextNode, sal_Int32 nStt1, sal_Int32 nStt2 ) const;
801 bool CompareParRsid( const SwTextNode &rTextNode ) const;
803 // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
804 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const override;
806 /// In MS Word, the font underline setting of the paragraph end position won't affect the formatting of numbering, so we ignore it
807 static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich);
808 void FormatDropNotify(const SwFormatDrop& rDrop) override
809 { TriggerNodeUpdate(sw::LegacyModifyHint(&rDrop, &rDrop)); };
812 inline SwpHints & SwTextNode::GetSwpHints()
814 assert( m_pSwpHints );
815 return *m_pSwpHints;
817 inline const SwpHints &SwTextNode::GetSwpHints() const
819 assert( m_pSwpHints );
820 return *m_pSwpHints;
823 inline SwpHints& SwTextNode::GetOrCreateSwpHints()
825 if ( !m_pSwpHints )
827 m_pSwpHints.reset(new SwpHints(*this));
829 return *m_pSwpHints;
832 inline void SwTextNode::TryDeleteSwpHints()
834 if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() )
836 m_pSwpHints.reset();
840 inline SwTextFormatColl* SwTextNode::GetTextColl() const
842 return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn()));
845 /// Inline methods from Node.hxx
846 inline SwTextNode *SwNode::GetTextNode()
848 return SwNodeType::Text == m_nNodeType ? static_cast<SwTextNode*>(this) : nullptr;
851 inline const SwTextNode *SwNode::GetTextNode() const
853 return SwNodeType::Text == m_nNodeType ? static_cast<const SwTextNode*>(this) : nullptr;
856 inline void
857 SwTextNode::CutText(SwTextNode * const pDest, const SwIndex & rDestStart,
858 const SwIndex & rStart, const sal_Int32 nLen)
860 CutImpl( pDest, rDestStart, rStart, nLen );
863 inline sal_Int32 SwTextNode::GetSpaceLeft() const
865 // do not fill the String up to the max - need to be able to have a
866 // SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1
867 const sal_Int32 TXTNODE_MAX = SAL_MAX_INT32 - 2;
868 return TXTNODE_MAX-m_Text.getLength();
871 #endif
873 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */