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 <sal/types.h>
24 : #include <tools/mempool.hxx>
25 :
26 : #include "swdllapi.h"
27 : #include <ndarr.hxx>
28 : #include <ndtyp.hxx>
29 : #include <index.hxx>
30 : #include <fmtcol.hxx>
31 :
32 : #include <memory>
33 : #include <vector>
34 :
35 : class SwContentFrm;
36 : class SwContentNode;
37 : class SwDoc;
38 : class SwEndNode;
39 : class SwFrm;
40 : class SwFrameFormat;
41 : class SwGrfNode;
42 : class SwNoTextNode;
43 : class SwNodeIndex;
44 : class SwOLENode;
45 : class SwRect;
46 : class SwSection;
47 : class SwSectionFormat;
48 : class SwTOXBase;
49 : class SwSectionNode;
50 : class SwStartNode;
51 : class SwTabFrm;
52 : class SwRootFrm;
53 : class SwTable;
54 : class SwTableNode;
55 : class SwTableBox;
56 : class SwTextNode;
57 : class SwPageDesc;
58 : class SwViewShell;
59 : struct SwPosition;
60 : class IStyleAccess;
61 : class IDocumentSettingAccess;
62 : class IDocumentDeviceAccess;
63 : class IDocumentMarkAccess;
64 : class IDocumentRedlineAccess;
65 : class IDocumentStylePoolAccess;
66 : class IDocumentLinksAdministration;
67 : class IDocumentFieldsAccess;
68 : class IDocumentContentOperations;
69 : class IDocumentListItems;
70 : class Point;
71 : typedef std::vector<SwOLENode*> SwOLENodes; // docary.hxx
72 :
73 : //UUUU
74 : namespace drawinglayer { namespace attribute {
75 : class SdrAllFillAttributesHelper;
76 : typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
77 : }}
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 nAFormatNumLvl : 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 : /// all SwFrameFormat that are anchored at the node
98 : /// invariant: SwFrameFormat is in the list iff
99 : /// SwFrameFormat::GetAnchor().GetContentAnchor() points to this node
100 : std::unique_ptr<std::vector<SwFrameFormat*>> m_pAnchoredFlys;
101 :
102 : protected:
103 : SwStartNode* pStartOfSection;
104 :
105 : SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeId );
106 :
107 : /// for the initial StartNode
108 : SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNodeId );
109 :
110 : public:
111 : /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
112 : from subclasses */
113 : virtual ~SwNode() = 0;
114 :
115 : #ifdef DBG_UTIL
116 : long GetSerial() const { return m_nSerial; }
117 : #endif
118 :
119 : sal_uInt16 GetSectionLevel() const;
120 :
121 : inline sal_uLong StartOfSectionIndex() const;
122 7855232 : inline const SwStartNode* StartOfSectionNode() const { return pStartOfSection; }
123 12079353 : inline SwStartNode* StartOfSectionNode() { return pStartOfSection; }
124 :
125 : inline sal_uLong EndOfSectionIndex() const;
126 : inline const SwEndNode* EndOfSectionNode() const;
127 : inline SwEndNode* EndOfSectionNode();
128 :
129 0 : inline sal_uInt8 GetAutoFormatLvl() const { return nAFormatNumLvl; }
130 0 : inline void SetAutoFormatLvl( sal_uInt8 nVal ) { nAFormatNumLvl = nVal; }
131 :
132 : inline bool IsSetNumLSpace() const { return bSetNumLSpace; }
133 0 : inline void SetNumLSpace( bool bFlag ) { bSetNumLSpace = bFlag; }
134 :
135 176300 : inline bool IsIgnoreDontExpand() const { return bIgnoreDontExpand; }
136 1908 : inline void SetIgnoreDontExpand( bool bNew ) { bIgnoreDontExpand = bNew; }
137 :
138 471932 : sal_uInt8 GetNodeType() const { return nNodeType; }
139 :
140 : inline SwStartNode *GetStartNode();
141 : inline const SwStartNode *GetStartNode() const;
142 : inline SwContentNode *GetContentNode();
143 : inline const SwContentNode *GetContentNode() const;
144 : inline SwEndNode *GetEndNode();
145 : inline const SwEndNode *GetEndNode() const;
146 : inline SwTextNode *GetTextNode();
147 : inline const SwTextNode *GetTextNode() const;
148 : inline SwOLENode *GetOLENode();
149 : inline const SwOLENode *GetOLENode() const;
150 : inline SwNoTextNode *GetNoTextNode();
151 : inline const SwNoTextNode *GetNoTextNode() const;
152 : inline SwGrfNode *GetGrfNode();
153 : inline const SwGrfNode *GetGrfNode() const;
154 : inline SwTableNode *GetTableNode();
155 : inline const SwTableNode *GetTableNode() const;
156 : inline SwSectionNode *GetSectionNode();
157 : inline const SwSectionNode *GetSectionNode() const;
158 :
159 : inline bool IsStartNode() const;
160 : inline bool IsContentNode() const;
161 : inline bool IsEndNode() const;
162 : inline bool IsTextNode() const;
163 : inline bool IsTableNode() const;
164 : inline bool IsSectionNode() const;
165 : inline bool IsOLENode() const;
166 : inline bool IsNoTextNode() const;
167 : inline bool IsGrfNode() const;
168 :
169 : /**
170 : Checks if this node is in redlines.
171 :
172 : @retval true this node is in redlines
173 : @retval false else
174 : */
175 : bool IsInRedlines() const;
176 :
177 : /** Search table node, in which it is. If it is in no table
178 : @return 0. */
179 : SwTableNode *FindTableNode();
180 : inline const SwTableNode *FindTableNode() const;
181 :
182 : /** Search section node, in which it is. If it is in no section
183 : @return 0. */
184 : SwSectionNode *FindSectionNode();
185 : inline const SwSectionNode *FindSectionNode() const;
186 :
187 : SwStartNode* FindSttNodeByType( SwStartNodeType eTyp );
188 : inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const;
189 :
190 131141 : const SwStartNode* FindTableBoxStartNode() const
191 131141 : { return FindSttNodeByType( SwTableBoxStartNode ); }
192 24418 : const SwStartNode* FindFlyStartNode() const
193 24418 : { return FindSttNodeByType( SwFlyStartNode ); }
194 5865 : const SwStartNode* FindFootnoteStartNode() const
195 5865 : { return FindSttNodeByType( SwFootnoteStartNode ); }
196 5860 : const SwStartNode* FindHeaderStartNode() const
197 5860 : { return FindSttNodeByType( SwHeaderStartNode ); }
198 6516 : const SwStartNode* FindFooterStartNode() const
199 6516 : { return FindSttNodeByType( SwFooterStartNode ); }
200 :
201 : /// Node is in which nodes-array/doc?
202 : inline SwNodes& GetNodes();
203 : inline const SwNodes& GetNodes() const;
204 : inline SwDoc* GetDoc();
205 : inline const SwDoc* GetDoc() const;
206 :
207 : /** Provides access to the document setting interface
208 : */
209 : const IDocumentSettingAccess* getIDocumentSettingAccess() const;
210 :
211 : /** Provides access to the document device interface
212 : */
213 : const IDocumentDeviceAccess* getIDocumentDeviceAccess() const;
214 :
215 : /** Provides access to the document bookmark interface
216 : */
217 : const IDocumentMarkAccess* getIDocumentMarkAccess() const;
218 :
219 : /** Provides access to the document redline interface
220 : */
221 : const IDocumentRedlineAccess* getIDocumentRedlineAccess() const;
222 :
223 : /** Provides access to the document style pool interface
224 : */
225 : const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
226 :
227 : /** Provides access to the document draw model interface
228 : */
229 : const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
230 :
231 : /** Provides access to the document layout interface
232 : */
233 : const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
234 : IDocumentLayoutAccess* getIDocumentLayoutAccess();
235 :
236 : /** Provides access to the document links administration interface
237 : */
238 : const IDocumentLinksAdministration* getIDocumentLinksAdministration() const;
239 : IDocumentLinksAdministration* getIDocumentLinksAdministration();
240 :
241 : /** Provides access to the document fields administration interface
242 : */
243 : const IDocumentFieldsAccess* getIDocumentFieldsAccess() const;
244 : IDocumentFieldsAccess* getIDocumentFieldsAccess();
245 :
246 : /** Provides access to the document content operations interface
247 : */
248 : IDocumentContentOperations* getIDocumentContentOperations();
249 :
250 : /** Provides access to the document automatic styles interface
251 : */
252 : IStyleAccess& getIDocumentStyleAccess();
253 :
254 : /** Provides access to the document's numbered items interface
255 :
256 : @author OD
257 : */
258 : IDocumentListItems& getIDocumentListItems();
259 :
260 : /// Is node in the visible area of the Shell?
261 : bool IsInVisibleArea( SwViewShell const * pSh = 0 ) const;
262 : /// Is node in an protected area?
263 : bool IsInProtectSect() const;
264 : /** Is node in something that is protected (range, frame,
265 : table cells ... including anchor in case of frames or footnotes)? */
266 : bool IsProtect() const;
267 :
268 : /** Search PageDesc with which this node is formatted. If layout is existent
269 : search over layout, else only the hard way is left: search over the nodes
270 : to the front!! */
271 : const SwPageDesc* FindPageDesc( bool bCalcLay, size_t* pPgDescNdIdx = 0 ) const;
272 :
273 : /// If node is in a fly return the respective format.
274 : SwFrameFormat* GetFlyFormat() const;
275 :
276 : /// If node is in a table return the respective table box.
277 : SwTableBox* GetTableBox() const;
278 :
279 197958844 : inline sal_uLong GetIndex() const { return GetPos(); }
280 :
281 : const SwTextNode* FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const;
282 :
283 : sal_uInt8 HasPrevNextLayNode() const;
284 :
285 168317 : std::vector<SwFrameFormat *> const* GetAnchoredFlys() const { return m_pAnchoredFlys.get(); }
286 : void AddAnchoredFly(SwFrameFormat *);
287 : void RemoveAnchoredFly(SwFrameFormat *);
288 :
289 : /**
290 : * Dumps the node structure to the given destination (file nodes.xml in the current directory by default)
291 : * @since 3.5
292 : */
293 : virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
294 :
295 : private:
296 : SwNode( const SwNode & rNodes ) SAL_DELETED_FUNCTION;
297 : SwNode & operator= ( const SwNode & rNodes ) SAL_DELETED_FUNCTION;
298 : };
299 :
300 : /// Starts a section of nodes in the document model.
301 100764 : class SwStartNode: public SwNode
302 : {
303 : friend class SwNode;
304 : friend class SwNodes;
305 : friend class SwEndNode; ///< to set the theEndOfSection !!
306 :
307 : SwEndNode* pEndOfSection;
308 : SwStartNodeType eSttNdTyp;
309 :
310 : /// for the initial StartNode
311 : SwStartNode( SwNodes& rNodes, sal_uLong nPos );
312 :
313 : protected:
314 : SwStartNode( const SwNodeIndex &rWhere,
315 : const sal_uInt8 nNodeType = ND_STARTNODE,
316 : SwStartNodeType = SwNormalStartNode );
317 : public:
318 102298 : DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)
319 :
320 2867863 : SwStartNodeType GetStartNodeType() const { return eSttNdTyp; }
321 :
322 : /// Call ChkCondcoll to all ContentNodes of section.
323 : void CheckSectionCondColl() const;
324 :
325 : virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
326 :
327 : private:
328 : SwStartNode( const SwStartNode & rNode ) SAL_DELETED_FUNCTION;
329 : SwStartNode & operator= ( const SwStartNode & rNode ) SAL_DELETED_FUNCTION;
330 : };
331 :
332 : /// Ends a section of nodes in the document model.
333 102194 : class SwEndNode : public SwNode
334 : {
335 : friend class SwNodes;
336 : friend class SwTableNode; ///< To enable creation of its EndNote.
337 : friend class SwSectionNode; ///< To enable creation of its EndNote.
338 :
339 : /// for the initial StartNode
340 : SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd );
341 :
342 : protected:
343 : SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd );
344 :
345 102290 : DECL_FIXEDMEMPOOL_NEWDEL(SwEndNode)
346 :
347 : private:
348 : SwEndNode( const SwEndNode & rNode ) SAL_DELETED_FUNCTION;
349 : SwEndNode & operator= ( const SwEndNode & rNode ) SAL_DELETED_FUNCTION;
350 : };
351 :
352 : // SwContentNode
353 :
354 : class SW_DLLPUBLIC SwContentNode: public SwModify, public SwNode, public SwIndexReg
355 : {
356 :
357 : //FEATURE::CONDCOLL
358 : SwDepend* pCondColl;
359 : //FEATURE::CONDCOLL
360 : mutable bool mbSetModifyAtAttr;
361 :
362 : protected:
363 : SwContentNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeType,
364 : SwFormatColl *pFormatColl );
365 : /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
366 : from subclasses */
367 : virtual ~SwContentNode() = 0;
368 :
369 : /** Attribute-set for all auto attributes of a ContentNode.
370 : (e.g. TextNode or NoTextNode). */
371 : std::shared_ptr<const SfxItemSet> mpAttrSet;
372 :
373 : /// Make respective nodes create the specific AttrSets.
374 : virtual void NewAttrSet( SwAttrPool& ) = 0;
375 :
376 : /** There some functions that like to remove items from the internal
377 : SwAttrSet (handle): */
378 : sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds );
379 :
380 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
381 :
382 : public:
383 : TYPEINFO_OVERRIDE(); /// Already contained in base class Client.
384 :
385 : /** MakeFrm will be called for a certain layout
386 : pSib is another SwFrm of the same layout (e.g. the SwRootFrm itself, a sibling, the parent) */
387 : virtual SwContentFrm *MakeFrm( SwFrm* pSib ) = 0;
388 :
389 : virtual SwContentNode *SplitContentNode(const SwPosition & ) = 0;
390 :
391 : virtual SwContentNode *JoinNext();
392 : virtual SwContentNode *JoinPrev();
393 : /** Is it possible to join two nodes?
394 : In pIdx the second position can be returned. */
395 : bool CanJoinNext( SwNodeIndex* pIdx =0 ) const;
396 : bool CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
397 :
398 140269 : void MakeStartIndex( SwIndex * pIdx ) { pIdx->Assign( this, 0 ); }
399 84923 : void MakeEndIndex( SwIndex * pIdx ) { pIdx->Assign( this, Len() ); }
400 :
401 : bool GoNext(SwIndex *, sal_uInt16 nMode ) const;
402 : bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const;
403 :
404 : /// Replacement for good old GetFrm(..):
405 : SwContentFrm *getLayoutFrm( const SwRootFrm*,
406 : const Point* pDocPos = 0,
407 : const SwPosition *pPos = 0,
408 : const bool bCalcFrm = true ) const;
409 : /** @return the real size of the frame or an empty rectangle if
410 : no layout exists. Needed for export filters. */
411 : SwRect FindLayoutRect( const bool bPrtArea = false,
412 : const Point* pPoint = 0,
413 : const bool bCalcFrm = false ) const;
414 : SwRect FindPageFrmRect( const bool bPrtArea = false,
415 : const Point* pPoint = 0,
416 : const bool bCalcFrm = false ) const;
417 :
418 : /** Method creates all views of document for given node. The content
419 : frames that are created are put in the respective layout. */
420 : void MakeFrms( SwContentNode& rNode );
421 :
422 : /** Method deletes all views of document for the node. The content-
423 : frames are removed from the respective layout.
424 :
425 : Add an input param to identify if acc table should be disposed
426 : */
427 : void DelFrms( bool bIsAccTableDispose = true );
428 :
429 : /** @return count of elements of node content. Default is 1.
430 : There are differences between text node and formula node. */
431 : virtual sal_Int32 Len() const;
432 :
433 : virtual SwContentNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const = 0;
434 :
435 : /// Get information from Client.
436 : virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE;
437 :
438 : /// SS for PoolItems: hard attributation.
439 :
440 : /// If bInParent is FALSE search for attribute only in this node.
441 : const SfxPoolItem& GetAttr( sal_uInt16 nWhich, bool bInParent=true ) const;
442 : bool GetAttr( SfxItemSet& rSet, bool bInParent=true ) const;
443 : /// made virtual
444 : virtual bool SetAttr( const SfxPoolItem& );
445 : virtual bool SetAttr( const SfxItemSet& rSet );
446 : virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
447 : virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr );
448 : virtual sal_uInt16 ResetAllAttr();
449 :
450 : /// Obtains attribute that is not delivered via conditional style!
451 : const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, bool bInParents ) const;
452 :
453 : /** Does node has already its own auto-attributes?
454 : Access to SwAttrSet. */
455 : inline const SwAttrSet &GetSwAttrSet() const;
456 4867801 : inline const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); }
457 500474 : inline bool HasSwAttrSet() const { return mpAttrSet != nullptr; }
458 :
459 : virtual SwFormatColl* ChgFormatColl( SwFormatColl* );
460 60978 : SwFormatColl* GetFormatColl() const { return const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn())); }
461 :
462 : //FEATURE::CONDCOLL
463 : inline SwFormatColl& GetAnyFormatColl() const;
464 : void SetCondFormatColl( SwFormatColl* );
465 : inline SwFormatColl* GetCondFormatColl() const;
466 :
467 : bool IsAnyCondition( SwCollCondition& rTmp ) const;
468 : void ChkCondColl();
469 : //FEATURE::CONDCOLL
470 :
471 : /** Invalidates NumRule at the node. NumRule is updated
472 : on EndAction of a Shell at the latest. */
473 : bool InvalidateNumRule();
474 :
475 : /** determines the text direction for a certain
476 : position. @return -1, if text direction could *not* be determined. */
477 : short GetTextDirection( const SwPosition& rPos,
478 : const Point* pPt ) const;
479 :
480 83758 : inline void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
481 195498 : inline bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
482 :
483 : static SwOLENodes* CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize );
484 :
485 : //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
486 : virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
487 :
488 : private:
489 : SwContentNode( const SwContentNode & rNode ) SAL_DELETED_FUNCTION;
490 : SwContentNode & operator= ( const SwContentNode & rNode ) SAL_DELETED_FUNCTION;
491 : };
492 :
493 : // SwTableNode
494 :
495 : class SW_DLLPUBLIC SwTableNode : public SwStartNode, public SwModify
496 : {
497 : friend class SwNodes;
498 : SwTable* pTable;
499 : protected:
500 : virtual ~SwTableNode();
501 :
502 : public:
503 : SwTableNode( const SwNodeIndex & );
504 :
505 31804 : const SwTable& GetTable() const { return *pTable; }
506 28842 : SwTable& GetTable() { return *pTable; }
507 : SwTabFrm *MakeFrm( SwFrm* );
508 :
509 : /// Creates the frms for the table node (i.e. the TabFrms).
510 : void MakeFrms( SwNodeIndex* pIdxBehind );
511 :
512 : /** Method deletes all views of document for the node.
513 : The content frames are removed from the respective layout. */
514 : void DelFrms();
515 :
516 : /** Method creates all views of the document for the previous node.
517 : The content frames that are created are put into the respective layout. */
518 : void MakeFrms( const SwNodeIndex & rIdx );
519 :
520 : SwTableNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
521 : void SetNewTable( SwTable* , bool bNewFrames=true );
522 :
523 : // Removes redline objects that relate to this table from the 'Extra Redlines' table
524 : void RemoveRedlines();
525 :
526 : private:
527 : SwTableNode( const SwTableNode & rNode ) SAL_DELETED_FUNCTION;
528 : SwTableNode & operator= ( const SwTableNode & rNode ) SAL_DELETED_FUNCTION;
529 : };
530 :
531 : class SwSectionNode
532 : : public SwStartNode
533 : {
534 : friend class SwNodes;
535 :
536 : private:
537 : SwSectionNode(const SwSectionNode&) SAL_DELETED_FUNCTION;
538 : SwSectionNode& operator=(const SwSectionNode&) SAL_DELETED_FUNCTION;
539 :
540 : std::unique_ptr<SwSection> const m_pSection;
541 :
542 : protected:
543 : virtual ~SwSectionNode();
544 :
545 : public:
546 : SwSectionNode(SwNodeIndex const&,
547 : SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase);
548 :
549 3197 : const SwSection& GetSection() const { return *m_pSection; }
550 1899 : SwSection& GetSection() { return *m_pSection; }
551 :
552 : SwFrm *MakeFrm( SwFrm* );
553 :
554 : /** Creates the frms for the SectionNode (i.e. the SectionFrms).
555 : On default the frames are created until the end of the range.
556 : When another NodeIndex pEnd is passed a MakeFrms is called up to it.
557 : Used by TableToText. */
558 : void MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = NULL );
559 :
560 : /** Method deletes all views of document for the node. The
561 : content frames are removed from the respective layout. */
562 : void DelFrms();
563 :
564 : /** Method creates all views of document for the previous node.
565 : The content frames created are put into the respective layout. */
566 : void MakeFrms( const SwNodeIndex & rIdx );
567 :
568 : SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
569 :
570 : /// Set pointer in format of section on itself.
571 : void NodesArrChgd();
572 :
573 : /** Check for not hidden areas whether there is content that is not in
574 : a hidden sub-area. */
575 : bool IsContentHidden() const;
576 :
577 : };
578 :
579 : /** This class is internal, used only during DocumentContentOperationsManager::CopyWithFlyInFly(), and for undo.
580 :
581 : Some of the nodes are then replaced with SwPlaceholderNode, and at the end of the operation, removed again.
582 : FIXME find out if this is really necessary, and if we can avoid creation of the SwPlaceholderNodes in the first place.
583 : */
584 18 : class SwPlaceholderNode : private SwNode
585 : {
586 : private:
587 : friend class SwNodes;
588 : SwPlaceholderNode(const SwNodeIndex &rWhere);
589 : };
590 :
591 343585 : inline SwEndNode *SwNode::GetEndNode()
592 : {
593 343585 : return ND_ENDNODE == nNodeType ? static_cast<SwEndNode*>(this) : 0;
594 : }
595 2 : inline const SwEndNode *SwNode::GetEndNode() const
596 : {
597 2 : return ND_ENDNODE == nNodeType ? static_cast<const SwEndNode*>(this) : 0;
598 : }
599 219998 : inline SwStartNode *SwNode::GetStartNode()
600 : {
601 219998 : return ND_STARTNODE & nNodeType ? static_cast<SwStartNode*>(this) : 0;
602 : }
603 0 : inline const SwStartNode *SwNode::GetStartNode() const
604 : {
605 0 : return ND_STARTNODE & nNodeType ? static_cast<const SwStartNode*>(this) : 0;
606 : }
607 712171 : inline SwTableNode *SwNode::GetTableNode()
608 : {
609 712171 : return ND_TABLENODE == nNodeType ? static_cast<SwTableNode*>(this) : 0;
610 : }
611 1044 : inline const SwTableNode *SwNode::GetTableNode() const
612 : {
613 1044 : return ND_TABLENODE == nNodeType ? static_cast<const SwTableNode*>(this) : 0;
614 : }
615 11590398 : inline SwSectionNode *SwNode::GetSectionNode()
616 : {
617 11590398 : return ND_SECTIONNODE == nNodeType ? static_cast<SwSectionNode*>(this) : 0;
618 : }
619 18094 : inline const SwSectionNode *SwNode::GetSectionNode() const
620 : {
621 18094 : return ND_SECTIONNODE == nNodeType ? static_cast<const SwSectionNode*>(this) : 0;
622 : }
623 96719072 : inline SwContentNode *SwNode::GetContentNode()
624 : {
625 96719072 : return ND_CONTENTNODE & nNodeType ? static_cast<SwContentNode*>(this) : 0;
626 : }
627 53331 : inline const SwContentNode *SwNode::GetContentNode() const
628 : {
629 53331 : return ND_CONTENTNODE & nNodeType ? static_cast<const SwContentNode*>(this) : 0;
630 : }
631 :
632 770222 : inline bool SwNode::IsStartNode() const
633 : {
634 770222 : return (ND_STARTNODE & nNodeType) != 0;
635 : }
636 1127462 : inline bool SwNode::IsContentNode() const
637 : {
638 1127462 : return (ND_CONTENTNODE & nNodeType) != 0;
639 : }
640 113662 : inline bool SwNode::IsEndNode() const
641 : {
642 113662 : return ND_ENDNODE == nNodeType;
643 : }
644 1027090 : inline bool SwNode::IsTextNode() const
645 : {
646 1027090 : return ND_TEXTNODE == nNodeType;
647 : }
648 1872962 : inline bool SwNode::IsTableNode() const
649 : {
650 1872962 : return ND_TABLENODE == nNodeType;
651 : }
652 36289829 : inline bool SwNode::IsSectionNode() const
653 : {
654 36289829 : return ND_SECTIONNODE == nNodeType;
655 : }
656 4374 : inline bool SwNode::IsNoTextNode() const
657 : {
658 4374 : return (ND_NOTXTNODE & nNodeType) != 0;
659 : }
660 617 : inline bool SwNode::IsOLENode() const
661 : {
662 617 : return ND_OLENODE == nNodeType;
663 : }
664 1055 : inline bool SwNode::IsGrfNode() const
665 : {
666 1055 : return ND_GRFNODE == nNodeType;
667 : }
668 :
669 187719 : inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
670 : {
671 187719 : return const_cast<SwNode*>(this)->FindSttNodeByType( eTyp );
672 : }
673 140861 : inline const SwTableNode* SwNode::FindTableNode() const
674 : {
675 140861 : return const_cast<SwNode*>(this)->FindTableNode();
676 : }
677 11488702 : inline const SwSectionNode* SwNode::FindSectionNode() const
678 : {
679 11488702 : return const_cast<SwNode*>(this)->FindSectionNode();
680 : }
681 151517 : inline sal_uLong SwNode::StartOfSectionIndex() const
682 : {
683 151517 : return pStartOfSection->GetIndex();
684 : }
685 23412 : inline sal_uLong SwNode::EndOfSectionIndex() const
686 : {
687 23412 : const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : pStartOfSection;
688 23412 : return pStNd->pEndOfSection->GetIndex();
689 : }
690 280715 : inline const SwEndNode* SwNode::EndOfSectionNode() const
691 : {
692 280715 : const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : pStartOfSection;
693 280715 : return pStNd->pEndOfSection;
694 : }
695 52619 : inline SwEndNode* SwNode::EndOfSectionNode()
696 : {
697 52619 : const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : pStartOfSection;
698 52619 : return pStNd->pEndOfSection;
699 : }
700 :
701 184735657 : inline SwNodes& SwNode::GetNodes()
702 : {
703 184735657 : return static_cast<SwNodes&>(GetArray());
704 : }
705 126326731 : inline const SwNodes& SwNode::GetNodes() const
706 : {
707 126326731 : return static_cast<SwNodes&>(GetArray());
708 : }
709 :
710 52041847 : inline SwDoc* SwNode::GetDoc()
711 : {
712 52041847 : return GetNodes().GetDoc();
713 : }
714 123901947 : inline const SwDoc* SwNode::GetDoc() const
715 : {
716 123901947 : return GetNodes().GetDoc();
717 : }
718 :
719 3469 : inline SwFormatColl* SwContentNode::GetCondFormatColl() const
720 : {
721 3469 : return pCondColl ? static_cast<SwFormatColl*>(pCondColl->GetRegisteredIn()) : 0;
722 : }
723 :
724 190584484 : inline SwFormatColl& SwContentNode::GetAnyFormatColl() const
725 : {
726 0 : return pCondColl && pCondColl->GetRegisteredIn()
727 0 : ? *static_cast<SwFormatColl*>(pCondColl->GetRegisteredIn())
728 190584484 : : *const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn()));
729 : }
730 :
731 193760783 : inline const SwAttrSet& SwContentNode::GetSwAttrSet() const
732 : {
733 193760783 : return mpAttrSet ? *GetpSwAttrSet() : GetAnyFormatColl().GetAttrSet();
734 : }
735 :
736 : //FEATURE::CONDCOLL
737 :
738 1049650 : inline const SfxPoolItem& SwContentNode::GetAttr( sal_uInt16 nWhich,
739 : bool bInParents ) const
740 : {
741 1049650 : return GetSwAttrSet().Get( nWhich, bInParents );
742 : }
743 :
744 9 : inline SwPlaceholderNode::SwPlaceholderNode(const SwNodeIndex &rWhere)
745 9 : : SwNode(rWhere, ND_PLACEHOLDER)
746 : {
747 9 : }
748 :
749 3867416 : inline SwNodePtr SwNodes::operator[]( sal_uLong n ) const
750 : {
751 3867416 : return static_cast<SwNodePtr>(BigPtrArray::operator[] ( n ));
752 : }
753 :
754 : #endif
755 :
756 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|