Basic compiler undetected typo
[LibreOffice.git] / sw / inc / ndtxt.hxx
blobc77e062d80cdad989ae3939a642ebade3fa433d4
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 #pragma once
21 #include <cppuhelper/weakref.hxx>
23 #include "swdllapi.h"
24 #include "IDocumentContentOperations.hxx"
25 #include "SwNumberTreeTypes.hxx"
26 #include "hintids.hxx"
27 #include "modeltoviewhelper.hxx"
28 #include "ndhints.hxx"
29 #include "node.hxx"
30 #include "paratr.hxx"
32 #include <sfx2/Metadatable.hxx>
33 #include <o3tl/sorted_vector.hxx>
34 #include <memory>
35 #include <vector>
36 #include <functional>
38 class SfxHint;
39 class SwNumRule;
40 class SwNodeNum;
41 class SvxLRSpaceItem;
43 namespace utl {
44 class TransliterationWrapper;
46 namespace vcl
48 class Font;
51 class SwContentFrame;
52 class SwTextField;
53 class SwTextInputField;
54 class SfxItemSet;
55 class SwUndoTransliterate;
56 struct SwSpellArgs;
57 struct SwConversionArgs;
58 class SwInterHyphInfo;
59 class SwWrongList;
60 class SwGrammarMarkUp;
61 struct SwDocStat;
62 struct SwParaIdleData_Impl;
63 enum class ExpandMode;
64 enum class SwFieldIds : sal_uInt16;
65 class SwField;
67 namespace sw::mark { enum class RestoreMode; }
69 namespace com::sun::star {
70 namespace uno {
71 template < class > class Sequence;
73 namespace text { class XTextContent; }
76 typedef o3tl::sorted_vector< sal_Int32 > SwSoftPageBreakList;
78 /// SwTextNode is a paragraph in the document model.
79 class SW_DLLPUBLIC SwTextNode final
80 : public SwContentNode
81 , public ::sfx2::Metadatable
82 , public sw::FormatDropDefiner
84 friend class SwContentNode;
85 /// For creating the first TextNode.
86 friend class SwDoc; ///< CTOR and AppendTextNode()
87 friend class SwNodes;
88 friend class SwTextFrame;
89 friend class SwScriptInfo;
91 /** May be 0. It is only then not 0 if it contains hard attributes.
92 Therefore: never access directly! */
93 std::unique_ptr<SwpHints> m_pSwpHints;
95 mutable std::unique_ptr<SwNodeNum> mpNodeNum; ///< Numbering for this paragraph.
96 mutable std::unique_ptr<SwNodeNum> mpNodeNumRLHidden; ///< Numbering for this paragraph (hidden redlines)
98 OUString m_Text;
100 SwParaIdleData_Impl* m_pParaIdleData_Impl;
102 /** Some of the chars this para are hidden. Paragraph has to be reformatted
103 on changing the view to print preview. */
104 mutable bool m_bContainsHiddenChars : 1;
105 /// The whole paragraph is hidden because of the hidden text attribute
106 mutable bool m_bHiddenCharsHidePara : 1;
107 /// The last two flags have to be recalculated if this flag is set:
108 mutable bool m_bRecalcHiddenCharFlags : 1;
110 mutable bool m_bLastOutlineState : 1;
111 bool m_bNotifiable;
113 bool mbEmptyListStyleSetDueToSetOutlineLevelAttr;
115 /** boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or
116 <ResetAllAttr(..)> method is running.
117 Needed to avoid duplicate handling of attribute change actions. */
118 bool mbInSetOrResetAttr;
120 /// Is an undo operation in progress?
121 bool m_bInUndo;
123 std::optional< OUString > m_oNumStringCache;
125 css::uno::WeakReference<css::text::XTextContent> m_wXParagraph;
127 // DrawingLayer FillAttributes in a preprocessed form for primitive usage
128 drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes;
130 SAL_DLLPRIVATE SwTextNode( const SwNodeIndex &rWhere, SwTextFormatColl *pTextColl,
131 const SfxItemSet* pAutoAttr = nullptr );
132 virtual void SwClientNotify( const SwModify&, const SfxHint& ) override;
133 /// Copies the attributes at nStart to pDest.
134 SAL_DLLPRIVATE void CopyAttr( SwTextNode *pDest, const sal_Int32 nStart, const sal_Int32 nOldPos);
136 SAL_DLLPRIVATE SwTextNode* MakeNewTextNode( const SwNodeIndex&, bool bNext = true,
137 bool bChgFollow = true );
139 SAL_DLLPRIVATE void CutImpl(
140 SwTextNode * const pDest, const SwIndex & rDestStart,
141 const SwIndex & rStart, /*const*/ sal_Int32 nLen,
142 const bool bUpdate = true );
144 /// Move all comprising hard attributes to the AttrSet of the paragraph.
145 SAL_DLLPRIVATE void MoveTextAttr_To_AttrSet(); // Called by SplitNode.
147 /// Create the specific AttrSet.
148 SAL_DLLPRIVATE virtual void NewAttrSet( SwAttrPool& ) override;
150 /// Optimization: Asking for information about hidden characters at SwScriptInfo
151 /// updates these flags.
152 bool IsCalcHiddenCharFlags() const
153 { return m_bRecalcHiddenCharFlags; }
154 void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const
156 m_bHiddenCharsHidePara = bNewHiddenCharsHidePara;
157 m_bContainsHiddenChars = bNewContainsHiddenChars;
158 m_bRecalcHiddenCharFlags = false;
161 SAL_DLLPRIVATE void CalcHiddenCharFlags() const;
163 SAL_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM,
164 LanguageType nLang, sal_uInt16 nLangWhichId,
165 const vcl::Font *pFont, sal_uInt16 nFontWhichId );
167 /// Start: Data collected during idle time
169 SAL_DLLPRIVATE void InitSwParaStatistics( bool bNew );
171 inline void TryDeleteSwpHints();
173 SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet);
175 const SwTextInputField* GetOverlappingInputField( const SwTextAttr& rTextAttr ) const;
177 void DelFrames_TextNodePart();
179 public:
180 enum class WrongState { TODO, PENDING, DONE };
182 bool IsWordCountDirty() const;
183 WrongState GetWrongDirty() const;
184 bool IsWrongDirty() const;
185 bool IsGrammarCheckDirty() const;
186 bool IsSmartTagDirty() const;
187 bool IsAutoCompleteWordDirty() const;
188 void SetWordCountDirty( bool bNew ) const;
189 void SetWrongDirty(WrongState eNew) const;
190 void SetGrammarCheckDirty( bool bNew ) const;
191 void SetSmartTagDirty( bool bNew ) const;
192 void SetAutoCompleteWordDirty( bool bNew ) const;
193 void SetWrong( std::unique_ptr<SwWrongList> pNew );
194 void ClearWrong();
195 std::unique_ptr<SwWrongList> ReleaseWrong();
196 SwWrongList* GetWrong();
197 const SwWrongList* GetWrong() const;
198 void SetGrammarCheck( std::unique_ptr<SwGrammarMarkUp> pNew );
199 void ClearGrammarCheck();
200 std::unique_ptr<SwGrammarMarkUp> ReleaseGrammarCheck();
201 SwGrammarMarkUp* GetGrammarCheck();
202 // return SwWrongList because *function pointer* return values aren't covariant
203 SwWrongList const* GetGrammarCheck() const;
204 void SetSmartTags( std::unique_ptr<SwWrongList> pNew );
205 void ClearSmartTags();
206 std::unique_ptr<SwWrongList> ReleaseSmartTags();
207 SwWrongList* GetSmartTags();
208 SwWrongList const* GetSmartTags() const;
210 /// End: Data collected during idle time
213 public:
214 using SwContentNode::GetAttr;
215 /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
216 void TriggerNodeUpdate(const sw::LegacyModifyHint&);
218 const OUString& GetText() const { return m_Text; }
220 // returns the maximum number of characters that can still be added to the node
221 inline sal_Int32 GetSpaceLeft() const;
223 /// getters for SwpHints
224 inline SwpHints &GetSwpHints();
225 inline const SwpHints &GetSwpHints() const;
226 SwpHints *GetpSwpHints() { return m_pSwpHints.get(); }
227 const SwpHints *GetpSwpHints() const { return m_pSwpHints.get(); }
228 bool HasHints() const { return m_pSwpHints != nullptr; }
229 inline SwpHints &GetOrCreateSwpHints();
231 virtual ~SwTextNode() override;
233 virtual sal_Int32 Len() const override;
235 /// Is in itratr.
236 void GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong &rAbs ) const;
238 /// overriding to handle change of certain paragraph attributes
239 virtual bool SetAttr( const SfxPoolItem& ) override;
240 virtual bool SetAttr( const SfxItemSet& rSet ) override;
241 virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ) override;
242 virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr ) override;
243 virtual sal_uInt16 ResetAllAttr() override;
245 /// insert text content
246 /// @param rStr text to insert; in case it does not fit into the capacity
247 /// of the node, the longest prefix that fits is inserted
248 /// @return the prefix of rStr that was actually inserted
249 OUString InsertText( const OUString & rStr, const SwIndex & rIdx,
250 const SwInsertFlags nMode
251 = SwInsertFlags::DEFAULT );
253 /** delete text content
254 ATTENTION: must not be called with a range that overlaps the start of
255 an attribute with both extent and dummy char
257 void EraseText ( const SwIndex &rIdx, const sal_Int32 nCount = SAL_MAX_INT32,
258 const SwInsertFlags nMode = SwInsertFlags::DEFAULT );
260 /** delete all attributes.
261 If neither pSet nor nWhich is given, delete all attributes (except
262 refmarks, toxmarks, meta) in range.
263 @param rIdx start position
264 @param nLen range in which attributes will be deleted
265 @param pSet if not 0, delete only attributes contained in pSet
266 @param nWhich if not 0, delete only attributes with matching which
267 @param bInclRefToxMark
268 refmarks, toxmarks, and metas will be ignored unless this is true
269 ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
270 @param bExactRange From the attributes included in the range, delete
271 only the ones which have exactly same range. Don't delete the ones
272 which are simply included in the range.
274 void RstTextAttr(
275 const SwIndex &rIdx,
276 const sal_Int32 nLen,
277 const sal_uInt16 nWhich = 0,
278 const SfxItemSet* pSet = nullptr,
279 const bool bInclRefToxMark = false,
280 const bool bExactRange = false );
281 void GCAttr();
283 // Delete text attribute (needs to be deregistered at Pool!)
284 void DestroyAttr( SwTextAttr* pAttr );
286 // delete all attributes from SwpHintsArray.
287 void ClearSwpHintsArr( bool bDelFields );
289 /// initialize the hints after file loading (which takes shortcuts)
290 void FileLoadedInitHints();
292 /// Insert pAttr into hints array. @return true iff inserted successfully
293 bool InsertHint( SwTextAttr * const pAttr,
294 const SetAttrMode nMode = SetAttrMode::DEFAULT );
295 /// create new text attribute from rAttr and insert it
296 /// @return inserted hint; 0 if not sure the hint is inserted
297 SwTextAttr* InsertItem( SfxPoolItem& rAttr,
298 const sal_Int32 nStart, const sal_Int32 nEnd,
299 const SetAttrMode nMode = SetAttrMode::DEFAULT );
301 /** Set these attributes at TextNode. If the whole range is comprised
302 set them only in AutoAttrSet (SwContentNode::SetAttr). */
303 bool SetAttr( const SfxItemSet& rSet,
304 sal_Int32 nStt, sal_Int32 nEnd,
305 const SetAttrMode nMode = SetAttrMode::DEFAULT,
306 SwTextAttr **ppNewTextAttr = nullptr);
307 /** Query the attributes of textnode over the range.
308 Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
309 If <bMergeIndentValuesOfNumRule> == true, the indent attributes of
310 the corresponding list level of an applied list style is merged into
311 the requested item set as a LR-SPACE item, if <bOnlyTextAttr> == false,
312 corresponding node has not its own indent attributes and the
313 position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT. */
314 bool GetParaAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
315 const bool bOnlyTextAttr = false,
316 const bool bGetFromChrFormat = true,
317 const bool bMergeIndentValuesOfNumRule = false,
318 SwRootFrame const* pLayout = nullptr) 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 );
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 css::uno::Sequence<sal_Int32>& rOffsets );
355 /// Virtual methods from ContentNode.
356 virtual SwContentFrame *MakeFrame( SwFrame* ) override;
357 SwTextNode * SplitContentNode(const SwPosition &,
358 std::function<void (SwTextNode *, sw::mark::RestoreMode, bool AtStart)> const* pContentIndexRestore);
359 virtual SwContentNode *JoinNext() override;
360 void JoinPrev();
362 SwContentNode *AppendNode( const SwPosition & );
364 /// When appropriate set DontExpand-flag at INet or character styles respectively.
365 bool DontExpandFormat( const SwIndex& rIdx, bool bFlag = true,
366 bool bFormatToTextAttributes = true );
368 enum GetTextAttrMode {
369 DEFAULT, /// DEFAULT: (Start <= nIndex < End)
370 EXPAND, /// EXPAND : (Start < nIndex <= End)
371 PARENT, /// PARENT : (Start < nIndex < End)
374 /** get the innermost text attribute covering position nIndex.
375 @param nWhich only attribute with this id is returned.
376 @param eMode the predicate for matching (@see GetTextAttrMode).
378 ATTENTION: this function is not well-defined for those
379 hints of which several may cover a single position, like
380 RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
382 SwTextAttr *GetTextAttrAt(
383 sal_Int32 const nIndex,
384 sal_uInt16 const nWhich,
385 enum GetTextAttrMode const eMode = DEFAULT ) const;
387 /** get the innermost text attributes covering position nIndex.
388 @param nWhich only attributes with this id are returned.
389 @param eMode the predicate for matching (@see GetTextAttrMode).
391 std::vector<SwTextAttr *> GetTextAttrsAt(
392 sal_Int32 const nIndex,
393 sal_uInt16 const nWhich ) 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 sal_uInt16 nWhich = RES_TXTATR_END ) const;
406 SwTextField* GetFieldTextAttrAt(
407 const sal_Int32 nIndex,
408 const bool bIncludeInputFieldAtStart = false ) const;
410 bool Spell(SwSpellArgs*);
411 bool Convert( SwConversionArgs & );
413 inline SwTextFormatColl *GetTextColl() const;
414 virtual SwFormatColl *ChgFormatColl( SwFormatColl* ) override;
415 void ChgTextCollUpdateNum( const SwTextFormatColl* pOld,
416 const SwTextFormatColl* pNew );
418 /** Copy collection with all auto formats to dest-node.
419 The latter might be in another document!
420 (Method in ndcopy.cxx!!). */
421 void CopyCollFormat(SwTextNode& rDestNd, bool bUndoForChgFormatColl = true);
423 // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
426 Returns numbering rule of this text node.
428 @param bInParent search in parent attributes, too
430 @return numbering rule of this text node or NULL if none is set
432 SwNumRule *GetNumRule(bool bInParent = true) const;
434 const SwNodeNum* GetNum(SwRootFrame const* pLayout = nullptr) const;
435 void DoNum(std::function<void (SwNodeNum &)> const&);
437 SwNumberTree::tNumberVector GetNumberVector(SwRootFrame const* pLayout = nullptr) const;
440 Returns if this text node is an outline.
442 @retval true this text node is an outline
443 @retval false else
445 bool IsOutline() const;
447 bool IsOutlineStateChanged() const;
449 void UpdateOutlineState();
452 Notify this textnode that its numbering rule has changed.
454 void NumRuleChgd();
456 /** Returns outline of numbering string
458 Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control,
459 if the prefix and the suffix strings have to been included or not.
461 @param _bInclPrefixAndSuffixStrings
462 optional input parameter - boolean indicating, if the prefix and the
463 suffix strings have to been included or not. default value = <true>
465 @param _nRestrictToThisLevel
466 optional input parameter - unsigned integer indicating the maximum outline
467 level to which the output string must be restricted to. Default value is
468 MAXLEVEL
470 OUString GetNumString( const bool _bInclPrefixAndSuffixStrings = true,
471 const unsigned int _nRestrictToThisLevel = MAXLEVEL,
472 SwRootFrame const* pLayout = nullptr) const;
475 Returns the additional indents of this text node and its numbering.
477 @param bTextLeft ???
479 @return additional indents
481 tools::Long GetLeftMarginWithNum( bool bTextLeft = false ) const;
484 Returns the combined first line indent of this text node and
485 its numbering.
487 @param the first line indent of this text node taking the
488 numbering into account (return parameter)
490 @retval true this node has SwNodeNum and has numbering rule
491 @retval false else
493 bool GetFirstLineOfsWithNum( short& rFirstOffset ) const;
495 SwTwips GetAdditionalIndentForStartingNewList() const;
497 void ClearLRSpaceItemDueToListLevelIndents( std::shared_ptr<SvxLRSpaceItem>& o_rLRSpaceItem ) const;
499 /** return left margin for tab stop position calculation
501 Needed for text formatting
502 Method considers new list level attributes, which also can provide a left margin value
504 tools::Long GetLeftMarginForTabCalculation() const;
506 /** Returns if this text node has a number.
508 This text node has a number if it has a SwNodeNum and a
509 numbering rule and the numbering format specified for the
510 level of the SwNodeNum is of an enumeration type.
512 @retval true This text node has a number.
513 @retval false else
515 bool HasNumber(SwRootFrame const* pLayout = nullptr) const;
517 /** Returns if this text node has a bullet.
519 This text node has a bullet if it has a SwNodeNum and a
520 numbering rule and the numbering format specified for the
521 level of the SwNodeNum is of a bullet type.
523 @retval true This text node has a bullet.
524 @retval false else
526 bool HasBullet() const;
528 /** Returns is this text node is numbered.
530 This node is numbered if it has a SwNodeNum and it has a
531 numbering rule and has not a hidden SwNodeNum.
533 ATTENTION: Returns true even if the SwNumFormat has type
534 SVX_NUM_NUMBER_NONE.
536 @retval true This node is numbered.
537 @retval false else
539 bool IsNumbered(SwRootFrame const* pLayout = nullptr) const;
541 /** Returns if this text node has a marked label.
543 @retval true This text node has a marked label.
544 @retval false else
546 bool HasMarkedLabel() const;
548 /** Sets the list level of this text node.
550 Side effect, when the text node is a list item:
551 The text node's representation in the list tree (<SwNodeNum> instance)
552 is updated.
554 @param nLevel level to set
556 void SetAttrListLevel(int nLevel);
558 bool HasAttrListLevel() const;
560 int GetAttrListLevel() const;
562 /** Returns the actual list level of this text node, when it is a list item
564 @return the actual list level of this text node, if it is a list item,
565 -1 otherwise
567 int GetActualListLevel() const;
570 Returns outline level of this text node.
572 If a text node has an outline number (i.e. it has an SwNodeNum
573 and an outline numbering rule) the outline level is the level of
574 this SwNodeNum.
576 If a text node has no outline number and has a paragraph style
577 attached the outline level is the outline level of the
578 paragraph style.
580 Otherwise the text node has no outline level (NO_NUMBERING).
582 NOTE: The outline level of text nodes is subject to change. The
583 plan is to have an SwTextNode::nOutlineLevel member that is
584 updated from a paragraph style upon appliance of that paragraph
585 style.
587 @return outline level or NO_NUMBERING if there is no outline level
589 int GetAttrOutlineLevel() const;
592 Sets the out line level *at* a text node.
594 @param nLevel the level to be set
596 If the text node has an outline number the level is set at the
597 outline number.
599 If the text node has no outline number but has a paragraph
600 style applied the outline level is set at the paragraph style.
602 NOTE: This is subject to change, see GetOutlineLevel.
604 void SetAttrOutlineLevel(int nLevel);
607 * @brief GetAttrOutlineContentVisible
608 * @param bOutlineContentVisibleAttr the value stored in RES_PARATR_GRABBAG for 'OutlineContentVisibleAttr'
609 * @return true if 'OutlineContentVisibleAttr' is found in RES_PARATR_GRABBAG
611 void GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr);
612 void SetAttrOutlineContentVisible(bool bVisible);
614 bool IsEmptyListStyleDueToSetOutlineLevelAttr() const { return mbEmptyListStyleSetDueToSetOutlineLevelAttr;}
615 void SetEmptyListStyleDueToSetOutlineLevelAttr();
616 void ResetEmptyListStyleDueToResetOutlineLevelAttr();
619 Returns the width of leading tabs/blanks in this paragraph.
620 This space will be converted into numbering indent if the paragraph
621 is set to be numbered.
623 @return the width of the leading whitespace
625 SwTwips GetWidthOfLeadingTabs() const;
628 Returns if the paragraph has a visible numbering or bullet.
629 This includes all kinds of numbering/bullet/outlines.
630 Note: This function returns false, if the numbering format is
631 SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
633 @return true if the paragraph has a visible numbering/bullet/outline
635 bool HasVisibleNumberingOrBullet() const;
637 void SetListId(OUString const& rListId);
638 OUString GetListId() const;
640 /** Determines, if the list level indent attributes can be applied to the
641 paragraph.
643 The list level indents can be applied to the paragraph under the one
644 of following conditions:
645 - the list style is directly applied to the paragraph and the paragraph
646 has no own indent attributes.
647 - the list style is applied to the paragraph through one of its paragraph
648 styles, the paragraph has no own indent attributes and on the paragraph
649 style hierarchy from the paragraph to the paragraph style with the
650 list style no indent attributes are found.
652 @return boolean
654 bool AreListLevelIndentsApplicable() const;
656 /** Retrieves the list tab stop position, if the paragraph's list level defines
657 one and this list tab stop has to merged into the tap stops of the paragraph
659 @param nListTabStopPosition
660 output parameter - containing the list tab stop position
662 @return boolean - indicating, if a list tab stop position is provided
664 bool GetListTabStopPosition( tools::Long& nListTabStopPosition ) const;
666 /** Retrieves the character following the list label, if the paragraph's
667 list level defines one.
669 @return the list tab stop position as string
671 OUString GetLabelFollowedBy() const;
673 // END OF BULLET/NUMBERING/OUTLINE STUFF:
675 void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
677 LanguageType GetLang( const sal_Int32 nBegin, const sal_Int32 nLen = 0,
678 sal_uInt16 nScript = 0 ) const;
680 /// in ndcopy.cxx
681 bool IsSymbolAt(sal_Int32 nBegin) const; // In itratr.cxx.
682 virtual SwContentNode* MakeCopy(SwDoc&, const SwNodeIndex&, bool bNewFrames) const override;
684 /// Interactive hyphenation: we find TextFrame and call its CalcHyph.
685 bool Hyphenate( SwInterHyphInfo &rHyphInf );
686 void DelSoftHyph( const sal_Int32 nStart, const sal_Int32 nEnd );
688 /** add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
689 when <bWithNum = true> that a space is inserted after the string for
690 the list label.
691 add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
692 spaces are inserted in front of the expanded text string depending on
693 the list level. */
694 OUString GetExpandText( SwRootFrame const* pLayout,
695 const sal_Int32 nIdx = 0,
696 const sal_Int32 nLen = -1,
697 const bool bWithNum = false,
698 const bool bAddSpaceAfterListLabelStr = false,
699 const bool bWithSpacesForLevel = false,
700 const ExpandMode eAdditionalMode = ExpandMode::ExpandFootnote) const;
701 bool CopyExpandText( SwTextNode& rDestNd, const SwIndex* pDestIdx,
702 sal_Int32 nIdx, sal_Int32 nLen,
703 SwRootFrame const* pLayout,
704 bool bWithNum = false, bool bWithFootnote = true,
705 bool bReplaceTabsWithSpaces = false ) const;
707 OUString GetRedlineText() const;
709 /** @return actual count of initial chars for initial-function.
710 If nWishLen == 0 that of first word. */
711 sal_Int32 GetDropLen(sal_Int32 nWishLen) const;
713 /// Passes back info needed on the dropcap dimensions
714 bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const;
716 /// Hidden Paragraph Field:
717 bool CalcHiddenParaField()
718 { return m_pSwpHints && m_pSwpHints->CalcHiddenParaField(); }
719 /// set CalcVisible flags
720 void SetCalcHiddenParaField()
721 { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); }
723 /// is the paragraph visible?
724 bool IsHiddenByParaField() const
725 { return m_pSwpHints && m_pSwpHints->IsHiddenByParaField(); }
727 /// Hidden Paragraph Field:
729 bool HasHiddenCharAttribute( bool bWholePara ) const
731 if ( m_bRecalcHiddenCharFlags )
732 CalcHiddenCharFlags();
733 return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars;
736 void SetCalcHiddenCharFlags() const
737 { m_bRecalcHiddenCharFlags = true; }
739 /** @return if the node is hidden due to
740 1. HiddenParaField
741 2. HiddenCharAttribute
742 3. HiddenSection */
744 bool IsHidden() const;
747 /// override SwIndexReg
748 virtual void Update(
749 SwIndex const & rPos,
750 const sal_Int32 nChangeLen,
751 const bool bNegative = false,
752 const bool bDelete = false ) override;
754 /// change text to Upper/Lower/Hiragana/Katakana/...
755 void TransliterateText( utl::TransliterationWrapper& rTrans,
756 sal_Int32 nStart, sal_Int32 nEnd,
757 SwUndoTransliterate* pUndo, bool bUseRedlining = false );
759 /// count words in given range - returns true if we refreshed out count
760 bool CountWords( SwDocStat& rStat, sal_Int32 nStart, sal_Int32 nEnd ) const;
762 /** Checks some global conditions like loading or destruction of document
763 to economize notifications */
764 bool IsNotificationEnabled() const;
766 /// Checks a temporary notification blocker and the global conditions of IsNotificationEnabled()
767 bool IsNotifiable() const;
769 void SetListRestart( bool bRestart );
770 bool IsListRestart() const;
772 void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
773 bool HasAttrListRestartValue() const;
774 SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const;
775 SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const;
777 void SetCountedInList( bool bCounted );
778 bool IsCountedInList() const;
780 void AddToList();
781 void AddToListRLHidden();
782 void RemoveFromList();
783 void RemoveFromListRLHidden();
784 bool IsInList() const;
786 bool IsFirstOfNumRule(SwRootFrame const& rLayout) const;
788 SAL_DLLPRIVATE css::uno::WeakReference<css::text::XTextContent> const& GetXParagraph() const
789 { return m_wXParagraph; }
790 SAL_DLLPRIVATE void SetXParagraph(css::uno::Reference<css::text::XTextContent> const& xParagraph)
791 { m_wXParagraph = xParagraph; }
793 /// sfx2::Metadatable
794 virtual ::sfx2::IXmlIdRegistry& GetRegistry() override;
795 virtual bool IsInClipboard() const override;
796 /// Is this node in the undo array?
797 virtual bool IsInUndo() const override;
798 virtual bool IsInContent() const override;
799 virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override;
801 bool IsCollapse() const;
803 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
805 sal_uInt32 GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const;
806 sal_uInt32 GetParRsid() const;
808 bool CompareRsid( const SwTextNode &rTextNode, sal_Int32 nStt1, sal_Int32 nStt2 ) const;
809 bool CompareParRsid( const SwTextNode &rTextNode ) const;
811 // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
812 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const override;
814 /// In MS Word, the font underline setting of the paragraph end position won't affect the formatting of numbering, so we ignore it
815 static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich, bool bIsCharStyle = false);
816 void FormatDropNotify(const SwFormatDrop& rDrop) override
817 { TriggerNodeUpdate(sw::LegacyModifyHint(&rDrop, &rDrop)); };
819 void SetInSwUndo(bool bInUndo);
822 inline SwpHints & SwTextNode::GetSwpHints()
824 assert( m_pSwpHints );
825 return *m_pSwpHints;
827 inline const SwpHints &SwTextNode::GetSwpHints() const
829 assert( m_pSwpHints );
830 return *m_pSwpHints;
833 inline SwpHints& SwTextNode::GetOrCreateSwpHints()
835 if ( !m_pSwpHints )
837 m_pSwpHints.reset(new SwpHints(*this));
839 return *m_pSwpHints;
842 inline void SwTextNode::TryDeleteSwpHints()
844 if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() )
846 m_pSwpHints.reset();
850 inline SwTextFormatColl* SwTextNode::GetTextColl() const
852 return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn()));
855 /// Inline methods from Node.hxx
856 inline SwTextNode *SwNode::GetTextNode()
858 return SwNodeType::Text == m_nNodeType ? static_cast<SwTextNode*>(this) : nullptr;
861 inline const SwTextNode *SwNode::GetTextNode() const
863 return SwNodeType::Text == m_nNodeType ? static_cast<const SwTextNode*>(this) : nullptr;
866 inline void
867 SwTextNode::CutText(SwTextNode * const pDest, const SwIndex & rDestStart,
868 const SwIndex & rStart, const sal_Int32 nLen)
870 CutImpl( pDest, rDestStart, rStart, nLen );
873 inline sal_Int32 SwTextNode::GetSpaceLeft() const
875 // do not fill the String up to the max - need to be able to have a
876 // SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1
877 const sal_Int32 TXTNODE_MAX = SAL_MAX_INT32 - 2;
878 return TXTNODE_MAX-m_Text.getLength();
881 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */