/src/libreoffice/sw/inc/node.hxx
Line | Count | Source |
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 | | |
25 | | #include "swdllapi.h" |
26 | | #include "BorderCacheOwner.hxx" |
27 | | #include "ndarr.hxx" |
28 | | #include "ndtyp.hxx" |
29 | | #include "contentindex.hxx" |
30 | | #include "fmtcol.hxx" |
31 | | #include "nodeoffset.hxx" |
32 | | |
33 | | #include <sfx2/AccessibilityIssue.hxx> |
34 | | |
35 | | #include <memory> |
36 | | #include <vector> |
37 | | |
38 | | class SwContentFrame; |
39 | | class SwContentNode; |
40 | | class SwDoc; |
41 | | class SwEndNode; |
42 | | class SwFrame; |
43 | | class SwFrameFormat; |
44 | | class SwGrfNode; |
45 | | class SwNoTextNode; |
46 | | class SwNodeIndex; |
47 | | class SwOLENode; |
48 | | class SwRect; |
49 | | class SwSection; |
50 | | class SwSectionFormat; |
51 | | class SwTOXBase; |
52 | | class SwSectionNode; |
53 | | class SwStartNode; |
54 | | class SwTabFrame; |
55 | | class SwRootFrame; |
56 | | class SwTable; |
57 | | class SwTableNode; |
58 | | class SwTableBox; |
59 | | class SwTextNode; |
60 | | class SwPageDesc; |
61 | | class SwViewShell; |
62 | | struct SwPosition; |
63 | | class IStyleAccess; |
64 | | class IDocumentSettingAccess; |
65 | | class IDocumentDeviceAccess; |
66 | | class IDocumentMarkAccess; |
67 | | class IDocumentRedlineAccess; |
68 | | class IDocumentStylePoolAccess; |
69 | | class IDocumentLinksAdministration; |
70 | | class IDocumentFieldsAccess; |
71 | | class IDocumentContentOperations; |
72 | | class IDocumentListItems; |
73 | | class Point; |
74 | | enum class SvxFrameDirection; |
75 | | typedef std::vector<SwOLENode*> SwOLENodes; // docary.hxx |
76 | | enum class SwCursorSkipMode; |
77 | | |
78 | | namespace drawinglayer::attribute { |
79 | | class SdrAllFillAttributesHelper; |
80 | | typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; |
81 | | } |
82 | | |
83 | | // Accessibility check |
84 | | |
85 | | namespace sw |
86 | | { |
87 | | struct AccessibilityCheckStatus |
88 | | { |
89 | | std::unique_ptr<sfx::AccessibilityIssueCollection> pCollection; |
90 | | void reset(); |
91 | | }; |
92 | | |
93 | | } |
94 | | |
95 | | /// Base class of the Writer document model elements. |
96 | | class SW_DLLPUBLIC SwNode |
97 | | : public sw::BorderCacheOwner, private BigPtrEntry |
98 | | { |
99 | | friend class SwNodes; |
100 | | friend class SwNodeIndex; |
101 | | |
102 | | SwNodeType m_nNodeType; |
103 | | |
104 | | /// For text nodes: level of auto format. Was put here because we had still free bits. |
105 | | sal_uInt8 m_nAFormatNumLvl : 3; |
106 | | bool m_bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the flag |
107 | | |
108 | | mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus; |
109 | | SwNodeIndex* m_vIndices { nullptr }; ///< ring of indices pointing to this node. |
110 | | |
111 | | public: |
112 | | /// sw_redlinehide: redline node merge state |
113 | | enum class Merge { None, First, NonFirst, Hidden }; |
114 | 119k | bool IsCreateFrameWhenHidingRedlines() const { |
115 | 119k | return m_eMerge == Merge::None || m_eMerge == Merge::First; |
116 | 119k | } |
117 | 0 | void SetRedlineMergeFlag(Merge const eMerge) { m_eMerge = eMerge; } |
118 | 203k | Merge GetRedlineMergeFlag() const { return m_eMerge; } |
119 | | |
120 | | using BigPtrEntry::IsDisconnected; // make this public |
121 | | |
122 | | private: |
123 | | Merge m_eMerge; |
124 | | |
125 | | #ifdef DBG_UTIL |
126 | | static tools::Long s_nSerial; |
127 | | tools::Long m_nSerial; |
128 | | #endif |
129 | | |
130 | | /// all SwFrameFormat that are anchored at the node |
131 | | /// invariant: SwFrameFormat is in the list iff |
132 | | /// SwFrameFormat::GetAnchor().GetContentAnchor() points to this node |
133 | | std::vector<SwFrameFormat*> m_aAnchoredFlys; |
134 | | |
135 | | protected: |
136 | | SwStartNode* m_pStartOfSection; |
137 | | |
138 | | /// only used by SwContentNodeTmp in SwTextNode::Update |
139 | | SwNode(); |
140 | | |
141 | | SwNode( const SwNode& rWhere, const SwNodeType nNodeId ); |
142 | | |
143 | | /// for the initial StartNode |
144 | | SwNode( SwNodes& rNodes, SwNodeOffset nPos, const SwNodeType nNodeId ); |
145 | | |
146 | | public: |
147 | | /** the = 0 forces the class to be an abstract base class, but the dtor can be still called |
148 | | from subclasses */ |
149 | | virtual ~SwNode() override = 0; |
150 | | |
151 | | #ifdef DBG_UTIL |
152 | | tools::Long GetSerial() const { return m_nSerial; } |
153 | | #endif |
154 | | |
155 | | sal_uInt16 GetSectionLevel() const; |
156 | | |
157 | | inline SwNodeOffset StartOfSectionIndex() const; |
158 | 8.23M | const SwStartNode* StartOfSectionNode() const { return m_pStartOfSection; } |
159 | 7.93M | SwStartNode* StartOfSectionNode() { return m_pStartOfSection; } |
160 | | |
161 | | inline SwNodeOffset EndOfSectionIndex() const; |
162 | | inline const SwEndNode* EndOfSectionNode() const; |
163 | | inline SwEndNode* EndOfSectionNode(); |
164 | | |
165 | 0 | sal_uInt8 GetAutoFormatLvl() const { return m_nAFormatNumLvl; } |
166 | 0 | void SetAutoFormatLvl( sal_uInt8 nVal ) { m_nAFormatNumLvl = nVal; } |
167 | | |
168 | 30.5M | bool IsIgnoreDontExpand() const { return m_bIgnoreDontExpand; } |
169 | 0 | void SetIgnoreDontExpand( bool bNew ) { m_bIgnoreDontExpand = bNew; } |
170 | | |
171 | 5.81M | SwNodeType GetNodeType() const { return m_nNodeType; } |
172 | | |
173 | | inline SwStartNode *GetStartNode(); |
174 | | inline const SwStartNode *GetStartNode() const; |
175 | | inline SwContentNode *GetContentNode(); |
176 | | inline const SwContentNode *GetContentNode() const; |
177 | | inline SwEndNode *GetEndNode(); |
178 | | inline const SwEndNode *GetEndNode() const; |
179 | | inline SwTextNode *GetTextNode(); |
180 | | inline const SwTextNode *GetTextNode() const; |
181 | | inline SwOLENode *GetOLENode(); |
182 | | inline const SwOLENode *GetOLENode() const; |
183 | | inline SwNoTextNode *GetNoTextNode(); |
184 | | inline const SwNoTextNode *GetNoTextNode() const; |
185 | | inline SwGrfNode *GetGrfNode(); |
186 | | inline const SwGrfNode *GetGrfNode() const; |
187 | | inline SwTableNode *GetTableNode(); |
188 | | inline const SwTableNode *GetTableNode() const; |
189 | | inline SwSectionNode *GetSectionNode(); |
190 | | inline const SwSectionNode *GetSectionNode() const; |
191 | | |
192 | 24.6M | bool IsStartNode() const { return bool(SwNodeType::Start & m_nNodeType); } |
193 | 181M | bool IsContentNode() const { return bool(SwNodeType::ContentMask & m_nNodeType); } |
194 | 7.77M | bool IsEndNode() const { return SwNodeType::End == m_nNodeType; } |
195 | 352M | bool IsTextNode() const { return SwNodeType::Text == m_nNodeType; } |
196 | 44.2M | bool IsTableNode() const { return SwNodeType::Table == m_nNodeType; } |
197 | 15.9M | bool IsSectionNode() const { return SwNodeType::Section == m_nNodeType; } |
198 | 0 | bool IsOLENode() const { return SwNodeType::Ole == m_nNodeType; } |
199 | 2.85M | bool IsNoTextNode() const { return bool(SwNodeType::NoTextMask & m_nNodeType); } |
200 | 19.1k | bool IsGrfNode() const { return SwNodeType::Grf == m_nNodeType; } |
201 | | |
202 | | /** |
203 | | Checks if this node is in redlines. |
204 | | |
205 | | @retval true this node is in redlines |
206 | | @retval false else |
207 | | */ |
208 | | bool IsInRedlines() const; |
209 | | |
210 | | /** Search table node, in which it is. If it is in no table |
211 | | @return 0. */ |
212 | | SwTableNode *FindTableNode(); |
213 | | inline const SwTableNode *FindTableNode() const; |
214 | | |
215 | | /** Search section node, in which it is. If it is in no section |
216 | | @return 0. */ |
217 | | SwSectionNode *FindSectionNode(); |
218 | | inline const SwSectionNode *FindSectionNode() const; |
219 | | |
220 | | SwStartNode* FindStartNodeByType( SwStartNodeType eTyp ); |
221 | | inline const SwStartNode* FindStartNodeByType( SwStartNodeType eTyp ) const; |
222 | | |
223 | | const SwStartNode* FindTableBoxStartNode() const |
224 | 520k | { return FindStartNodeByType( SwTableBoxStartNode ); } |
225 | | const SwStartNode* FindFlyStartNode() const |
226 | 1.21M | { return FindStartNodeByType( SwFlyStartNode ); } |
227 | | const SwStartNode* FindFootnoteStartNode() const |
228 | 17.2k | { return FindStartNodeByType( SwFootnoteStartNode ); } |
229 | | const SwStartNode* FindHeaderStartNode() const |
230 | 335k | { return FindStartNodeByType( SwHeaderStartNode ); } |
231 | | const SwStartNode* FindFooterStartNode() const |
232 | 289k | { return FindStartNodeByType( SwFooterStartNode ); } |
233 | | |
234 | | /// Node is in which nodes-array/doc? |
235 | | inline SwNodes& GetNodes(); |
236 | | inline const SwNodes& GetNodes() const; |
237 | | |
238 | | SwDoc& GetDoc() |
239 | 174M | { |
240 | 174M | return GetNodes().GetDoc(); |
241 | 174M | } |
242 | | |
243 | | const SwDoc& GetDoc() const |
244 | 56.6M | { |
245 | 56.6M | return GetNodes().GetDoc(); |
246 | 56.6M | } |
247 | | |
248 | | /** Provides access to the document setting interface |
249 | | */ |
250 | | const IDocumentSettingAccess* getIDocumentSettingAccess() const; |
251 | | |
252 | | /** Provides access to the document device interface |
253 | | */ |
254 | | const IDocumentDeviceAccess& getIDocumentDeviceAccess() const; |
255 | | |
256 | | /** Provides access to the document bookmark interface |
257 | | */ |
258 | | const IDocumentMarkAccess* getIDocumentMarkAccess() const; |
259 | | |
260 | | /** Provides access to the document redline interface |
261 | | */ |
262 | | const IDocumentRedlineAccess& getIDocumentRedlineAccess() const; |
263 | | |
264 | | /** Provides access to the document style pool interface |
265 | | */ |
266 | | const IDocumentStylePoolAccess& getIDocumentStylePoolAccess() const; |
267 | | |
268 | | /** Provides access to the document draw model interface |
269 | | */ |
270 | | const IDocumentDrawModelAccess& getIDocumentDrawModelAccess() const; |
271 | | |
272 | | /** Provides access to the document layout interface |
273 | | */ |
274 | | const IDocumentLayoutAccess& getIDocumentLayoutAccess() const; |
275 | | IDocumentLayoutAccess& getIDocumentLayoutAccess(); |
276 | | |
277 | | /** Provides access to the document links administration interface |
278 | | */ |
279 | | const IDocumentLinksAdministration& getIDocumentLinksAdministration() const; |
280 | | IDocumentLinksAdministration& getIDocumentLinksAdministration(); |
281 | | |
282 | | /** Provides access to the document fields administration interface |
283 | | */ |
284 | | const IDocumentFieldsAccess& getIDocumentFieldsAccess() const; |
285 | | IDocumentFieldsAccess& getIDocumentFieldsAccess(); |
286 | | |
287 | | /** Provides access to the document content operations interface |
288 | | */ |
289 | | IDocumentContentOperations& getIDocumentContentOperations(); |
290 | | |
291 | | /** Provides access to the document automatic styles interface |
292 | | */ |
293 | | IStyleAccess& getIDocumentStyleAccess(); |
294 | | |
295 | | /** Provides access to the document's numbered items interface */ |
296 | | IDocumentListItems& getIDocumentListItems(); |
297 | | |
298 | | /// Is node in the visible area of the Shell? |
299 | | bool IsInVisibleArea( SwViewShell const * pSh ) const; |
300 | | /// Is node in a protected area? |
301 | | bool IsInProtectSect() const; |
302 | | /** Is node in something that is protected (range, frame, |
303 | | table cells ... including anchor in case of frames or footnotes)? */ |
304 | | bool IsProtect() const; |
305 | | |
306 | | /** Search PageDesc with which this node is formatted. If layout is existent |
307 | | search over layout, else only the hard way is left: search over the nodes |
308 | | to the front!! */ |
309 | | const SwPageDesc* FindPageDesc( SwNodeOffset* pPgDescNdIdx = nullptr ) const; |
310 | | |
311 | | /// If node is in a fly return the respective format. |
312 | | SwFrameFormat* GetFlyFormat() const; |
313 | | |
314 | | /// If node is in a table return the respective table box. |
315 | | SAL_RET_MAYBENULL SwTableBox* GetTableBox() const; |
316 | | |
317 | 2.88G | SwNodeOffset GetIndex() const { return SwNodeOffset(GetPos()); } |
318 | | |
319 | | const SwTextNode* FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const* pLayout = nullptr) const; |
320 | | |
321 | | sal_uInt8 HasPrevNextLayNode() const; |
322 | | |
323 | 30.4M | std::vector<SwFrameFormat *> const & GetAnchoredFlys() const { return m_aAnchoredFlys; } |
324 | | void AddAnchoredFly(SwFrameFormat *); |
325 | | void RemoveAnchoredFly(SwFrameFormat *); |
326 | | |
327 | | /** |
328 | | * Dumps the node structure to the given destination (file nodes.xml in the current directory by default) |
329 | | */ |
330 | | virtual void dumpAsXml(xmlTextWriterPtr pWriter) const; |
331 | | |
332 | 8.42M | bool operator==(const SwNode& rOther) const { return this == &rOther; } |
333 | 17.7M | bool operator!=(const SwNode& rOther) const { return this != &rOther; } |
334 | 12.5M | bool operator<(const SwNode& rOther) const { assert(&GetNodes() == &rOther.GetNodes()); return GetIndex() < rOther.GetIndex(); } |
335 | 765k | bool operator<=(const SwNode& rOther) const { assert(&GetNodes() == &rOther.GetNodes()); return GetIndex() <= rOther.GetIndex(); } |
336 | 560k | bool operator>(const SwNode& rOther) const { assert(&GetNodes() == &rOther.GetNodes()); return GetIndex() > rOther.GetIndex(); } |
337 | 1.39M | bool operator>=(const SwNode& rOther) const { assert(&GetNodes() == &rOther.GetNodes()); return GetIndex() >= rOther.GetIndex(); } |
338 | | |
339 | | sw::AccessibilityCheckStatus& getAccessibilityCheckStatus() |
340 | 0 | { |
341 | 0 | return m_aAccessibilityCheckStatus; |
342 | 0 | } |
343 | | |
344 | | void resetAndQueueAccessibilityCheck(bool bIssueObjectNameChanged = false); |
345 | | |
346 | | private: |
347 | | SwNode( const SwNode & rNodes ) = delete; |
348 | | SwNode & operator= ( const SwNode & rNodes ) = delete; |
349 | | }; |
350 | | |
351 | | /// Starts a section of nodes in the document model. |
352 | | class SAL_DLLPUBLIC_RTTI SwStartNode: public SwNode |
353 | | { |
354 | | friend class SwNode; |
355 | | friend class SwNodes; |
356 | | friend class SwEndNode; ///< to set the theEndOfSection !! |
357 | | |
358 | | SwEndNode* m_pEndOfSection; |
359 | | SwStartNodeType m_eStartNodeType; |
360 | | |
361 | | /// for the initial StartNode |
362 | | SwStartNode( SwNodes& rNodes, SwNodeOffset nPos ); |
363 | | |
364 | | protected: |
365 | | SwStartNode( const SwNode& rWhere, |
366 | | const SwNodeType nNodeType = SwNodeType::Start, |
367 | | SwStartNodeType = SwNormalStartNode ); |
368 | | public: |
369 | 13.0M | SwStartNodeType GetStartNodeType() const { return m_eStartNodeType; } |
370 | | |
371 | | /// Call ChkCondcoll to all ContentNodes of section. |
372 | | void CheckSectionCondColl() const; |
373 | | |
374 | | virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
375 | | |
376 | | private: |
377 | | SwStartNode( const SwStartNode & rNode ) = delete; |
378 | | SwStartNode & operator= ( const SwStartNode & rNode ) = delete; |
379 | | }; |
380 | | |
381 | | /// Ends a section of nodes in the document model. |
382 | | class SwEndNode final : public SwNode |
383 | | { |
384 | | friend class SwNodes; |
385 | | friend class SwTableNode; ///< To enable creation of its EndNote. |
386 | | friend class SwSectionNode; ///< To enable creation of its EndNote. |
387 | | |
388 | | /// for the initial StartNode |
389 | | SwEndNode( SwNodes& rNodes, SwNodeOffset nPos, SwStartNode& rSttNd ); |
390 | | |
391 | | SwEndNode( const SwNode& rWhere, SwStartNode& rSttNd ); |
392 | | |
393 | | SwEndNode( const SwEndNode & rNode ) = delete; |
394 | | SwEndNode & operator= ( const SwEndNode & rNode ) = delete; |
395 | | }; |
396 | | |
397 | | // SwContentNode |
398 | | |
399 | | class SAL_DLLPUBLIC_RTTI SwContentNode: public sw::BroadcastingModify, public SwNode, public SwContentIndexReg |
400 | | { |
401 | | |
402 | | sw::WriterMultiListener m_aCondCollListener; |
403 | | SwFormatColl* m_pCondColl; |
404 | | mutable bool mbSetModifyAtAttr; |
405 | | |
406 | | protected: |
407 | | /// only used by SwContentNodeTmp in SwTextNode::Update |
408 | | SwContentNode(); |
409 | | |
410 | | SwContentNode( const SwNode& rWhere, const SwNodeType nNodeType, |
411 | | SwFormatColl *pFormatColl ); |
412 | | /** the = 0 forces the class to be an abstract base class, but the dtor can be still called |
413 | | from subclasses */ |
414 | | virtual ~SwContentNode() override = 0; |
415 | | |
416 | | /** Attribute-set for all auto attributes of a ContentNode. |
417 | | (e.g. TextNode or NoTextNode). */ |
418 | | std::shared_ptr<const SwAttrSet> mpAttrSet; |
419 | | |
420 | | /// Make respective nodes create the specific AttrSets. |
421 | | virtual void NewAttrSet( SwAttrPool& ) = 0; |
422 | | |
423 | | /** There some functions that like to remove items from the internal |
424 | | SwAttrSet (handle): */ |
425 | | sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds ); |
426 | | |
427 | | virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) override; |
428 | | |
429 | | public: |
430 | | |
431 | | /** MakeFrame will be called for a certain layout |
432 | | pSib is another SwFrame of the same layout (e.g. the SwRootFrame itself, a sibling, the parent) */ |
433 | | virtual SwContentFrame *MakeFrame( SwFrame* pSib ) = 0; |
434 | | |
435 | | virtual SwContentNode *JoinNext(); |
436 | | /** Is it possible to join two nodes? |
437 | | In pIdx the second position can be returned. */ |
438 | | SW_DLLPUBLIC bool CanJoinNext( SwNodeIndex* pIdx = nullptr ) const; |
439 | | bool CanJoinNext( SwPosition* pIdx ) const; |
440 | | SW_DLLPUBLIC bool CanJoinPrev( SwNodeIndex* pIdx =nullptr ) const; |
441 | | |
442 | | bool GoNext(SwContentIndex&, SwCursorSkipMode nMode ) const; |
443 | | bool GoNext(SwPosition&, SwCursorSkipMode nMode ) const; |
444 | | bool GoPrevious(SwContentIndex&, SwCursorSkipMode nMode ) const; |
445 | | |
446 | | /// @see GetFrameOfModify |
447 | | SW_DLLPUBLIC SwContentFrame *getLayoutFrame( const SwRootFrame*, |
448 | | const SwPosition *pPos = nullptr, |
449 | | std::pair<Point, bool> const* pViewPosAndCalcFrame = nullptr) const; |
450 | | /** @return the real size of the frame or an empty rectangle if |
451 | | no layout exists. Needed for export filters. */ |
452 | | SW_DLLPUBLIC SwRect FindLayoutRect( const Point* pPoint = nullptr ) const; |
453 | | SW_DLLPUBLIC SwRect FindPageFrameRect() const; |
454 | | |
455 | | /** Method creates all views of document for given node. The content |
456 | | frames that are created are put in the respective layout. */ |
457 | | void MakeFramesForAdjacentContentNode(SwContentNode& rNode); |
458 | | |
459 | | /** Method deletes all views of document for the node. The content- |
460 | | frames are removed from the respective layout. |
461 | | */ |
462 | | void DelFrames(SwRootFrame const* pLayout); |
463 | | |
464 | | /** @return count of elements of node content. Default is 1. |
465 | | There are differences between text node and formula node. */ |
466 | | virtual sal_Int32 Len() const; |
467 | | |
468 | | virtual SwContentNode* MakeCopy(SwDoc&, SwNode& rWhere, bool bNewFrames) const = 0; |
469 | | |
470 | | /// Get information from Client. |
471 | | virtual bool GetInfo( SwFindNearestNode& ) const override; |
472 | | |
473 | | /// SS for PoolItems: hard attributation. |
474 | | |
475 | | /// If bInParent is FALSE search for attribute only in this node. |
476 | | const SfxPoolItem& GetAttr( sal_uInt16 nWhich, bool bInParent=true ) const; |
477 | | template<class T> |
478 | | const T& GetAttr( TypedWhichId<T> nWhich, bool bInParent=true ) const |
479 | 53.4M | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); }SvxFirstLineIndentItem const& SwContentNode::GetAttr<SvxFirstLineIndentItem>(TypedWhichId<SvxFirstLineIndentItem>, bool) const Line | Count | Source | 479 | 381k | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
SvxTextLeftMarginItem const& SwContentNode::GetAttr<SvxTextLeftMarginItem>(TypedWhichId<SvxTextLeftMarginItem>, bool) const Line | Count | Source | 479 | 381k | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
Unexecuted instantiation: SwFormatPageDesc const& SwContentNode::GetAttr<SwFormatPageDesc>(TypedWhichId<SwFormatPageDesc>, bool) const SwFormatAutoFormat const& SwContentNode::GetAttr<SwFormatAutoFormat>(TypedWhichId<SwFormatAutoFormat>, bool) const Line | Count | Source | 479 | 125k | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
Unexecuted instantiation: SvxLRSpaceItem const& SwContentNode::GetAttr<SvxLRSpaceItem>(TypedWhichId<SvxLRSpaceItem>, bool) const Unexecuted instantiation: SvxAdjustItem const& SwContentNode::GetAttr<SvxAdjustItem>(TypedWhichId<SvxAdjustItem>, bool) const SvxFormatBreakItem const& SwContentNode::GetAttr<SvxFormatBreakItem>(TypedWhichId<SvxFormatBreakItem>, bool) const Line | Count | Source | 479 | 4.18k | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
SfxUInt16Item const& SwContentNode::GetAttr<SfxUInt16Item>(TypedWhichId<SfxUInt16Item>, bool) const Line | Count | Source | 479 | 30.7M | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
Unexecuted instantiation: SfxGrabBagItem const& SwContentNode::GetAttr<SfxGrabBagItem>(TypedWhichId<SfxGrabBagItem>, bool) const SfxInt16Item const& SwContentNode::GetAttr<SfxInt16Item>(TypedWhichId<SfxInt16Item>, bool) const Line | Count | Source | 479 | 6.87M | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
SfxBoolItem const& SwContentNode::GetAttr<SfxBoolItem>(TypedWhichId<SfxBoolItem>, bool) const Line | Count | Source | 479 | 7.21M | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
SfxStringItem const& SwContentNode::GetAttr<SfxStringItem>(TypedWhichId<SfxStringItem>, bool) const Line | Count | Source | 479 | 7.43M | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
Unexecuted instantiation: SvxRsidItem const& SwContentNode::GetAttr<SvxRsidItem>(TypedWhichId<SvxRsidItem>, bool) const SvxULSpaceItem const& SwContentNode::GetAttr<SvxULSpaceItem>(TypedWhichId<SvxULSpaceItem>, bool) const Line | Count | Source | 479 | 133k | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
Unexecuted instantiation: SvxRightMarginItem const& SwContentNode::GetAttr<SvxRightMarginItem>(TypedWhichId<SvxRightMarginItem>, bool) const Unexecuted instantiation: SvxFontItem const& SwContentNode::GetAttr<SvxFontItem>(TypedWhichId<SvxFontItem>, bool) const Unexecuted instantiation: SwFormatLineNumber const& SwContentNode::GetAttr<SwFormatLineNumber>(TypedWhichId<SwFormatLineNumber>, bool) const SvxParaGridItem const& SwContentNode::GetAttr<SvxParaGridItem>(TypedWhichId<SvxParaGridItem>, bool) const Line | Count | Source | 479 | 51.9k | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
SvxBrushItem const& SwContentNode::GetAttr<SvxBrushItem>(TypedWhichId<SvxBrushItem>, bool) const Line | Count | Source | 479 | 5.89k | { return static_cast<const T&>(GetAttr(sal_uInt16(nWhich), bInParent)); } |
Unexecuted instantiation: SwCropGrf const& SwContentNode::GetAttr<SwCropGrf>(TypedWhichId<SwCropGrf>, bool) const |
480 | | SW_DLLPUBLIC bool GetAttr( SfxItemSet& rSet ) const; |
481 | | /// made virtual |
482 | | SW_DLLPUBLIC virtual bool SetAttr( const SfxPoolItem& ); |
483 | | virtual bool SetAttr( const SfxItemSet& rSet ); |
484 | | virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ); |
485 | | virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr ); |
486 | | virtual sal_uInt16 ResetAllAttr(); |
487 | | |
488 | | /// Obtains attribute that is not delivered via conditional style! |
489 | | SW_DLLPUBLIC const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, bool bInParents ) const; |
490 | | template<class T> |
491 | | const T* GetNoCondAttr( TypedWhichId<T> nWhich, bool bInParents ) const |
492 | 36.5M | { return static_cast<const T*>(GetNoCondAttr(sal_uInt16(nWhich), bInParents)); }Unexecuted instantiation: SfxStringItem const* SwContentNode::GetNoCondAttr<SfxStringItem>(TypedWhichId<SfxStringItem>, bool) const SwNumRuleItem const* SwContentNode::GetNoCondAttr<SwNumRuleItem>(TypedWhichId<SwNumRuleItem>, bool) const Line | Count | Source | 492 | 36.5M | { return static_cast<const T*>(GetNoCondAttr(sal_uInt16(nWhich), bInParents)); } |
|
493 | | |
494 | | /** Does node has already its own auto-attributes? |
495 | | Access to SwAttrSet. */ |
496 | | inline const SwAttrSet &GetSwAttrSet() const; |
497 | 420M | const SwAttrSet *GetpSwAttrSet() const { return mpAttrSet.get(); } |
498 | 11.4M | bool HasSwAttrSet() const { return mpAttrSet != nullptr; } |
499 | | |
500 | | virtual SwFormatColl* ChgFormatColl( SwFormatColl*, bool bSetListLevel = true ); |
501 | 5.59M | SwFormatColl* GetFormatColl() const { return const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn())); } |
502 | | |
503 | | inline SwFormatColl& GetAnyFormatColl() const; |
504 | | inline SwTextFormatColl& GetTextFormatColl() const; |
505 | | void SetCondFormatColl( SwFormatColl* ); |
506 | | inline SwFormatColl* GetCondFormatColl() const; |
507 | | |
508 | | bool IsAnyCondition( SwCollCondition& rTmp ) const; |
509 | | void ChkCondColl(const SwTextFormatColl* pColl = nullptr); |
510 | | |
511 | | /** Invalidates NumRule at the node. NumRule is updated |
512 | | on EndAction of a Shell at the latest. */ |
513 | | bool InvalidateNumRule(); |
514 | | |
515 | | /** determines the text direction for a certain |
516 | | position. @return -1, if text direction could *not* be determined. */ |
517 | | SvxFrameDirection GetTextDirection( const SwPosition& rPos, |
518 | | const Point* pPt ) const; |
519 | | |
520 | 10.5M | void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; } |
521 | 23.7M | bool GetModifyAtAttr() const { return mbSetModifyAtAttr; } |
522 | | |
523 | | static std::unique_ptr<SwOLENodes> CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize ); |
524 | | |
525 | | // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage |
526 | | virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; |
527 | | |
528 | | void UpdateAttr(const SwUpdateAttr&); |
529 | | |
530 | | private: |
531 | | SwContentNode( const SwContentNode & rNode ) = delete; |
532 | | SwContentNode & operator= ( const SwContentNode & rNode ) = delete; |
533 | | |
534 | | void ImplDestroy(); |
535 | | }; |
536 | | |
537 | | // SwTableNode |
538 | | |
539 | | class SW_DLLPUBLIC SwTableNode final : public SwStartNode, public sw::BroadcastingModify |
540 | | { |
541 | | friend class SwNodes; |
542 | | std::unique_ptr<SwTable> m_pTable; |
543 | | |
544 | | void ImplDestroy(); |
545 | | |
546 | | virtual ~SwTableNode() override; |
547 | | |
548 | | public: |
549 | | SwTableNode( const SwNode& ); |
550 | | |
551 | 667k | const SwTable& GetTable() const { return *m_pTable; } |
552 | 568k | SwTable& GetTable() { return *m_pTable; } |
553 | | SwTabFrame *MakeFrame( SwFrame* ); |
554 | | |
555 | | /// Creates the frms for the table node (i.e. the TabFrames). |
556 | | /// pIdxBehind is optional parameter. |
557 | | void MakeOwnFrames(SwPosition* pIdxBehind = nullptr); |
558 | | |
559 | | /** Method deletes all views of document for the node. |
560 | | The content frames are removed from the respective layout. */ |
561 | | void DelFrames(SwRootFrame const* pLayout = nullptr); |
562 | | |
563 | | /** Method creates all views of the document for the previous node. |
564 | | The content frames that are created are put into the respective layout. */ |
565 | | void MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx); |
566 | | |
567 | | SwTableNode* MakeCopy( SwDoc&, const SwNodeIndex& ) const; |
568 | | void SetNewTable( std::unique_ptr<SwTable> , bool bNewFrames=true ); |
569 | | |
570 | | // Removes redline objects that relate to this table from the 'Extra Redlines' table |
571 | | void RemoveRedlines(); |
572 | | |
573 | | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
574 | | |
575 | | private: |
576 | | SwTableNode( const SwTableNode & rNode ) = delete; |
577 | | SwTableNode & operator= ( const SwTableNode & rNode ) = delete; |
578 | | }; |
579 | | |
580 | | /// A section node represents the start of a section on the UI, i.e. the container created using |
581 | | /// Insert -> Section menu item. |
582 | | class SAL_DLLPUBLIC_RTTI SwSectionNode final |
583 | | : public SwStartNode |
584 | | { |
585 | | friend class SwNodes; |
586 | | |
587 | | private: |
588 | | SwSectionNode(const SwSectionNode&) = delete; |
589 | | SwSectionNode& operator=(const SwSectionNode&) = delete; |
590 | | |
591 | | std::unique_ptr<SwSection> const m_pSection; |
592 | | |
593 | | virtual ~SwSectionNode() override; |
594 | | |
595 | | public: |
596 | | SwSectionNode(const SwNode& rWhere, |
597 | | SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase); |
598 | | |
599 | 2.71M | const SwSection& GetSection() const { return *m_pSection; } |
600 | 339k | SwSection& GetSection() { return *m_pSection; } |
601 | | |
602 | | SwFrame* MakeFrame(SwFrame* pSib, bool bHidden); |
603 | | |
604 | | /** Creates the frms for the SectionNode (i.e. the SectionFrames). |
605 | | On default the frames are created until the end of the range. |
606 | | When another NodeIndex pEnd is passed a MakeFrames is called up to it. |
607 | | Used by TableToText. */ |
608 | | void MakeOwnFrames(SwNodeIndex* pIdxBehind, const SwNodeIndex* pEnd = nullptr); |
609 | | |
610 | | /** Method deletes all views of document for the node. The |
611 | | content frames are removed from the respective layout. */ |
612 | | void DelFrames(SwRootFrame const* pLayout = nullptr, bool bForce = false); |
613 | | |
614 | | /** Method creates all views of document for the previous node. |
615 | | The content frames created are put into the respective layout. */ |
616 | | void MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx); |
617 | | |
618 | | SwSectionNode* MakeCopy( SwDoc&, const SwNodeIndex& ) const; |
619 | | |
620 | | /// Set pointer in format of section on itself. |
621 | | void NodesArrChgd(); |
622 | | |
623 | | /** Check for not hidden areas whether there is content that is not in |
624 | | a hidden sub-area. */ |
625 | | bool IsContentHidden() const; |
626 | | |
627 | | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
628 | | |
629 | | }; |
630 | | |
631 | | /** This class is internal, used only during DocumentContentOperationsManager::CopyWithFlyInFly(), and for undo. |
632 | | |
633 | | Some of the nodes are then replaced with SwPlaceholderNode, and at the end of the operation, removed again. |
634 | | FIXME find out if this is really necessary, and if we can avoid creation of the SwPlaceholderNodes in the first place. |
635 | | */ |
636 | | class SwPlaceholderNode final : private SwNode |
637 | | { |
638 | | private: |
639 | | friend class SwNodes; |
640 | | SwPlaceholderNode(const SwNode& rWhere); |
641 | | }; |
642 | | |
643 | | inline SwEndNode *SwNode::GetEndNode() |
644 | 7.12M | { |
645 | 7.12M | return IsEndNode() ? static_cast<SwEndNode*>(this) : nullptr; |
646 | 7.12M | } |
647 | | inline const SwEndNode *SwNode::GetEndNode() const |
648 | 0 | { |
649 | 0 | return IsEndNode() ? static_cast<const SwEndNode*>(this) : nullptr; |
650 | 0 | } |
651 | | inline SwStartNode *SwNode::GetStartNode() |
652 | 10.5M | { |
653 | 10.5M | return IsStartNode() ? static_cast<SwStartNode*>(this) : nullptr; |
654 | 10.5M | } |
655 | | inline const SwStartNode *SwNode::GetStartNode() const |
656 | 99.8k | { |
657 | 99.8k | return IsStartNode() ? static_cast<const SwStartNode*>(this) : nullptr; |
658 | 99.8k | } |
659 | | inline SwTableNode *SwNode::GetTableNode() |
660 | 17.4M | { |
661 | 17.4M | return IsTableNode() ? static_cast<SwTableNode*>(this) : nullptr; |
662 | 17.4M | } |
663 | | inline const SwTableNode *SwNode::GetTableNode() const |
664 | 40.8k | { |
665 | 40.8k | return IsTableNode() ? static_cast<const SwTableNode*>(this) : nullptr; |
666 | 40.8k | } |
667 | | inline SwSectionNode *SwNode::GetSectionNode() |
668 | 11.8M | { |
669 | 11.8M | return IsSectionNode() ? static_cast<SwSectionNode*>(this) : nullptr; |
670 | 11.8M | } |
671 | | inline const SwSectionNode *SwNode::GetSectionNode() const |
672 | 11.2k | { |
673 | 11.2k | return IsSectionNode() ? static_cast<const SwSectionNode*>(this) : nullptr; |
674 | 11.2k | } |
675 | | inline SwContentNode *SwNode::GetContentNode() |
676 | 166M | { |
677 | 166M | return IsContentNode() ? static_cast<SwContentNode*>(this) : nullptr; |
678 | 166M | } |
679 | | inline const SwContentNode *SwNode::GetContentNode() const |
680 | 3.07M | { |
681 | 3.07M | return IsContentNode() ? static_cast<const SwContentNode*>(this) : nullptr; |
682 | 3.07M | } |
683 | | |
684 | | inline const SwStartNode* SwNode::FindStartNodeByType( SwStartNodeType eTyp ) const |
685 | 2.47M | { |
686 | 2.47M | return const_cast<SwNode*>(this)->FindStartNodeByType( eTyp ); |
687 | 2.47M | } |
688 | | inline const SwTableNode* SwNode::FindTableNode() const |
689 | 8.01M | { |
690 | 8.01M | return const_cast<SwNode*>(this)->FindTableNode(); |
691 | 8.01M | } |
692 | | inline const SwSectionNode* SwNode::FindSectionNode() const |
693 | 170k | { |
694 | 170k | return const_cast<SwNode*>(this)->FindSectionNode(); |
695 | 170k | } |
696 | | inline SwNodeOffset SwNode::StartOfSectionIndex() const |
697 | 3.29M | { |
698 | 3.29M | return m_pStartOfSection->GetIndex(); |
699 | 3.29M | } |
700 | | inline SwNodeOffset SwNode::EndOfSectionIndex() const |
701 | 1.09M | { |
702 | 1.09M | return EndOfSectionNode()->GetIndex(); |
703 | 1.09M | } |
704 | | inline const SwEndNode* SwNode::EndOfSectionNode() const |
705 | 8.10M | { |
706 | 8.10M | const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : m_pStartOfSection; |
707 | 8.10M | return pStNd->m_pEndOfSection; |
708 | 8.10M | } |
709 | | inline SwEndNode* SwNode::EndOfSectionNode() |
710 | 933k | { |
711 | 933k | const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : m_pStartOfSection; |
712 | 933k | return pStNd->m_pEndOfSection; |
713 | 933k | } |
714 | | |
715 | | inline SwNodes& SwNode::GetNodes() |
716 | 358M | { |
717 | 358M | return static_cast<SwNodes&>(GetArray()); |
718 | 358M | } |
719 | | inline const SwNodes& SwNode::GetNodes() const |
720 | 163M | { |
721 | 163M | return static_cast<SwNodes&>(GetArray()); |
722 | 163M | } |
723 | | |
724 | | inline SwFormatColl* SwContentNode::GetCondFormatColl() const |
725 | 4.39k | { |
726 | 4.39k | return m_pCondColl; |
727 | 4.39k | } |
728 | | |
729 | | inline SwFormatColl& SwContentNode::GetAnyFormatColl() const |
730 | 60.7M | { |
731 | 60.7M | return m_pCondColl |
732 | 60.7M | ? *m_pCondColl |
733 | 60.7M | : *const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn())); |
734 | 60.7M | } |
735 | | |
736 | | inline SwTextFormatColl& SwContentNode::GetTextFormatColl() const |
737 | 435k | { |
738 | 435k | if (m_pCondColl) |
739 | 0 | { |
740 | 0 | assert(dynamic_cast<SwTextFormatColl*>(m_pCondColl)); |
741 | 0 | return *static_cast<SwTextFormatColl*>(m_pCondColl); |
742 | 0 | } |
743 | 435k | auto pRegistered = GetRegisteredIn(); |
744 | 435k | assert(dynamic_cast<const SwTextFormatColl*>(pRegistered)); |
745 | 435k | return *const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(pRegistered)); |
746 | 435k | } |
747 | | |
748 | | inline const SwAttrSet& SwContentNode::GetSwAttrSet() const |
749 | 362M | { |
750 | 362M | return mpAttrSet ? *GetpSwAttrSet() : GetAnyFormatColl().GetAttrSet(); |
751 | 362M | } |
752 | | |
753 | | inline const SfxPoolItem& SwContentNode::GetAttr( sal_uInt16 nWhich, |
754 | | bool bInParents ) const |
755 | 109M | { |
756 | 109M | return GetSwAttrSet().Get( nWhich, bInParents ); |
757 | 109M | } |
758 | | |
759 | | inline SwPlaceholderNode::SwPlaceholderNode(const SwNode& rWhere) |
760 | 0 | : SwNode(rWhere, SwNodeType::PlaceHolder) |
761 | 0 | { |
762 | 0 | } |
763 | | |
764 | | inline SwNode* SwNodes::operator[]( SwNodeOffset n ) const |
765 | 247M | { |
766 | 247M | return static_cast<SwNode*>(BigPtrArray::operator[] ( sal_Int32(n) )); |
767 | 247M | } |
768 | | |
769 | | #endif |
770 | | |
771 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |