Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / node.hxx
blobbc8f8d090a3102df6b1a20cafb2ac9227a013b19
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>
24 #include <tools/mempool.hxx>
26 #include "swdllapi.h"
27 #include <ndarr.hxx>
28 #include <ndtyp.hxx>
29 #include <index.hxx>
30 #include <fmtcol.hxx>
32 #include <memory>
33 #include <vector>
35 class SwContentFrm;
36 class SwContentNode;
37 class SwDoc;
38 class SwEndNode;
39 class SwFrm;
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 SwTabFrm;
52 class SwRootFrm;
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 typedef std::vector<SwOLENode*> SwOLENodes; // docary.hxx
73 //UUUU
74 namespace drawinglayer { namespace 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 : private BigPtrEntry
83 friend class SwNodes;
85 sal_uInt8 nNodeType;
87 /// For text nodes: level of auto format. Was put here because we had still free bits.
88 sal_uInt8 nAFormatNumLvl : 3;
89 bool bSetNumLSpace : 1; ///< For numbering: TRUE: set indent.
90 bool bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the flag
92 #ifdef DBG_UTIL
93 static long s_nSerial;
94 long m_nSerial;
95 #endif
97 /// all SwFrameFormat that are anchored at the node
98 /// invariant: SwFrameFormat is in the list iff
99 /// SwFrameFormat::GetAnchor().GetContentAnchor() points to this node
100 std::unique_ptr<std::vector<SwFrameFormat*>> m_pAnchoredFlys;
102 protected:
103 SwStartNode* pStartOfSection;
105 SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeId );
107 /// for the initial StartNode
108 SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNodeId );
110 public:
111 /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
112 from subclasses */
113 virtual ~SwNode() = 0;
115 #ifdef DBG_UTIL
116 long GetSerial() const { return m_nSerial; }
117 #endif
119 sal_uInt16 GetSectionLevel() const;
121 inline sal_uLong StartOfSectionIndex() const;
122 inline const SwStartNode* StartOfSectionNode() const { return pStartOfSection; }
123 inline SwStartNode* StartOfSectionNode() { return pStartOfSection; }
125 inline sal_uLong EndOfSectionIndex() const;
126 inline const SwEndNode* EndOfSectionNode() const;
127 inline SwEndNode* EndOfSectionNode();
129 inline sal_uInt8 GetAutoFormatLvl() const { return nAFormatNumLvl; }
130 inline void SetAutoFormatLvl( sal_uInt8 nVal ) { nAFormatNumLvl = nVal; }
132 inline bool IsSetNumLSpace() const { return bSetNumLSpace; }
133 inline void SetNumLSpace( bool bFlag ) { bSetNumLSpace = bFlag; }
135 inline bool IsIgnoreDontExpand() const { return bIgnoreDontExpand; }
136 inline void SetIgnoreDontExpand( bool bNew ) { bIgnoreDontExpand = bNew; }
138 sal_uInt8 GetNodeType() const { return nNodeType; }
140 inline SwStartNode *GetStartNode();
141 inline const SwStartNode *GetStartNode() const;
142 inline SwContentNode *GetContentNode();
143 inline const SwContentNode *GetContentNode() const;
144 inline SwEndNode *GetEndNode();
145 inline const SwEndNode *GetEndNode() const;
146 inline SwTextNode *GetTextNode();
147 inline const SwTextNode *GetTextNode() const;
148 inline SwOLENode *GetOLENode();
149 inline const SwOLENode *GetOLENode() const;
150 inline SwNoTextNode *GetNoTextNode();
151 inline const SwNoTextNode *GetNoTextNode() const;
152 inline SwGrfNode *GetGrfNode();
153 inline const SwGrfNode *GetGrfNode() const;
154 inline SwTableNode *GetTableNode();
155 inline const SwTableNode *GetTableNode() const;
156 inline SwSectionNode *GetSectionNode();
157 inline const SwSectionNode *GetSectionNode() const;
159 inline bool IsStartNode() const;
160 inline bool IsContentNode() const;
161 inline bool IsEndNode() const;
162 inline bool IsTextNode() const;
163 inline bool IsTableNode() const;
164 inline bool IsSectionNode() const;
165 inline bool IsOLENode() const;
166 inline bool IsNoTextNode() const;
167 inline bool IsGrfNode() const;
170 Checks if this node is in redlines.
172 @retval true this node is in redlines
173 @retval false else
175 bool IsInRedlines() const;
177 /** Search table node, in which it is. If it is in no table
178 @return 0. */
179 SwTableNode *FindTableNode();
180 inline const SwTableNode *FindTableNode() const;
182 /** Search section node, in which it is. If it is in no section
183 @return 0. */
184 SwSectionNode *FindSectionNode();
185 inline const SwSectionNode *FindSectionNode() const;
187 SwStartNode* FindSttNodeByType( SwStartNodeType eTyp );
188 inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const;
190 const SwStartNode* FindTableBoxStartNode() const
191 { return FindSttNodeByType( SwTableBoxStartNode ); }
192 const SwStartNode* FindFlyStartNode() const
193 { return FindSttNodeByType( SwFlyStartNode ); }
194 const SwStartNode* FindFootnoteStartNode() const
195 { return FindSttNodeByType( SwFootnoteStartNode ); }
196 const SwStartNode* FindHeaderStartNode() const
197 { return FindSttNodeByType( SwHeaderStartNode ); }
198 const SwStartNode* FindFooterStartNode() const
199 { return FindSttNodeByType( SwFooterStartNode ); }
201 /// Node is in which nodes-array/doc?
202 inline SwNodes& GetNodes();
203 inline const SwNodes& GetNodes() const;
204 inline SwDoc* GetDoc();
205 inline const SwDoc* GetDoc() const;
207 /** Provides access to the document setting interface
209 const IDocumentSettingAccess* getIDocumentSettingAccess() const;
211 /** Provides access to the document device interface
213 const IDocumentDeviceAccess* getIDocumentDeviceAccess() const;
215 /** Provides access to the document bookmark interface
217 const IDocumentMarkAccess* getIDocumentMarkAccess() const;
219 /** Provides access to the document redline interface
221 const IDocumentRedlineAccess* getIDocumentRedlineAccess() const;
223 /** Provides access to the document style pool interface
225 const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
227 /** Provides access to the document draw model interface
229 const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
231 /** Provides access to the document layout interface
233 const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
234 IDocumentLayoutAccess* getIDocumentLayoutAccess();
236 /** Provides access to the document links administration interface
238 const IDocumentLinksAdministration* getIDocumentLinksAdministration() const;
239 IDocumentLinksAdministration* getIDocumentLinksAdministration();
241 /** Provides access to the document fields administration interface
243 const IDocumentFieldsAccess* getIDocumentFieldsAccess() const;
244 IDocumentFieldsAccess* getIDocumentFieldsAccess();
246 /** Provides access to the document content operations interface
248 IDocumentContentOperations* getIDocumentContentOperations();
250 /** Provides access to the document automatic styles interface
252 IStyleAccess& getIDocumentStyleAccess();
254 /** Provides access to the document's numbered items interface
256 @author OD
258 IDocumentListItems& getIDocumentListItems();
260 /// Is node in the visible area of the Shell?
261 bool IsInVisibleArea( SwViewShell const * pSh = 0 ) const;
262 /// Is node in an protected area?
263 bool IsInProtectSect() const;
264 /** Is node in something that is protected (range, frame,
265 table cells ... including anchor in case of frames or footnotes)? */
266 bool IsProtect() const;
268 /** Search PageDesc with which this node is formatted. If layout is existent
269 search over layout, else only the hard way is left: search over the nodes
270 to the front!! */
271 const SwPageDesc* FindPageDesc( bool bCalcLay, size_t* pPgDescNdIdx = 0 ) const;
273 /// If node is in a fly return the respective format.
274 SwFrameFormat* GetFlyFormat() const;
276 /// If node is in a table return the respective table box.
277 SwTableBox* GetTableBox() const;
279 inline sal_uLong GetIndex() const { return GetPos(); }
281 const SwTextNode* FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const;
283 sal_uInt8 HasPrevNextLayNode() const;
285 std::vector<SwFrameFormat *> const* GetAnchoredFlys() const { return m_pAnchoredFlys.get(); }
286 void AddAnchoredFly(SwFrameFormat *);
287 void RemoveAnchoredFly(SwFrameFormat *);
290 * Dumps the node structure to the given destination (file nodes.xml in the current directory by default)
291 * @since 3.5
293 virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
295 private:
296 SwNode( const SwNode & rNodes ) SAL_DELETED_FUNCTION;
297 SwNode & operator= ( const SwNode & rNodes ) SAL_DELETED_FUNCTION;
300 /// Starts a section of nodes in the document model.
301 class SwStartNode: public SwNode
303 friend class SwNode;
304 friend class SwNodes;
305 friend class SwEndNode; ///< to set the theEndOfSection !!
307 SwEndNode* pEndOfSection;
308 SwStartNodeType eSttNdTyp;
310 /// for the initial StartNode
311 SwStartNode( SwNodes& rNodes, sal_uLong nPos );
313 protected:
314 SwStartNode( const SwNodeIndex &rWhere,
315 const sal_uInt8 nNodeType = ND_STARTNODE,
316 SwStartNodeType = SwNormalStartNode );
317 public:
318 DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)
320 SwStartNodeType GetStartNodeType() const { return eSttNdTyp; }
322 /// Call ChkCondcoll to all ContentNodes of section.
323 void CheckSectionCondColl() const;
325 virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
327 private:
328 SwStartNode( const SwStartNode & rNode ) SAL_DELETED_FUNCTION;
329 SwStartNode & operator= ( const SwStartNode & rNode ) SAL_DELETED_FUNCTION;
332 /// Ends a section of nodes in the document model.
333 class SwEndNode : public SwNode
335 friend class SwNodes;
336 friend class SwTableNode; ///< To enable creation of its EndNote.
337 friend class SwSectionNode; ///< To enable creation of its EndNote.
339 /// for the initial StartNode
340 SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd );
342 protected:
343 SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd );
345 DECL_FIXEDMEMPOOL_NEWDEL(SwEndNode)
347 private:
348 SwEndNode( const SwEndNode & rNode ) SAL_DELETED_FUNCTION;
349 SwEndNode & operator= ( const SwEndNode & rNode ) SAL_DELETED_FUNCTION;
352 // SwContentNode
354 class SW_DLLPUBLIC SwContentNode: public SwModify, public SwNode, public SwIndexReg
357 //FEATURE::CONDCOLL
358 SwDepend* pCondColl;
359 //FEATURE::CONDCOLL
360 mutable bool mbSetModifyAtAttr;
362 protected:
363 SwContentNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeType,
364 SwFormatColl *pFormatColl );
365 /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
366 from subclasses */
367 virtual ~SwContentNode() = 0;
369 /** Attribute-set for all auto attributes of a ContentNode.
370 (e.g. TextNode or NoTextNode). */
371 std::shared_ptr<const SfxItemSet> mpAttrSet;
373 /// Make respective nodes create the specific AttrSets.
374 virtual void NewAttrSet( SwAttrPool& ) = 0;
376 /** There some functions that like to remove items from the internal
377 SwAttrSet (handle): */
378 sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds );
380 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
382 public:
383 TYPEINFO_OVERRIDE(); /// Already contained in base class Client.
385 /** MakeFrm will be called for a certain layout
386 pSib is another SwFrm of the same layout (e.g. the SwRootFrm itself, a sibling, the parent) */
387 virtual SwContentFrm *MakeFrm( SwFrm* pSib ) = 0;
389 virtual SwContentNode *SplitContentNode(const SwPosition & ) = 0;
391 virtual SwContentNode *JoinNext();
392 virtual SwContentNode *JoinPrev();
393 /** Is it possible to join two nodes?
394 In pIdx the second position can be returned. */
395 bool CanJoinNext( SwNodeIndex* pIdx =0 ) const;
396 bool CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
398 void MakeStartIndex( SwIndex * pIdx ) { pIdx->Assign( this, 0 ); }
399 void MakeEndIndex( SwIndex * pIdx ) { pIdx->Assign( this, Len() ); }
401 bool GoNext(SwIndex *, sal_uInt16 nMode ) const;
402 bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const;
404 /// Replacement for good old GetFrm(..):
405 SwContentFrm *getLayoutFrm( const SwRootFrm*,
406 const Point* pDocPos = 0,
407 const SwPosition *pPos = 0,
408 const bool bCalcFrm = true ) const;
409 /** @return the real size of the frame or an empty rectangle if
410 no layout exists. Needed for export filters. */
411 SwRect FindLayoutRect( const bool bPrtArea = false,
412 const Point* pPoint = 0,
413 const bool bCalcFrm = false ) const;
414 SwRect FindPageFrmRect( const bool bPrtArea = false,
415 const Point* pPoint = 0,
416 const bool bCalcFrm = false ) const;
418 /** Method creates all views of document for given node. The content
419 frames that are created are put in the respective layout. */
420 void MakeFrms( SwContentNode& rNode );
422 /** Method deletes all views of document for the node. The content-
423 frames are removed from the respective layout.
425 Add an input param to identify if acc table should be disposed
427 void DelFrms( bool bIsAccTableDispose = true );
429 /** @return count of elements of node content. Default is 1.
430 There are differences between text node and formula node. */
431 virtual sal_Int32 Len() const;
433 virtual SwContentNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const = 0;
435 /// Get information from Client.
436 virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE;
438 /// SS for PoolItems: hard attributation.
440 /// If bInParent is FALSE search for attribute only in this node.
441 const SfxPoolItem& GetAttr( sal_uInt16 nWhich, bool bInParent=true ) const;
442 bool GetAttr( SfxItemSet& rSet, bool bInParent=true ) const;
443 /// made virtual
444 virtual bool SetAttr( const SfxPoolItem& );
445 virtual bool SetAttr( const SfxItemSet& rSet );
446 virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
447 virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr );
448 virtual sal_uInt16 ResetAllAttr();
450 /// Obtains attribute that is not delivered via conditional style!
451 const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, bool bInParents ) const;
453 /** Does node has already its own auto-attributes?
454 Access to SwAttrSet. */
455 inline const SwAttrSet &GetSwAttrSet() const;
456 inline const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); }
457 inline bool HasSwAttrSet() const { return mpAttrSet != nullptr; }
459 virtual SwFormatColl* ChgFormatColl( SwFormatColl* );
460 SwFormatColl* GetFormatColl() const { return const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn())); }
462 //FEATURE::CONDCOLL
463 inline SwFormatColl& GetAnyFormatColl() const;
464 void SetCondFormatColl( SwFormatColl* );
465 inline SwFormatColl* GetCondFormatColl() const;
467 bool IsAnyCondition( SwCollCondition& rTmp ) const;
468 void ChkCondColl();
469 //FEATURE::CONDCOLL
471 /** Invalidates NumRule at the node. NumRule is updated
472 on EndAction of a Shell at the latest. */
473 bool InvalidateNumRule();
475 /** determines the text direction for a certain
476 position. @return -1, if text direction could *not* be determined. */
477 short GetTextDirection( const SwPosition& rPos,
478 const Point* pPt ) const;
480 inline void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
481 inline bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
483 static SwOLENodes* CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize );
485 //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
486 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
488 private:
489 SwContentNode( const SwContentNode & rNode ) SAL_DELETED_FUNCTION;
490 SwContentNode & operator= ( const SwContentNode & rNode ) SAL_DELETED_FUNCTION;
493 // SwTableNode
495 class SW_DLLPUBLIC SwTableNode : public SwStartNode, public SwModify
497 friend class SwNodes;
498 SwTable* pTable;
499 protected:
500 virtual ~SwTableNode();
502 public:
503 SwTableNode( const SwNodeIndex & );
505 const SwTable& GetTable() const { return *pTable; }
506 SwTable& GetTable() { return *pTable; }
507 SwTabFrm *MakeFrm( SwFrm* );
509 /// Creates the frms for the table node (i.e. the TabFrms).
510 void MakeFrms( SwNodeIndex* pIdxBehind );
512 /** Method deletes all views of document for the node.
513 The content frames are removed from the respective layout. */
514 void DelFrms();
516 /** Method creates all views of the document for the previous node.
517 The content frames that are created are put into the respective layout. */
518 void MakeFrms( const SwNodeIndex & rIdx );
520 SwTableNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
521 void SetNewTable( SwTable* , bool bNewFrames=true );
523 // Removes redline objects that relate to this table from the 'Extra Redlines' table
524 void RemoveRedlines();
526 private:
527 SwTableNode( const SwTableNode & rNode ) SAL_DELETED_FUNCTION;
528 SwTableNode & operator= ( const SwTableNode & rNode ) SAL_DELETED_FUNCTION;
531 class SwSectionNode
532 : public SwStartNode
534 friend class SwNodes;
536 private:
537 SwSectionNode(const SwSectionNode&) SAL_DELETED_FUNCTION;
538 SwSectionNode& operator=(const SwSectionNode&) SAL_DELETED_FUNCTION;
540 std::unique_ptr<SwSection> const m_pSection;
542 protected:
543 virtual ~SwSectionNode();
545 public:
546 SwSectionNode(SwNodeIndex const&,
547 SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase);
549 const SwSection& GetSection() const { return *m_pSection; }
550 SwSection& GetSection() { return *m_pSection; }
552 SwFrm *MakeFrm( SwFrm* );
554 /** Creates the frms for the SectionNode (i.e. the SectionFrms).
555 On default the frames are created until the end of the range.
556 When another NodeIndex pEnd is passed a MakeFrms is called up to it.
557 Used by TableToText. */
558 void MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = NULL );
560 /** Method deletes all views of document for the node. The
561 content frames are removed from the respective layout. */
562 void DelFrms();
564 /** Method creates all views of document for the previous node.
565 The content frames created are put into the respective layout. */
566 void MakeFrms( const SwNodeIndex & rIdx );
568 SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
570 /// Set pointer in format of section on itself.
571 void NodesArrChgd();
573 /** Check for not hidden areas whether there is content that is not in
574 a hidden sub-area. */
575 bool IsContentHidden() const;
579 /** This class is internal, used only during DocumentContentOperationsManager::CopyWithFlyInFly(), and for undo.
581 Some of the nodes are then replaced with SwPlaceholderNode, and at the end of the operation, removed again.
582 FIXME find out if this is really necessary, and if we can avoid creation of the SwPlaceholderNodes in the first place.
584 class SwPlaceholderNode : private SwNode
586 private:
587 friend class SwNodes;
588 SwPlaceholderNode(const SwNodeIndex &rWhere);
591 inline SwEndNode *SwNode::GetEndNode()
593 return ND_ENDNODE == nNodeType ? static_cast<SwEndNode*>(this) : 0;
595 inline const SwEndNode *SwNode::GetEndNode() const
597 return ND_ENDNODE == nNodeType ? static_cast<const SwEndNode*>(this) : 0;
599 inline SwStartNode *SwNode::GetStartNode()
601 return ND_STARTNODE & nNodeType ? static_cast<SwStartNode*>(this) : 0;
603 inline const SwStartNode *SwNode::GetStartNode() const
605 return ND_STARTNODE & nNodeType ? static_cast<const SwStartNode*>(this) : 0;
607 inline SwTableNode *SwNode::GetTableNode()
609 return ND_TABLENODE == nNodeType ? static_cast<SwTableNode*>(this) : 0;
611 inline const SwTableNode *SwNode::GetTableNode() const
613 return ND_TABLENODE == nNodeType ? static_cast<const SwTableNode*>(this) : 0;
615 inline SwSectionNode *SwNode::GetSectionNode()
617 return ND_SECTIONNODE == nNodeType ? static_cast<SwSectionNode*>(this) : 0;
619 inline const SwSectionNode *SwNode::GetSectionNode() const
621 return ND_SECTIONNODE == nNodeType ? static_cast<const SwSectionNode*>(this) : 0;
623 inline SwContentNode *SwNode::GetContentNode()
625 return ND_CONTENTNODE & nNodeType ? static_cast<SwContentNode*>(this) : 0;
627 inline const SwContentNode *SwNode::GetContentNode() const
629 return ND_CONTENTNODE & nNodeType ? static_cast<const SwContentNode*>(this) : 0;
632 inline bool SwNode::IsStartNode() const
634 return (ND_STARTNODE & nNodeType) != 0;
636 inline bool SwNode::IsContentNode() const
638 return (ND_CONTENTNODE & nNodeType) != 0;
640 inline bool SwNode::IsEndNode() const
642 return ND_ENDNODE == nNodeType;
644 inline bool SwNode::IsTextNode() const
646 return ND_TEXTNODE == nNodeType;
648 inline bool SwNode::IsTableNode() const
650 return ND_TABLENODE == nNodeType;
652 inline bool SwNode::IsSectionNode() const
654 return ND_SECTIONNODE == nNodeType;
656 inline bool SwNode::IsNoTextNode() const
658 return (ND_NOTXTNODE & nNodeType) != 0;
660 inline bool SwNode::IsOLENode() const
662 return ND_OLENODE == nNodeType;
664 inline bool SwNode::IsGrfNode() const
666 return ND_GRFNODE == nNodeType;
669 inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
671 return const_cast<SwNode*>(this)->FindSttNodeByType( eTyp );
673 inline const SwTableNode* SwNode::FindTableNode() const
675 return const_cast<SwNode*>(this)->FindTableNode();
677 inline const SwSectionNode* SwNode::FindSectionNode() const
679 return const_cast<SwNode*>(this)->FindSectionNode();
681 inline sal_uLong SwNode::StartOfSectionIndex() const
683 return pStartOfSection->GetIndex();
685 inline sal_uLong SwNode::EndOfSectionIndex() const
687 const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : pStartOfSection;
688 return pStNd->pEndOfSection->GetIndex();
690 inline const SwEndNode* SwNode::EndOfSectionNode() const
692 const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : pStartOfSection;
693 return pStNd->pEndOfSection;
695 inline SwEndNode* SwNode::EndOfSectionNode()
697 const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : pStartOfSection;
698 return pStNd->pEndOfSection;
701 inline SwNodes& SwNode::GetNodes()
703 return static_cast<SwNodes&>(GetArray());
705 inline const SwNodes& SwNode::GetNodes() const
707 return static_cast<SwNodes&>(GetArray());
710 inline SwDoc* SwNode::GetDoc()
712 return GetNodes().GetDoc();
714 inline const SwDoc* SwNode::GetDoc() const
716 return GetNodes().GetDoc();
719 inline SwFormatColl* SwContentNode::GetCondFormatColl() const
721 return pCondColl ? static_cast<SwFormatColl*>(pCondColl->GetRegisteredIn()) : 0;
724 inline SwFormatColl& SwContentNode::GetAnyFormatColl() const
726 return pCondColl && pCondColl->GetRegisteredIn()
727 ? *static_cast<SwFormatColl*>(pCondColl->GetRegisteredIn())
728 : *const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn()));
731 inline const SwAttrSet& SwContentNode::GetSwAttrSet() const
733 return mpAttrSet ? *GetpSwAttrSet() : GetAnyFormatColl().GetAttrSet();
736 //FEATURE::CONDCOLL
738 inline const SfxPoolItem& SwContentNode::GetAttr( sal_uInt16 nWhich,
739 bool bInParents ) const
741 return GetSwAttrSet().Get( nWhich, bInParents );
744 inline SwPlaceholderNode::SwPlaceholderNode(const SwNodeIndex &rWhere)
745 : SwNode(rWhere, ND_PLACEHOLDER)
749 inline SwNodePtr SwNodes::operator[]( sal_uLong n ) const
751 return static_cast<SwNodePtr>(BigPtrArray::operator[] ( n ));
754 #endif
756 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */