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 SW_NODE_HXX
21 : #define SW_NODE_HXX
22 :
23 : #include <vector>
24 :
25 : #include <boost/utility.hpp>
26 : #include <boost/shared_ptr.hpp>
27 :
28 : #include <tools/mempool.hxx>
29 : #include <tools/gen.hxx>
30 :
31 : #include "swdllapi.h"
32 : #include <ndarr.hxx>
33 : #include <ndtyp.hxx>
34 : #include <index.hxx>
35 : #include <fmtcol.hxx>
36 :
37 : // ---------------------
38 : // forward declarations
39 : // ---------------------
40 :
41 : class SwCntntFrm;
42 : class SwCntntNode;
43 : class SwDoc;
44 : class SwEndNode;
45 : class SwFrm;
46 : class SwFrmFmt;
47 : class SwGrfNode;
48 : class SwNoTxtNode;
49 : class SwNodeIndex;
50 : class SwOLENode;
51 : class SwRect;
52 : class SwSection;
53 : class SwSectionFmt;
54 : class SwTOXBase;
55 : class SwSectionNode;
56 : class SwStartNode;
57 : class SwTabFrm;
58 : class SwRootFrm;
59 : class SwTable;
60 : class SwTableNode;
61 : class SwTableBox;
62 : class SwTxtNode;
63 : class SwPageDesc;
64 : class ViewShell;
65 : struct SwPosition;
66 : class IStyleAccess;
67 : class IDocumentSettingAccess;
68 : class IDocumentDeviceAccess;
69 : class IDocumentMarkAccess;
70 : class IDocumentRedlineAccess;
71 : class IDocumentStylePoolAccess;
72 : class IDocumentLineNumberAccess;
73 : class IDocumentLinksAdministration;
74 : class IDocumentFieldsAccess;
75 : class IDocumentContentOperations;
76 : class IDocumentListItems;
77 : class SwOLENodes;
78 :
79 : /// Base class of the Writer document model elements.
80 : class SW_DLLPUBLIC SwNode
81 : : private BigPtrEntry
82 : {
83 : friend class SwNodes;
84 :
85 : sal_uInt8 nNodeType;
86 :
87 : /// For text nodes: level of auto format. Was put here because we had still free bits.
88 : sal_uInt8 nAFmtNumLvl : 3;
89 : bool bSetNumLSpace : 1; ///< For numbering: TRUE: set indent.
90 : bool bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the flag
91 :
92 : #ifdef DBG_UTIL
93 : static long s_nSerial;
94 : long m_nSerial;
95 : #endif
96 :
97 : protected:
98 : SwStartNode* pStartOfSection;
99 :
100 : SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeId );
101 :
102 : /// for the initial StartNode
103 : SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNodeId );
104 :
105 : public:
106 : /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
107 : from subclasses */
108 : virtual ~SwNode() = 0;
109 :
110 : #ifdef DBG_UTIL
111 : long GetSerial() const { return m_nSerial; }
112 : #endif
113 :
114 : sal_uInt16 GetSectionLevel() const;
115 :
116 : inline sal_uLong StartOfSectionIndex() const;
117 11777 : inline const SwStartNode* StartOfSectionNode() const { return pStartOfSection; }
118 17799 : inline SwStartNode* StartOfSectionNode() { return pStartOfSection; }
119 :
120 : inline sal_uLong EndOfSectionIndex() const;
121 : inline const SwEndNode* EndOfSectionNode() const;
122 : inline SwEndNode* EndOfSectionNode();
123 :
124 0 : inline sal_uInt8 GetAutoFmtLvl() const { return nAFmtNumLvl; }
125 0 : inline void SetAutoFmtLvl( sal_uInt8 nVal ) { nAFmtNumLvl = nVal; }
126 :
127 : inline bool IsSetNumLSpace() const { return bSetNumLSpace; }
128 0 : inline void SetNumLSpace( bool bFlag ) { bSetNumLSpace = bFlag; }
129 :
130 48346 : inline bool IsIgnoreDontExpand() const { return bIgnoreDontExpand; }
131 1292 : inline void SetIgnoreDontExpand( bool bNew ) { bIgnoreDontExpand = bNew; }
132 :
133 14091 : sal_uInt8 GetNodeType() const { return nNodeType; }
134 :
135 : inline SwStartNode *GetStartNode();
136 : inline const SwStartNode *GetStartNode() const;
137 : inline SwCntntNode *GetCntntNode();
138 : inline const SwCntntNode *GetCntntNode() const;
139 : inline SwEndNode *GetEndNode();
140 : inline const SwEndNode *GetEndNode() const;
141 : inline SwTxtNode *GetTxtNode();
142 : inline const SwTxtNode *GetTxtNode() const;
143 : inline SwOLENode *GetOLENode();
144 : inline const SwOLENode *GetOLENode() const;
145 : inline SwNoTxtNode *GetNoTxtNode();
146 : inline const SwNoTxtNode *GetNoTxtNode() const;
147 : inline SwGrfNode *GetGrfNode();
148 : inline const SwGrfNode *GetGrfNode() const;
149 : inline SwTableNode *GetTableNode();
150 : inline const SwTableNode *GetTableNode() const;
151 : inline SwSectionNode *GetSectionNode();
152 : inline const SwSectionNode *GetSectionNode() const;
153 :
154 : inline sal_Bool IsStartNode() const;
155 : inline sal_Bool IsCntntNode() const;
156 : inline sal_Bool IsEndNode() const;
157 : inline sal_Bool IsTxtNode() const;
158 : inline sal_Bool IsTableNode() const;
159 : inline sal_Bool IsSectionNode() const;
160 : inline sal_Bool IsOLENode() const;
161 : inline sal_Bool IsNoTxtNode() const;
162 : inline sal_Bool IsGrfNode() const;
163 :
164 : /**
165 : Checks if this node is in redlines.
166 :
167 : @retval sal_True this node is in redlines
168 : @retval sal_False else
169 : */
170 : sal_Bool IsInRedlines() const;
171 :
172 : /** Search table node, in which it is. If it is in no table
173 : @return 0. */
174 : SwTableNode *FindTableNode();
175 : inline const SwTableNode *FindTableNode() const;
176 :
177 : /** Search section node, in which it is. If it is in no section
178 : @return 0. */
179 : SwSectionNode *FindSectionNode();
180 : inline const SwSectionNode *FindSectionNode() const;
181 :
182 : SwStartNode* FindSttNodeByType( SwStartNodeType eTyp );
183 : inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const;
184 :
185 1659 : const SwStartNode* FindTableBoxStartNode() const
186 1659 : { return FindSttNodeByType( SwTableBoxStartNode ); }
187 42 : const SwStartNode* FindFlyStartNode() const
188 42 : { return FindSttNodeByType( SwFlyStartNode ); }
189 9 : const SwStartNode* FindFootnoteStartNode() const
190 9 : { return FindSttNodeByType( SwFootnoteStartNode ); }
191 23 : const SwStartNode* FindHeaderStartNode() const
192 23 : { return FindSttNodeByType( SwHeaderStartNode ); }
193 21 : const SwStartNode* FindFooterStartNode() const
194 21 : { return FindSttNodeByType( SwFooterStartNode ); }
195 :
196 : /// Node is in which nodes-array/doc?
197 : inline SwNodes& GetNodes();
198 : inline const SwNodes& GetNodes() const;
199 : inline SwDoc* GetDoc();
200 : inline const SwDoc* GetDoc() const;
201 :
202 : /** Provides access to the document setting interface
203 : */
204 : const IDocumentSettingAccess* getIDocumentSettingAccess() const;
205 :
206 : /** Provides access to the document device interface
207 : */
208 : const IDocumentDeviceAccess* getIDocumentDeviceAccess() const;
209 :
210 : /** Provides access to the document bookmark interface
211 : */
212 : const IDocumentMarkAccess* getIDocumentMarkAccess() const;
213 :
214 : /** Provides access to the document redline interface
215 : */
216 : const IDocumentRedlineAccess* getIDocumentRedlineAccess() const;
217 :
218 : /** Provides access to the document style pool interface
219 : */
220 : const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
221 :
222 : /** Provides access to the document line number information interface
223 : */
224 : const IDocumentLineNumberAccess* getIDocumentLineNumberAccess() 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 : sal_Bool IsInVisibleArea( ViewShell* 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 : sal_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( sal_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 2142786 : 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 );
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 3858 : 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 6195 : DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)
315 :
316 13433 : 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 );
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 :
330 : /// Ends a section of nodes in the document model.
331 3904 : class SwEndNode : public SwNode
332 : {
333 : friend class SwNodes;
334 : friend class SwTableNode; ///< To enable creation of its EndNote.
335 : friend class SwSectionNode; ///< To enable creation of its EndNote.
336 :
337 : /// for the initial StartNode
338 : SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd );
339 :
340 : protected:
341 : SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd );
342 :
343 6195 : DECL_FIXEDMEMPOOL_NEWDEL(SwEndNode)
344 :
345 : private:
346 : /// Private constructor because copying is never allowed!!
347 : SwEndNode( const SwEndNode & rNode );
348 : SwEndNode & operator= ( const SwEndNode & rNode );
349 : };
350 :
351 :
352 : // --------------------
353 : // SwCntntNode
354 : // --------------------
355 : class SW_DLLPUBLIC SwCntntNode: public SwModify, public SwNode, public SwIndexReg
356 : {
357 :
358 : //FEATURE::CONDCOLL
359 : SwDepend* pCondColl;
360 : //FEATURE::CONDCOLL
361 : mutable bool mbSetModifyAtAttr;
362 :
363 : protected:
364 : SwCntntNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeType,
365 : SwFmtColl *pFmtColl );
366 : /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
367 : from subclasses */
368 : virtual ~SwCntntNode() = 0;
369 :
370 : /** Attribute-set for all auto attributes of a CntntNode.
371 : (e.g. TxtNode or NoTxtNode). */
372 : boost::shared_ptr<const SfxItemSet> mpAttrSet;
373 :
374 : /// Make respective nodes create the specific AttrSets.
375 : virtual void NewAttrSet( SwAttrPool& ) = 0;
376 :
377 : /** There some functions that like to remove items from the internal
378 : SwAttrSet (handle): */
379 : sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds );
380 :
381 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
382 :
383 : public:
384 : TYPEINFO(); /// Already contained in base class Client.
385 :
386 : /** MakeFrm will be called for a certain layout
387 : pSib is another SwFrm of the same layout (e.g. the SwRootFrm itself, a sibling, the parent) */
388 : virtual SwCntntFrm *MakeFrm( SwFrm* pSib ) = 0;
389 :
390 : virtual SwCntntNode *SplitCntntNode(const SwPosition & ) = 0;
391 :
392 : virtual SwCntntNode *JoinNext();
393 : virtual SwCntntNode *JoinPrev();
394 : /** Is it possible to join two nodes?
395 : In pIdx the second position can be returned. */
396 : int CanJoinNext( SwNodeIndex* pIdx =0 ) const;
397 : int CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
398 :
399 3296 : void MakeStartIndex( SwIndex * pIdx ) { pIdx->Assign( this, 0 ); }
400 1994 : void MakeEndIndex( SwIndex * pIdx ) { pIdx->Assign( this, Len() ); }
401 :
402 : sal_Bool GoNext(SwIndex *, sal_uInt16 nMode ) const;
403 : sal_Bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const;
404 :
405 : /// Replacement for good old GetFrm(..):
406 : SwCntntFrm *getLayoutFrm( const SwRootFrm*,
407 : const Point* pDocPos = 0,
408 : const SwPosition *pPos = 0,
409 : const sal_Bool bCalcFrm = sal_True ) 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 sal_Bool bPrtArea = sal_False,
413 : const Point* pPoint = 0,
414 : const sal_Bool bCalcFrm = sal_False ) const;
415 : SwRect FindPageFrmRect( const sal_Bool bPrtArea = sal_False,
416 : const Point* pPoint = 0,
417 : const sal_Bool bCalcFrm = sal_False ) const;
418 :
419 : /** Method creates all views of document for given node. The content
420 : frames that are created are put in the respective layout. */
421 : void MakeFrms( SwCntntNode& rNode );
422 :
423 : /** Method deletes all views of document for the node. The content-
424 : frames are removed from the respective layout. */
425 : void DelFrms();
426 :
427 : /** @return count of elements of node content. Default is 1.
428 : There are differences between text node and formula node. */
429 : virtual xub_StrLen Len() const;
430 :
431 : virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const = 0;
432 :
433 : /// Get information from Client.
434 : virtual bool GetInfo( SfxPoolItem& ) const;
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, sal_Bool bInParent=sal_True ) const;
440 : sal_Bool GetAttr( SfxItemSet& rSet, sal_Bool bInParent=sal_True ) const;
441 : /// made virtual
442 : virtual sal_Bool SetAttr( const SfxPoolItem& );
443 : virtual sal_Bool SetAttr( const SfxItemSet& rSet );
444 : virtual sal_Bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
445 : virtual sal_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, sal_Bool bInParents ) const;
450 :
451 : /** Does node has already its own auto-attributes?
452 : Access to SwAttrSet. */
453 : inline const SwAttrSet &GetSwAttrSet() const;
454 233832 : inline const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); }
455 27880 : inline sal_Bool HasSwAttrSet() const { return mpAttrSet ? sal_True : sal_False; }
456 :
457 : virtual SwFmtColl* ChgFmtColl( SwFmtColl* );
458 5871 : 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 : sal_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 : sal_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 11035 : inline void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
479 21982 : inline bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
480 :
481 : static SwOLENodes* CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize );
482 :
483 : private:
484 : /// Private constructor because copying is never allowed!!
485 : SwCntntNode( const SwCntntNode & rNode );
486 : SwCntntNode & operator= ( const SwCntntNode & rNode );
487 : };
488 :
489 :
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 2061 : const SwTable& GetTable() const { return *pTable; }
505 1174 : 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* , sal_Bool bNewFrames=sal_True );
521 :
522 : private:
523 : /// Private constructor because copying is never allowed!!
524 : SwTableNode( const SwTableNode & rNode );
525 : SwTableNode & operator= ( const SwTableNode & rNode );
526 : };
527 :
528 :
529 : //---------
530 : // SwSectionNode
531 : //---------
532 : class SwSectionNode
533 : : public SwStartNode
534 : , private ::boost::noncopyable
535 : {
536 : friend class SwNodes;
537 :
538 : private:
539 : ::std::auto_ptr<SwSection> const m_pSection;
540 :
541 : protected:
542 : virtual ~SwSectionNode();
543 :
544 : public:
545 : SwSectionNode(SwNodeIndex const&,
546 : SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase);
547 :
548 81 : const SwSection& GetSection() const { return *m_pSection; }
549 47 : SwSection& GetSection() { return *m_pSection; }
550 :
551 : SwFrm *MakeFrm( SwFrm* );
552 :
553 : /** Creates the frms for the SectionNode (i.e. the SectionFrms).
554 : On default the frames are created until the end of the range.
555 : When another NodeIndex pEnd is passed a MakeFrms is called up to it.
556 : Used by TableToText. */
557 : void MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = NULL );
558 :
559 : /** Method deletes all views of document for the node. The
560 : content frames are removed from the respective layout. */
561 : void DelFrms();
562 :
563 : /** Method creates all views of document for the previous node.
564 : The content frames created are put into the respective layout. */
565 : void MakeFrms( const SwNodeIndex & rIdx );
566 :
567 : SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
568 :
569 : /// Set pointer in format of section on itself.
570 : void NodesArrChgd();
571 :
572 : // ueberprueft bei _nicht_ versteckten Bereichen, ob es Inhalt gibt, der
573 : // _nicht_ in einem versteckten (Unter-)Bereich liegt
574 : /** Check for not hidden areas whether there is content that is not in
575 : a hidden sub-area. */
576 : sal_Bool IsCntntHidden() const;
577 :
578 :
579 : };
580 :
581 :
582 : //----------------
583 : // SwDummySectionNode
584 : //----------------
585 :
586 : /** This class is internal. And quite frankly I don't know what ND_SECTIONDUMMY is for,
587 : the class has been merely created to replace "SwNode( ND_SECTIONDUMMY )", the only case
588 : of instantiating SwNode directly. Now SwNode can be an abstract base class. */
589 0 : class SwDummySectionNode
590 : : private SwNode
591 : {
592 : private:
593 : friend class SwNodes;
594 : SwDummySectionNode( const SwNodeIndex &rWhere );
595 : };
596 :
597 :
598 13500 : inline SwEndNode *SwNode::GetEndNode()
599 : {
600 13500 : return ND_ENDNODE == nNodeType ? (SwEndNode*)this : 0;
601 : }
602 0 : inline const SwEndNode *SwNode::GetEndNode() const
603 : {
604 0 : return ND_ENDNODE == nNodeType ? (const SwEndNode*)this : 0;
605 : }
606 16822 : inline SwStartNode *SwNode::GetStartNode()
607 : {
608 16822 : return ND_STARTNODE & nNodeType ? (SwStartNode*)this : 0;
609 : }
610 0 : inline const SwStartNode *SwNode::GetStartNode() const
611 : {
612 0 : return ND_STARTNODE & nNodeType ? (const SwStartNode*)this : 0;
613 : }
614 17148 : inline SwTableNode *SwNode::GetTableNode()
615 : {
616 17148 : return ND_TABLENODE == nNodeType ? (SwTableNode*)this : 0;
617 : }
618 0 : inline const SwTableNode *SwNode::GetTableNode() const
619 : {
620 0 : return ND_TABLENODE == nNodeType ? (const SwTableNode*)this : 0;
621 : }
622 4275 : inline SwSectionNode *SwNode::GetSectionNode()
623 : {
624 4275 : return ND_SECTIONNODE == nNodeType ? (SwSectionNode*)this : 0;
625 : }
626 558 : inline const SwSectionNode *SwNode::GetSectionNode() const
627 : {
628 558 : return ND_SECTIONNODE == nNodeType ? (const SwSectionNode*)this : 0;
629 : }
630 305551 : inline SwCntntNode *SwNode::GetCntntNode()
631 : {
632 305551 : return ND_CONTENTNODE & nNodeType ? (SwCntntNode*)this : 0;
633 : }
634 1176 : inline const SwCntntNode *SwNode::GetCntntNode() const
635 : {
636 1176 : return ND_CONTENTNODE & nNodeType ? (const SwCntntNode*)this : 0;
637 : }
638 :
639 :
640 16564 : inline sal_Bool SwNode::IsStartNode() const
641 : {
642 16564 : return ND_STARTNODE & nNodeType ? sal_True : sal_False;
643 : }
644 30963 : inline sal_Bool SwNode::IsCntntNode() const
645 : {
646 30963 : return ND_CONTENTNODE & nNodeType ? sal_True : sal_False;
647 : }
648 3326 : inline sal_Bool SwNode::IsEndNode() const
649 : {
650 3326 : return ND_ENDNODE == nNodeType ? sal_True : sal_False;
651 : }
652 83940 : inline sal_Bool SwNode::IsTxtNode() const
653 : {
654 83940 : return ND_TEXTNODE == nNodeType ? sal_True : sal_False;
655 : }
656 50789 : inline sal_Bool SwNode::IsTableNode() const
657 : {
658 50789 : return ND_TABLENODE == nNodeType ? sal_True : sal_False;
659 : }
660 21979 : inline sal_Bool SwNode::IsSectionNode() const
661 : {
662 21979 : return ND_SECTIONNODE == nNodeType ? sal_True : sal_False;
663 : }
664 379 : inline sal_Bool SwNode::IsNoTxtNode() const
665 : {
666 379 : return ND_NOTXTNODE & nNodeType ? sal_True : sal_False;
667 : }
668 44 : inline sal_Bool SwNode::IsOLENode() const
669 : {
670 44 : return ND_OLENODE == nNodeType ? sal_True : sal_False;
671 : }
672 166 : inline sal_Bool SwNode::IsGrfNode() const
673 : {
674 166 : return ND_GRFNODE == nNodeType ? sal_True : sal_False;
675 : }
676 :
677 1973 : inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
678 : {
679 1973 : return ((SwNode*)this)->FindSttNodeByType( eTyp );
680 : }
681 6638 : inline const SwTableNode* SwNode::FindTableNode() const
682 : {
683 6638 : return ((SwNode*)this)->FindTableNode();
684 : }
685 1474 : inline const SwSectionNode* SwNode::FindSectionNode() const
686 : {
687 1474 : return ((SwNode*)this)->FindSectionNode();
688 : }
689 24240 : inline sal_uLong SwNode::StartOfSectionIndex() const
690 : {
691 24240 : return pStartOfSection->GetIndex();
692 : }
693 1465 : inline sal_uLong SwNode::EndOfSectionIndex() const
694 : {
695 1465 : const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
696 1465 : return pStNd->pEndOfSection->GetIndex();
697 : }
698 7427 : inline const SwEndNode* SwNode::EndOfSectionNode() const
699 : {
700 7427 : const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
701 7427 : return pStNd->pEndOfSection;
702 : }
703 1147 : inline SwEndNode* SwNode::EndOfSectionNode()
704 : {
705 1147 : SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
706 1147 : return pStNd->pEndOfSection;
707 : }
708 :
709 1778555 : inline SwNodes& SwNode::GetNodes()
710 : {
711 1778555 : return (SwNodes&)GetArray();
712 : }
713 163401 : inline const SwNodes& SwNode::GetNodes() const
714 : {
715 163401 : return (SwNodes&)GetArray();
716 : }
717 :
718 284103 : inline SwDoc* SwNode::GetDoc()
719 : {
720 284103 : return GetNodes().GetDoc();
721 : }
722 141000 : inline const SwDoc* SwNode::GetDoc() const
723 : {
724 141000 : return GetNodes().GetDoc();
725 : }
726 :
727 22 : inline SwFmtColl* SwCntntNode::GetCondFmtColl() const
728 : {
729 22 : return pCondColl ? (SwFmtColl*)pCondColl->GetRegisteredIn() : 0;
730 : }
731 :
732 :
733 113288 : inline SwFmtColl& SwCntntNode::GetAnyFmtColl() const
734 : {
735 0 : return pCondColl && pCondColl->GetRegisteredIn()
736 0 : ? *(SwFmtColl*)pCondColl->GetRegisteredIn()
737 113288 : : *(SwFmtColl*)GetRegisteredIn();
738 : }
739 :
740 218472 : inline const SwAttrSet& SwCntntNode::GetSwAttrSet() const
741 : {
742 218472 : return mpAttrSet ? *GetpSwAttrSet() : GetAnyFmtColl().GetAttrSet();
743 : }
744 :
745 : //FEATURE::CONDCOLL
746 :
747 73149 : inline const SfxPoolItem& SwCntntNode::GetAttr( sal_uInt16 nWhich,
748 : sal_Bool bInParents ) const
749 : {
750 73149 : return GetSwAttrSet().Get( nWhich, bInParents );
751 : }
752 :
753 0 : inline SwDummySectionNode::SwDummySectionNode( const SwNodeIndex &rWhere )
754 0 : : SwNode( rWhere, ND_SECTIONDUMMY )
755 : {
756 0 : }
757 :
758 : #endif
759 :
760 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|