xref: /trunk/main/sw/inc/node.hxx (revision 56b35d86)
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 //UUUU
85 namespace drawinglayer { namespace attribute {
86     class SdrAllFillAttributesHelper;
87     typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
88 }}
89 
90 // --------------------
91 // class SwNode
92 // --------------------
93 class SW_DLLPUBLIC SwNode : private /* public*/ BigPtrEntry
94 {
95 	friend class SwNodes;
96 
97 #ifdef DBG_UTIL
98     static long nSerial;
99     long nMySerial;
100 #endif
101 
102 	sal_uInt8 nNodeType;
103 
104 	// JP 28.03.96
105 	// fuer Textnodes: Stufungslevel der Autoformatierung. Ist erstmal hier
106 	//					gelandet, weil noch Bits frei sind
107 	sal_uInt8 nAFmtNumLvl : 3;
108 	sal_Bool bSetNumLSpace : 1;			// fuer Numerierung: sal_True Einzug setzen
109 	sal_Bool bIgnoreDontExpand : 1;		// for Text Attributes - ignore the flag
110 
111 protected:
112 	SwStartNode* pStartOfSection;
113 
114 	SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeId );
115 
116 	// fuer den initialen StartNode
117 	SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNodeId );
118 
119 public:
120 	virtual ~SwNode();
121 
122 #ifdef DBG_UTIL
GetSerial() const123     long int GetSerial() const { return nMySerial; }
124 #endif
125 
126 	sal_uInt16 GetSectionLevel() const;
127 
128     inline sal_uLong StartOfSectionIndex() const;
StartOfSectionNode() const129     inline const SwStartNode* StartOfSectionNode() const { return pStartOfSection; }
StartOfSectionNode()130     inline       SwStartNode* StartOfSectionNode() { return pStartOfSection; }
131 
132     inline sal_uLong EndOfSectionIndex() const;
133     inline const SwEndNode* EndOfSectionNode() const;
134     inline         SwEndNode* EndOfSectionNode();
135 
GetAutoFmtLvl() const136     inline sal_uInt8 GetAutoFmtLvl() const     { return nAFmtNumLvl; }
SetAutoFmtLvl(sal_uInt8 nVal)137     inline void SetAutoFmtLvl( sal_uInt8 nVal )      { nAFmtNumLvl = nVal; }
138 
IsSetNumLSpace() const139     inline sal_Bool IsSetNumLSpace() const  { return bSetNumLSpace; }
SetNumLSpace(sal_Bool bFlag)140     inline void SetNumLSpace( sal_Bool bFlag )        { bSetNumLSpace = bFlag; }
141 
IsIgnoreDontExpand() const142     inline sal_Bool IsIgnoreDontExpand() const  { return bIgnoreDontExpand; }
SetIgnoreDontExpand(sal_Bool bNew)143     inline void SetIgnoreDontExpand( sal_Bool bNew )  { bIgnoreDontExpand = bNew; }
144 
GetNodeType() const145 	sal_uInt8 	GetNodeType() const { return nNodeType; }
146 
147     inline       SwStartNode *GetStartNode();
148     inline const SwStartNode *GetStartNode() const;
149     inline       SwCntntNode *GetCntntNode();
150     inline const SwCntntNode *GetCntntNode() const;
151     inline       SwEndNode   *GetEndNode();
152     inline const SwEndNode   *GetEndNode() const;
153 #ifndef	 ICC
154   inline
155 #endif
156 	SwTxtNode   *GetTxtNode();
157 
158 #ifndef	 ICC
159   inline
160 #endif
161 	const SwTxtNode   *GetTxtNode() const;
162     inline        SwOLENode   *GetOLENode();
163     inline  const SwOLENode   *GetOLENode() const;
164     inline        SwNoTxtNode *GetNoTxtNode();
165     inline  const SwNoTxtNode *GetNoTxtNode() const;
166     inline        SwGrfNode   *GetGrfNode();
167     inline  const SwGrfNode   *GetGrfNode() const;
168     inline       SwTableNode *GetTableNode();
169     inline const SwTableNode *GetTableNode() const;
170     inline       SwSectionNode *GetSectionNode();
171     inline const SwSectionNode *GetSectionNode() const;
172 
173     inline sal_Bool IsStartNode() const;
174     inline sal_Bool IsCntntNode() const;
175     inline sal_Bool IsEndNode() const;
176     inline sal_Bool IsTxtNode() const;
177     inline sal_Bool IsTableNode() const;
178     inline sal_Bool IsSectionNode() const;
179     inline sal_Bool IsOLENode() const;
180     inline sal_Bool IsNoTxtNode() const;
181     inline sal_Bool IsGrfNode() const;
182 
183     /**
184        Checks if this node is in redlines.
185 
186        @retval sal_True       this node is in redlines
187        @retval sal_False      else
188      */
189     sal_Bool IsInRedlines() const;
190 
191 	// suche den TabellenNode, in dem dieser steht. Wenn in keiner
192 	// Tabelle wird 0 returnt.
193 					SwTableNode *FindTableNode();
194     inline const  SwTableNode *FindTableNode() const;
195 
196 	// suche den SectionNode, in dem dieser steht. Wenn es in keiner
197 	// Section steht wird 0 returnt.
198 					SwSectionNode *FindSectionNode();
199     inline    const   SwSectionNode *FindSectionNode() const;
200 
201     SwStartNode* FindSttNodeByType( SwStartNodeType eTyp );
202     inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const;
203 
FindTableBoxStartNode() const204 	const SwStartNode* FindTableBoxStartNode() const
205 						{ return FindSttNodeByType( SwTableBoxStartNode ); }
FindFlyStartNode() const206 	const SwStartNode* FindFlyStartNode() const
207 						{ return FindSttNodeByType( SwFlyStartNode ); }
FindFootnoteStartNode() const208 	const SwStartNode* FindFootnoteStartNode() const
209 						{ return FindSttNodeByType( SwFootnoteStartNode ); }
FindHeaderStartNode() const210 	const SwStartNode* FindHeaderStartNode() const
211 						{ return FindSttNodeByType( SwHeaderStartNode ); }
FindFooterStartNode() const212 	const SwStartNode* FindFooterStartNode() const
213 						{ return FindSttNodeByType( SwFooterStartNode ); }
214 
215 		// in welchem Nodes-Array/Doc steht der Node ?
216     inline          SwNodes& GetNodes();
217     inline const  SwNodes& GetNodes() const;
218     inline            SwDoc* GetDoc();
219     inline const  SwDoc* GetDoc() const;
220 
221     /** Provides access to the document setting interface
222      */
223     const IDocumentSettingAccess* getIDocumentSettingAccess() const;
224 
225     /** Provides access to the document device interface
226      */
227     const IDocumentDeviceAccess* getIDocumentDeviceAccess() const;
228 
229     /** Provides access to the document bookmark interface
230      */
231     const IDocumentMarkAccess* getIDocumentMarkAccess() const;
232 
233     /** Provides access to the document redline interface
234      */
235     const IDocumentRedlineAccess* getIDocumentRedlineAccess() const;
236 
237     /** Provides access to the document style pool interface
238      */
239     const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
240 
241     /** Provides access to the document line number information interface
242      */
243     const IDocumentLineNumberAccess* getIDocumentLineNumberAccess() const;
244 
245     /** Provides access to the document draw model interface
246      */
247     const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
248 
249     /** Provides access to the document layout interface
250      */
251     const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
252           IDocumentLayoutAccess* getIDocumentLayoutAccess();
253 
254     /** Provides access to the document links administration interface
255      */
256     const IDocumentLinksAdministration* getIDocumentLinksAdministration() const;
257           IDocumentLinksAdministration* getIDocumentLinksAdministration();
258 
259     /** Provides access to the document fields administration interface
260      */
261     const IDocumentFieldsAccess* getIDocumentFieldsAccess() const;
262           IDocumentFieldsAccess* getIDocumentFieldsAccess();
263 
264     /** Provides access to the document content operations interface
265      */
266           IDocumentContentOperations* getIDocumentContentOperations();
267 
268     /** Provides access to the document automatic styles interface
269      */
270           IStyleAccess& getIDocumentStyleAccess();
271 
272     /** Provides access to the document's numbered items interface
273 
274         OD 2007-10-31 #i83479#
275 
276         @author OD
277     */
278     IDocumentListItems& getIDocumentListItems();
279 
280 	// liegt der Node im Sichtbarenbereich der Shell ?
281     sal_Bool IsInVisibleArea( ViewShell* pSh = 0 ) const;
282 	// befindet sich der Node in einem geschuetzten Bereich?
283 	sal_Bool IsInProtectSect() const;
284 	// befindet sich der Node in irgendetwas geschuetzten ?
285 	// (Bereich/Rahmen/Tabellenzellen/... incl. des Ankers bei
286 	//	Rahmen/Fussnoten/..)
287 	sal_Bool IsProtect() const;
288 	// suche den PageDesc, mit dem dieser Node formatiert ist. Wenn das
289 	// Layout vorhanden ist wird ueber das gesucht, ansonsten gibt es nur
290 	// die harte Tour ueber die Nodes nach vorne suchen!!
291     // OD 18.03.2003 #106326#
292     const SwPageDesc* FindPageDesc( sal_Bool bCalcLay, sal_uInt32* pPgDescNdIdx = 0 ) const;
293 
294 	// falls der Node in einem Fly steht, dann wird das entsprechende Format
295 	// returnt
296 	SwFrmFmt* GetFlyFmt() const;
297 
298 	// falls der Node in einer Tabelle steht, dann wird die entsprechende
299 	// TabellenBox returnt
300 	SwTableBox* GetTblBox() const;
301 
GetIndex() const302     inline sal_uLong GetIndex() const { return GetPos(); }
303 
304 	const SwTxtNode* FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const;
305 
306 	sal_uInt8 HasPrevNextLayNode() const;
307 
308 private:
309 	// privater Constructor, weil nie kopiert werden darf !!
310 	SwNode( const SwNode & rNodes );
311 	SwNode & operator= ( const SwNode & rNodes );
312 };
313 
314 // --------------------
315 // class SwStartNode
316 // --------------------
317 class SwStartNode: public SwNode
318 {
319 	friend class SwNode;
320 	friend class SwNodes;
321 	friend class SwEndNode;		// um theEndOfSection zu setzen !!
322 
323 	SwEndNode* pEndOfSection;
324 	SwStartNodeType eSttNdTyp;
325 
326 	// fuer den initialen StartNode
327 	SwStartNode( SwNodes& rNodes, sal_uLong nPos );
328 
329 protected:
330 	SwStartNode( const SwNodeIndex &rWhere,
331 				 const sal_uInt8 nNodeType = ND_STARTNODE,
332 				 SwStartNodeType = SwNormalStartNode );
333 public:
DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)334 	DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)
335 
336 	SwStartNodeType GetStartNodeType() const 		{ return eSttNdTyp; }
337 
338 	// an alle ContentNodes der Section das ChkCondColl rufen
339 	void CheckSectionCondColl() const;
340 
341 private:
342 	// privater Constructor, weil nie kopiert werden darf !!
343 	SwStartNode( const SwStartNode & rNode );
344 	SwStartNode & operator= ( const SwStartNode & rNode );
345 };
346 
347 
348 // --------------------
349 // class SwEndNode
350 // --------------------
351 class SwEndNode : public SwNode
352 {
353 	friend class SwNodes;
354 	friend class SwTableNode;		// um seinen EndNode anlegen zukoennen
355 	friend class SwSectionNode;		// um seinen EndNode anlegen zukoennen
356 
357 	// fuer den initialen StartNode
358 	SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd );
359 
360 protected:
361 	SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd );
362 
363 	DECL_FIXEDMEMPOOL_NEWDEL(SwEndNode)
364 
365 private:
366 	// privater Constructor, weil nie kopiert werden darf !!
367 	SwEndNode( const SwEndNode & rNode );
368 	SwEndNode & operator= ( const SwEndNode & rNode );
369 };
370 
371 
372 // --------------------
373 // SwCntntNode
374 // --------------------
375 class SW_DLLPUBLIC SwCntntNode: public SwModify, public SwNode, public SwIndexReg
376 {
377 	// Der Reader darf NewAttrSet() aufrufen!
378 //  friend class SwSwgReader;
379 //  friend class Sw3IoImp;
380 
381 //FEATURE::CONDCOLL
382 	SwDepend* pCondColl;
383 //FEATURE::CONDCOLL
384     mutable bool mbSetModifyAtAttr;
385 
386 protected:
387 	SwCntntNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeType,
388 				SwFmtColl *pFmtColl );
389 	virtual ~SwCntntNode();
390 
391 	// Attribut-Set fuer alle AUTO-Attribute eines CntntNodes
392 	//	( z.B: TxtNode oder NoTxtNode
393     boost::shared_ptr<const SfxItemSet> mpAttrSet;
394 
395 	// lasse von den entsprechenden Nodes die spz. AttrSets anlegen
396 	virtual void NewAttrSet( SwAttrPool& ) = 0;
397 
398     // There some functions that like to remove items from the internal
399     // SwAttrSet (handle):
400     sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds );
401 
402    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
403 
404 public:
405 	TYPEINFO();		//Bereits in Basisklasse Client drin.
406 
407     // MakeFrm will be called for a certain layout
408     // pSib is another SwFrm of the same layout (e.g. the SwRootFrm itself, a sibling, the parent)
409 	virtual SwCntntFrm *MakeFrm( SwFrm* pSib ) = 0;
410 
411     virtual SwCntntNode *SplitCntntNode(const SwPosition & ) = 0;
412 
413 	virtual SwCntntNode *JoinNext();
414 	virtual SwCntntNode *JoinPrev();
415 	// koennen 2 Nodes zusammengefasst werden ?
416 	// in pIdx kann die 2. Position returnt werden.
417 	int CanJoinNext( SwNodeIndex* pIdx =0 ) const;
418 	int CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
419 
MakeStartIndex(SwIndex * pIdx)420 	void MakeStartIndex( SwIndex * pIdx )	{ pIdx->Assign( this, 0 ); }
MakeEndIndex(SwIndex * pIdx)421 	void MakeEndIndex( SwIndex * pIdx )		{ pIdx->Assign( this, Len() ); }
422 
423 	sal_Bool GoNext(SwIndex *, sal_uInt16 nMode ) const;
424 	sal_Bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const;
425 
426     // Replacement for good old GetFrm(..):
427 	SwCntntFrm *getLayoutFrm( const SwRootFrm*,
428                         const Point* pDocPos = 0,
429 						const SwPosition *pPos = 0,
430 						const sal_Bool bCalcFrm = sal_True ) const;
431 	// Gibt die tatsaechlcheGroesse des Frames zurueck bzw. ein leeres
432 	// Rechteck, wenn kein Layout existiert.
433 	// Wird fuer die Export Filter benoetigt.
434 	SwRect FindLayoutRect( const sal_Bool bPrtArea = sal_False,
435 							const Point* pPoint = 0,
436 							const sal_Bool bCalcFrm = sal_False  ) const;
437 	SwRect FindPageFrmRect( const sal_Bool bPrtArea = sal_False,
438 							const Point* pPoint = 0,
439 							const sal_Bool bCalcFrm = sal_False  ) const;
440 	/*
441 	 * Methode erzeugt fuer den angegebenen Node alle Ansichten vom
442 	 * Dokument. Die erzeugten Contentframes werden in das entsprechende
443 	 * Layout gehaengt.
444 	 */
445 	void MakeFrms( SwCntntNode& rNode );
446 	/*
447 	 * Methode loescht fuer den Node alle Ansichten vom
448 	 * Dokument. Die Contentframes werden aus dem entsprechenden
449 	 * Layout ausgehaengt.
450 	 */
451 	//Solution:Add an input param to identify if acc table should be disposed
452 	//void DelFrms();
453 	void DelFrms( sal_Bool bNeedDel = sal_False, sal_Bool bIsAccTableDispose = sal_True );
454 	//void DelFrms(sal_Bool bNeedDel = sal_False);//added by zlcdl for al
455 
456 	/*
457 	 * liefert die Anzahl der Elemente des Inhalts des Nodes;
458 	 * Default ist 1, Unterschiede gibt es beim TextNode und beim
459 	 * Formelnode.
460 	 */
461 	virtual xub_StrLen Len() const;
462 
463 	virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const = 0;
464 		// erfrage vom Client Informationen
465 	virtual sal_Bool GetInfo( SfxPoolItem& ) const;
466 
467 	// SS fuer die PoolItems: (Harte-(Fmt)Attrbutierung)
468 
469 	// Ist bInParent sal_False, wird nur in diesem Node nach dem Attribut gesucht.
470 	const SfxPoolItem& GetAttr( sal_uInt16 nWhich, sal_Bool bInParent=sal_True ) const;
471 	sal_Bool GetAttr( SfxItemSet& rSet, sal_Bool bInParent=sal_True ) const;
472     // --> OD 2008-03-13 #refactorlists#
473     // made virtual
474     virtual sal_Bool SetAttr( const SfxPoolItem& );
475     virtual sal_Bool SetAttr( const SfxItemSet& rSet );
476     virtual sal_Bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
477     virtual sal_Bool ResetAttr( const SvUShorts& rWhichArr );
478     virtual sal_uInt16 ResetAllAttr();
479     // <--
480 
481     // liefert das Attribut, das nicht ueber die bedingte Vorlage kommt!
482 	const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, sal_Bool bInParents ) const;
483 
484 	// hat der Node schon eigene Auto-Attribute ?
485 	// Zugriff auf SwAttrSet
486     inline const SwAttrSet &GetSwAttrSet() const;
GetpSwAttrSet() const487     inline const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); }
HasSwAttrSet() const488     inline sal_Bool  HasSwAttrSet() const { return mpAttrSet ? sal_True : sal_False; }
489 
490 	virtual SwFmtColl* ChgFmtColl( SwFmtColl* );
GetFmtColl() const491 	SwFmtColl* GetFmtColl() const { return (SwFmtColl*)GetRegisteredIn(); }
492 
493 //FEATURE::CONDCOLL
494     inline SwFmtColl& GetAnyFmtColl() const;
495 	void SetCondFmtColl( SwFmtColl* );
496     inline SwFmtColl* GetCondFmtColl() const;
497 
498 	sal_Bool IsAnyCondition( SwCollCondition& rTmp ) const;
499 	void ChkCondColl();
500 //FEATURE::CONDCOLL
501 
502 	// invalidiert die am Node gesetzte NumRule. Diese wird
503 	// spaetestend in EndAction einer Shell geupdatet
504 	sal_Bool InvalidateNumRule();
505 
506     // --> OD 2005-02-21 #i42921# - determines the text direction for a certain
507     // position. Return -1, if text direction could *not* be determined.
508     short GetTextDirection( const SwPosition& rPos,
509                             const Point* pPt ) const;
510     // <--
511 
SetModifyAtAttr(bool bSetModifyAtAttr) const512     inline void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
GetModifyAtAttr() const513     inline bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
514 
515     static SwOLENodes* CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize );
516 
517     //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
518     virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
519 
520 private:
521 	// privater Constructor, weil nie kopiert werden darf !!
522 	SwCntntNode( const SwCntntNode & rNode );
523 	SwCntntNode & operator= ( const SwCntntNode & rNode );
524 };
525 
526 
527 
528 //---------
529 // SwTableNode
530 //---------
531 class SW_DLLPUBLIC SwTableNode : public SwStartNode, public SwModify
532 {
533 	friend class SwNodes;
534 	SwTable* pTable;
535 protected:
536 	virtual ~SwTableNode();
537 
538 public:
539 	SwTableNode( const SwNodeIndex & );
540 
GetTable() const541 	const SwTable& GetTable() const { return *pTable; }
GetTable()542 	SwTable& GetTable() { return *pTable; }
543 	SwTabFrm *MakeFrm( SwFrm* );
544 
545 	//Legt die Frms fuer den TableNode (also die TabFrms) an.
546 	void MakeFrms( SwNodeIndex* pIdxBehind );
547 
548 	//Methode loescht fuer den Node alle Ansichten vom
549 	//Dokument. Die Contentframes werden aus dem entsprechenden
550 	//Layout ausgehaengt.
551 	void DelFrms();
552 
553 	//Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
554 	//Dokument. Die erzeugten Contentframes werden in das entsprechende
555 	//Layout gehaengt.
556 	void MakeFrms( const SwNodeIndex & rIdx );
557 
558 	SwTableNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
559 	void SetNewTable( SwTable* , sal_Bool bNewFrames=sal_True );
560 
561 private:
562 	// privater Constructor, weil nie kopiert werden darf !!
563 	SwTableNode( const SwTableNode & rNode );
564 	SwTableNode & operator= ( const SwTableNode & rNode );
565 };
566 
567 
568 //---------
569 // SwSectionNode
570 //---------
571 class SwSectionNode
572     : public SwStartNode
573     , private ::boost::noncopyable
574 {
575 	friend class SwNodes;
576 
577 private:
578     ::std::auto_ptr<SwSection> const m_pSection;
579 
580 protected:
581 	virtual ~SwSectionNode();
582 
583 public:
584     SwSectionNode(SwNodeIndex const&,
585         SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase);
586 
GetSection() const587     const SwSection& GetSection() const { return *m_pSection; }
GetSection()588           SwSection& GetSection()       { return *m_pSection; }
589 
590 	SwFrm *MakeFrm( SwFrm* );
591 
592 	//Legt die Frms fuer den SectionNode (also die SectionFrms) an.
593 	//Im Defaultfall wird bis die Frames bis zum Ende des Bereichs angelegt,
594 	//uebergibt man einen weiteren NodeIndex pEnd, so wird bis zu diesem
595 	//ein MakeFrms gerufen, genutzt wird dies von TableToText
596 	void MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = NULL );
597 
598 	//Methode loescht fuer den Node alle Ansichten vom
599 	//Dokument. Die Contentframes werden aus dem entsprechenden
600 	//Layout ausgehaengt.
601 	void DelFrms();
602 
603 	//Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
604 	//Dokument. Die erzeugten Contentframes werden in das entsprechende
605 	//Layout gehaengt.
606 	void MakeFrms( const SwNodeIndex & rIdx );
607 
608 	SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
609 
610 	// setze den Verweis im Format der Section auf sich selbst
611 	void NodesArrChgd();
612 
613 	// ueberprueft bei _nicht_ versteckten Bereichen, ob es Inhalt gibt, der
614 	// _nicht_ in einem versteckten (Unter-)Bereich liegt
615 	sal_Bool IsCntntHidden() const;
616 
617 };
618 
619 
620 
621 // ---------------------- einige inline Methoden ----------------------
GetEndNode()622 inline       SwEndNode   *SwNode::GetEndNode()
623 {
624 	 return ND_ENDNODE == nNodeType ? (SwEndNode*)this : 0;
625 }
GetEndNode() const626 inline const SwEndNode   *SwNode::GetEndNode() const
627 {
628 	 return ND_ENDNODE == nNodeType ? (const SwEndNode*)this : 0;
629 }
GetStartNode()630 inline       SwStartNode *SwNode::GetStartNode()
631 {
632 	 return ND_STARTNODE & nNodeType ? (SwStartNode*)this : 0;
633 }
GetStartNode() const634 inline const SwStartNode *SwNode::GetStartNode() const
635 {
636 	 return ND_STARTNODE & nNodeType ? (const SwStartNode*)this : 0;
637 }
GetTableNode()638 inline       SwTableNode *SwNode::GetTableNode()
639 {
640 	 return ND_TABLENODE == nNodeType ? (SwTableNode*)this : 0;
641 }
GetTableNode() const642 inline const SwTableNode *SwNode::GetTableNode() const
643 {
644 	 return ND_TABLENODE == nNodeType ? (const SwTableNode*)this : 0;
645 }
GetSectionNode()646 inline       SwSectionNode *SwNode::GetSectionNode()
647 {
648 	 return ND_SECTIONNODE == nNodeType ? (SwSectionNode*)this : 0;
649 }
GetSectionNode() const650 inline const SwSectionNode *SwNode::GetSectionNode() const
651 {
652 	 return ND_SECTIONNODE == nNodeType ? (const SwSectionNode*)this : 0;
653 }
GetCntntNode()654 inline       SwCntntNode *SwNode::GetCntntNode()
655 {
656 	 return ND_CONTENTNODE & nNodeType ? (SwCntntNode*)this : 0;
657 }
GetCntntNode() const658 inline const SwCntntNode *SwNode::GetCntntNode() const
659 {
660 	 return ND_CONTENTNODE & nNodeType ? (const SwCntntNode*)this : 0;
661 }
662 
663 
IsStartNode() const664 inline sal_Bool SwNode::IsStartNode() const
665 {
666 	return ND_STARTNODE & nNodeType  ? sal_True : sal_False;
667 }
IsCntntNode() const668 inline sal_Bool SwNode::IsCntntNode() const
669 {
670 	return ND_CONTENTNODE & nNodeType  ? sal_True : sal_False;
671 }
IsEndNode() const672 inline sal_Bool SwNode::IsEndNode() const
673 {
674 	return ND_ENDNODE == nNodeType  ? sal_True : sal_False;
675 }
IsTxtNode() const676 inline sal_Bool SwNode::IsTxtNode() const
677 {
678 	return ND_TEXTNODE == nNodeType  ? sal_True : sal_False;
679 }
IsTableNode() const680 inline sal_Bool SwNode::IsTableNode() const
681 {
682 	return ND_TABLENODE == nNodeType  ? sal_True : sal_False;
683 }
IsSectionNode() const684 inline sal_Bool SwNode::IsSectionNode() const
685 {
686 	return ND_SECTIONNODE == nNodeType  ? sal_True : sal_False;
687 }
IsNoTxtNode() const688 inline sal_Bool SwNode::IsNoTxtNode() const
689 {
690 	return ND_NOTXTNODE & nNodeType  ? sal_True : sal_False;
691 }
IsOLENode() const692 inline sal_Bool SwNode::IsOLENode() const
693 {
694 	return ND_OLENODE == nNodeType  ? sal_True : sal_False;
695 }
IsGrfNode() const696 inline sal_Bool SwNode::IsGrfNode() const
697 {
698 	return ND_GRFNODE == nNodeType  ? sal_True : sal_False;
699 }
700 
FindSttNodeByType(SwStartNodeType eTyp) const701 inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
702 {
703 	return ((SwNode*)this)->FindSttNodeByType( eTyp );
704 }
FindTableNode() const705 inline const SwTableNode* SwNode::FindTableNode() const
706 {
707 	return ((SwNode*)this)->FindTableNode();
708 }
FindSectionNode() const709 inline const SwSectionNode* SwNode::FindSectionNode() const
710 {
711 	return ((SwNode*)this)->FindSectionNode();
712 }
StartOfSectionIndex() const713 inline sal_uLong SwNode::StartOfSectionIndex() const
714 {
715     return pStartOfSection->GetIndex();
716 }
EndOfSectionIndex() const717 inline sal_uLong SwNode::EndOfSectionIndex() const
718 {
719 	const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
720 	return pStNd->pEndOfSection->GetIndex();
721 }
EndOfSectionNode() const722 inline const SwEndNode* SwNode::EndOfSectionNode() const
723 {
724 	const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
725 	return pStNd->pEndOfSection;
726 }
EndOfSectionNode()727 inline SwEndNode* SwNode::EndOfSectionNode()
728 {
729 	SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
730 	return pStNd->pEndOfSection;
731 }
732 
GetNodes()733 inline SwNodes& SwNode::GetNodes()
734 {
735 	return (SwNodes&)GetArray();
736 }
GetNodes() const737 inline const SwNodes& SwNode::GetNodes() const
738 {
739 	return (SwNodes&)GetArray();
740 }
741 
GetDoc()742 inline SwDoc* SwNode::GetDoc()
743 {
744 	return GetNodes().GetDoc();
745 }
GetDoc() const746 inline const SwDoc* SwNode::GetDoc() const
747 {
748 	return GetNodes().GetDoc();
749 }
750 
GetCondFmtColl() const751 inline SwFmtColl* SwCntntNode::GetCondFmtColl() const
752 {
753 	return pCondColl ? (SwFmtColl*)pCondColl->GetRegisteredIn() : 0;
754 }
755 
756 
GetAnyFmtColl() const757 inline SwFmtColl& SwCntntNode::GetAnyFmtColl() const
758 {
759 	return pCondColl && pCondColl->GetRegisteredIn()
760 				? *(SwFmtColl*)pCondColl->GetRegisteredIn()
761 				: *(SwFmtColl*)GetRegisteredIn();
762 }
763 
GetSwAttrSet() const764 inline const SwAttrSet& SwCntntNode::GetSwAttrSet() const
765 {
766     return mpAttrSet ? *GetpSwAttrSet() : GetAnyFmtColl().GetAttrSet();
767 }
768 
769 //FEATURE::CONDCOLL
770 
GetAttr(sal_uInt16 nWhich,sal_Bool bInParents) const771 inline const SfxPoolItem& SwCntntNode::GetAttr( sal_uInt16 nWhich,
772 												sal_Bool bInParents ) const
773 {
774 	return GetSwAttrSet().Get( nWhich, bInParents );
775 }
776 #endif
777