1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SW_INC_NODE_HXX
21 #define INCLUDED_SW_INC_NODE_HXX
23 #include <sal/types.h>
26 #include "BorderCacheOwner.hxx"
29 #include "contentindex.hxx"
31 #include "nodeoffset.hxx"
33 #include <sfx2/AccessibilityIssue.hxx>
50 class SwSectionFormat
;
64 class IDocumentSettingAccess
;
65 class IDocumentDeviceAccess
;
66 class IDocumentMarkAccess
;
67 class IDocumentRedlineAccess
;
68 class IDocumentStylePoolAccess
;
69 class IDocumentLinksAdministration
;
70 class IDocumentFieldsAccess
;
71 class IDocumentContentOperations
;
72 class IDocumentListItems
;
74 enum class SvxFrameDirection
;
75 typedef std::vector
<SwOLENode
*> SwOLENodes
; // docary.hxx
76 enum class SwCursorSkipMode
;
78 namespace drawinglayer::attribute
{
79 class SdrAllFillAttributesHelper
;
80 typedef std::shared_ptr
< SdrAllFillAttributesHelper
> SdrAllFillAttributesHelperPtr
;
83 // Accessibility check
87 struct AccessibilityCheckStatus
89 std::unique_ptr
<sfx::AccessibilityIssueCollection
> pCollection
;
95 /// Base class of the Writer document model elements.
96 class SW_DLLPUBLIC SwNode
97 : public sw::BorderCacheOwner
, private BigPtrEntry
100 friend class SwNodeIndex
;
102 SwNodeType m_nNodeType
;
104 /// For text nodes: level of auto format. Was put here because we had still free bits.
105 sal_uInt8 m_nAFormatNumLvl
: 3;
106 bool m_bIgnoreDontExpand
: 1; ///< for Text Attributes - ignore the flag
108 mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus
;
109 SwNodeIndex
* m_vIndices
{ nullptr }; ///< ring of indices pointing to this node.
112 /// sw_redlinehide: redline node merge state
113 enum class Merge
{ None
, First
, NonFirst
, Hidden
};
114 bool IsCreateFrameWhenHidingRedlines() const {
115 return m_eMerge
== Merge::None
|| m_eMerge
== Merge::First
;
117 void SetRedlineMergeFlag(Merge
const eMerge
) { m_eMerge
= eMerge
; }
118 Merge
GetRedlineMergeFlag() const { return m_eMerge
; }
123 static tools::Long s_nSerial
;
124 tools::Long m_nSerial
;
127 /// all SwFrameFormat that are anchored at the node
128 /// invariant: SwFrameFormat is in the list iff
129 /// SwFrameFormat::GetAnchor().GetContentAnchor() points to this node
130 std::vector
<SwFrameFormat
*> m_aAnchoredFlys
;
133 SwStartNode
* m_pStartOfSection
;
135 /// only used by SwContentNodeTmp in SwTextNode::Update
138 SwNode( const SwNode
& rWhere
, const SwNodeType nNodeId
);
140 /// for the initial StartNode
141 SwNode( SwNodes
& rNodes
, SwNodeOffset nPos
, const SwNodeType nNodeId
);
144 /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
146 virtual ~SwNode() override
= 0;
149 tools::Long
GetSerial() const { return m_nSerial
; }
152 sal_uInt16
GetSectionLevel() const;
154 inline SwNodeOffset
StartOfSectionIndex() const;
155 const SwStartNode
* StartOfSectionNode() const { return m_pStartOfSection
; }
156 SwStartNode
* StartOfSectionNode() { return m_pStartOfSection
; }
158 inline SwNodeOffset
EndOfSectionIndex() const;
159 inline const SwEndNode
* EndOfSectionNode() const;
160 inline SwEndNode
* EndOfSectionNode();
162 sal_uInt8
GetAutoFormatLvl() const { return m_nAFormatNumLvl
; }
163 void SetAutoFormatLvl( sal_uInt8 nVal
) { m_nAFormatNumLvl
= nVal
; }
165 bool IsIgnoreDontExpand() const { return m_bIgnoreDontExpand
; }
166 void SetIgnoreDontExpand( bool bNew
) { m_bIgnoreDontExpand
= bNew
; }
168 SwNodeType
GetNodeType() const { return m_nNodeType
; }
170 inline SwStartNode
*GetStartNode();
171 inline const SwStartNode
*GetStartNode() const;
172 inline SwContentNode
*GetContentNode();
173 inline const SwContentNode
*GetContentNode() const;
174 inline SwEndNode
*GetEndNode();
175 inline const SwEndNode
*GetEndNode() const;
176 inline SwTextNode
*GetTextNode();
177 inline const SwTextNode
*GetTextNode() const;
178 inline SwOLENode
*GetOLENode();
179 inline const SwOLENode
*GetOLENode() const;
180 inline SwNoTextNode
*GetNoTextNode();
181 inline const SwNoTextNode
*GetNoTextNode() const;
182 inline SwGrfNode
*GetGrfNode();
183 inline const SwGrfNode
*GetGrfNode() const;
184 inline SwTableNode
*GetTableNode();
185 inline const SwTableNode
*GetTableNode() const;
186 inline SwSectionNode
*GetSectionNode();
187 inline const SwSectionNode
*GetSectionNode() const;
189 bool IsStartNode() const { return bool(SwNodeType::Start
& m_nNodeType
); }
190 bool IsContentNode() const { return bool(SwNodeType::ContentMask
& m_nNodeType
); }
191 bool IsEndNode() const { return SwNodeType::End
== m_nNodeType
; }
192 bool IsTextNode() const { return SwNodeType::Text
== m_nNodeType
; }
193 bool IsTableNode() const { return SwNodeType::Table
== m_nNodeType
; }
194 bool IsSectionNode() const { return SwNodeType::Section
== m_nNodeType
; }
195 bool IsOLENode() const { return SwNodeType::Ole
== m_nNodeType
; }
196 bool IsNoTextNode() const { return bool(SwNodeType::NoTextMask
& m_nNodeType
); }
197 bool IsGrfNode() const { return SwNodeType::Grf
== m_nNodeType
; }
200 Checks if this node is in redlines.
202 @retval true this node is in redlines
205 bool IsInRedlines() const;
207 /** Search table node, in which it is. If it is in no table
209 SwTableNode
*FindTableNode();
210 inline const SwTableNode
*FindTableNode() const;
212 /** Search section node, in which it is. If it is in no section
214 SwSectionNode
*FindSectionNode();
215 inline const SwSectionNode
*FindSectionNode() const;
217 SwStartNode
* FindSttNodeByType( SwStartNodeType eTyp
);
218 inline const SwStartNode
* FindSttNodeByType( SwStartNodeType eTyp
) const;
220 const SwStartNode
* FindTableBoxStartNode() const
221 { return FindSttNodeByType( SwTableBoxStartNode
); }
222 const SwStartNode
* FindFlyStartNode() const
223 { return FindSttNodeByType( SwFlyStartNode
); }
224 const SwStartNode
* FindFootnoteStartNode() const
225 { return FindSttNodeByType( SwFootnoteStartNode
); }
226 const SwStartNode
* FindHeaderStartNode() const
227 { return FindSttNodeByType( SwHeaderStartNode
); }
228 const SwStartNode
* FindFooterStartNode() const
229 { return FindSttNodeByType( SwFooterStartNode
); }
231 /// Node is in which nodes-array/doc?
232 inline SwNodes
& GetNodes();
233 inline const SwNodes
& GetNodes() const;
237 return GetNodes().GetDoc();
240 const SwDoc
& GetDoc() const
242 return GetNodes().GetDoc();
245 /** Provides access to the document setting interface
247 const IDocumentSettingAccess
* getIDocumentSettingAccess() const;
249 /** Provides access to the document device interface
251 const IDocumentDeviceAccess
& getIDocumentDeviceAccess() const;
253 /** Provides access to the document bookmark interface
255 const IDocumentMarkAccess
* getIDocumentMarkAccess() const;
257 /** Provides access to the document redline interface
259 const IDocumentRedlineAccess
& getIDocumentRedlineAccess() const;
261 /** Provides access to the document style pool interface
263 const IDocumentStylePoolAccess
& getIDocumentStylePoolAccess() const;
265 /** Provides access to the document draw model interface
267 const IDocumentDrawModelAccess
& getIDocumentDrawModelAccess() const;
269 /** Provides access to the document layout interface
271 const IDocumentLayoutAccess
& getIDocumentLayoutAccess() const;
272 IDocumentLayoutAccess
& getIDocumentLayoutAccess();
274 /** Provides access to the document links administration interface
276 const IDocumentLinksAdministration
& getIDocumentLinksAdministration() const;
277 IDocumentLinksAdministration
& getIDocumentLinksAdministration();
279 /** Provides access to the document fields administration interface
281 const IDocumentFieldsAccess
& getIDocumentFieldsAccess() const;
282 IDocumentFieldsAccess
& getIDocumentFieldsAccess();
284 /** Provides access to the document content operations interface
286 IDocumentContentOperations
& getIDocumentContentOperations();
288 /** Provides access to the document automatic styles interface
290 IStyleAccess
& getIDocumentStyleAccess();
292 /** Provides access to the document's numbered items interface */
293 IDocumentListItems
& getIDocumentListItems();
295 /// Is node in the visible area of the Shell?
296 bool IsInVisibleArea( SwViewShell
const * pSh
) const;
297 /// Is node in a protected area?
298 bool IsInProtectSect() const;
299 /** Is node in something that is protected (range, frame,
300 table cells ... including anchor in case of frames or footnotes)? */
301 bool IsProtect() const;
303 /** Search PageDesc with which this node is formatted. If layout is existent
304 search over layout, else only the hard way is left: search over the nodes
306 const SwPageDesc
* FindPageDesc( SwNodeOffset
* pPgDescNdIdx
= nullptr ) const;
308 /// If node is in a fly return the respective format.
309 SwFrameFormat
* GetFlyFormat() const;
311 /// If node is in a table return the respective table box.
312 SAL_RET_MAYBENULL SwTableBox
* GetTableBox() const;
314 SwNodeOffset
GetIndex() const { return SwNodeOffset(GetPos()); }
316 const SwTextNode
* FindOutlineNodeOfLevel(sal_uInt8 nLvl
, SwRootFrame
const* pLayout
= nullptr) const;
318 sal_uInt8
HasPrevNextLayNode() const;
320 std::vector
<SwFrameFormat
*> const & GetAnchoredFlys() const { return m_aAnchoredFlys
; }
321 void AddAnchoredFly(SwFrameFormat
*);
322 void RemoveAnchoredFly(SwFrameFormat
*);
325 * Dumps the node structure to the given destination (file nodes.xml in the current directory by default)
327 virtual void dumpAsXml(xmlTextWriterPtr pWriter
) const;
329 bool operator==(const SwNode
& rOther
) const { return this == &rOther
; }
330 bool operator!=(const SwNode
& rOther
) const { return this != &rOther
; }
331 bool operator<(const SwNode
& rOther
) const { assert(&GetNodes() == &rOther
.GetNodes()); return GetIndex() < rOther
.GetIndex(); }
332 bool operator<=(const SwNode
& rOther
) const { assert(&GetNodes() == &rOther
.GetNodes()); return GetIndex() <= rOther
.GetIndex(); }
333 bool operator>(const SwNode
& rOther
) const { assert(&GetNodes() == &rOther
.GetNodes()); return GetIndex() > rOther
.GetIndex(); }
334 bool operator>=(const SwNode
& rOther
) const { assert(&GetNodes() == &rOther
.GetNodes()); return GetIndex() >= rOther
.GetIndex(); }
336 sw::AccessibilityCheckStatus
& getAccessibilityCheckStatus()
338 return m_aAccessibilityCheckStatus
;
341 void resetAndQueueAccessibilityCheck(bool bIssueObjectNameChanged
= false);
344 SwNode( const SwNode
& rNodes
) = delete;
345 SwNode
& operator= ( const SwNode
& rNodes
) = delete;
348 /// Starts a section of nodes in the document model.
349 class SAL_DLLPUBLIC_RTTI SwStartNode
: public SwNode
352 friend class SwNodes
;
353 friend class SwEndNode
; ///< to set the theEndOfSection !!
355 SwEndNode
* m_pEndOfSection
;
356 SwStartNodeType m_eStartNodeType
;
358 /// for the initial StartNode
359 SwStartNode( SwNodes
& rNodes
, SwNodeOffset nPos
);
362 SwStartNode( const SwNode
& rWhere
,
363 const SwNodeType nNodeType
= SwNodeType::Start
,
364 SwStartNodeType
= SwNormalStartNode
);
366 SwStartNodeType
GetStartNodeType() const { return m_eStartNodeType
; }
368 /// Call ChkCondcoll to all ContentNodes of section.
369 void CheckSectionCondColl() const;
371 virtual void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
374 SwStartNode( const SwStartNode
& rNode
) = delete;
375 SwStartNode
& operator= ( const SwStartNode
& rNode
) = delete;
378 /// Ends a section of nodes in the document model.
379 class SwEndNode final
: public SwNode
381 friend class SwNodes
;
382 friend class SwTableNode
; ///< To enable creation of its EndNote.
383 friend class SwSectionNode
; ///< To enable creation of its EndNote.
385 /// for the initial StartNode
386 SwEndNode( SwNodes
& rNodes
, SwNodeOffset nPos
, SwStartNode
& rSttNd
);
388 SwEndNode( const SwNode
& rWhere
, SwStartNode
& rSttNd
);
390 SwEndNode( const SwEndNode
& rNode
) = delete;
391 SwEndNode
& operator= ( const SwEndNode
& rNode
) = delete;
396 class SAL_DLLPUBLIC_RTTI SwContentNode
: public sw::BroadcastingModify
, public SwNode
, public SwContentIndexReg
399 sw::WriterMultiListener m_aCondCollListener
;
400 SwFormatColl
* m_pCondColl
;
401 mutable bool mbSetModifyAtAttr
;
404 /// only used by SwContentNodeTmp in SwTextNode::Update
407 SwContentNode( const SwNode
& rWhere
, const SwNodeType nNodeType
,
408 SwFormatColl
*pFormatColl
);
409 /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
411 virtual ~SwContentNode() override
= 0;
413 /** Attribute-set for all auto attributes of a ContentNode.
414 (e.g. TextNode or NoTextNode). */
415 std::shared_ptr
<const SwAttrSet
> mpAttrSet
;
417 /// Make respective nodes create the specific AttrSets.
418 virtual void NewAttrSet( SwAttrPool
& ) = 0;
420 /** There some functions that like to remove items from the internal
421 SwAttrSet (handle): */
422 sal_uInt16
ClearItemsFromAttrSet( const std::vector
<sal_uInt16
>& rWhichIds
);
424 virtual void SwClientNotify( const SwModify
&, const SfxHint
& rHint
) override
;
428 /** MakeFrame will be called for a certain layout
429 pSib is another SwFrame of the same layout (e.g. the SwRootFrame itself, a sibling, the parent) */
430 virtual SwContentFrame
*MakeFrame( SwFrame
* pSib
) = 0;
432 virtual SwContentNode
*JoinNext();
433 /** Is it possible to join two nodes?
434 In pIdx the second position can be returned. */
435 SW_DLLPUBLIC
bool CanJoinNext( SwNodeIndex
* pIdx
= nullptr ) const;
436 bool CanJoinNext( SwPosition
* pIdx
) const;
437 SW_DLLPUBLIC
bool CanJoinPrev( SwNodeIndex
* pIdx
=nullptr ) const;
439 bool GoNext(SwContentIndex
*, SwCursorSkipMode nMode
) const;
440 bool GoNext(SwPosition
*, SwCursorSkipMode nMode
) const;
441 bool GoPrevious(SwContentIndex
*, SwCursorSkipMode nMode
) const;
443 /// @see GetFrameOfModify
444 SW_DLLPUBLIC SwContentFrame
*getLayoutFrame( const SwRootFrame
*,
445 const SwPosition
*pPos
= nullptr,
446 std::pair
<Point
, bool> const* pViewPosAndCalcFrame
= nullptr) const;
447 /** @return the real size of the frame or an empty rectangle if
448 no layout exists. Needed for export filters. */
449 SW_DLLPUBLIC SwRect
FindLayoutRect( const bool bPrtArea
= false,
450 const Point
* pPoint
= nullptr ) const;
451 SW_DLLPUBLIC SwRect
FindPageFrameRect() const;
453 /** Method creates all views of document for given node. The content
454 frames that are created are put in the respective layout. */
455 void MakeFramesForAdjacentContentNode(SwContentNode
& rNode
);
457 /** Method deletes all views of document for the node. The content-
458 frames are removed from the respective layout.
460 void DelFrames(SwRootFrame
const* pLayout
);
462 /** @return count of elements of node content. Default is 1.
463 There are differences between text node and formula node. */
464 virtual sal_Int32
Len() const;
466 virtual SwContentNode
* MakeCopy(SwDoc
&, SwNode
& rWhere
, bool bNewFrames
) const = 0;
468 /// Get information from Client.
469 virtual bool GetInfo( SwFindNearestNode
& ) const override
;
471 /// SS for PoolItems: hard attributation.
473 /// If bInParent is FALSE search for attribute only in this node.
474 const SfxPoolItem
& GetAttr( sal_uInt16 nWhich
, bool bInParent
=true ) const;
476 const T
& GetAttr( TypedWhichId
<T
> nWhich
, bool bInParent
=true ) const
477 { return static_cast<const T
&>(GetAttr(sal_uInt16(nWhich
), bInParent
)); }
478 SW_DLLPUBLIC
bool GetAttr( SfxItemSet
& rSet
) const;
480 SW_DLLPUBLIC
virtual bool SetAttr( const SfxPoolItem
& );
481 virtual bool SetAttr( const SfxItemSet
& rSet
);
482 virtual bool ResetAttr( sal_uInt16 nWhich1
, sal_uInt16 nWhich2
= 0 );
483 virtual bool ResetAttr( const std::vector
<sal_uInt16
>& rWhichArr
);
484 virtual sal_uInt16
ResetAllAttr();
486 /// Obtains attribute that is not delivered via conditional style!
487 SW_DLLPUBLIC
const SfxPoolItem
* GetNoCondAttr( sal_uInt16 nWhich
, bool bInParents
) const;
489 const T
* GetNoCondAttr( TypedWhichId
<T
> nWhich
, bool bInParents
) const
490 { return static_cast<const T
*>(GetNoCondAttr(sal_uInt16(nWhich
), bInParents
)); }
492 /** Does node has already its own auto-attributes?
493 Access to SwAttrSet. */
494 inline const SwAttrSet
&GetSwAttrSet() const;
495 const SwAttrSet
*GetpSwAttrSet() const { return mpAttrSet
.get(); }
496 bool HasSwAttrSet() const { return mpAttrSet
!= nullptr; }
498 virtual SwFormatColl
* ChgFormatColl( SwFormatColl
* );
499 SwFormatColl
* GetFormatColl() const { return const_cast<SwFormatColl
*>(static_cast<const SwFormatColl
*>(GetRegisteredIn())); }
501 inline SwFormatColl
& GetAnyFormatColl() const;
502 void SetCondFormatColl( SwFormatColl
* );
503 inline SwFormatColl
* GetCondFormatColl() const;
505 bool IsAnyCondition( SwCollCondition
& rTmp
) const;
506 void ChkCondColl(const SwTextFormatColl
* pColl
= nullptr);
508 /** Invalidates NumRule at the node. NumRule is updated
509 on EndAction of a Shell at the latest. */
510 bool InvalidateNumRule();
512 /** determines the text direction for a certain
513 position. @return -1, if text direction could *not* be determined. */
514 SvxFrameDirection
GetTextDirection( const SwPosition
& rPos
,
515 const Point
* pPt
) const;
517 void SetModifyAtAttr( bool bSetModifyAtAttr
) const { mbSetModifyAtAttr
= bSetModifyAtAttr
; }
518 bool GetModifyAtAttr() const { return mbSetModifyAtAttr
; }
520 static std::unique_ptr
<SwOLENodes
> CreateOLENodesArray( const SwFormatColl
& rColl
, bool bOnlyWithInvalidSize
);
522 // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
523 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr
getSdrAllFillAttributesHelper() const;
525 void UpdateAttr(const SwUpdateAttr
&);
528 SwContentNode( const SwContentNode
& rNode
) = delete;
529 SwContentNode
& operator= ( const SwContentNode
& rNode
) = delete;
534 class SW_DLLPUBLIC SwTableNode final
: public SwStartNode
, public sw::BroadcastingModify
536 friend class SwNodes
;
537 std::unique_ptr
<SwTable
> m_pTable
;
539 virtual ~SwTableNode() override
;
542 SwTableNode( const SwNode
& );
544 const SwTable
& GetTable() const { return *m_pTable
; }
545 SwTable
& GetTable() { return *m_pTable
; }
546 SwTabFrame
*MakeFrame( SwFrame
* );
548 /// Creates the frms for the table node (i.e. the TabFrames).
549 /// pIdxBehind is optional parameter.
550 void MakeOwnFrames(SwPosition
* pIdxBehind
= nullptr);
552 /** Method deletes all views of document for the node.
553 The content frames are removed from the respective layout. */
554 void DelFrames(SwRootFrame
const* pLayout
= nullptr);
556 /** Method creates all views of the document for the previous node.
557 The content frames that are created are put into the respective layout. */
558 void MakeFramesForAdjacentContentNode(const SwNodeIndex
& rIdx
);
560 SwTableNode
* MakeCopy( SwDoc
&, const SwNodeIndex
& ) const;
561 void SetNewTable( std::unique_ptr
<SwTable
> , bool bNewFrames
=true );
563 // Removes redline objects that relate to this table from the 'Extra Redlines' table
564 void RemoveRedlines();
566 void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
569 SwTableNode( const SwTableNode
& rNode
) = delete;
570 SwTableNode
& operator= ( const SwTableNode
& rNode
) = delete;
573 /// A section node represents the start of a section on the UI, i.e. the container created using
574 /// Insert -> Section menu item.
575 class SAL_DLLPUBLIC_RTTI SwSectionNode final
578 friend class SwNodes
;
581 SwSectionNode(const SwSectionNode
&) = delete;
582 SwSectionNode
& operator=(const SwSectionNode
&) = delete;
584 std::unique_ptr
<SwSection
> const m_pSection
;
586 virtual ~SwSectionNode() override
;
589 SwSectionNode(const SwNode
& rWhere
,
590 SwSectionFormat
& rFormat
, SwTOXBase
const*const pTOXBase
);
592 const SwSection
& GetSection() const { return *m_pSection
; }
593 SwSection
& GetSection() { return *m_pSection
; }
595 SwFrame
* MakeFrame(SwFrame
* pSib
, bool bHidden
);
597 /** Creates the frms for the SectionNode (i.e. the SectionFrames).
598 On default the frames are created until the end of the range.
599 When another NodeIndex pEnd is passed a MakeFrames is called up to it.
600 Used by TableToText. */
601 void MakeOwnFrames(SwNodeIndex
* pIdxBehind
, SwNodeIndex
* pEnd
= nullptr);
603 /** Method deletes all views of document for the node. The
604 content frames are removed from the respective layout. */
605 void DelFrames(SwRootFrame
const* pLayout
= nullptr, bool bForce
= false);
607 /** Method creates all views of document for the previous node.
608 The content frames created are put into the respective layout. */
609 void MakeFramesForAdjacentContentNode(const SwNodeIndex
& rIdx
);
611 SwSectionNode
* MakeCopy( SwDoc
&, const SwNodeIndex
& ) const;
613 /// Set pointer in format of section on itself.
616 /** Check for not hidden areas whether there is content that is not in
617 a hidden sub-area. */
618 bool IsContentHidden() const;
620 void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
624 /** This class is internal, used only during DocumentContentOperationsManager::CopyWithFlyInFly(), and for undo.
626 Some of the nodes are then replaced with SwPlaceholderNode, and at the end of the operation, removed again.
627 FIXME find out if this is really necessary, and if we can avoid creation of the SwPlaceholderNodes in the first place.
629 class SwPlaceholderNode final
: private SwNode
632 friend class SwNodes
;
633 SwPlaceholderNode(const SwNode
& rWhere
);
636 inline SwEndNode
*SwNode::GetEndNode()
638 return IsEndNode() ? static_cast<SwEndNode
*>(this) : nullptr;
640 inline const SwEndNode
*SwNode::GetEndNode() const
642 return IsEndNode() ? static_cast<const SwEndNode
*>(this) : nullptr;
644 inline SwStartNode
*SwNode::GetStartNode()
646 return IsStartNode() ? static_cast<SwStartNode
*>(this) : nullptr;
648 inline const SwStartNode
*SwNode::GetStartNode() const
650 return IsStartNode() ? static_cast<const SwStartNode
*>(this) : nullptr;
652 inline SwTableNode
*SwNode::GetTableNode()
654 return IsTableNode() ? static_cast<SwTableNode
*>(this) : nullptr;
656 inline const SwTableNode
*SwNode::GetTableNode() const
658 return IsTableNode() ? static_cast<const SwTableNode
*>(this) : nullptr;
660 inline SwSectionNode
*SwNode::GetSectionNode()
662 return IsSectionNode() ? static_cast<SwSectionNode
*>(this) : nullptr;
664 inline const SwSectionNode
*SwNode::GetSectionNode() const
666 return IsSectionNode() ? static_cast<const SwSectionNode
*>(this) : nullptr;
668 inline SwContentNode
*SwNode::GetContentNode()
670 return IsContentNode() ? static_cast<SwContentNode
*>(this) : nullptr;
672 inline const SwContentNode
*SwNode::GetContentNode() const
674 return IsContentNode() ? static_cast<const SwContentNode
*>(this) : nullptr;
677 inline const SwStartNode
* SwNode::FindSttNodeByType( SwStartNodeType eTyp
) const
679 return const_cast<SwNode
*>(this)->FindSttNodeByType( eTyp
);
681 inline const SwTableNode
* SwNode::FindTableNode() const
683 return const_cast<SwNode
*>(this)->FindTableNode();
685 inline const SwSectionNode
* SwNode::FindSectionNode() const
687 return const_cast<SwNode
*>(this)->FindSectionNode();
689 inline SwNodeOffset
SwNode::StartOfSectionIndex() const
691 return m_pStartOfSection
->GetIndex();
693 inline SwNodeOffset
SwNode::EndOfSectionIndex() const
695 return EndOfSectionNode()->GetIndex();
697 inline const SwEndNode
* SwNode::EndOfSectionNode() const
699 const SwStartNode
* pStNd
= IsStartNode() ? static_cast<const SwStartNode
*>(this) : m_pStartOfSection
;
700 return pStNd
->m_pEndOfSection
;
702 inline SwEndNode
* SwNode::EndOfSectionNode()
704 const SwStartNode
* pStNd
= IsStartNode() ? static_cast<const SwStartNode
*>(this) : m_pStartOfSection
;
705 return pStNd
->m_pEndOfSection
;
708 inline SwNodes
& SwNode::GetNodes()
710 return static_cast<SwNodes
&>(GetArray());
712 inline const SwNodes
& SwNode::GetNodes() const
714 return static_cast<SwNodes
&>(GetArray());
717 inline SwFormatColl
* SwContentNode::GetCondFormatColl() const
722 inline SwFormatColl
& SwContentNode::GetAnyFormatColl() const
726 : *const_cast<SwFormatColl
*>(static_cast<const SwFormatColl
*>(GetRegisteredIn()));
729 inline const SwAttrSet
& SwContentNode::GetSwAttrSet() const
731 return mpAttrSet
? *GetpSwAttrSet() : GetAnyFormatColl().GetAttrSet();
734 inline const SfxPoolItem
& SwContentNode::GetAttr( sal_uInt16 nWhich
,
735 bool bInParents
) const
737 return GetSwAttrSet().Get( nWhich
, bInParents
);
740 inline SwPlaceholderNode::SwPlaceholderNode(const SwNode
& rWhere
)
741 : SwNode(rWhere
, SwNodeType::PlaceHolder
)
745 inline SwNode
* SwNodes::operator[]( SwNodeOffset n
) const
747 return static_cast<SwNode
*>(BigPtrArray::operator[] ( sal_Int32(n
) ));
752 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */