xref: /aoo4110/main/sw/inc/node.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SW_NODE_HXX
25 #define SW_NODE_HXX
26 
27 #include <vector>
28 
29 #include <boost/utility.hpp>
30 #include <boost/shared_ptr.hpp>
31 
32 #include <tools/mempool.hxx>
33 #include <tools/gen.hxx>
34 
35 #include "swdllapi.h"
36 #include <ndarr.hxx>
37 #include <ndtyp.hxx>
38 #include <index.hxx>
39 #include <fmtcol.hxx>
40 
41 // ---------------------
42 // forward Deklarationen
43 // ---------------------
44 
45 class SvUShorts;
46 class SwCntntFrm;
47 class SwCntntNode;
48 class SwDoc;
49 class SwEndNode;
50 class SwFrm;
51 class SwFrmFmt;
52 class SwGrfNode;
53 class SwNoTxtNode;
54 class SwNodeIndex;
55 class SwOLENode;
56 class SwRect;
57 class SwSection;
58 class SwSectionFmt;
59 class SwTOXBase;
60 class SwSectionNode;
61 class SwStartNode;
62 class SwTabFrm;
63 class SwRootFrm;
64 class SwTable;
65 class SwTableNode;
66 class SwTableBox;
67 class SwTxtNode;
68 class SwPageDesc;
69 class ViewShell;
70 struct SwPosition;
71 class IStyleAccess;
72 class IDocumentSettingAccess;
73 class IDocumentDeviceAccess;
74 class IDocumentMarkAccess;
75 class IDocumentRedlineAccess;
76 class IDocumentStylePoolAccess;
77 class IDocumentLineNumberAccess;
78 class IDocumentLinksAdministration;
79 class IDocumentFieldsAccess;
80 class IDocumentContentOperations;
81 class IDocumentListItems;
82 class SwOLENodes;
83 
84 // --------------------
85 // class SwNode
86 // --------------------
87 class SW_DLLPUBLIC SwNode : private /* public*/ BigPtrEntry
88 {
89 	friend class SwNodes;
90 
91 #ifdef DBG_UTIL
92     static long nSerial;
93     long nMySerial;
94 #endif
95 
96 	sal_uInt8 nNodeType;
97 
98 	// JP 28.03.96
99 	// fuer Textnodes: Stufungslevel der Autoformatierung. Ist erstmal hier
100 	//					gelandet, weil noch Bits frei sind
101 	sal_uInt8 nAFmtNumLvl : 3;
102 	sal_Bool bSetNumLSpace : 1;			// fuer Numerierung: sal_True Einzug setzen
103 	sal_Bool bIgnoreDontExpand : 1;		// for Text Attributes - ignore the flag
104 
105 protected:
106 	SwStartNode* pStartOfSection;
107 
108 	SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeId );
109 
110 	// fuer den initialen StartNode
111 	SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNodeId );
112 
113 public:
114 	virtual ~SwNode();
115 
116 #ifdef DBG_UTIL
GetSerial() const117     long int GetSerial() const { return nMySerial; }
118 #endif
119 
120 	sal_uInt16 GetSectionLevel() const;
121 
122     inline sal_uLong StartOfSectionIndex() const;
StartOfSectionNode() const123     inline const SwStartNode* StartOfSectionNode() const { return pStartOfSection; }
StartOfSectionNode()124     inline       SwStartNode* StartOfSectionNode() { return pStartOfSection; }
125 
126     inline sal_uLong EndOfSectionIndex() const;
127     inline const SwEndNode* EndOfSectionNode() const;
128     inline         SwEndNode* EndOfSectionNode();
129 
GetAutoFmtLvl() const130     inline sal_uInt8 GetAutoFmtLvl() const     { return nAFmtNumLvl; }
SetAutoFmtLvl(sal_uInt8 nVal)131     inline void SetAutoFmtLvl( sal_uInt8 nVal )      { nAFmtNumLvl = nVal; }
132 
IsSetNumLSpace() const133     inline sal_Bool IsSetNumLSpace() const  { return bSetNumLSpace; }
SetNumLSpace(sal_Bool bFlag)134     inline void SetNumLSpace( sal_Bool bFlag )        { bSetNumLSpace = bFlag; }
135 
IsIgnoreDontExpand() const136     inline sal_Bool IsIgnoreDontExpand() const  { return bIgnoreDontExpand; }
SetIgnoreDontExpand(sal_Bool bNew)137     inline void SetIgnoreDontExpand( sal_Bool bNew )  { bIgnoreDontExpand = bNew; }
138 
GetNodeType() const139 	sal_uInt8 	GetNodeType() const { return nNodeType; }
140 
141     inline       SwStartNode *GetStartNode();
142     inline const SwStartNode *GetStartNode() const;
143     inline       SwCntntNode *GetCntntNode();
144     inline const SwCntntNode *GetCntntNode() const;
145     inline       SwEndNode   *GetEndNode();
146     inline const SwEndNode   *GetEndNode() const;
147 #ifndef	 ICC
148   inline
149 #endif
150 	SwTxtNode   *GetTxtNode();
151 
152 #ifndef	 ICC
153   inline
154 #endif
155 	const SwTxtNode   *GetTxtNode() const;
156     inline        SwOLENode   *GetOLENode();
157     inline  const SwOLENode   *GetOLENode() const;
158     inline        SwNoTxtNode *GetNoTxtNode();
159     inline  const SwNoTxtNode *GetNoTxtNode() const;
160     inline        SwGrfNode   *GetGrfNode();
161     inline  const SwGrfNode   *GetGrfNode() const;
162     inline       SwTableNode *GetTableNode();
163     inline const SwTableNode *GetTableNode() const;
164     inline       SwSectionNode *GetSectionNode();
165     inline const SwSectionNode *GetSectionNode() const;
166 
167     inline sal_Bool IsStartNode() const;
168     inline sal_Bool IsCntntNode() const;
169     inline sal_Bool IsEndNode() const;
170     inline sal_Bool IsTxtNode() const;
171     inline sal_Bool IsTableNode() const;
172     inline sal_Bool IsSectionNode() const;
173     inline sal_Bool IsOLENode() const;
174     inline sal_Bool IsNoTxtNode() const;
175     inline sal_Bool IsGrfNode() const;
176 
177     /**
178        Checks if this node is in redlines.
179 
180        @retval sal_True       this node is in redlines
181        @retval sal_False      else
182      */
183     sal_Bool IsInRedlines() const;
184 
185 	// suche den TabellenNode, in dem dieser steht. Wenn in keiner
186 	// Tabelle wird 0 returnt.
187 					SwTableNode *FindTableNode();
188     inline const  SwTableNode *FindTableNode() const;
189 
190 	// suche den SectionNode, in dem dieser steht. Wenn es in keiner
191 	// Section steht wird 0 returnt.
192 					SwSectionNode *FindSectionNode();
193     inline    const   SwSectionNode *FindSectionNode() const;
194 
195     SwStartNode* FindSttNodeByType( SwStartNodeType eTyp );
196     inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const;
197 
FindTableBoxStartNode() const198 	const SwStartNode* FindTableBoxStartNode() const
199 						{ return FindSttNodeByType( SwTableBoxStartNode ); }
FindFlyStartNode() const200 	const SwStartNode* FindFlyStartNode() const
201 						{ return FindSttNodeByType( SwFlyStartNode ); }
FindFootnoteStartNode() const202 	const SwStartNode* FindFootnoteStartNode() const
203 						{ return FindSttNodeByType( SwFootnoteStartNode ); }
FindHeaderStartNode() const204 	const SwStartNode* FindHeaderStartNode() const
205 						{ return FindSttNodeByType( SwHeaderStartNode ); }
FindFooterStartNode() const206 	const SwStartNode* FindFooterStartNode() const
207 						{ return FindSttNodeByType( SwFooterStartNode ); }
208 
209 		// in welchem Nodes-Array/Doc steht der Node ?
210     inline          SwNodes& GetNodes();
211     inline const  SwNodes& GetNodes() const;
212     inline            SwDoc* GetDoc();
213     inline const  SwDoc* GetDoc() const;
214 
215     /** Provides access to the document setting interface
216      */
217     const IDocumentSettingAccess* getIDocumentSettingAccess() const;
218 
219     /** Provides access to the document device interface
220      */
221     const IDocumentDeviceAccess* getIDocumentDeviceAccess() const;
222 
223     /** Provides access to the document bookmark interface
224      */
225     const IDocumentMarkAccess* getIDocumentMarkAccess() const;
226 
227     /** Provides access to the document redline interface
228      */
229     const IDocumentRedlineAccess* getIDocumentRedlineAccess() const;
230 
231     /** Provides access to the document style pool interface
232      */
233     const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
234 
235     /** Provides access to the document line number information interface
236      */
237     const IDocumentLineNumberAccess* getIDocumentLineNumberAccess() const;
238 
239     /** Provides access to the document draw model interface
240      */
241     const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
242 
243     /** Provides access to the document layout interface
244      */
245     const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
246           IDocumentLayoutAccess* getIDocumentLayoutAccess();
247 
248     /** Provides access to the document links administration interface
249      */
250     const IDocumentLinksAdministration* getIDocumentLinksAdministration() const;
251           IDocumentLinksAdministration* getIDocumentLinksAdministration();
252 
253     /** Provides access to the document fields administration interface
254      */
255     const IDocumentFieldsAccess* getIDocumentFieldsAccess() const;
256           IDocumentFieldsAccess* getIDocumentFieldsAccess();
257 
258     /** Provides access to the document content operations interface
259      */
260           IDocumentContentOperations* getIDocumentContentOperations();
261 
262     /** Provides access to the document automatic styles interface
263      */
264           IStyleAccess& getIDocumentStyleAccess();
265 
266     /** Provides access to the document's numbered items interface
267 
268         OD 2007-10-31 #i83479#
269 
270         @author OD
271     */
272     IDocumentListItems& getIDocumentListItems();
273 
274 	// liegt der Node im Sichtbarenbereich der Shell ?
275     sal_Bool IsInVisibleArea( ViewShell* pSh = 0 ) const;
276 	// befindet sich der Node in einem geschuetzten Bereich?
277 	sal_Bool IsInProtectSect() const;
278 	// befindet sich der Node in irgendetwas geschuetzten ?
279 	// (Bereich/Rahmen/Tabellenzellen/... incl. des Ankers bei
280 	//	Rahmen/Fussnoten/..)
281 	sal_Bool IsProtect() const;
282 	// suche den PageDesc, mit dem dieser Node formatiert ist. Wenn das
283 	// Layout vorhanden ist wird ueber das gesucht, ansonsten gibt es nur
284 	// die harte Tour ueber die Nodes nach vorne suchen!!
285     // OD 18.03.2003 #106326#
286     const SwPageDesc* FindPageDesc( sal_Bool bCalcLay, sal_uInt32* pPgDescNdIdx = 0 ) const;
287 
288 	// falls der Node in einem Fly steht, dann wird das entsprechende Format
289 	// returnt
290 	SwFrmFmt* GetFlyFmt() const;
291 
292 	// falls der Node in einer Tabelle steht, dann wird die entsprechende
293 	// TabellenBox returnt
294 	SwTableBox* GetTblBox() const;
295 
GetIndex() const296     inline sal_uLong GetIndex() const { return GetPos(); }
297 
298 	const SwTxtNode* FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const;
299 
300 	sal_uInt8 HasPrevNextLayNode() const;
301 
302 private:
303 	// privater Constructor, weil nie kopiert werden darf !!
304 	SwNode( const SwNode & rNodes );
305 	SwNode & operator= ( const SwNode & rNodes );
306 };
307 
308 // --------------------
309 // class SwStartNode
310 // --------------------
311 class SwStartNode: public SwNode
312 {
313 	friend class SwNode;
314 	friend class SwNodes;
315 	friend class SwEndNode;		// um theEndOfSection zu setzen !!
316 
317 	SwEndNode* pEndOfSection;
318 	SwStartNodeType eSttNdTyp;
319 
320 	// fuer den initialen StartNode
321 	SwStartNode( SwNodes& rNodes, sal_uLong nPos );
322 
323 protected:
324 	SwStartNode( const SwNodeIndex &rWhere,
325 				 const sal_uInt8 nNodeType = ND_STARTNODE,
326 				 SwStartNodeType = SwNormalStartNode );
327 public:
DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)328 	DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)
329 
330 	SwStartNodeType GetStartNodeType() const 		{ return eSttNdTyp; }
331 
332 	// an alle ContentNodes der Section das ChkCondColl rufen
333 	void CheckSectionCondColl() const;
334 
335 private:
336 	// privater Constructor, weil nie kopiert werden darf !!
337 	SwStartNode( const SwStartNode & rNode );
338 	SwStartNode & operator= ( const SwStartNode & rNode );
339 };
340 
341 
342 // --------------------
343 // class SwEndNode
344 // --------------------
345 class SwEndNode : public SwNode
346 {
347 	friend class SwNodes;
348 	friend class SwTableNode;		// um seinen EndNode anlegen zukoennen
349 	friend class SwSectionNode;		// um seinen EndNode anlegen zukoennen
350 
351 	// fuer den initialen StartNode
352 	SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd );
353 
354 protected:
355 	SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd );
356 
357 	DECL_FIXEDMEMPOOL_NEWDEL(SwEndNode)
358 
359 private:
360 	// privater Constructor, weil nie kopiert werden darf !!
361 	SwEndNode( const SwEndNode & rNode );
362 	SwEndNode & operator= ( const SwEndNode & rNode );
363 };
364 
365 
366 // --------------------
367 // SwCntntNode
368 // --------------------
369 class SW_DLLPUBLIC SwCntntNode: public SwModify, public SwNode, public SwIndexReg
370 {
371 	// Der Reader darf NewAttrSet() aufrufen!
372 //  friend class SwSwgReader;
373 //  friend class Sw3IoImp;
374 
375 //FEATURE::CONDCOLL
376 	SwDepend* pCondColl;
377 //FEATURE::CONDCOLL
378     mutable bool mbSetModifyAtAttr;
379 
380 protected:
381 	SwCntntNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeType,
382 				SwFmtColl *pFmtColl );
383 	virtual ~SwCntntNode();
384 
385 	// Attribut-Set fuer alle AUTO-Attribute eines CntntNodes
386 	//	( z.B: TxtNode oder NoTxtNode
387     boost::shared_ptr<const SfxItemSet> mpAttrSet;
388 
389 	// lasse von den entsprechenden Nodes die spz. AttrSets anlegen
390 	virtual void NewAttrSet( SwAttrPool& ) = 0;
391 
392     // There some functions that like to remove items from the internal
393     // SwAttrSet (handle):
394     sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds );
395 
396    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
397 
398 public:
399 	TYPEINFO();		//Bereits in Basisklasse Client drin.
400 
401     // MakeFrm will be called for a certain layout
402     // pSib is another SwFrm of the same layout (e.g. the SwRootFrm itself, a sibling, the parent)
403 	virtual SwCntntFrm *MakeFrm( SwFrm* pSib ) = 0;
404 
405     virtual SwCntntNode *SplitCntntNode(const SwPosition & ) = 0;
406 
407 	virtual SwCntntNode *JoinNext();
408 	virtual SwCntntNode *JoinPrev();
409 	// koennen 2 Nodes zusammengefasst werden ?
410 	// in pIdx kann die 2. Position returnt werden.
411 	int CanJoinNext( SwNodeIndex* pIdx =0 ) const;
412 	int CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
413 
MakeStartIndex(SwIndex * pIdx)414 	void MakeStartIndex( SwIndex * pIdx )	{ pIdx->Assign( this, 0 ); }
MakeEndIndex(SwIndex * pIdx)415 	void MakeEndIndex( SwIndex * pIdx )		{ pIdx->Assign( this, Len() ); }
416 
417 	sal_Bool GoNext(SwIndex *, sal_uInt16 nMode ) const;
418 	sal_Bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const;
419 
420     // Replacement for good old GetFrm(..):
421 	SwCntntFrm *getLayoutFrm( const SwRootFrm*,
422                         const Point* pDocPos = 0,
423 						const SwPosition *pPos = 0,
424 						const sal_Bool bCalcFrm = sal_True ) const;
425 	// Gibt die tatsaechlcheGroesse des Frames zurueck bzw. ein leeres
426 	// Rechteck, wenn kein Layout existiert.
427 	// Wird fuer die Export Filter benoetigt.
428 	SwRect FindLayoutRect( const sal_Bool bPrtArea = sal_False,
429 							const Point* pPoint = 0,
430 							const sal_Bool bCalcFrm = sal_False  ) const;
431 	SwRect FindPageFrmRect( const sal_Bool bPrtArea = sal_False,
432 							const Point* pPoint = 0,
433 							const sal_Bool bCalcFrm = sal_False  ) const;
434 	/*
435 	 * Methode erzeugt fuer den angegebenen Node alle Ansichten vom
436 	 * Dokument. Die erzeugten Contentframes werden in das entsprechende
437 	 * Layout gehaengt.
438 	 */
439 	void MakeFrms( SwCntntNode& rNode );
440 	/*
441 	 * Methode loescht fuer den Node alle Ansichten vom
442 	 * Dokument. Die Contentframes werden aus dem entsprechenden
443 	 * Layout ausgehaengt.
444 	 */
445 	//Solution:Add an input param to identify if acc table should be disposed
446 	//void DelFrms();
447 	void DelFrms( sal_Bool bNeedDel = sal_False, sal_Bool bIsAccTableDispose = sal_True );
448 	//void DelFrms(sal_Bool bNeedDel = sal_False);//added by zlcdl for al
449 
450 	/*
451 	 * liefert die Anzahl der Elemente des Inhalts des Nodes;
452 	 * Default ist 1, Unterschiede gibt es beim TextNode und beim
453 	 * Formelnode.
454 	 */
455 	virtual xub_StrLen Len() const;
456 
457 	virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const = 0;
458 		// erfrage vom Client Informationen
459 	virtual sal_Bool GetInfo( SfxPoolItem& ) const;
460 
461 	// SS fuer die PoolItems: (Harte-(Fmt)Attrbutierung)
462 
463 	// Ist bInParent sal_False, wird nur in diesem Node nach dem Attribut gesucht.
464 	const SfxPoolItem& GetAttr( sal_uInt16 nWhich, sal_Bool bInParent=sal_True ) const;
465 	sal_Bool GetAttr( SfxItemSet& rSet, sal_Bool bInParent=sal_True ) const;
466     // --> OD 2008-03-13 #refactorlists#
467     // made virtual
468     virtual sal_Bool SetAttr( const SfxPoolItem& );
469     virtual sal_Bool SetAttr( const SfxItemSet& rSet );
470     virtual sal_Bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
471     virtual sal_Bool ResetAttr( const SvUShorts& rWhichArr );
472     virtual sal_uInt16 ResetAllAttr();
473     // <--
474 
475     // liefert das Attribut, das nicht ueber die bedingte Vorlage kommt!
476 	const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, sal_Bool bInParents ) const;
477 
478 	// hat der Node schon eigene Auto-Attribute ?
479 	// Zugriff auf SwAttrSet
480     inline const SwAttrSet &GetSwAttrSet() const;
GetpSwAttrSet() const481     inline const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); }
HasSwAttrSet() const482     inline sal_Bool  HasSwAttrSet() const { return mpAttrSet ? sal_True : sal_False; }
483 
484 	virtual SwFmtColl* ChgFmtColl( SwFmtColl* );
GetFmtColl() const485 	SwFmtColl* GetFmtColl() const { return (SwFmtColl*)GetRegisteredIn(); }
486 
487 //FEATURE::CONDCOLL
488     inline SwFmtColl& GetAnyFmtColl() const;
489 	void SetCondFmtColl( SwFmtColl* );
490     inline SwFmtColl* GetCondFmtColl() const;
491 
492 	sal_Bool IsAnyCondition( SwCollCondition& rTmp ) const;
493 	void ChkCondColl();
494 //FEATURE::CONDCOLL
495 
496 	// invalidiert die am Node gesetzte NumRule. Diese wird
497 	// spaetestend in EndAction einer Shell geupdatet
498 	sal_Bool InvalidateNumRule();
499 
500     // --> OD 2005-02-21 #i42921# - determines the text direction for a certain
501     // position. Return -1, if text direction could *not* be determined.
502     short GetTextDirection( const SwPosition& rPos,
503                             const Point* pPt ) const;
504     // <--
505 
SetModifyAtAttr(bool bSetModifyAtAttr) const506     inline void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
GetModifyAtAttr() const507     inline bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
508 
509     static SwOLENodes* CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize );
510 
511 private:
512 	// privater Constructor, weil nie kopiert werden darf !!
513 	SwCntntNode( const SwCntntNode & rNode );
514 	SwCntntNode & operator= ( const SwCntntNode & rNode );
515 };
516 
517 
518 
519 //---------
520 // SwTableNode
521 //---------
522 class SW_DLLPUBLIC SwTableNode : public SwStartNode, public SwModify
523 {
524 	friend class SwNodes;
525 	SwTable* pTable;
526 protected:
527 	virtual ~SwTableNode();
528 
529 public:
530 	SwTableNode( const SwNodeIndex & );
531 
GetTable() const532 	const SwTable& GetTable() const { return *pTable; }
GetTable()533 	SwTable& GetTable() { return *pTable; }
534 	SwTabFrm *MakeFrm( SwFrm* );
535 
536 	//Legt die Frms fuer den TableNode (also die TabFrms) an.
537 	void MakeFrms( SwNodeIndex* pIdxBehind );
538 
539 	//Methode loescht fuer den Node alle Ansichten vom
540 	//Dokument. Die Contentframes werden aus dem entsprechenden
541 	//Layout ausgehaengt.
542 	void DelFrms();
543 
544 	//Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
545 	//Dokument. Die erzeugten Contentframes werden in das entsprechende
546 	//Layout gehaengt.
547 	void MakeFrms( const SwNodeIndex & rIdx );
548 
549 	SwTableNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
550 	void SetNewTable( SwTable* , sal_Bool bNewFrames=sal_True );
551 
552 private:
553 	// privater Constructor, weil nie kopiert werden darf !!
554 	SwTableNode( const SwTableNode & rNode );
555 	SwTableNode & operator= ( const SwTableNode & rNode );
556 };
557 
558 
559 //---------
560 // SwSectionNode
561 //---------
562 class SwSectionNode
563     : public SwStartNode
564     , private ::boost::noncopyable
565 {
566 	friend class SwNodes;
567 
568 private:
569     ::std::auto_ptr<SwSection> const m_pSection;
570 
571 protected:
572 	virtual ~SwSectionNode();
573 
574 public:
575     SwSectionNode(SwNodeIndex const&,
576         SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase);
577 
GetSection() const578     const SwSection& GetSection() const { return *m_pSection; }
GetSection()579           SwSection& GetSection()       { return *m_pSection; }
580 
581 	SwFrm *MakeFrm( SwFrm* );
582 
583 	//Legt die Frms fuer den SectionNode (also die SectionFrms) an.
584 	//Im Defaultfall wird bis die Frames bis zum Ende des Bereichs angelegt,
585 	//uebergibt man einen weiteren NodeIndex pEnd, so wird bis zu diesem
586 	//ein MakeFrms gerufen, genutzt wird dies von TableToText
587 	void MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = NULL );
588 
589 	//Methode loescht fuer den Node alle Ansichten vom
590 	//Dokument. Die Contentframes werden aus dem entsprechenden
591 	//Layout ausgehaengt.
592 	void DelFrms();
593 
594 	//Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
595 	//Dokument. Die erzeugten Contentframes werden in das entsprechende
596 	//Layout gehaengt.
597 	void MakeFrms( const SwNodeIndex & rIdx );
598 
599 	SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
600 
601 	// setze den Verweis im Format der Section auf sich selbst
602 	void NodesArrChgd();
603 
604 	// ueberprueft bei _nicht_ versteckten Bereichen, ob es Inhalt gibt, der
605 	// _nicht_ in einem versteckten (Unter-)Bereich liegt
606 	sal_Bool IsCntntHidden() const;
607 
608 };
609 
610 
611 
612 // ---------------------- einige inline Methoden ----------------------
GetEndNode()613 inline       SwEndNode   *SwNode::GetEndNode()
614 {
615 	 return ND_ENDNODE == nNodeType ? (SwEndNode*)this : 0;
616 }
GetEndNode() const617 inline const SwEndNode   *SwNode::GetEndNode() const
618 {
619 	 return ND_ENDNODE == nNodeType ? (const SwEndNode*)this : 0;
620 }
GetStartNode()621 inline       SwStartNode *SwNode::GetStartNode()
622 {
623 	 return ND_STARTNODE & nNodeType ? (SwStartNode*)this : 0;
624 }
GetStartNode() const625 inline const SwStartNode *SwNode::GetStartNode() const
626 {
627 	 return ND_STARTNODE & nNodeType ? (const SwStartNode*)this : 0;
628 }
GetTableNode()629 inline       SwTableNode *SwNode::GetTableNode()
630 {
631 	 return ND_TABLENODE == nNodeType ? (SwTableNode*)this : 0;
632 }
GetTableNode() const633 inline const SwTableNode *SwNode::GetTableNode() const
634 {
635 	 return ND_TABLENODE == nNodeType ? (const SwTableNode*)this : 0;
636 }
GetSectionNode()637 inline       SwSectionNode *SwNode::GetSectionNode()
638 {
639 	 return ND_SECTIONNODE == nNodeType ? (SwSectionNode*)this : 0;
640 }
GetSectionNode() const641 inline const SwSectionNode *SwNode::GetSectionNode() const
642 {
643 	 return ND_SECTIONNODE == nNodeType ? (const SwSectionNode*)this : 0;
644 }
GetCntntNode()645 inline       SwCntntNode *SwNode::GetCntntNode()
646 {
647 	 return ND_CONTENTNODE & nNodeType ? (SwCntntNode*)this : 0;
648 }
GetCntntNode() const649 inline const SwCntntNode *SwNode::GetCntntNode() const
650 {
651 	 return ND_CONTENTNODE & nNodeType ? (const SwCntntNode*)this : 0;
652 }
653 
654 
IsStartNode() const655 inline sal_Bool SwNode::IsStartNode() const
656 {
657 	return ND_STARTNODE & nNodeType  ? sal_True : sal_False;
658 }
IsCntntNode() const659 inline sal_Bool SwNode::IsCntntNode() const
660 {
661 	return ND_CONTENTNODE & nNodeType  ? sal_True : sal_False;
662 }
IsEndNode() const663 inline sal_Bool SwNode::IsEndNode() const
664 {
665 	return ND_ENDNODE == nNodeType  ? sal_True : sal_False;
666 }
IsTxtNode() const667 inline sal_Bool SwNode::IsTxtNode() const
668 {
669 	return ND_TEXTNODE == nNodeType  ? sal_True : sal_False;
670 }
IsTableNode() const671 inline sal_Bool SwNode::IsTableNode() const
672 {
673 	return ND_TABLENODE == nNodeType  ? sal_True : sal_False;
674 }
IsSectionNode() const675 inline sal_Bool SwNode::IsSectionNode() const
676 {
677 	return ND_SECTIONNODE == nNodeType  ? sal_True : sal_False;
678 }
IsNoTxtNode() const679 inline sal_Bool SwNode::IsNoTxtNode() const
680 {
681 	return ND_NOTXTNODE & nNodeType  ? sal_True : sal_False;
682 }
IsOLENode() const683 inline sal_Bool SwNode::IsOLENode() const
684 {
685 	return ND_OLENODE == nNodeType  ? sal_True : sal_False;
686 }
IsGrfNode() const687 inline sal_Bool SwNode::IsGrfNode() const
688 {
689 	return ND_GRFNODE == nNodeType  ? sal_True : sal_False;
690 }
691 
FindSttNodeByType(SwStartNodeType eTyp) const692 inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
693 {
694 	return ((SwNode*)this)->FindSttNodeByType( eTyp );
695 }
FindTableNode() const696 inline const SwTableNode* SwNode::FindTableNode() const
697 {
698 	return ((SwNode*)this)->FindTableNode();
699 }
FindSectionNode() const700 inline const SwSectionNode* SwNode::FindSectionNode() const
701 {
702 	return ((SwNode*)this)->FindSectionNode();
703 }
StartOfSectionIndex() const704 inline sal_uLong SwNode::StartOfSectionIndex() const
705 {
706     return pStartOfSection->GetIndex();
707 }
EndOfSectionIndex() const708 inline sal_uLong SwNode::EndOfSectionIndex() const
709 {
710 	const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
711 	return pStNd->pEndOfSection->GetIndex();
712 }
EndOfSectionNode() const713 inline const SwEndNode* SwNode::EndOfSectionNode() const
714 {
715 	const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
716 	return pStNd->pEndOfSection;
717 }
EndOfSectionNode()718 inline SwEndNode* SwNode::EndOfSectionNode()
719 {
720 	SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
721 	return pStNd->pEndOfSection;
722 }
723 
GetNodes()724 inline SwNodes& SwNode::GetNodes()
725 {
726 	return (SwNodes&)GetArray();
727 }
GetNodes() const728 inline const SwNodes& SwNode::GetNodes() const
729 {
730 	return (SwNodes&)GetArray();
731 }
732 
GetDoc()733 inline SwDoc* SwNode::GetDoc()
734 {
735 	return GetNodes().GetDoc();
736 }
GetDoc() const737 inline const SwDoc* SwNode::GetDoc() const
738 {
739 	return GetNodes().GetDoc();
740 }
741 
GetCondFmtColl() const742 inline SwFmtColl* SwCntntNode::GetCondFmtColl() const
743 {
744 	return pCondColl ? (SwFmtColl*)pCondColl->GetRegisteredIn() : 0;
745 }
746 
747 
GetAnyFmtColl() const748 inline SwFmtColl& SwCntntNode::GetAnyFmtColl() const
749 {
750 	return pCondColl && pCondColl->GetRegisteredIn()
751 				? *(SwFmtColl*)pCondColl->GetRegisteredIn()
752 				: *(SwFmtColl*)GetRegisteredIn();
753 }
754 
GetSwAttrSet() const755 inline const SwAttrSet& SwCntntNode::GetSwAttrSet() const
756 {
757     return mpAttrSet ? *GetpSwAttrSet() : GetAnyFmtColl().GetAttrSet();
758 }
759 
760 //FEATURE::CONDCOLL
761 
GetAttr(sal_uInt16 nWhich,sal_Bool bInParents) const762 inline const SfxPoolItem& SwCntntNode::GetAttr( sal_uInt16 nWhich,
763 												sal_Bool bInParents ) const
764 {
765 	return GetSwAttrSet().Get( nWhich, bInParents );
766 }
767 #endif
768