tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sw / inc / node.hxx
blobdd16cff8c7a86ec7841116557c52e1404664ef73
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 .
20 #ifndef INCLUDED_SW_INC_NODE_HXX
21 #define INCLUDED_SW_INC_NODE_HXX
23 #include <sal/types.h>
25 #include "swdllapi.h"
26 #include "BorderCacheOwner.hxx"
27 #include "ndarr.hxx"
28 #include "ndtyp.hxx"
29 #include "contentindex.hxx"
30 #include "fmtcol.hxx"
31 #include "nodeoffset.hxx"
33 #include <sfx2/AccessibilityIssue.hxx>
35 #include <memory>
36 #include <vector>
38 class SwContentFrame;
39 class SwContentNode;
40 class SwDoc;
41 class SwEndNode;
42 class SwFrame;
43 class SwFrameFormat;
44 class SwGrfNode;
45 class SwNoTextNode;
46 class SwNodeIndex;
47 class SwOLENode;
48 class SwRect;
49 class SwSection;
50 class SwSectionFormat;
51 class SwTOXBase;
52 class SwSectionNode;
53 class SwStartNode;
54 class SwTabFrame;
55 class SwRootFrame;
56 class SwTable;
57 class SwTableNode;
58 class SwTableBox;
59 class SwTextNode;
60 class SwPageDesc;
61 class SwViewShell;
62 struct SwPosition;
63 class IStyleAccess;
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;
73 class Point;
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
85 namespace sw
87 struct AccessibilityCheckStatus
89 std::unique_ptr<sfx::AccessibilityIssueCollection> pCollection;
90 void reset();
95 /// Base class of the Writer document model elements.
96 class SW_DLLPUBLIC SwNode
97 : public sw::BorderCacheOwner, private BigPtrEntry
99 friend class SwNodes;
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.
111 public:
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; }
119 private:
120 Merge m_eMerge;
122 #ifdef DBG_UTIL
123 static tools::Long s_nSerial;
124 tools::Long m_nSerial;
125 #endif
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;
132 protected:
133 SwStartNode* m_pStartOfSection;
135 /// only used by SwContentNodeTmp in SwTextNode::Update
136 SwNode();
138 SwNode( const SwNode& rWhere, const SwNodeType nNodeId );
140 /// for the initial StartNode
141 SwNode( SwNodes& rNodes, SwNodeOffset nPos, const SwNodeType nNodeId );
143 public:
144 /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
145 from subclasses */
146 virtual ~SwNode() override = 0;
148 #ifdef DBG_UTIL
149 tools::Long GetSerial() const { return m_nSerial; }
150 #endif
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
203 @retval false else
205 bool IsInRedlines() const;
207 /** Search table node, in which it is. If it is in no table
208 @return 0. */
209 SwTableNode *FindTableNode();
210 inline const SwTableNode *FindTableNode() const;
212 /** Search section node, in which it is. If it is in no section
213 @return 0. */
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;
235 SwDoc& GetDoc()
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
305 to the front!! */
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);
343 private:
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
351 friend class 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 );
361 protected:
362 SwStartNode( const SwNode& rWhere,
363 const SwNodeType nNodeType = SwNodeType::Start,
364 SwStartNodeType = SwNormalStartNode );
365 public:
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;
373 private:
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;
394 // SwContentNode
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;
403 protected:
404 /// only used by SwContentNodeTmp in SwTextNode::Update
405 SwContentNode();
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
410 from subclasses */
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;
426 public:
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;
475 template<class T>
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;
479 /// made virtual
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;
488 template<class T>
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&);
527 private:
528 SwContentNode( const SwContentNode & rNode ) = delete;
529 SwContentNode & operator= ( const SwContentNode & rNode ) = delete;
532 // SwTableNode
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;
541 public:
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;
568 private:
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
576 : public SwStartNode
578 friend class SwNodes;
580 private:
581 SwSectionNode(const SwSectionNode&) = delete;
582 SwSectionNode& operator=(const SwSectionNode&) = delete;
584 std::unique_ptr<SwSection> const m_pSection;
586 virtual ~SwSectionNode() override;
588 public:
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.
614 void NodesArrChgd();
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
631 private:
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
719 return m_pCondColl;
722 inline SwFormatColl& SwContentNode::GetAnyFormatColl() const
724 return m_pCondColl
725 ? *m_pCondColl
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) ));
750 #endif
752 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */