Bump version to 21.06.18.1
[LibreOffice.git] / sw / inc / ndtxt.hxx
blobf6605d73c247bc697a934ac1b56fe094eb93370e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_INC_NDTXT_HXX
20 #define INCLUDED_SW_INC_NDTXT_HXX
22 #include <cppuhelper/weakref.hxx>
24 #include "swdllapi.h"
25 #include "node.hxx"
26 #include "hintids.hxx"
27 #include "ndhints.hxx"
28 #include "SwNumberTreeTypes.hxx"
29 #include "IDocumentContentOperations.hxx"
30 #include "modeltoviewhelper.hxx"
32 #include <sfx2/Metadatable.hxx>
33 #include <o3tl/sorted_vector.hxx>
34 #include <memory>
35 #include <vector>
36 #include <set>
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
81 : public SwContentNode
82 , public ::sfx2::Metadatable
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 std::unique_ptr< OUString > m_pNumStringCache;
122 css::uno::WeakReference<css::text::XTextContent> m_wXParagraph;
124 // DrawingLayer FillAttributes in a preprocessed form for primitive usage
125 drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes;
127 SAL_DLLPRIVATE SwTextNode( const SwNodeIndex &rWhere, SwTextFormatColl *pTextColl,
128 const SfxItemSet* pAutoAttr = nullptr );
130 /// Copies the attributes at nStart to pDest.
131 SAL_DLLPRIVATE void CopyAttr( SwTextNode *pDest, const sal_Int32 nStart, const sal_Int32 nOldPos);
133 SAL_DLLPRIVATE SwTextNode* MakeNewTextNode( const SwNodeIndex&, bool bNext = true,
134 bool bChgFollow = true );
136 SAL_DLLPRIVATE void CutImpl(
137 SwTextNode * const pDest, const SwIndex & rDestStart,
138 const SwIndex & rStart, /*const*/ sal_Int32 nLen,
139 const bool bUpdate = true );
141 /// Move all comprising hard attributes to the AttrSet of the paragraph.
142 SAL_DLLPRIVATE void MoveTextAttr_To_AttrSet(); // Called by SplitNode.
144 /// Create the specific AttrSet.
145 SAL_DLLPRIVATE virtual void NewAttrSet( SwAttrPool& ) override;
147 /// Optimization: Asking for information about hidden characters at SwScriptInfo
148 /// updates these flags.
149 bool IsCalcHiddenCharFlags() const
150 { return m_bRecalcHiddenCharFlags; }
151 void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const
153 m_bHiddenCharsHidePara = bNewHiddenCharsHidePara;
154 m_bContainsHiddenChars = bNewContainsHiddenChars;
155 m_bRecalcHiddenCharFlags = false;
158 SAL_DLLPRIVATE void CalcHiddenCharFlags() const;
160 SAL_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM,
161 LanguageType nLang, sal_uInt16 nLangWhichId,
162 const vcl::Font *pFont, sal_uInt16 nFontWhichId );
164 /// Start: Data collected during idle time
166 SAL_DLLPRIVATE void InitSwParaStatistics( bool bNew );
168 inline void TryDeleteSwpHints();
170 SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet);
172 const SwTextInputField* GetOverlappingInputField( const SwTextAttr& rTextAttr ) const;
174 void DelFrames_TextNodePart();
176 public:
177 enum class WrongState { TODO, PENDING, DONE };
179 bool IsWordCountDirty() const;
180 WrongState GetWrongDirty() const;
181 bool IsWrongDirty() const;
182 bool IsGrammarCheckDirty() const;
183 bool IsSmartTagDirty() const;
184 bool IsAutoCompleteWordDirty() const;
185 void SetWordCountDirty( bool bNew ) const;
186 void SetWrongDirty(WrongState eNew) const;
187 void SetGrammarCheckDirty( bool bNew ) const;
188 void SetSmartTagDirty( bool bNew ) const;
189 void SetAutoCompleteWordDirty( bool bNew ) const;
190 void SetWrong( SwWrongList* pNew, bool bDelete = true );
191 SwWrongList* GetWrong();
192 const SwWrongList* GetWrong() const;
193 void SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete = true );
194 SwGrammarMarkUp* GetGrammarCheck();
195 // return SwWrongList because *function pointer* return values aren't covariant
196 SwWrongList const* GetGrammarCheck() const;
197 void SetSmartTags( SwWrongList* pNew, bool bDelete = true );
198 SwWrongList* GetSmartTags();
199 SwWrongList const* GetSmartTags() const;
200 void TryCharSetExpandToNum(const SfxItemSet& pCharSet);
202 /// End: Data collected during idle time
204 protected:
205 virtual void SwClientNotify( const SwModify&, const SfxHint& ) override;
207 public:
208 using SwContentNode::GetAttr;
209 /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
210 void TriggerNodeUpdate(const sw::LegacyModifyHint&);
212 const OUString& GetText() const { return m_Text; }
214 // returns the maximum number of characters that can still be added to the node
215 inline sal_Int32 GetSpaceLeft() const;
217 /// getters for SwpHints
218 inline SwpHints &GetSwpHints();
219 inline const SwpHints &GetSwpHints() const;
220 SwpHints *GetpSwpHints() { return m_pSwpHints.get(); }
221 const SwpHints *GetpSwpHints() const { return m_pSwpHints.get(); }
222 bool HasHints() const { return m_pSwpHints != nullptr; }
223 inline SwpHints &GetOrCreateSwpHints();
225 virtual ~SwTextNode() override;
227 virtual sal_Int32 Len() const override;
229 /// Is in itratr.
230 void GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong &rAbs ) const;
232 /// overriding to handle change of certain paragraph attributes
233 virtual bool SetAttr( const SfxPoolItem& ) override;
234 virtual bool SetAttr( const SfxItemSet& rSet ) override;
235 virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ) override;
236 virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr ) override;
237 virtual sal_uInt16 ResetAllAttr() override;
239 /// insert text content
240 /// @param rStr text to insert; in case it does not fit into the capacity
241 /// of the node, the longest prefix that fits is inserted
242 /// @return the prefix of rStr that was actually inserted
243 OUString InsertText( const OUString & rStr, const SwIndex & rIdx,
244 const SwInsertFlags nMode
245 = SwInsertFlags::DEFAULT );
247 /** delete text content
248 ATTENTION: must not be called with a range that overlaps the start of
249 an attribute with both extent and dummy char
251 void EraseText ( const SwIndex &rIdx, const sal_Int32 nCount = SAL_MAX_INT32,
252 const SwInsertFlags nMode = SwInsertFlags::DEFAULT );
254 /** delete all attributes.
255 If neither pSet nor nWhich is given, delete all attributes (except
256 refmarks, toxmarks, meta) in range.
257 @param rIdx start position
258 @param nLen range in which attributes will be deleted
259 @param pSet if not 0, delete only attributes contained in pSet
260 @param nWhich if not 0, delete only attributes with matching which
261 @param bInclRefToxMark
262 refmarks, toxmarks, and metas will be ignored unless this is true
263 ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
264 @param bExactRange From the attributes included in the range, delete
265 only the ones which have exactly same range. Don't delete the ones
266 which are simply included in the range.
268 void RstTextAttr(
269 const SwIndex &rIdx,
270 const sal_Int32 nLen,
271 const sal_uInt16 nWhich = 0,
272 const SfxItemSet* pSet = nullptr,
273 const bool bInclRefToxMark = false,
274 const bool bExactRange = false );
275 void GCAttr();
277 // Delete text attribute (needs to be deregistered at Pool!)
278 void DestroyAttr( SwTextAttr* pAttr );
280 // delete all attributes from SwpHintsArray.
281 void ClearSwpHintsArr( bool bDelFields );
283 /// initialize the hints after file loading (which takes shortcuts)
284 void FileLoadedInitHints();
286 /// Insert pAttr into hints array. @return true iff inserted successfully
287 bool InsertHint( SwTextAttr * const pAttr,
288 const SetAttrMode nMode = SetAttrMode::DEFAULT );
289 /// create new text attribute from rAttr and insert it
290 /// @return inserted hint; 0 if not sure the hint is inserted
291 SwTextAttr* InsertItem( SfxPoolItem& rAttr,
292 const sal_Int32 nStart, const sal_Int32 nEnd,
293 const SetAttrMode nMode = SetAttrMode::DEFAULT );
295 /** Set these attributes at TextNode. If the whole range is comprised
296 set them only in AutoAttrSet (SwContentNode::SetAttr). */
297 bool SetAttr( const SfxItemSet& rSet,
298 sal_Int32 nStt, sal_Int32 nEnd,
299 const SetAttrMode nMode = SetAttrMode::DEFAULT,
300 SwTextAttr **ppNewTextAttr = nullptr);
301 /** Query the attributes of textnode over the range.
302 Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
303 If <bMergeIndentValuesOfNumRule> == true, the indent attributes of
304 the corresponding list level of an applied list style is merged into
305 the requested item set as a LR-SPACE item, if <bOnlyTextAttr> == false,
306 corresponding node has not its own indent attributes and the
307 position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT. */
308 bool GetParaAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
309 const bool bOnlyTextAttr = false,
310 const bool bGetFromChrFormat = true,
311 const bool bMergeIndentValuesOfNumRule = false,
312 SwRootFrame const* pLayout = nullptr) const;
314 /// Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
315 void FormatToTextAttr( SwTextNode* pNd );
317 /// delete all attributes of type nWhich at nStart (opt. end nEnd)
318 void DeleteAttributes( const sal_uInt16 nWhich,
319 const sal_Int32 nStart, const sal_Int32 nEnd = 0 );
320 /// delete the attribute pTextAttr
321 void DeleteAttribute ( SwTextAttr * const pTextAttr );
323 /** Actions on text and attributes.
324 introduce optional parameter to control, if all attributes have to be copied. */
325 void CopyText( SwTextNode * const pDest,
326 const SwIndex &rStart,
327 const sal_Int32 nLen,
328 const bool bForceCopyOfAllAttrs );
329 void CopyText( SwTextNode * const pDest,
330 const SwIndex &rDestStart,
331 const SwIndex &rStart,
332 sal_Int32 nLen,
333 const bool bForceCopyOfAllAttrs = false );
335 void CutText(SwTextNode * const pDest,
336 const SwIndex & rStart, const sal_Int32 nLen);
337 inline void CutText(SwTextNode * const pDest, const SwIndex &rDestStart,
338 const SwIndex & rStart, const sal_Int32 nLen);
340 /// replace nDelLen characters at rStart with rText
341 /// in case the replacement does not fit, it is partially inserted up to
342 /// the capacity of the node
343 void ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen,
344 const OUString & rText );
345 void ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
346 const OUString& rText,
347 const css::uno::Sequence<sal_Int32>& rOffsets );
349 /// Virtual methods from ContentNode.
350 virtual SwContentFrame *MakeFrame( SwFrame* ) override;
351 SwTextNode * SplitContentNode(const SwPosition &,
352 std::function<void (SwTextNode *, sw::mark::RestoreMode)> const* pContentIndexRestore);
353 virtual SwContentNode *JoinNext() override;
354 void JoinPrev();
356 SwContentNode *AppendNode( const SwPosition & );
358 /// When appropriate set DontExpand-flag at INet or character styles respectively.
359 bool DontExpandFormat( const SwIndex& rIdx, bool bFlag = true,
360 bool bFormatToTextAttributes = true );
362 enum GetTextAttrMode {
363 DEFAULT, /// DEFAULT: (Start <= nIndex < End)
364 EXPAND, /// EXPAND : (Start < nIndex <= End)
365 PARENT, /// PARENT : (Start < nIndex < End)
368 /** get the innermost text attribute covering position nIndex.
369 @param nWhich only attribute with this id is returned.
370 @param eMode the predicate for matching (@see GetTextAttrMode).
372 ATTENTION: this function is not well-defined for those
373 hints of which several may cover a single position, like
374 RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
376 SwTextAttr *GetTextAttrAt(
377 sal_Int32 const nIndex,
378 sal_uInt16 const nWhich,
379 enum GetTextAttrMode const eMode = DEFAULT ) const;
381 /** get the innermost text attributes covering position nIndex.
382 @param nWhich only attributes with this id are returned.
383 @param eMode the predicate for matching (@see GetTextAttrMode).
385 std::vector<SwTextAttr *> GetTextAttrsAt(
386 sal_Int32 const nIndex,
387 sal_uInt16 const nWhich ) const;
389 /** get the text attribute at position nIndex which owns
390 the dummy character CH_TXTATR_* at that position, if one exists.
391 @param nIndex the position in the text
392 @param nWhich if different from RES_TXTATR_END, return only
393 attribute with given which id
394 @return the text attribute at nIndex of type nWhich, if it exists
396 SwTextAttr *GetTextAttrForCharAt(
397 const sal_Int32 nIndex,
398 const sal_uInt16 nWhich = RES_TXTATR_END ) const;
400 SwTextField* GetFieldTextAttrAt(
401 const sal_Int32 nIndex,
402 const bool bIncludeInputFieldAtStart = false ) const;
404 bool Spell(SwSpellArgs*);
405 bool Convert( SwConversionArgs & );
407 inline SwTextFormatColl *GetTextColl() const;
408 virtual SwFormatColl *ChgFormatColl( SwFormatColl* ) override;
409 void ChgTextCollUpdateNum( const SwTextFormatColl* pOld,
410 const SwTextFormatColl* pNew );
412 /** Copy collection with all auto formats to dest-node.
413 The latter might be in another document!
414 (Method in ndcopy.cxx!!). */
415 void CopyCollFormat(SwTextNode& rDestNd, bool bUndoForChgFormatColl = true);
417 // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
420 Returns numbering rule of this text node.
422 @param bInParent search in parent attributes, too
424 @return numbering rule of this text node or NULL if none is set
426 SwNumRule *GetNumRule(bool bInParent = true) const;
428 const SwNodeNum* GetNum(SwRootFrame const* pLayout = nullptr) const;
429 void DoNum(std::function<void (SwNodeNum &)> const&);
431 SwNumberTree::tNumberVector GetNumberVector(SwRootFrame const* pLayout = nullptr) const;
434 Returns if this text node is an outline.
436 @retval true this text node is an outline
437 @retval false else
439 bool IsOutline() const;
441 bool IsOutlineStateChanged() const;
443 void UpdateOutlineState();
446 Notify this textnode that its numbering rule has changed.
448 void NumRuleChgd();
450 /** Returns outline of numbering string
452 Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control,
453 if the prefix and the suffix strings have to been included or not.
455 @param _bInclPrefixAndSuffixStrings
456 optional input parameter - boolean indicating, if the prefix and the
457 suffix strings have to been included or not. default value = <true>
459 @param _nRestrictToThisLevel
460 optional input parameter - unsigned integer indicating the maximum outline
461 level to which the output string must be restricted to. Default value is
462 MAXLEVEL
464 OUString GetNumString( const bool _bInclPrefixAndSuffixStrings = true,
465 const unsigned int _nRestrictToThisLevel = MAXLEVEL,
466 SwRootFrame const* pLayout = nullptr) const;
469 Returns the additional indents of this text node and its numbering.
471 @param bTextLeft ???
473 @return additional indents
475 tools::Long GetLeftMarginWithNum( bool bTextLeft = false ) const;
478 Returns the combined first line indent of this text node and
479 its numbering.
481 @param the first line indent of this text node taking the
482 numbering into account (return parameter)
484 @retval true this node has SwNodeNum and has numbering rule
485 @retval false else
487 bool GetFirstLineOfsWithNum( short& rFirstOffset ) const;
489 SwTwips GetAdditionalIndentForStartingNewList() const;
491 void ClearLRSpaceItemDueToListLevelIndents( std::shared_ptr<SvxLRSpaceItem>& o_rLRSpaceItem ) const;
493 /** return left margin for tab stop position calculation
495 Needed for text formatting
496 Method considers new list level attributes, which also can provide a left margin value
498 tools::Long GetLeftMarginForTabCalculation() const;
500 /** Returns if this text node has a number.
502 This text node has a number if it has a SwNodeNum and a
503 numbering rule and the numbering format specified for the
504 level of the SwNodeNum is of an enumeration type.
506 @retval true This text node has a number.
507 @retval false else
509 bool HasNumber() const;
511 /** Returns if this text node has a bullet.
513 This text node has a bullet if it has a SwNodeNum and a
514 numbering rule and the numbering format specified for the
515 level of the SwNodeNum is of a bullet type.
517 @retval true This text node has a bullet.
518 @retval false else
520 bool HasBullet() const;
522 /** Returns is this text node is numbered.
524 This node is numbered if it has a SwNodeNum and it has a
525 numbering rule and has not a hidden SwNodeNum.
527 ATTENTION: Returns true even if the SwNumFormat has type
528 SVX_NUM_NUMBER_NONE.
530 @retval true This node is numbered.
531 @retval false else
533 bool IsNumbered(SwRootFrame const* pLayout = nullptr) const;
535 /** Returns if this text node has a marked label.
537 @retval true This text node has a marked label.
538 @retval false else
540 bool HasMarkedLabel() const;
542 /** Sets the list level of this text node.
544 Side effect, when the text node is a list item:
545 The text node's representation in the list tree (<SwNodeNum> instance)
546 is updated.
548 @param nLevel level to set
550 void SetAttrListLevel(int nLevel);
552 bool HasAttrListLevel() const;
554 int GetAttrListLevel() const;
556 /** Returns the actual list level of this text node, when it is a list item
558 @return the actual list level of this text node, if it is a list item,
559 -1 otherwise
561 int GetActualListLevel() const;
564 Returns outline level of this text node.
566 If a text node has an outline number (i.e. it has an SwNodeNum
567 and an outline numbering rule) the outline level is the level of
568 this SwNodeNum.
570 If a text node has no outline number and has a paragraph style
571 attached the outline level is the outline level of the
572 paragraph style.
574 Otherwise the text node has no outline level (NO_NUMBERING).
576 NOTE: The outline level of text nodes is subject to change. The
577 plan is to have an SwTextNode::nOutlineLevel member that is
578 updated from a paragraph style upon appliance of that paragraph
579 style.
581 @return outline level or NO_NUMBERING if there is no outline level
583 int GetAttrOutlineLevel() const;
586 Sets the out line level *at* a text node.
588 @param nLevel the level to be set
590 If the text node has an outline number the level is set at the
591 outline number.
593 If the text node has no outline number but has a paragraph
594 style applied the outline level is set at the paragraph style.
596 NOTE: This is subject to change, see GetOutlineLevel.
598 void SetAttrOutlineLevel(int nLevel);
601 * @brief GetAttrOutlineContentVisible
602 * @param bOutlineContentVisibleAttr the value stored in RES_PARATR_GRABBAG for 'OutlineContentVisibleAttr'
603 * @return true if 'OutlineContentVisibleAttr' is found in RES_PARATR_GRABBAG
605 bool GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr);
606 void SetAttrOutlineContentVisible(bool bVisible);
608 bool IsEmptyListStyleDueToSetOutlineLevelAttr() const { return mbEmptyListStyleSetDueToSetOutlineLevelAttr;}
609 void SetEmptyListStyleDueToSetOutlineLevelAttr();
610 void ResetEmptyListStyleDueToResetOutlineLevelAttr();
613 Returns the width of leading tabs/blanks in this paragraph.
614 This space will be converted into numbering indent if the paragraph
615 is set to be numbered.
617 @return the width of the leading whitespace
619 SwTwips GetWidthOfLeadingTabs() const;
622 Returns if the paragraph has a visible numbering or bullet.
623 This includes all kinds of numbering/bullet/outlines.
624 Note: This function returns false, if the numbering format is
625 SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
627 @return true if the paragraph has a visible numbering/bullet/outline
629 bool HasVisibleNumberingOrBullet() const;
631 void SetListId(OUString const& rListId);
632 OUString GetListId() const;
634 /** Determines, if the list level indent attributes can be applied to the
635 paragraph.
637 The list level indents can be applied to the paragraph under the one
638 of following conditions:
639 - the list style is directly applied to the paragraph and the paragraph
640 has no own indent attributes.
641 - the list style is applied to the paragraph through one of its paragraph
642 styles, the paragraph has no own indent attributes and on the paragraph
643 style hierarchy from the paragraph to the paragraph style with the
644 list style no indent attributes are found.
646 @return boolean
648 bool AreListLevelIndentsApplicable() const;
650 /** Retrieves the list tab stop position, if the paragraph's list level defines
651 one and this list tab stop has to merged into the tap stops of the paragraph
653 @param nListTabStopPosition
654 output parameter - containing the list tab stop position
656 @return boolean - indicating, if a list tab stop position is provided
658 bool GetListTabStopPosition( tools::Long& nListTabStopPosition ) const;
660 /** Retrieves the character following the list label, if the paragraph's
661 list level defines one.
663 @return the list tab stop position as string
665 OUString GetLabelFollowedBy() const;
667 // END OF BULLET/NUMBERING/OUTLINE STUFF:
669 void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
671 LanguageType GetLang( const sal_Int32 nBegin, const sal_Int32 nLen = 0,
672 sal_uInt16 nScript = 0 ) const;
674 /// in ndcopy.cxx
675 bool IsSymbolAt(sal_Int32 nBegin) const; // In itratr.cxx.
676 virtual SwContentNode* MakeCopy(SwDoc&, const SwNodeIndex&, bool bNewFrames) const override;
678 /// Interactive hyphenation: we find TextFrame and call its CalcHyph.
679 bool Hyphenate( SwInterHyphInfo &rHyphInf );
680 void DelSoftHyph( const sal_Int32 nStart, const sal_Int32 nEnd );
682 /** add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
683 when <bWithNum = true> that a space is inserted after the string for
684 the list label.
685 add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
686 spaces are inserted in front of the expanded text string depending on
687 the list level. */
688 OUString GetExpandText( SwRootFrame const* pLayout,
689 const sal_Int32 nIdx = 0,
690 const sal_Int32 nLen = -1,
691 const bool bWithNum = false,
692 const bool bAddSpaceAfterListLabelStr = false,
693 const bool bWithSpacesForLevel = false,
694 const ExpandMode eAdditionalMode = ExpandMode::ExpandFootnote) const;
695 bool CopyExpandText( SwTextNode& rDestNd, const SwIndex* pDestIdx,
696 sal_Int32 nIdx, sal_Int32 nLen,
697 SwRootFrame const* pLayout,
698 bool bWithNum = false, bool bWithFootnote = true,
699 bool bReplaceTabsWithSpaces = false ) const;
701 OUString GetRedlineText() const;
703 /** @return actual count of initial chars for initial-function.
704 If nWishLen == 0 that of first word. */
705 sal_Int32 GetDropLen(sal_Int32 nWishLen) const;
707 /// Passes back info needed on the dropcap dimensions
708 bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const;
710 /// Hidden Paragraph Field:
711 bool CalcHiddenParaField()
712 { return m_pSwpHints && m_pSwpHints->CalcHiddenParaField(); }
713 /// set CalcVisible flags
714 void SetCalcHiddenParaField()
715 { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); }
717 /// is the paragraph visible?
718 bool IsHiddenByParaField() const
719 { return m_pSwpHints && m_pSwpHints->IsHiddenByParaField(); }
721 /// Hidden Paragraph Field:
723 bool HasHiddenCharAttribute( bool bWholePara ) const
725 if ( m_bRecalcHiddenCharFlags )
726 CalcHiddenCharFlags();
727 return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars;
730 void SetCalcHiddenCharFlags() const
731 { m_bRecalcHiddenCharFlags = true; }
733 /** @return if the node is hidden due to
734 1. HiddenParaField
735 2. HiddenCharAttribute
736 3. HiddenSection */
738 bool IsHidden() const;
741 /// override SwIndexReg
742 virtual void Update(
743 SwIndex const & rPos,
744 const sal_Int32 nChangeLen,
745 const bool bNegative = false,
746 const bool bDelete = false ) override;
748 /// change text to Upper/Lower/Hiragana/Katakana/...
749 void TransliterateText( utl::TransliterationWrapper& rTrans,
750 sal_Int32 nStart, sal_Int32 nEnd,
751 SwUndoTransliterate* pUndo );
753 /// count words in given range - returns true if we refreshed out count
754 bool CountWords( SwDocStat& rStat, sal_Int32 nStart, sal_Int32 nEnd ) const;
756 /** Checks some global conditions like loading or destruction of document
757 to economize notifications */
758 bool IsNotificationEnabled() const;
760 /// Checks a temporary notification blocker and the global conditions of IsNotificationEnabled()
761 bool IsNotifiable() const;
763 void SetListRestart( bool bRestart );
764 bool IsListRestart() const;
766 void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
767 bool HasAttrListRestartValue() const;
768 SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const;
769 SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const;
771 void SetCountedInList( bool bCounted );
772 bool IsCountedInList() const;
774 void AddToList();
775 void AddToListRLHidden();
776 void RemoveFromList();
777 void RemoveFromListRLHidden();
778 bool IsInList() const;
780 bool IsFirstOfNumRule(SwRootFrame const& rLayout) const;
782 SAL_DLLPRIVATE css::uno::WeakReference<css::text::XTextContent> const& GetXParagraph() const
783 { return m_wXParagraph; }
784 SAL_DLLPRIVATE void SetXParagraph(css::uno::Reference<css::text::XTextContent> const& xParagraph)
785 { m_wXParagraph = xParagraph; }
787 /// sfx2::Metadatable
788 virtual ::sfx2::IXmlIdRegistry& GetRegistry() override;
789 virtual bool IsInClipboard() const override;
790 virtual bool IsInUndo() const override;
791 virtual bool IsInContent() const override;
792 virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override;
794 bool IsCollapse() const;
796 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
798 sal_uInt32 GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const;
799 sal_uInt32 GetParRsid() const;
801 bool CompareRsid( const SwTextNode &rTextNode, sal_Int32 nStt1, sal_Int32 nStt2 ) const;
802 bool CompareParRsid( const SwTextNode &rTextNode ) const;
804 // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
805 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const override;
807 /// In MS Word, the font underline setting of the paragraph end position won't affect the formatting of numbering, so we ignore it
808 static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich);
811 inline SwpHints & SwTextNode::GetSwpHints()
813 assert( m_pSwpHints );
814 return *m_pSwpHints;
816 inline const SwpHints &SwTextNode::GetSwpHints() const
818 assert( m_pSwpHints );
819 return *m_pSwpHints;
822 inline SwpHints& SwTextNode::GetOrCreateSwpHints()
824 if ( !m_pSwpHints )
826 m_pSwpHints.reset(new SwpHints(*this));
828 return *m_pSwpHints;
831 inline void SwTextNode::TryDeleteSwpHints()
833 if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() )
835 m_pSwpHints.reset();
839 inline SwTextFormatColl* SwTextNode::GetTextColl() const
841 return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn()));
844 /// Inline methods from Node.hxx
845 inline SwTextNode *SwNode::GetTextNode()
847 return SwNodeType::Text == m_nNodeType ? static_cast<SwTextNode*>(this) : nullptr;
850 inline const SwTextNode *SwNode::GetTextNode() const
852 return SwNodeType::Text == m_nNodeType ? static_cast<const SwTextNode*>(this) : nullptr;
855 inline void
856 SwTextNode::CutText(SwTextNode * const pDest, const SwIndex & rDestStart,
857 const SwIndex & rStart, const sal_Int32 nLen)
859 CutImpl( pDest, rDestStart, rStart, nLen );
862 inline sal_Int32 SwTextNode::GetSpaceLeft() const
864 // do not fill the String up to the max - need to be able to have a
865 // SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1
866 const sal_Int32 TXTNODE_MAX = SAL_MAX_INT32 - 2;
867 return TXTNODE_MAX-m_Text.getLength();
870 #endif
872 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */