Resolves tdf#142513 - Order of ZoomIn and ZoomOut at Print Preview
[LibreOffice.git] / sw / inc / node.hxx
blob53e2a79d0068f1936ff8fb259f50b1e33f5f402f
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 "index.hxx"
30 #include "fmtcol.hxx"
32 #include <memory>
33 #include <vector>
35 class SwContentFrame;
36 class SwContentNode;
37 class SwDoc;
38 class SwEndNode;
39 class SwFrame;
40 class SwFrameFormat;
41 class SwGrfNode;
42 class SwNoTextNode;
43 class SwNodeIndex;
44 class SwOLENode;
45 class SwRect;
46 class SwSection;
47 class SwSectionFormat;
48 class SwTOXBase;
49 class SwSectionNode;
50 class SwStartNode;
51 class SwTabFrame;
52 class SwRootFrame;
53 class SwTable;
54 class SwTableNode;
55 class SwTableBox;
56 class SwTextNode;
57 class SwPageDesc;
58 class SwViewShell;
59 struct SwPosition;
60 class IStyleAccess;
61 class IDocumentSettingAccess;
62 class IDocumentDeviceAccess;
63 class IDocumentMarkAccess;
64 class IDocumentRedlineAccess;
65 class IDocumentStylePoolAccess;
66 class IDocumentLinksAdministration;
67 class IDocumentFieldsAccess;
68 class IDocumentContentOperations;
69 class IDocumentListItems;
70 class Point;
71 enum class SvxFrameDirection;
72 typedef std::vector<SwOLENode*> SwOLENodes; // docary.hxx
74 namespace drawinglayer::attribute {
75 class SdrAllFillAttributesHelper;
76 typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
79 /// Base class of the Writer document model elements.
80 class SW_DLLPUBLIC SwNode
81 : public sw::BorderCacheOwner, private BigPtrEntry
83 friend class SwNodes;
85 SwNodeType m_nNodeType;
87 /// For text nodes: level of auto format. Was put here because we had still free bits.
88 sal_uInt8 m_nAFormatNumLvl : 3;
89 bool m_bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the flag
91 public:
92 /// sw_redlinehide: redline node merge state
93 enum class Merge { None, First, NonFirst, Hidden };
94 bool IsCreateFrameWhenHidingRedlines() const {
95 return m_eMerge == Merge::None || m_eMerge == Merge::First;
97 void SetRedlineMergeFlag(Merge const eMerge) { m_eMerge = eMerge; }
98 Merge GetRedlineMergeFlag() const { return m_eMerge; }
99 private:
100 Merge m_eMerge;
102 #ifdef DBG_UTIL
103 static tools::Long s_nSerial;
104 tools::Long m_nSerial;
105 #endif
107 /// all SwFrameFormat that are anchored at the node
108 /// invariant: SwFrameFormat is in the list iff
109 /// SwFrameFormat::GetAnchor().GetContentAnchor() points to this node
110 std::vector<SwFrameFormat*> m_aAnchoredFlys;
112 protected:
113 SwStartNode* m_pStartOfSection;
115 SwNode( const SwNodeIndex &rWhere, const SwNodeType nNodeId );
117 /// for the initial StartNode
118 SwNode( SwNodes& rNodes, sal_uLong nPos, const SwNodeType nNodeId );
120 public:
121 /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
122 from subclasses */
123 virtual ~SwNode() override = 0;
125 #ifdef DBG_UTIL
126 tools::Long GetSerial() const { return m_nSerial; }
127 #endif
129 sal_uInt16 GetSectionLevel() const;
131 inline sal_uLong StartOfSectionIndex() const;
132 const SwStartNode* StartOfSectionNode() const { return m_pStartOfSection; }
133 SwStartNode* StartOfSectionNode() { return m_pStartOfSection; }
135 inline sal_uLong EndOfSectionIndex() const;
136 inline const SwEndNode* EndOfSectionNode() const;
137 inline SwEndNode* EndOfSectionNode();
139 sal_uInt8 GetAutoFormatLvl() const { return m_nAFormatNumLvl; }
140 void SetAutoFormatLvl( sal_uInt8 nVal ) { m_nAFormatNumLvl = nVal; }
142 bool IsIgnoreDontExpand() const { return m_bIgnoreDontExpand; }
143 void SetIgnoreDontExpand( bool bNew ) { m_bIgnoreDontExpand = bNew; }
145 SwNodeType GetNodeType() const { return m_nNodeType; }
147 inline SwStartNode *GetStartNode();
148 inline const SwStartNode *GetStartNode() const;
149 inline SwContentNode *GetContentNode();
150 inline const SwContentNode *GetContentNode() const;
151 inline SwEndNode *GetEndNode();
152 inline const SwEndNode *GetEndNode() const;
153 inline SwTextNode *GetTextNode();
154 inline const SwTextNode *GetTextNode() const;
155 inline SwOLENode *GetOLENode();
156 inline const SwOLENode *GetOLENode() const;
157 inline SwNoTextNode *GetNoTextNode();
158 inline const SwNoTextNode *GetNoTextNode() const;
159 inline SwGrfNode *GetGrfNode();
160 inline const SwGrfNode *GetGrfNode() const;
161 inline SwTableNode *GetTableNode();
162 inline const SwTableNode *GetTableNode() const;
163 inline SwSectionNode *GetSectionNode();
164 inline const SwSectionNode *GetSectionNode() const;
166 inline bool IsStartNode() const;
167 inline bool IsContentNode() const;
168 inline bool IsEndNode() const;
169 inline bool IsTextNode() const;
170 inline bool IsTableNode() const;
171 inline bool IsSectionNode() const;
172 inline bool IsOLENode() const;
173 inline bool IsNoTextNode() const;
174 inline bool IsGrfNode() const;
177 Checks if this node is in redlines.
179 @retval true this node is in redlines
180 @retval false else
182 bool IsInRedlines() const;
184 /** Search table node, in which it is. If it is in no table
185 @return 0. */
186 SwTableNode *FindTableNode();
187 inline const SwTableNode *FindTableNode() const;
189 /** Search section node, in which it is. If it is in no section
190 @return 0. */
191 SwSectionNode *FindSectionNode();
192 inline const SwSectionNode *FindSectionNode() const;
194 SwStartNode* FindSttNodeByType( SwStartNodeType eTyp );
195 inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const;
197 const SwStartNode* FindTableBoxStartNode() const
198 { return FindSttNodeByType( SwTableBoxStartNode ); }
199 const SwStartNode* FindFlyStartNode() const
200 { return FindSttNodeByType( SwFlyStartNode ); }
201 const SwStartNode* FindFootnoteStartNode() const
202 { return FindSttNodeByType( SwFootnoteStartNode ); }
203 const SwStartNode* FindHeaderStartNode() const
204 { return FindSttNodeByType( SwHeaderStartNode ); }
205 const SwStartNode* FindFooterStartNode() const
206 { return FindSttNodeByType( SwFooterStartNode ); }
208 /// Node is in which nodes-array/doc?
209 inline SwNodes& GetNodes();
210 inline const SwNodes& GetNodes() const;
212 SwDoc& GetDoc()
214 return GetNodes().GetDoc();
217 const SwDoc& GetDoc() const
219 return GetNodes().GetDoc();
222 /** Provides access to the document setting interface
224 const IDocumentSettingAccess* getIDocumentSettingAccess() const;
226 /** Provides access to the document device interface
228 const IDocumentDeviceAccess& getIDocumentDeviceAccess() const;
230 /** Provides access to the document bookmark interface
232 const IDocumentMarkAccess* getIDocumentMarkAccess() const;
234 /** Provides access to the document redline interface
236 const IDocumentRedlineAccess& getIDocumentRedlineAccess() const;
238 /** Provides access to the document style pool interface
240 const IDocumentStylePoolAccess& getIDocumentStylePoolAccess() const;
242 /** Provides access to the document draw model interface
244 const IDocumentDrawModelAccess& getIDocumentDrawModelAccess() const;
246 /** Provides access to the document layout interface
248 const IDocumentLayoutAccess& getIDocumentLayoutAccess() const;
249 IDocumentLayoutAccess& getIDocumentLayoutAccess();
251 /** Provides access to the document links administration interface
253 const IDocumentLinksAdministration& getIDocumentLinksAdministration() const;
254 IDocumentLinksAdministration& getIDocumentLinksAdministration();
256 /** Provides access to the document fields administration interface
258 const IDocumentFieldsAccess& getIDocumentFieldsAccess() const;
259 IDocumentFieldsAccess& getIDocumentFieldsAccess();
261 /** Provides access to the document content operations interface
263 IDocumentContentOperations& getIDocumentContentOperations();
265 /** Provides access to the document automatic styles interface
267 IStyleAccess& getIDocumentStyleAccess();
269 /** Provides access to the document's numbered items interface */
270 IDocumentListItems& getIDocumentListItems();
272 /// Is node in the visible area of the Shell?
273 bool IsInVisibleArea( SwViewShell const * pSh ) const;
274 /// Is node in a protected area?
275 bool IsInProtectSect() const;
276 /** Is node in something that is protected (range, frame,
277 table cells ... including anchor in case of frames or footnotes)? */
278 bool IsProtect() const;
280 /** Search PageDesc with which this node is formatted. If layout is existent
281 search over layout, else only the hard way is left: search over the nodes
282 to the front!! */
283 const SwPageDesc* FindPageDesc( size_t* pPgDescNdIdx = nullptr ) const;
285 /// If node is in a fly return the respective format.
286 SwFrameFormat* GetFlyFormat() const;
288 /// If node is in a table return the respective table box.
289 SwTableBox* GetTableBox() const;
291 sal_uLong GetIndex() const { return GetPos(); }
293 const SwTextNode* FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const* pLayout = nullptr) const;
295 sal_uInt8 HasPrevNextLayNode() const;
297 std::vector<SwFrameFormat *> const & GetAnchoredFlys() const { return m_aAnchoredFlys; }
298 void AddAnchoredFly(SwFrameFormat *);
299 void RemoveAnchoredFly(SwFrameFormat *);
302 * Dumps the node structure to the given destination (file nodes.xml in the current directory by default)
304 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
306 private:
307 SwNode( const SwNode & rNodes ) = delete;
308 SwNode & operator= ( const SwNode & rNodes ) = delete;
311 /// Starts a section of nodes in the document model.
312 class SAL_DLLPUBLIC_RTTI SwStartNode: public SwNode
314 friend class SwNode;
315 friend class SwNodes;
316 friend class SwEndNode; ///< to set the theEndOfSection !!
318 SwEndNode* m_pEndOfSection;
319 SwStartNodeType m_eStartNodeType;
321 /// for the initial StartNode
322 SwStartNode( SwNodes& rNodes, sal_uLong nPos );
324 protected:
325 SwStartNode( const SwNodeIndex &rWhere,
326 const SwNodeType nNodeType = SwNodeType::Start,
327 SwStartNodeType = SwNormalStartNode );
328 public:
329 SwStartNodeType GetStartNodeType() const { return m_eStartNodeType; }
331 /// Call ChkCondcoll to all ContentNodes of section.
332 void CheckSectionCondColl() const;
334 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
336 private:
337 SwStartNode( const SwStartNode & rNode ) = delete;
338 SwStartNode & operator= ( const SwStartNode & rNode ) = delete;
341 /// Ends a section of nodes in the document model.
342 class SwEndNode : public SwNode
344 friend class SwNodes;
345 friend class SwTableNode; ///< To enable creation of its EndNote.
346 friend class SwSectionNode; ///< To enable creation of its EndNote.
348 /// for the initial StartNode
349 SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd );
351 protected:
352 SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd );
354 private:
355 SwEndNode( const SwEndNode & rNode ) = delete;
356 SwEndNode & operator= ( const SwEndNode & rNode ) = delete;
359 // SwContentNode
361 class SW_DLLPUBLIC SwContentNode: public sw::BroadcastingModify, public SwNode, public SwIndexReg
364 sw::WriterMultiListener m_aCondCollListener;
365 SwFormatColl* m_pCondColl;
366 mutable bool mbSetModifyAtAttr;
368 protected:
369 SwContentNode( const SwNodeIndex &rWhere, const SwNodeType nNodeType,
370 SwFormatColl *pFormatColl );
371 /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
372 from subclasses */
373 virtual ~SwContentNode() override = 0;
375 /** Attribute-set for all auto attributes of a ContentNode.
376 (e.g. TextNode or NoTextNode). */
377 std::shared_ptr<const SfxItemSet> mpAttrSet;
379 /// Make respective nodes create the specific AttrSets.
380 virtual void NewAttrSet( SwAttrPool& ) = 0;
382 /** There some functions that like to remove items from the internal
383 SwAttrSet (handle): */
384 sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds );
386 virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) override;
388 public:
390 /** MakeFrame will be called for a certain layout
391 pSib is another SwFrame of the same layout (e.g. the SwRootFrame itself, a sibling, the parent) */
392 virtual SwContentFrame *MakeFrame( SwFrame* pSib ) = 0;
394 virtual SwContentNode *JoinNext();
395 /** Is it possible to join two nodes?
396 In pIdx the second position can be returned. */
397 bool CanJoinNext( SwNodeIndex* pIdx =nullptr ) const;
398 bool CanJoinPrev( SwNodeIndex* pIdx =nullptr ) const;
400 void MakeStartIndex( SwIndex * pIdx ) { pIdx->Assign( this, 0 ); }
401 void MakeEndIndex( SwIndex * pIdx ) { pIdx->Assign( this, Len() ); }
403 bool GoNext(SwIndex *, sal_uInt16 nMode ) const;
404 bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const;
406 /// @see GetFrameOfModify
407 SwContentFrame *getLayoutFrame( const SwRootFrame*,
408 const SwPosition *pPos = nullptr,
409 std::pair<Point, bool> const* pViewPosAndCalcFrame = nullptr) const;
410 /** @return the real size of the frame or an empty rectangle if
411 no layout exists. Needed for export filters. */
412 SwRect FindLayoutRect( const bool bPrtArea = false,
413 const Point* pPoint = nullptr ) const;
414 SwRect FindPageFrameRect() const;
416 /** Method creates all views of document for given node. The content
417 frames that are created are put in the respective layout. */
418 void MakeFramesForAdjacentContentNode(SwContentNode& rNode);
420 /** Method deletes all views of document for the node. The content-
421 frames are removed from the respective layout.
423 void DelFrames(SwRootFrame const* pLayout);
425 /** @return count of elements of node content. Default is 1.
426 There are differences between text node and formula node. */
427 virtual sal_Int32 Len() const;
429 virtual SwContentNode* MakeCopy(SwDoc&, const SwNodeIndex&, bool bNewFrames) const = 0;
431 /// Get information from Client.
432 virtual bool GetInfo( SfxPoolItem& ) const override;
434 /// SS for PoolItems: hard attributation.
436 /// If bInParent is FALSE search for attribute only in this node.
437 const SfxPoolItem& GetAttr( sal_uInt16 nWhich, bool bInParent=true ) const;
438 bool GetAttr( SfxItemSet& rSet ) const;
439 /// made virtual
440 virtual bool SetAttr( const SfxPoolItem& );
441 virtual bool SetAttr( const SfxItemSet& rSet );
442 virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
443 virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr );
444 virtual sal_uInt16 ResetAllAttr();
446 /// Obtains attribute that is not delivered via conditional style!
447 const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, bool bInParents ) const;
449 /** Does node has already its own auto-attributes?
450 Access to SwAttrSet. */
451 inline const SwAttrSet &GetSwAttrSet() const;
452 const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); }
453 bool HasSwAttrSet() const { return mpAttrSet != nullptr; }
455 virtual SwFormatColl* ChgFormatColl( SwFormatColl* );
456 SwFormatColl* GetFormatColl() const { return const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn())); }
458 inline SwFormatColl& GetAnyFormatColl() const;
459 void SetCondFormatColl( SwFormatColl* );
460 inline SwFormatColl* GetCondFormatColl() const;
462 bool IsAnyCondition( SwCollCondition& rTmp ) const;
463 void ChkCondColl(const SwTextFormatColl* pColl = nullptr);
465 /** Invalidates NumRule at the node. NumRule is updated
466 on EndAction of a Shell at the latest. */
467 bool InvalidateNumRule();
469 /** determines the text direction for a certain
470 position. @return -1, if text direction could *not* be determined. */
471 SvxFrameDirection GetTextDirection( const SwPosition& rPos,
472 const Point* pPt ) const;
474 void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
475 bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
477 static std::unique_ptr<SwOLENodes> CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize );
479 // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
480 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
482 void UpdateAttr(const SwUpdateAttr&);
484 private:
485 SwContentNode( const SwContentNode & rNode ) = delete;
486 SwContentNode & operator= ( const SwContentNode & rNode ) = delete;
489 // SwTableNode
491 class SW_DLLPUBLIC SwTableNode : public SwStartNode, public sw::BroadcastingModify
493 friend class SwNodes;
494 std::unique_ptr<SwTable> m_pTable;
495 protected:
496 virtual ~SwTableNode() override;
498 public:
499 SwTableNode( const SwNodeIndex & );
501 const SwTable& GetTable() const { return *m_pTable; }
502 SwTable& GetTable() { return *m_pTable; }
503 SwTabFrame *MakeFrame( SwFrame* );
505 /// Creates the frms for the table node (i.e. the TabFrames).
506 void MakeOwnFrames(SwNodeIndex* pIdxBehind);
508 /** Method deletes all views of document for the node.
509 The content frames are removed from the respective layout. */
510 void DelFrames(SwRootFrame const* pLayout = nullptr);
512 /** Method creates all views of the document for the previous node.
513 The content frames that are created are put into the respective layout. */
514 void MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx);
516 SwTableNode* MakeCopy( SwDoc&, const SwNodeIndex& ) const;
517 void SetNewTable( std::unique_ptr<SwTable> , bool bNewFrames=true );
519 // Removes redline objects that relate to this table from the 'Extra Redlines' table
520 void RemoveRedlines();
522 private:
523 SwTableNode( const SwTableNode & rNode ) = delete;
524 SwTableNode & operator= ( const SwTableNode & rNode ) = delete;
527 class SAL_DLLPUBLIC_RTTI SwSectionNode
528 : public SwStartNode
530 friend class SwNodes;
532 private:
533 SwSectionNode(const SwSectionNode&) = delete;
534 SwSectionNode& operator=(const SwSectionNode&) = delete;
536 std::unique_ptr<SwSection> const m_pSection;
538 protected:
539 virtual ~SwSectionNode() override;
541 public:
542 SwSectionNode(SwNodeIndex const&,
543 SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase);
545 const SwSection& GetSection() const { return *m_pSection; }
546 SwSection& GetSection() { return *m_pSection; }
548 SwFrame *MakeFrame( SwFrame* );
550 /** Creates the frms for the SectionNode (i.e. the SectionFrames).
551 On default the frames are created until the end of the range.
552 When another NodeIndex pEnd is passed a MakeFrames is called up to it.
553 Used by TableToText. */
554 void MakeOwnFrames(SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = nullptr);
556 /** Method deletes all views of document for the node. The
557 content frames are removed from the respective layout. */
558 void DelFrames(SwRootFrame const* pLayout = nullptr, bool bForce = false);
560 /** Method creates all views of document for the previous node.
561 The content frames created are put into the respective layout. */
562 void MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx);
564 SwSectionNode* MakeCopy( SwDoc&, const SwNodeIndex& ) const;
566 /// Set pointer in format of section on itself.
567 void NodesArrChgd();
569 /** Check for not hidden areas whether there is content that is not in
570 a hidden sub-area. */
571 bool IsContentHidden() const;
575 /** This class is internal, used only during DocumentContentOperationsManager::CopyWithFlyInFly(), and for undo.
577 Some of the nodes are then replaced with SwPlaceholderNode, and at the end of the operation, removed again.
578 FIXME find out if this is really necessary, and if we can avoid creation of the SwPlaceholderNodes in the first place.
580 class SwPlaceholderNode final : private SwNode
582 private:
583 friend class SwNodes;
584 SwPlaceholderNode(const SwNodeIndex &rWhere);
587 inline SwEndNode *SwNode::GetEndNode()
589 return SwNodeType::End == m_nNodeType ? static_cast<SwEndNode*>(this) : nullptr;
591 inline const SwEndNode *SwNode::GetEndNode() const
593 return SwNodeType::End == m_nNodeType ? static_cast<const SwEndNode*>(this) : nullptr;
595 inline SwStartNode *SwNode::GetStartNode()
597 return SwNodeType::Start & m_nNodeType ? static_cast<SwStartNode*>(this) : nullptr;
599 inline const SwStartNode *SwNode::GetStartNode() const
601 return SwNodeType::Start & m_nNodeType ? static_cast<const SwStartNode*>(this) : nullptr;
603 inline SwTableNode *SwNode::GetTableNode()
605 return SwNodeType::Table == m_nNodeType ? static_cast<SwTableNode*>(this) : nullptr;
607 inline const SwTableNode *SwNode::GetTableNode() const
609 return SwNodeType::Table == m_nNodeType ? static_cast<const SwTableNode*>(this) : nullptr;
611 inline SwSectionNode *SwNode::GetSectionNode()
613 return SwNodeType::Section == m_nNodeType ? static_cast<SwSectionNode*>(this) : nullptr;
615 inline const SwSectionNode *SwNode::GetSectionNode() const
617 return SwNodeType::Section == m_nNodeType ? static_cast<const SwSectionNode*>(this) : nullptr;
619 inline SwContentNode *SwNode::GetContentNode()
621 return SwNodeType::ContentMask & m_nNodeType ? static_cast<SwContentNode*>(this) : nullptr;
623 inline const SwContentNode *SwNode::GetContentNode() const
625 return SwNodeType::ContentMask & m_nNodeType ? static_cast<const SwContentNode*>(this) : nullptr;
628 inline bool SwNode::IsStartNode() const
630 return bool(SwNodeType::Start & m_nNodeType);
632 inline bool SwNode::IsContentNode() const
634 return bool(SwNodeType::ContentMask & m_nNodeType);
636 inline bool SwNode::IsEndNode() const
638 return SwNodeType::End == m_nNodeType;
640 inline bool SwNode::IsTextNode() const
642 return SwNodeType::Text == m_nNodeType;
644 inline bool SwNode::IsTableNode() const
646 return SwNodeType::Table == m_nNodeType;
648 inline bool SwNode::IsSectionNode() const
650 return SwNodeType::Section == m_nNodeType;
652 inline bool SwNode::IsNoTextNode() const
654 return bool(SwNodeType::NoTextMask & m_nNodeType);
656 inline bool SwNode::IsOLENode() const
658 return SwNodeType::Ole == m_nNodeType;
660 inline bool SwNode::IsGrfNode() const
662 return SwNodeType::Grf == m_nNodeType;
665 inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
667 return const_cast<SwNode*>(this)->FindSttNodeByType( eTyp );
669 inline const SwTableNode* SwNode::FindTableNode() const
671 return const_cast<SwNode*>(this)->FindTableNode();
673 inline const SwSectionNode* SwNode::FindSectionNode() const
675 return const_cast<SwNode*>(this)->FindSectionNode();
677 inline sal_uLong SwNode::StartOfSectionIndex() const
679 return m_pStartOfSection->GetIndex();
681 inline sal_uLong SwNode::EndOfSectionIndex() const
683 const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : m_pStartOfSection;
684 return pStNd->m_pEndOfSection->GetIndex();
686 inline const SwEndNode* SwNode::EndOfSectionNode() const
688 const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : m_pStartOfSection;
689 return pStNd->m_pEndOfSection;
691 inline SwEndNode* SwNode::EndOfSectionNode()
693 const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : m_pStartOfSection;
694 return pStNd->m_pEndOfSection;
697 inline SwNodes& SwNode::GetNodes()
699 return static_cast<SwNodes&>(GetArray());
701 inline const SwNodes& SwNode::GetNodes() const
703 return static_cast<SwNodes&>(GetArray());
706 inline SwFormatColl* SwContentNode::GetCondFormatColl() const
708 return m_pCondColl;
711 inline SwFormatColl& SwContentNode::GetAnyFormatColl() const
713 return m_pCondColl
714 ? *m_pCondColl
715 : *const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn()));
718 inline const SwAttrSet& SwContentNode::GetSwAttrSet() const
720 return mpAttrSet ? *GetpSwAttrSet() : GetAnyFormatColl().GetAttrSet();
723 //FEATURE::CONDCOLL
725 inline const SfxPoolItem& SwContentNode::GetAttr( sal_uInt16 nWhich,
726 bool bInParents ) const
728 return GetSwAttrSet().Get( nWhich, bInParents );
731 inline SwPlaceholderNode::SwPlaceholderNode(const SwNodeIndex &rWhere)
732 : SwNode(rWhere, SwNodeType::PlaceHolder)
736 inline SwNodePtr SwNodes::operator[]( sal_uLong n ) const
738 return static_cast<SwNodePtr>(BigPtrArray::operator[] ( n ));
741 #endif
743 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */