Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SW_INC_NODE_HXX
21 : #define INCLUDED_SW_INC_NODE_HXX
22 :
23 : #include <vector>
24 :
25 : #include <boost/utility.hpp>
26 : #include <boost/shared_ptr.hpp>
27 :
28 : #include <sal/types.h>
29 : #include <tools/mempool.hxx>
30 :
31 : #include "swdllapi.h"
32 : #include <ndarr.hxx>
33 : #include <ndtyp.hxx>
34 : #include <index.hxx>
35 : #include <fmtcol.hxx>
36 : #include "docary.hxx"
37 :
38 : // forward declarations
39 :
40 : class SwCntntFrm;
41 : class SwCntntNode;
42 : class SwDoc;
43 : class SwEndNode;
44 : class SwFrm;
45 : class SwFrmFmt;
46 : class SwGrfNode;
47 : class SwNoTxtNode;
48 : class SwNodeIndex;
49 : class SwOLENode;
50 : class SwRect;
51 : class SwSection;
52 : class SwSectionFmt;
53 : class SwTOXBase;
54 : class SwSectionNode;
55 : class SwStartNode;
56 : class SwTabFrm;
57 : class SwRootFrm;
58 : class SwTable;
59 : class SwTableNode;
60 : class SwTableBox;
61 : class SwTxtNode;
62 : class SwPageDesc;
63 : class SwViewShell;
64 : struct SwPosition;
65 : class IStyleAccess;
66 : class IDocumentSettingAccess;
67 : class IDocumentDeviceAccess;
68 : class IDocumentMarkAccess;
69 : class IDocumentRedlineAccess;
70 : class IDocumentStylePoolAccess;
71 : class IDocumentLinksAdministration;
72 : class IDocumentFieldsAccess;
73 : class IDocumentContentOperations;
74 : class IDocumentListItems;
75 : class Point;
76 :
77 : //UUUU
78 : namespace drawinglayer { namespace attribute {
79 : class SdrAllFillAttributesHelper;
80 : typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
81 : }}
82 :
83 : /// Base class of the Writer document model elements.
84 : class SW_DLLPUBLIC SwNode
85 : : private BigPtrEntry
86 : {
87 : friend class SwNodes;
88 :
89 : sal_uInt8 nNodeType;
90 :
91 : /// For text nodes: level of auto format. Was put here because we had still free bits.
92 : sal_uInt8 nAFmtNumLvl : 3;
93 : bool bSetNumLSpace : 1; ///< For numbering: TRUE: set indent.
94 : bool bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the flag
95 :
96 : #ifdef DBG_UTIL
97 : static long s_nSerial;
98 : long m_nSerial;
99 : #endif
100 :
101 : protected:
102 : SwStartNode* pStartOfSection;
103 :
104 : SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeId );
105 :
106 : /// for the initial StartNode
107 : SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNodeId );
108 :
109 : public:
110 : /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
111 : from subclasses */
112 : virtual ~SwNode() = 0;
113 :
114 : #ifdef DBG_UTIL
115 : long GetSerial() const { return m_nSerial; }
116 : #endif
117 :
118 : sal_uInt16 GetSectionLevel() const;
119 :
120 : inline sal_uLong StartOfSectionIndex() const;
121 10956269 : inline const SwStartNode* StartOfSectionNode() const { return pStartOfSection; }
122 1033896 : inline SwStartNode* StartOfSectionNode() { return pStartOfSection; }
123 :
124 : inline sal_uLong EndOfSectionIndex() const;
125 : inline const SwEndNode* EndOfSectionNode() const;
126 : inline SwEndNode* EndOfSectionNode();
127 :
128 0 : inline sal_uInt8 GetAutoFmtLvl() const { return nAFmtNumLvl; }
129 0 : inline void SetAutoFmtLvl( sal_uInt8 nVal ) { nAFmtNumLvl = nVal; }
130 :
131 : inline bool IsSetNumLSpace() const { return bSetNumLSpace; }
132 0 : inline void SetNumLSpace( bool bFlag ) { bSetNumLSpace = bFlag; }
133 :
134 283831 : inline bool IsIgnoreDontExpand() const { return bIgnoreDontExpand; }
135 3932 : inline void SetIgnoreDontExpand( bool bNew ) { bIgnoreDontExpand = bNew; }
136 :
137 808242 : sal_uInt8 GetNodeType() const { return nNodeType; }
138 :
139 : inline SwStartNode *GetStartNode();
140 : inline const SwStartNode *GetStartNode() const;
141 : inline SwCntntNode *GetCntntNode();
142 : inline const SwCntntNode *GetCntntNode() const;
143 : inline SwEndNode *GetEndNode();
144 : inline const SwEndNode *GetEndNode() const;
145 : inline SwTxtNode *GetTxtNode();
146 : inline const SwTxtNode *GetTxtNode() const;
147 : inline SwOLENode *GetOLENode();
148 : inline const SwOLENode *GetOLENode() const;
149 : inline SwNoTxtNode *GetNoTxtNode();
150 : inline const SwNoTxtNode *GetNoTxtNode() const;
151 : inline SwGrfNode *GetGrfNode();
152 : inline const SwGrfNode *GetGrfNode() const;
153 : inline SwTableNode *GetTableNode();
154 : inline const SwTableNode *GetTableNode() const;
155 : inline SwSectionNode *GetSectionNode();
156 : inline const SwSectionNode *GetSectionNode() const;
157 :
158 : inline bool IsStartNode() const;
159 : inline bool IsCntntNode() const;
160 : inline bool IsEndNode() const;
161 : inline bool IsTxtNode() const;
162 : inline bool IsTableNode() const;
163 : inline bool IsSectionNode() const;
164 : inline bool IsOLENode() const;
165 : inline bool IsNoTxtNode() const;
166 : inline bool IsGrfNode() const;
167 :
168 : /**
169 : Checks if this node is in redlines.
170 :
171 : @retval sal_True this node is in redlines
172 : @retval sal_False else
173 : */
174 : bool IsInRedlines() const;
175 :
176 : /** Search table node, in which it is. If it is in no table
177 : @return 0. */
178 : SwTableNode *FindTableNode();
179 : inline const SwTableNode *FindTableNode() const;
180 :
181 : /** Search section node, in which it is. If it is in no section
182 : @return 0. */
183 : SwSectionNode *FindSectionNode();
184 : inline const SwSectionNode *FindSectionNode() const;
185 :
186 : SwStartNode* FindSttNodeByType( SwStartNodeType eTyp );
187 : inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const;
188 :
189 248324 : const SwStartNode* FindTableBoxStartNode() const
190 248324 : { return FindSttNodeByType( SwTableBoxStartNode ); }
191 38400 : const SwStartNode* FindFlyStartNode() const
192 38400 : { return FindSttNodeByType( SwFlyStartNode ); }
193 9276 : const SwStartNode* FindFootnoteStartNode() const
194 9276 : { return FindSttNodeByType( SwFootnoteStartNode ); }
195 7834 : const SwStartNode* FindHeaderStartNode() const
196 7834 : { return FindSttNodeByType( SwHeaderStartNode ); }
197 8332 : const SwStartNode* FindFooterStartNode() const
198 8332 : { return FindSttNodeByType( SwFooterStartNode ); }
199 :
200 : /// Node is in which nodes-array/doc?
201 : inline SwNodes& GetNodes();
202 : inline const SwNodes& GetNodes() const;
203 : inline SwDoc* GetDoc();
204 : inline const SwDoc* GetDoc() const;
205 :
206 : /** Provides access to the document setting interface
207 : */
208 : const IDocumentSettingAccess* getIDocumentSettingAccess() const;
209 :
210 : /** Provides access to the document device interface
211 : */
212 : const IDocumentDeviceAccess* getIDocumentDeviceAccess() const;
213 :
214 : /** Provides access to the document bookmark interface
215 : */
216 : const IDocumentMarkAccess* getIDocumentMarkAccess() const;
217 :
218 : /** Provides access to the document redline interface
219 : */
220 : const IDocumentRedlineAccess* getIDocumentRedlineAccess() const;
221 :
222 : /** Provides access to the document style pool interface
223 : */
224 : const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
225 :
226 : /** Provides access to the document draw model interface
227 : */
228 : const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
229 :
230 : /** Provides access to the document layout interface
231 : */
232 : const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
233 : IDocumentLayoutAccess* getIDocumentLayoutAccess();
234 :
235 : /** Provides access to the document links administration interface
236 : */
237 : const IDocumentLinksAdministration* getIDocumentLinksAdministration() const;
238 : IDocumentLinksAdministration* getIDocumentLinksAdministration();
239 :
240 : /** Provides access to the document fields administration interface
241 : */
242 : const IDocumentFieldsAccess* getIDocumentFieldsAccess() const;
243 : IDocumentFieldsAccess* getIDocumentFieldsAccess();
244 :
245 : /** Provides access to the document content operations interface
246 : */
247 : IDocumentContentOperations* getIDocumentContentOperations();
248 :
249 : /** Provides access to the document automatic styles interface
250 : */
251 : IStyleAccess& getIDocumentStyleAccess();
252 :
253 : /** Provides access to the document's numbered items interface
254 :
255 : @author OD
256 : */
257 : IDocumentListItems& getIDocumentListItems();
258 :
259 : /// Is node in the visible area of the Shell?
260 : bool IsInVisibleArea( SwViewShell const * pSh = 0 ) const;
261 : /// Is node in an protected area?
262 : bool IsInProtectSect() const;
263 : /** Is node in something that is protected (range, frame,
264 : table cells ... including anchor in case of frames or footnotes)? */
265 : bool IsProtect() const;
266 :
267 : /** Search PageDesc with which this node is formated. If layout is existent
268 : search over layout, else only the hard way is left: search over the nodes
269 : to the front!! */
270 : const SwPageDesc* FindPageDesc( bool bCalcLay, sal_uInt32* pPgDescNdIdx = 0 ) const;
271 :
272 : /// If node is in a fly return the respective format.
273 : SwFrmFmt* GetFlyFmt() const;
274 :
275 : /// If node is in a table return the respective table box.
276 : SwTableBox* GetTblBox() const;
277 :
278 90939616 : inline sal_uLong GetIndex() const { return GetPos(); }
279 :
280 : const SwTxtNode* FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const;
281 :
282 : sal_uInt8 HasPrevNextLayNode() const;
283 :
284 : /**
285 : * Dumps the node structure to the given destination (file nodes.xml in the current directory by default)
286 : * @since 3.5
287 : */
288 : virtual void dumpAsXml( xmlTextWriterPtr writer = NULL ) const;
289 :
290 : private:
291 : /// Private constructor because copying is never allowed!!
292 : SwNode( const SwNode & rNodes );
293 : SwNode & operator= ( const SwNode & rNodes );
294 : };
295 :
296 : /// Starts a section of nodes in the document model.
297 171816 : class SwStartNode: public SwNode
298 : {
299 : friend class SwNode;
300 : friend class SwNodes;
301 : friend class SwEndNode; ///< to set the theEndOfSection !!
302 :
303 : SwEndNode* pEndOfSection;
304 : SwStartNodeType eSttNdTyp;
305 :
306 : /// for the initial StartNode
307 : SwStartNode( SwNodes& rNodes, sal_uLong nPos );
308 :
309 : protected:
310 : SwStartNode( const SwNodeIndex &rWhere,
311 : const sal_uInt8 nNodeType = ND_STARTNODE,
312 : SwStartNodeType = SwNormalStartNode );
313 : public:
314 174298 : DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)
315 :
316 4357916 : SwStartNodeType GetStartNodeType() const { return eSttNdTyp; }
317 :
318 : /// Call ChkCondcoll to all ContentNodes of section.
319 : void CheckSectionCondColl() const;
320 :
321 : virtual void dumpAsXml( xmlTextWriterPtr writer = NULL ) const SAL_OVERRIDE;
322 :
323 : private:
324 : /// Private constructor because copying is never allowed!!
325 : SwStartNode( const SwStartNode & rNode );
326 : SwStartNode & operator= ( const SwStartNode & rNode );
327 : };
328 :
329 : /// Ends a section of nodes in the document model.
330 174200 : class SwEndNode : public SwNode
331 : {
332 : friend class SwNodes;
333 : friend class SwTableNode; ///< To enable creation of its EndNote.
334 : friend class SwSectionNode; ///< To enable creation of its EndNote.
335 :
336 : /// for the initial StartNode
337 : SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd );
338 :
339 : protected:
340 : SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd );
341 :
342 174282 : DECL_FIXEDMEMPOOL_NEWDEL(SwEndNode)
343 :
344 : private:
345 : /// Private constructor because copying is never allowed!!
346 : SwEndNode( const SwEndNode & rNode );
347 : SwEndNode & operator= ( const SwEndNode & rNode );
348 : };
349 :
350 : // SwCntntNode
351 :
352 : class SW_DLLPUBLIC SwCntntNode: public SwModify, public SwNode, public SwIndexReg
353 : {
354 :
355 : //FEATURE::CONDCOLL
356 : SwDepend* pCondColl;
357 : //FEATURE::CONDCOLL
358 : mutable bool mbSetModifyAtAttr;
359 :
360 : protected:
361 : SwCntntNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeType,
362 : SwFmtColl *pFmtColl );
363 : /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
364 : from subclasses */
365 : virtual ~SwCntntNode() = 0;
366 :
367 : /** Attribute-set for all auto attributes of a CntntNode.
368 : (e.g. TxtNode or NoTxtNode). */
369 : boost::shared_ptr<const SfxItemSet> mpAttrSet;
370 :
371 : /// Make respective nodes create the specific AttrSets.
372 : virtual void NewAttrSet( SwAttrPool& ) = 0;
373 :
374 : /** There some functions that like to remove items from the internal
375 : SwAttrSet (handle): */
376 : sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds );
377 :
378 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
379 :
380 : public:
381 : TYPEINFO_OVERRIDE(); /// Already contained in base class Client.
382 :
383 : /** MakeFrm will be called for a certain layout
384 : pSib is another SwFrm of the same layout (e.g. the SwRootFrm itself, a sibling, the parent) */
385 : virtual SwCntntFrm *MakeFrm( SwFrm* pSib ) = 0;
386 :
387 : virtual SwCntntNode *SplitCntntNode(const SwPosition & ) = 0;
388 :
389 : virtual SwCntntNode *JoinNext();
390 : virtual SwCntntNode *JoinPrev();
391 : /** Is it possible to join two nodes?
392 : In pIdx the second position can be returned. */
393 : bool CanJoinNext( SwNodeIndex* pIdx =0 ) const;
394 : bool CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
395 :
396 256894 : void MakeStartIndex( SwIndex * pIdx ) { pIdx->Assign( this, 0 ); }
397 153736 : void MakeEndIndex( SwIndex * pIdx ) { pIdx->Assign( this, Len() ); }
398 :
399 : bool GoNext(SwIndex *, sal_uInt16 nMode ) const;
400 : bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const;
401 :
402 : /// Replacement for good old GetFrm(..):
403 : SwCntntFrm *getLayoutFrm( const SwRootFrm*,
404 : const Point* pDocPos = 0,
405 : const SwPosition *pPos = 0,
406 : const bool bCalcFrm = true ) const;
407 : /** @return the real size of the frame or an empty rectangle if
408 : no layout exists. Needed for export filters. */
409 : SwRect FindLayoutRect( const bool bPrtArea = false,
410 : const Point* pPoint = 0,
411 : const bool bCalcFrm = false ) const;
412 : SwRect FindPageFrmRect( const bool bPrtArea = false,
413 : const Point* pPoint = 0,
414 : const bool bCalcFrm = false ) const;
415 :
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 MakeFrms( SwCntntNode& rNode );
419 :
420 : /** Method deletes all views of document for the node. The content-
421 : frames are removed from the respective layout.
422 :
423 : Add an input param to identify if acc table should be disposed
424 : */
425 : void DelFrms( bool bIsAccTableDispose = true );
426 :
427 : /** @return count of elements of node content. Default is 1.
428 : There are differences between text node and formula node. */
429 : virtual sal_Int32 Len() const;
430 :
431 : virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const = 0;
432 :
433 : /// Get information from Client.
434 : virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE;
435 :
436 : /// SS for PoolItems: hard attributation.
437 :
438 : /// If bInParent is FALSE search for attribute only in this node.
439 : const SfxPoolItem& GetAttr( sal_uInt16 nWhich, bool bInParent=true ) const;
440 : bool GetAttr( SfxItemSet& rSet, bool bInParent=true ) const;
441 : /// made virtual
442 : virtual bool SetAttr( const SfxPoolItem& );
443 : virtual bool SetAttr( const SfxItemSet& rSet );
444 : virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
445 : virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr );
446 : virtual sal_uInt16 ResetAllAttr();
447 :
448 : /// Obtains attribute that is not delivered via conditional style!
449 : const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, bool bInParents ) const;
450 :
451 : /** Does node has already its own auto-attributes?
452 : Access to SwAttrSet. */
453 : inline const SwAttrSet &GetSwAttrSet() const;
454 7422660 : inline const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); }
455 768124 : inline bool HasSwAttrSet() const { return mpAttrSet ? sal_True : sal_False; }
456 :
457 : virtual SwFmtColl* ChgFmtColl( SwFmtColl* );
458 96074 : SwFmtColl* GetFmtColl() const { return (SwFmtColl*)GetRegisteredIn(); }
459 :
460 : //FEATURE::CONDCOLL
461 : inline SwFmtColl& GetAnyFmtColl() const;
462 : void SetCondFmtColl( SwFmtColl* );
463 : inline SwFmtColl* GetCondFmtColl() const;
464 :
465 : bool IsAnyCondition( SwCollCondition& rTmp ) const;
466 : void ChkCondColl();
467 : //FEATURE::CONDCOLL
468 :
469 : /** Invalidates NumRule at the node. NumRule is updated
470 : on EndAction of a Shell at the latest. */
471 : bool InvalidateNumRule();
472 :
473 : /** determines the text direction for a certain
474 : position. @return -1, if text direction could *not* be determined. */
475 : short GetTextDirection( const SwPosition& rPos,
476 : const Point* pPt ) const;
477 :
478 142042 : inline void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
479 333500 : inline bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
480 :
481 : static SwOLENodes* CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize );
482 :
483 : //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
484 : virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
485 :
486 : private:
487 : /// Private constructor because copying is never allowed!!
488 : SwCntntNode( const SwCntntNode & rNode );
489 : SwCntntNode & operator= ( const SwCntntNode & rNode );
490 : };
491 :
492 : // SwTableNode
493 :
494 : class SW_DLLPUBLIC SwTableNode : public SwStartNode, public SwModify
495 : {
496 : friend class SwNodes;
497 : SwTable* pTable;
498 : protected:
499 : virtual ~SwTableNode();
500 :
501 : public:
502 : SwTableNode( const SwNodeIndex & );
503 :
504 54996 : const SwTable& GetTable() const { return *pTable; }
505 46514 : SwTable& GetTable() { return *pTable; }
506 : SwTabFrm *MakeFrm( SwFrm* );
507 :
508 : /// Creates the frms for the table node (i.e. the TabFrms).
509 : void MakeFrms( SwNodeIndex* pIdxBehind );
510 :
511 : /** Method deletes all views of document for the node.
512 : The content frames are removed from the respective layout. */
513 : void DelFrms();
514 :
515 : /** Method creates all views of the document for the previous node.
516 : The content frames that are created are put into the respective layout. */
517 : void MakeFrms( const SwNodeIndex & rIdx );
518 :
519 : SwTableNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
520 : void SetNewTable( SwTable* , bool bNewFrames=true );
521 :
522 : // Removes redline objects that relate to this table from the 'Extra Redlines' table
523 : void RemoveRedlines();
524 :
525 : private:
526 : /// Private constructor because copying is never allowed!!
527 : SwTableNode( const SwTableNode & rNode );
528 : SwTableNode & operator= ( const SwTableNode & rNode );
529 : };
530 :
531 : class SwSectionNode
532 : : public SwStartNode
533 : , private ::boost::noncopyable
534 : {
535 : friend class SwNodes;
536 :
537 : private:
538 : ::std::unique_ptr<SwSection> const m_pSection;
539 :
540 : protected:
541 : virtual ~SwSectionNode();
542 :
543 : public:
544 : SwSectionNode(SwNodeIndex const&,
545 : SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase);
546 :
547 5203 : const SwSection& GetSection() const { return *m_pSection; }
548 3572 : SwSection& GetSection() { return *m_pSection; }
549 :
550 : SwFrm *MakeFrm( SwFrm* );
551 :
552 : /** Creates the frms for the SectionNode (i.e. the SectionFrms).
553 : On default the frames are created until the end of the range.
554 : When another NodeIndex pEnd is passed a MakeFrms is called up to it.
555 : Used by TableToText. */
556 : void MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = NULL );
557 :
558 : /** Method deletes all views of document for the node. The
559 : content frames are removed from the respective layout. */
560 : void DelFrms();
561 :
562 : /** Method creates all views of document for the previous node.
563 : The content frames created are put into the respective layout. */
564 : void MakeFrms( const SwNodeIndex & rIdx );
565 :
566 : SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
567 :
568 : /// Set pointer in format of section on itself.
569 : void NodesArrChgd();
570 :
571 : /** Check for not hidden areas whether there is content that is not in
572 : a hidden sub-area. */
573 : bool IsCntntHidden() const;
574 :
575 : };
576 :
577 : /** This class is internal. And quite frankly I don't know what ND_SECTIONDUMMY is for,
578 : the class has been merely created to replace "SwNode( ND_SECTIONDUMMY )", the only case
579 : of instantiating SwNode directly. Now SwNode can be an abstract base class. */
580 36 : class SwDummySectionNode
581 : : private SwNode
582 : {
583 : private:
584 : friend class SwNodes;
585 : SwDummySectionNode( const SwNodeIndex &rWhere );
586 : };
587 :
588 623369 : inline SwEndNode *SwNode::GetEndNode()
589 : {
590 623369 : return ND_ENDNODE == nNodeType ? (SwEndNode*)this : 0;
591 : }
592 0 : inline const SwEndNode *SwNode::GetEndNode() const
593 : {
594 0 : return ND_ENDNODE == nNodeType ? (const SwEndNode*)this : 0;
595 : }
596 368207 : inline SwStartNode *SwNode::GetStartNode()
597 : {
598 368207 : return ND_STARTNODE & nNodeType ? (SwStartNode*)this : 0;
599 : }
600 0 : inline const SwStartNode *SwNode::GetStartNode() const
601 : {
602 0 : return ND_STARTNODE & nNodeType ? (const SwStartNode*)this : 0;
603 : }
604 1256844 : inline SwTableNode *SwNode::GetTableNode()
605 : {
606 1256844 : return ND_TABLENODE == nNodeType ? (SwTableNode*)this : 0;
607 : }
608 1836 : inline const SwTableNode *SwNode::GetTableNode() const
609 : {
610 1836 : return ND_TABLENODE == nNodeType ? (const SwTableNode*)this : 0;
611 : }
612 231120 : inline SwSectionNode *SwNode::GetSectionNode()
613 : {
614 231120 : return ND_SECTIONNODE == nNodeType ? (SwSectionNode*)this : 0;
615 : }
616 32278 : inline const SwSectionNode *SwNode::GetSectionNode() const
617 : {
618 32278 : return ND_SECTIONNODE == nNodeType ? (const SwSectionNode*)this : 0;
619 : }
620 5465700 : inline SwCntntNode *SwNode::GetCntntNode()
621 : {
622 5465700 : return ND_CONTENTNODE & nNodeType ? (SwCntntNode*)this : 0;
623 : }
624 89622 : inline const SwCntntNode *SwNode::GetCntntNode() const
625 : {
626 89622 : return ND_CONTENTNODE & nNodeType ? (const SwCntntNode*)this : 0;
627 : }
628 :
629 1377059 : inline bool SwNode::IsStartNode() const
630 : {
631 1377059 : return ND_STARTNODE & nNodeType ? sal_True : sal_False;
632 : }
633 1995197 : inline bool SwNode::IsCntntNode() const
634 : {
635 1995197 : return ND_CONTENTNODE & nNodeType ? sal_True : sal_False;
636 : }
637 200310 : inline bool SwNode::IsEndNode() const
638 : {
639 200310 : return ND_ENDNODE == nNodeType ? sal_True : sal_False;
640 : }
641 1805583 : inline bool SwNode::IsTxtNode() const
642 : {
643 1805583 : return ND_TEXTNODE == nNodeType ? sal_True : sal_False;
644 : }
645 3343979 : inline bool SwNode::IsTableNode() const
646 : {
647 3343979 : return ND_TABLENODE == nNodeType ? sal_True : sal_False;
648 : }
649 1438734 : inline bool SwNode::IsSectionNode() const
650 : {
651 1438734 : return ND_SECTIONNODE == nNodeType ? sal_True : sal_False;
652 : }
653 7126 : inline bool SwNode::IsNoTxtNode() const
654 : {
655 7126 : return ND_NOTXTNODE & nNodeType ? sal_True : sal_False;
656 : }
657 954 : inline bool SwNode::IsOLENode() const
658 : {
659 954 : return ND_OLENODE == nNodeType ? sal_True : sal_False;
660 : }
661 1362 : inline bool SwNode::IsGrfNode() const
662 : {
663 1362 : return ND_GRFNODE == nNodeType ? sal_True : sal_False;
664 : }
665 :
666 337666 : inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
667 : {
668 337666 : return ((SwNode*)this)->FindSttNodeByType( eTyp );
669 : }
670 255702 : inline const SwTableNode* SwNode::FindTableNode() const
671 : {
672 255702 : return ((SwNode*)this)->FindTableNode();
673 : }
674 57832 : inline const SwSectionNode* SwNode::FindSectionNode() const
675 : {
676 57832 : return ((SwNode*)this)->FindSectionNode();
677 : }
678 267463 : inline sal_uLong SwNode::StartOfSectionIndex() const
679 : {
680 267463 : return pStartOfSection->GetIndex();
681 : }
682 36183 : inline sal_uLong SwNode::EndOfSectionIndex() const
683 : {
684 36183 : const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
685 36183 : return pStNd->pEndOfSection->GetIndex();
686 : }
687 517106 : inline const SwEndNode* SwNode::EndOfSectionNode() const
688 : {
689 517106 : const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
690 517106 : return pStNd->pEndOfSection;
691 : }
692 88286 : inline SwEndNode* SwNode::EndOfSectionNode()
693 : {
694 88286 : SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
695 88286 : return pStNd->pEndOfSection;
696 : }
697 :
698 40719970 : inline SwNodes& SwNode::GetNodes()
699 : {
700 40719970 : return (SwNodes&)GetArray();
701 : }
702 7573209 : inline const SwNodes& SwNode::GetNodes() const
703 : {
704 7573209 : return (SwNodes&)GetArray();
705 : }
706 :
707 6957072 : inline SwDoc* SwNode::GetDoc()
708 : {
709 6957072 : return GetNodes().GetDoc();
710 : }
711 6041281 : inline const SwDoc* SwNode::GetDoc() const
712 : {
713 6041281 : return GetNodes().GetDoc();
714 : }
715 :
716 4914 : inline SwFmtColl* SwCntntNode::GetCondFmtColl() const
717 : {
718 4914 : return pCondColl ? (SwFmtColl*)pCondColl->GetRegisteredIn() : 0;
719 : }
720 :
721 4586414 : inline SwFmtColl& SwCntntNode::GetAnyFmtColl() const
722 : {
723 0 : return pCondColl && pCondColl->GetRegisteredIn()
724 0 : ? *(SwFmtColl*)pCondColl->GetRegisteredIn()
725 4586414 : : *(SwFmtColl*)GetRegisteredIn();
726 : }
727 :
728 9270370 : inline const SwAttrSet& SwCntntNode::GetSwAttrSet() const
729 : {
730 9270370 : return mpAttrSet ? *GetpSwAttrSet() : GetAnyFmtColl().GetAttrSet();
731 : }
732 :
733 : //FEATURE::CONDCOLL
734 :
735 1751069 : inline const SfxPoolItem& SwCntntNode::GetAttr( sal_uInt16 nWhich,
736 : bool bInParents ) const
737 : {
738 1751069 : return GetSwAttrSet().Get( nWhich, bInParents );
739 : }
740 :
741 18 : inline SwDummySectionNode::SwDummySectionNode( const SwNodeIndex &rWhere )
742 18 : : SwNode( rWhere, ND_SECTIONDUMMY )
743 : {
744 18 : }
745 :
746 : #endif
747 :
748 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|