/src/libreoffice/sw/inc/calbck.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 | | #pragma once |
21 | | |
22 | | #include <cassert> |
23 | | |
24 | | #include <svl/hint.hxx> |
25 | | #include <svl/broadcast.hxx> |
26 | | #include <svl/poolitem.hxx> |
27 | | #include <tools/debug.hxx> |
28 | | #include "swdllapi.h" |
29 | | #include "ring.hxx" |
30 | | #include <type_traits> |
31 | | #include <vector> |
32 | | #include <optional> |
33 | | |
34 | | class SwModify; |
35 | | class SwFormatChangeHint; |
36 | | class SwAttrSet; |
37 | | class SwCellFrame; |
38 | | class SwTabFrame; |
39 | | class SwRowFrame; |
40 | | class SwTable; |
41 | | class SwFindNearestNode; |
42 | | |
43 | | /* |
44 | | SwModify and SwClient cooperate in propagating attribute changes. |
45 | | If an attribute changes, the change is notified to all dependent |
46 | | formats and other interested objects, e.g. Nodes. The clients will detect |
47 | | if the change affects them. It could be that the changed attribute is |
48 | | overruled in the receiving object so that its change does not become |
49 | | effective or that the receiver is not interested in the particular attribute |
50 | | in general (though probably in other attributes of the SwModify object they |
51 | | are registered in). |
52 | | As SwModify objects are derived from SwClient, they can create a chain of SwClient |
53 | | objects where changes can get propagated through. |
54 | | Each SwClient can be registered at only one SwModify object, while each SwModify |
55 | | object is connected to a list of SwClient objects. If an object derived from SwClient |
56 | | wants to get notifications from more than one SwModify object, it must create additional |
57 | | SwClient objects. The SwDepend class allows to handle their notifications in the same |
58 | | notification callback as it forwards the Modify() calls it receives to a "master" |
59 | | SwClient implementation. |
60 | | The SwIterator class allows to iterate over the SwClient objects registered at an |
61 | | SwModify. For historical reasons its ability to use TypeInfo to restrict this iteration |
62 | | to objects of a particular type created a lot of code that misuses SwClient-SwModify |
63 | | relationships that basically should be used only for Modify/Notify callbacks. |
64 | | This is still subject to refactoring. |
65 | | */ |
66 | | |
67 | | |
68 | | namespace sw |
69 | | { |
70 | | class ClientIteratorBase; |
71 | | class ListenerEntry; |
72 | | class ObjectDyingHint; |
73 | | enum class IteratorMode { Exact, UnwrapMulti }; |
74 | | } |
75 | | |
76 | | template <typename TElementType, typename TSource, sw::IteratorMode eMode> class SwIterator; |
77 | | |
78 | | namespace sw |
79 | | { |
80 | | void ClientNotifyAttrChg(SwModify& rModify, const SwAttrSet& aSet, SwAttrSet& aOld, SwAttrSet& aNew); |
81 | | struct SAL_DLLPUBLIC_RTTI LegacyModifyHint final: SfxHint |
82 | | { |
83 | 2.67M | LegacyModifyHint(const SfxPoolItem* pOld, const SfxPoolItem* pNew) : SfxHint(SfxHintId::SwLegacyModify), m_pOld(pOld), m_pNew(pNew) {}; |
84 | 168k | sal_uInt16 GetWhich() const { return m_pOld ? m_pOld->Which() : m_pNew ? m_pNew->Which() : 0; }; |
85 | | virtual ~LegacyModifyHint() override; |
86 | | const SfxPoolItem* m_pOld; |
87 | | const SfxPoolItem* m_pNew; |
88 | | }; |
89 | | struct ModifyChangedHint final: SfxHint |
90 | | { |
91 | 4.00k | ModifyChangedHint(const SwModify* pNew) : SfxHint(SfxHintId::SwModifyChanged), m_pNew(pNew) {}; |
92 | | const SwModify* m_pNew; |
93 | | }; |
94 | | // Observer pattern using svl implementation |
95 | | // use this instead of SwClient/SwModify wherever possible |
96 | | // In writer layout, this might not always be possible, |
97 | | // but for listeners outside of it (e.g. unocore) this should be used. |
98 | | // The only "magic" signal this class issues is a ModifyChangedHint |
99 | | // proclaiming its death. It does NOT however provide a new SwModify for |
100 | | // listeners to switch to like the old SwModify/SwClient did, as that leads |
101 | | // to madness. |
102 | | class SW_DLLPUBLIC BroadcasterMixin { |
103 | | SvtBroadcaster m_aNotifier; |
104 | | public: |
105 | 44.4M | BroadcasterMixin() = default; |
106 | | BroadcasterMixin(BroadcasterMixin const &) = default; |
107 | | BroadcasterMixin& operator=(const BroadcasterMixin&) |
108 | 0 | { |
109 | 0 | return *this; // Listeners are never copied or moved. |
110 | 0 | } |
111 | 62.0M | SvtBroadcaster& GetNotifier() { return m_aNotifier; } |
112 | | }; |
113 | | /// refactoring out the same of the more sane SwClient functionality |
114 | | class SAL_DLLPUBLIC_RTTI WriterListener |
115 | | { |
116 | | friend class ::SwModify; |
117 | | friend class ::sw::ClientIteratorBase; |
118 | | private: |
119 | | WriterListener* m_pLeft; |
120 | | WriterListener* m_pRight; ///< double-linked list of other clients |
121 | | |
122 | | WriterListener(WriterListener const&) = delete; |
123 | | WriterListener& operator=(WriterListener const&) = delete; |
124 | | // Helpers for SwModify |
125 | 0 | virtual void RegisterIn(SwModify*) { assert(false); }; // should only be called with a ClientBase<> |
126 | | protected: |
127 | | WriterListener() |
128 | 58.3M | : m_pLeft(nullptr), m_pRight(nullptr) |
129 | 58.3M | {} |
130 | 58.3M | virtual ~WriterListener() {} |
131 | | virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) =0; |
132 | | public: |
133 | 538k | bool IsLast() const { return !m_pLeft && !m_pRight; } |
134 | 4.40M | virtual const SwCellFrame* DynCastCellFrame() const { return nullptr; } |
135 | 120k | virtual const SwTabFrame* DynCastTabFrame() const { return nullptr; } |
136 | 94.2k | virtual const SwRowFrame* DynCastRowFrame() const { return nullptr; } |
137 | 0 | virtual const SwTable* DynCastTable() const { return nullptr; } |
138 | | // get information about attribute |
139 | 0 | virtual bool GetInfo( SwFindNearestNode& ) const { return true; } |
140 | | }; |
141 | | |
142 | | template<typename T> |
143 | | class SW_DLLPUBLIC ClientBase : public ::sw::WriterListener |
144 | | { |
145 | | // avoids making the details of the linked list and the callback method public |
146 | | friend class ::SwModify; |
147 | | friend class sw::ClientIteratorBase; |
148 | | friend class sw::ListenerEntry; |
149 | | template<typename E, typename S, sw::IteratorMode> friend class ::SwIterator; |
150 | | |
151 | | T* m_pRegisteredIn; ///< event source |
152 | | virtual void RegisterIn(SwModify* pModify) override; |
153 | | |
154 | | protected: |
155 | | // single argument ctors shall be explicit. |
156 | | inline explicit ClientBase( T* pToRegisterIn ) |
157 | 13.9M | : m_pRegisteredIn( nullptr ) |
158 | 13.9M | { |
159 | 13.9M | if(pToRegisterIn) |
160 | 4.37M | pToRegisterIn->Add(*this); |
161 | 13.9M | } sw::ClientBase<SwModify>::ClientBase(SwModify*) Line | Count | Source | 157 | 13.2M | : m_pRegisteredIn( nullptr ) | 158 | 13.2M | { | 159 | 13.2M | if(pToRegisterIn) | 160 | 4.10M | pToRegisterIn->Add(*this); | 161 | 13.2M | } |
sw::ClientBase<SwFrameFormat>::ClientBase(SwFrameFormat*) Line | Count | Source | 157 | 639k | : m_pRegisteredIn( nullptr ) | 158 | 639k | { | 159 | 639k | if(pToRegisterIn) | 160 | 264k | pToRegisterIn->Add(*this); | 161 | 639k | } |
|
162 | | |
163 | | // write access to pRegisteredIn shall be granted only to the object itself (protected access) |
164 | 9.47M | T* GetRegisteredInNonConst() const { return m_pRegisteredIn; }sw::ClientBase<SwModify>::GetRegisteredInNonConst() const Line | Count | Source | 164 | 9.47M | T* GetRegisteredInNonConst() const { return m_pRegisteredIn; } |
Unexecuted instantiation: sw::ClientBase<SwFrameFormat>::GetRegisteredInNonConst() const |
165 | | |
166 | | // when overriding this, you MUST call SwClient::SwClientNotify() in the override! |
167 | | virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; |
168 | | |
169 | | public: |
170 | 44.4M | ClientBase() : m_pRegisteredIn(nullptr) {}sw::ClientBase<SwModify>::ClientBase() Line | Count | Source | 170 | 44.4M | ClientBase() : m_pRegisteredIn(nullptr) {} |
Unexecuted instantiation: sw::ClientBase<SwFrameFormat>::ClientBase() |
171 | | ClientBase(ClientBase&&) noexcept; |
172 | | virtual ~ClientBase() override; |
173 | | |
174 | | |
175 | | // in case an SwModify object is destroyed that itself is registered in another SwModify, |
176 | | // its SwClient objects can decide to get registered to the latter instead by calling this method |
177 | | std::optional<sw::ModifyChangedHint> CheckRegistration( const sw::ObjectDyingHint& rHint ); |
178 | | |
179 | 216M | const T* GetRegisteredIn() const { return m_pRegisteredIn; }sw::ClientBase<SwModify>::GetRegisteredIn() const Line | Count | Source | 179 | 200M | const T* GetRegisteredIn() const { return m_pRegisteredIn; } |
sw::ClientBase<SwFrameFormat>::GetRegisteredIn() const Line | Count | Source | 179 | 16.3M | const T* GetRegisteredIn() const { return m_pRegisteredIn; } |
|
180 | 107M | T* GetRegisteredIn() { return m_pRegisteredIn; }sw::ClientBase<SwModify>::GetRegisteredIn() Line | Count | Source | 180 | 104M | T* GetRegisteredIn() { return m_pRegisteredIn; } |
sw::ClientBase<SwFrameFormat>::GetRegisteredIn() Line | Count | Source | 180 | 2.90M | T* GetRegisteredIn() { return m_pRegisteredIn; } |
|
181 | | void EndListeningAll(); |
182 | | void StartListeningToSameModifyAs(const ClientBase&); |
183 | | |
184 | | |
185 | | }; |
186 | | } |
187 | | |
188 | | typedef sw::ClientBase<SwModify> SwClient; |
189 | | |
190 | | |
191 | | // SwModify |
192 | | |
193 | | // class has a doubly linked list for dependencies |
194 | | class SW_DLLPUBLIC SwModify: public SwClient |
195 | | { |
196 | | friend class sw::ClientIteratorBase; |
197 | | friend void sw::ClientNotifyAttrChg(SwModify&, const SwAttrSet&, SwAttrSet&, SwAttrSet&); |
198 | | template<typename E, typename S, sw::IteratorMode> friend class ::SwIterator; |
199 | | sw::WriterListener* m_pWriterListeners; // the start of the linked list of clients |
200 | | bool m_bModifyLocked; // don't broadcast changes now |
201 | | |
202 | | SwModify(SwModify const &) = delete; |
203 | | SwModify &operator =(const SwModify&) = delete; |
204 | | void EnsureBroadcasting(); |
205 | | protected: |
206 | | virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; |
207 | | // SwFormat wants to die different than the rest: It wants to reparent every client to its parent |
208 | | // and then send a SwFormatChg hint. |
209 | | void PrepareFormatDeath(const SwFormatChangeHint&); |
210 | | public: |
211 | | SwModify() |
212 | 44.2M | : SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false) |
213 | 44.2M | {} |
214 | | |
215 | | // broadcasting mechanism |
216 | | virtual void CallSwClientNotify( const SfxHint& rHint ) const; |
217 | | |
218 | | virtual ~SwModify() override; |
219 | | |
220 | | template<typename T> void Add(sw::ClientBase<T>& rDepend); |
221 | | template<typename T> void Remove(sw::ClientBase<T>& rDepend); |
222 | | void RemoveAllWriterListeners(); |
223 | 125M | bool HasWriterListeners() const { return m_pWriterListeners; } |
224 | | template<typename T> bool HasOnlySpecificWriterListeners() const; |
225 | 538k | bool HasOnlyOneListener() const { return m_pWriterListeners && m_pWriterListeners->IsLast(); } |
226 | | |
227 | | // get information about attribute |
228 | | virtual bool GetInfo( SwFindNearestNode& ) const override; |
229 | | |
230 | 63.5M | void LockModify() { m_bModifyLocked = true; } |
231 | 63.5M | void UnlockModify() { m_bModifyLocked = false; } |
232 | 163M | bool IsModifyLocked() const { return m_bModifyLocked; } |
233 | | }; |
234 | | |
235 | | |
236 | | namespace sw |
237 | | { |
238 | | |
239 | | // this class is part of the migration: it still forwards the "old" |
240 | | // SwModify events and announces them both to the old SwClients still |
241 | | // registered and also to the new SvtListeners. |
242 | | // Still: in the long run the SwClient/SwModify interface should not be |
243 | | // used anymore, in which case a BroadcasterMixin should be enough instead |
244 | | // then. |
245 | | class SW_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") BroadcastingModify : |
246 | | public SwModify, public BroadcasterMixin |
247 | | { |
248 | | public: |
249 | | virtual void CallSwClientNotify(const SfxHint& rHint) const override; |
250 | | }; |
251 | | // this should be hidden but sadly SwIterator template needs it... |
252 | | class ListenerEntry final : public SwClient |
253 | | { |
254 | | private: |
255 | | template<typename E, typename S, sw::IteratorMode> friend class ::SwIterator; |
256 | | SwClient *m_pToTell; |
257 | | |
258 | | public: |
259 | | ListenerEntry(SwClient *const pTellHim, SwModify *const pDepend) |
260 | 161k | : SwClient(pDepend), m_pToTell(pTellHim) |
261 | 161k | {} |
262 | | ListenerEntry(ListenerEntry const &) = delete; |
263 | | ListenerEntry& operator=(ListenerEntry const&) = delete; |
264 | | ListenerEntry(ListenerEntry&& other) noexcept |
265 | 34.9k | : SwClient(std::move(other)) |
266 | 34.9k | , m_pToTell(other.m_pToTell) |
267 | 34.9k | { } |
268 | | ListenerEntry& operator=(ListenerEntry&& other) noexcept |
269 | 160 | { |
270 | 160 | m_pToTell = other.m_pToTell; |
271 | 160 | other.GetRegisteredIn()->Add(*this); |
272 | 160 | other.EndListeningAll(); |
273 | 160 | return *this; |
274 | 160 | } |
275 | | |
276 | | /** get Client information */ |
277 | | virtual bool GetInfo( SwFindNearestNode& rInfo) const override; |
278 | | private: |
279 | | virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) override; |
280 | | }; |
281 | | |
282 | | class SW_DLLPUBLIC WriterMultiListener final |
283 | | { |
284 | | SwClient& m_rToTell; |
285 | | std::vector<ListenerEntry> m_vDepends; |
286 | | public: |
287 | | WriterMultiListener(SwClient& rToTell); |
288 | | WriterMultiListener& operator=(WriterMultiListener const&) = delete; // MSVC2015 workaround |
289 | | WriterMultiListener(WriterMultiListener const&) = delete; // MSVC2015 workaround |
290 | | ~WriterMultiListener(); |
291 | | void StartListening(SwModify* pDepend); |
292 | | void EndListening(SwModify* pDepend); |
293 | | bool IsListeningTo(const SwModify* const pDepend) const; |
294 | | void EndListeningAll(); |
295 | | }; |
296 | | class ClientIteratorBase : public sw::Ring< ::sw::ClientIteratorBase > |
297 | | { |
298 | | friend class ::SwModify; |
299 | | protected: |
300 | | const SwModify& m_rRoot; |
301 | | // the current object in an iteration |
302 | | WriterListener* m_pCurrent; |
303 | | // in case the current object is already removed, the next object in the list |
304 | | // is marked down to become the current object in the next step |
305 | | // this is necessary because iteration requires access to members of the current object |
306 | | WriterListener* m_pPosition; |
307 | | static SW_DLLPUBLIC ClientIteratorBase* s_pClientIters; |
308 | | |
309 | | ClientIteratorBase( const SwModify& rModify ) |
310 | 152M | : m_rRoot(rModify) |
311 | 152M | { |
312 | 152M | MoveTo(s_pClientIters); |
313 | | #if defined __GNUC__ && !defined __clang__ |
314 | | #pragma GCC diagnostic push |
315 | | #pragma GCC diagnostic ignored "-Wdangling-pointer" |
316 | | #endif |
317 | 152M | s_pClientIters = this; |
318 | | #if defined __GNUC__ && !defined __clang__ |
319 | | #pragma GCC diagnostic pop |
320 | | #endif |
321 | 152M | m_pCurrent = m_pPosition = m_rRoot.m_pWriterListeners; |
322 | 152M | } |
323 | 42.6M | WriterListener* GetRightOfPos() { return m_pPosition->m_pRight; } |
324 | | WriterListener* GoStart() |
325 | 152M | { |
326 | 152M | m_pPosition = m_rRoot.m_pWriterListeners; |
327 | 152M | if(m_pPosition) |
328 | 46.0M | while( m_pPosition->m_pLeft ) |
329 | 0 | m_pPosition = m_pPosition->m_pLeft; |
330 | 152M | m_pCurrent = m_pPosition; |
331 | 152M | return m_pCurrent; |
332 | 152M | } |
333 | | ~ClientIteratorBase() override |
334 | 152M | { |
335 | 152M | assert(s_pClientIters); |
336 | 152M | if(s_pClientIters == this) |
337 | 152M | s_pClientIters = unique() ? nullptr : GetNextInRing(); |
338 | 152M | MoveTo(nullptr); |
339 | 152M | } |
340 | | // return "true" if an object was removed from a client chain in iteration |
341 | | // adding objects to a client chain in iteration is forbidden |
342 | | // SwModify::Add() asserts this |
343 | 54.2M | bool IsChanged() const { return m_pPosition != m_pCurrent; } |
344 | | // ensures the iterator to point at a current client |
345 | 54.0M | WriterListener* Sync() { m_pCurrent = m_pPosition; return m_pCurrent; } |
346 | | }; |
347 | | } |
348 | | |
349 | | namespace sw::detail |
350 | | { |
351 | | // Dynamic casting can be expensive when used a lot, so for certain type combinations, |
352 | | // we have faster routines. |
353 | | template<typename CastDest> |
354 | | inline const CastDest * internal_dyn_cast(const sw::WriterListener * pSource) |
355 | 15.7M | { |
356 | 15.7M | return dynamic_cast<const CastDest *>(pSource); |
357 | 15.7M | } SwTextFrame const* sw::detail::internal_dyn_cast<SwTextFrame>(sw::WriterListener const*) Line | Count | Source | 355 | 186k | { | 356 | 186k | return dynamic_cast<const CastDest *>(pSource); | 357 | 186k | } |
SwFrame const* sw::detail::internal_dyn_cast<SwFrame>(sw::WriterListener const*) Line | Count | Source | 355 | 914k | { | 356 | 914k | return dynamic_cast<const CastDest *>(pSource); | 357 | 914k | } |
SwContentNode const* sw::detail::internal_dyn_cast<SwContentNode>(sw::WriterListener const*) Line | Count | Source | 355 | 17 | { | 356 | 17 | return dynamic_cast<const CastDest *>(pSource); | 357 | 17 | } |
SwTextFormatColl const* sw::detail::internal_dyn_cast<SwTextFormatColl>(sw::WriterListener const*) Line | Count | Source | 355 | 22.0k | { | 356 | 22.0k | return dynamic_cast<const CastDest *>(pSource); | 357 | 22.0k | } |
SwContentFrame const* sw::detail::internal_dyn_cast<SwContentFrame>(sw::WriterListener const*) Line | Count | Source | 355 | 78.6k | { | 356 | 78.6k | return dynamic_cast<const CastDest *>(pSource); | 357 | 78.6k | } |
SwSection const* sw::detail::internal_dyn_cast<SwSection>(sw::WriterListener const*) Line | Count | Source | 355 | 13.4M | { | 356 | 13.4M | return dynamic_cast<const CastDest *>(pSource); | 357 | 13.4M | } |
SwSectionFormat const* sw::detail::internal_dyn_cast<SwSectionFormat>(sw::WriterListener const*) Line | Count | Source | 355 | 156k | { | 356 | 156k | return dynamic_cast<const CastDest *>(pSource); | 357 | 156k | } |
SwFlyFrame const* sw::detail::internal_dyn_cast<SwFlyFrame>(sw::WriterListener const*) Line | Count | Source | 355 | 163k | { | 356 | 163k | return dynamic_cast<const CastDest *>(pSource); | 357 | 163k | } |
SwTextINetFormat const* sw::detail::internal_dyn_cast<SwTextINetFormat>(sw::WriterListener const*) Line | Count | Source | 355 | 4.65k | { | 356 | 4.65k | return dynamic_cast<const CastDest *>(pSource); | 357 | 4.65k | } |
SwSectionFrame const* sw::detail::internal_dyn_cast<SwSectionFrame>(sw::WriterListener const*) Line | Count | Source | 355 | 54 | { | 356 | 54 | return dynamic_cast<const CastDest *>(pSource); | 357 | 54 | } |
SwCursorShell const* sw::detail::internal_dyn_cast<SwCursorShell>(sw::WriterListener const*) Line | Count | Source | 355 | 2.45k | { | 356 | 2.45k | return dynamic_cast<const CastDest *>(pSource); | 357 | 2.45k | } |
SwTableLine const* sw::detail::internal_dyn_cast<SwTableLine>(sw::WriterListener const*) Line | Count | Source | 355 | 93.7k | { | 356 | 93.7k | return dynamic_cast<const CastDest *>(pSource); | 357 | 93.7k | } |
SwTableBox const* sw::detail::internal_dyn_cast<SwTableBox>(sw::WriterListener const*) Line | Count | Source | 355 | 669k | { | 356 | 669k | return dynamic_cast<const CastDest *>(pSource); | 357 | 669k | } |
Unexecuted instantiation: SwTextNode const* sw::detail::internal_dyn_cast<SwTextNode>(sw::WriterListener const*) SwLayoutFrame const* sw::detail::internal_dyn_cast<SwLayoutFrame>(sw::WriterListener const*) Line | Count | Source | 355 | 144 | { | 356 | 144 | return dynamic_cast<const CastDest *>(pSource); | 357 | 144 | } |
Unexecuted instantiation: SwFormatField const* sw::detail::internal_dyn_cast<SwFormatField>(sw::WriterListener const*) |
358 | | template<> |
359 | | inline const SwTable* internal_dyn_cast(const sw::WriterListener * pSource) |
360 | 490k | { |
361 | 490k | return pSource->DynCastTable(); |
362 | 490k | } |
363 | | template<> |
364 | | inline const SwCellFrame* internal_dyn_cast(const sw::WriterListener * pSource) |
365 | 4.40M | { |
366 | 4.40M | return pSource->DynCastCellFrame(); |
367 | 4.40M | } |
368 | | template<> |
369 | | inline const SwTabFrame* internal_dyn_cast(const sw::WriterListener * pSource) |
370 | 125k | { |
371 | 125k | return pSource->DynCastTabFrame(); |
372 | 125k | } |
373 | | template<> |
374 | | inline const SwRowFrame* internal_dyn_cast(const sw::WriterListener * pSource) |
375 | 94.6k | { |
376 | 94.6k | return pSource->DynCastRowFrame(); |
377 | 94.6k | } |
378 | | } // namespace sw::detail |
379 | | |
380 | | template<typename TElementType, typename TSource, |
381 | | sw::IteratorMode eMode = sw::IteratorMode::Exact> class SwIterator final |
382 | | : private sw::ClientIteratorBase |
383 | | { |
384 | | //static_assert(!std::is_base_of<SwPageDesc,TSource>::value, "SwPageDesc as TSource is deprecated."); |
385 | | static_assert(std::is_base_of<SwClient,TElementType>::value, "TElementType needs to be derived from SwClient."); |
386 | | static_assert(std::is_base_of<SwModify,TSource>::value, "TSource needs to be derived from SwModify."); |
387 | | public: |
388 | 49.1M | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {}SwIterator<SwTextFrame, SwTextNode, (sw::IteratorMode)1>::SwIterator(SwTextNode const&) Line | Count | Source | 388 | 32.0M | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwFrame, sw::BroadcastingModify, (sw::IteratorMode)1>::SwIterator(sw::BroadcastingModify const&) Line | Count | Source | 388 | 621k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
Unexecuted instantiation: SwIterator<SwFrame, SwModify, (sw::IteratorMode)0>::SwIterator(SwModify const&) SwIterator<SwContentNode, SwFormatColl, (sw::IteratorMode)0>::SwIterator(SwFormatColl const&) Line | Count | Source | 388 | 157 | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwTextFormatColl, SwFormatColl, (sw::IteratorMode)0>::SwIterator(SwFormatColl const&) Line | Count | Source | 388 | 36.5k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwRowFrame, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 13.1k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwTabFrame, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 120k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwFrame, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 336k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwContentFrame, SwContentNode, (sw::IteratorMode)1>::SwIterator(SwContentNode const&) Line | Count | Source | 388 | 449k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwFrame, SwContentNode, (sw::IteratorMode)1>::SwIterator(SwContentNode const&) Line | Count | Source | 388 | 142k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwSection, SwSectionFormat, (sw::IteratorMode)0>::SwIterator(SwSectionFormat const&) Line | Count | Source | 388 | 13.4M | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwSectionFormat, SwSectionFormat, (sw::IteratorMode)0>::SwIterator(SwSectionFormat const&) Line | Count | Source | 388 | 80.3k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwFlyFrame, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 317k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwTextINetFormat, SwCharFormat, (sw::IteratorMode)0>::SwIterator(SwCharFormat const&) Line | Count | Source | 388 | 5.55k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwCellFrame, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 254k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwSectionFrame, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 18 | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwCursorShell, SwContentNode, (sw::IteratorMode)0>::SwIterator(SwContentNode const&) Line | Count | Source | 388 | 2.45k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
Unexecuted instantiation: SwIterator<SwFrame, SwFrameFormat, (sw::IteratorMode)0>::SwIterator(SwFrameFormat const&) SwIterator<SwFrame, sw::BroadcastingModify, (sw::IteratorMode)0>::SwIterator(sw::BroadcastingModify const&) Line | Count | Source | 388 | 54.9k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwTableLine, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 92.0k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwTableBox, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 664k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwTable, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 490k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
SwIterator<SwContentFrame, SwTextNode, (sw::IteratorMode)1>::SwIterator(SwTextNode const&) Line | Count | Source | 388 | 4.14k | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
Unexecuted instantiation: SwIterator<SwFrame, SwGrfNode, (sw::IteratorMode)0>::SwIterator(SwGrfNode const&) Unexecuted instantiation: SwIterator<SwTabFrame, SwFrameFormat, (sw::IteratorMode)0>::SwIterator(SwFrameFormat const&) Unexecuted instantiation: SwIterator<SwFrame, SwTableFormat, (sw::IteratorMode)0>::SwIterator(SwTableFormat const&) Unexecuted instantiation: SwIterator<SwTextNode, SwFormatColl, (sw::IteratorMode)0>::SwIterator(SwFormatColl const&) Unexecuted instantiation: SwIterator<SwTextFrame, SwContentNode, (sw::IteratorMode)1>::SwIterator(SwContentNode const&) SwIterator<SwLayoutFrame, SwFormat, (sw::IteratorMode)0>::SwIterator(SwFormat const&) Line | Count | Source | 388 | 57 | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
Unexecuted instantiation: SwIterator<SwFormatField, SwFieldType, (sw::IteratorMode)0>::SwIterator(SwFieldType const&) |
389 | | TElementType* First() |
390 | 49.1M | { |
391 | 49.1M | GoStart(); |
392 | 49.1M | if(!m_pPosition) |
393 | 33.1M | return nullptr; |
394 | 16.0M | m_pCurrent = nullptr; |
395 | 16.0M | return Next(); |
396 | 49.1M | } SwIterator<SwTextFrame, SwTextNode, (sw::IteratorMode)1>::First() Line | Count | Source | 390 | 32.0M | { | 391 | 32.0M | GoStart(); | 392 | 32.0M | if(!m_pPosition) | 393 | 31.8M | return nullptr; | 394 | 186k | m_pCurrent = nullptr; | 395 | 186k | return Next(); | 396 | 32.0M | } |
SwIterator<SwFrame, sw::BroadcastingModify, (sw::IteratorMode)1>::First() Line | Count | Source | 390 | 621k | { | 391 | 621k | GoStart(); | 392 | 621k | if(!m_pPosition) | 393 | 218k | return nullptr; | 394 | 402k | m_pCurrent = nullptr; | 395 | 402k | return Next(); | 396 | 621k | } |
Unexecuted instantiation: SwIterator<SwFrame, SwModify, (sw::IteratorMode)0>::First() SwIterator<SwContentNode, SwFormatColl, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 157 | { | 391 | 157 | GoStart(); | 392 | 157 | if(!m_pPosition) | 393 | 140 | return nullptr; | 394 | 17 | m_pCurrent = nullptr; | 395 | 17 | return Next(); | 396 | 157 | } |
SwIterator<SwTextFormatColl, SwFormatColl, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 36.5k | { | 391 | 36.5k | GoStart(); | 392 | 36.5k | if(!m_pPosition) | 393 | 28.5k | return nullptr; | 394 | 8.01k | m_pCurrent = nullptr; | 395 | 8.01k | return Next(); | 396 | 36.5k | } |
SwIterator<SwRowFrame, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 13.1k | { | 391 | 13.1k | GoStart(); | 392 | 13.1k | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 13.1k | m_pCurrent = nullptr; | 395 | 13.1k | return Next(); | 396 | 13.1k | } |
SwIterator<SwTabFrame, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 120k | { | 391 | 120k | GoStart(); | 392 | 120k | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 120k | m_pCurrent = nullptr; | 395 | 120k | return Next(); | 396 | 120k | } |
SwIterator<SwFrame, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 336k | { | 391 | 336k | GoStart(); | 392 | 336k | if(!m_pPosition) | 393 | 223k | return nullptr; | 394 | 113k | m_pCurrent = nullptr; | 395 | 113k | return Next(); | 396 | 336k | } |
SwIterator<SwContentFrame, SwContentNode, (sw::IteratorMode)1>::First() Line | Count | Source | 390 | 449k | { | 391 | 449k | GoStart(); | 392 | 449k | if(!m_pPosition) | 393 | 445k | return nullptr; | 394 | 3.70k | m_pCurrent = nullptr; | 395 | 3.70k | return Next(); | 396 | 449k | } |
SwIterator<SwFrame, SwContentNode, (sw::IteratorMode)1>::First() Line | Count | Source | 390 | 142k | { | 391 | 142k | GoStart(); | 392 | 142k | if(!m_pPosition) | 393 | 136k | return nullptr; | 394 | 5.90k | m_pCurrent = nullptr; | 395 | 5.90k | return Next(); | 396 | 142k | } |
SwIterator<SwSection, SwSectionFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 13.4M | { | 391 | 13.4M | GoStart(); | 392 | 13.4M | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 13.4M | m_pCurrent = nullptr; | 395 | 13.4M | return Next(); | 396 | 13.4M | } |
SwIterator<SwSectionFormat, SwSectionFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 80.3k | { | 391 | 80.3k | GoStart(); | 392 | 80.3k | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 80.3k | m_pCurrent = nullptr; | 395 | 80.3k | return Next(); | 396 | 80.3k | } |
SwIterator<SwFlyFrame, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 317k | { | 391 | 317k | GoStart(); | 392 | 317k | if(!m_pPosition) | 393 | 155k | return nullptr; | 394 | 161k | m_pCurrent = nullptr; | 395 | 161k | return Next(); | 396 | 317k | } |
SwIterator<SwTextINetFormat, SwCharFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 5.55k | { | 391 | 5.55k | GoStart(); | 392 | 5.55k | if(!m_pPosition) | 393 | 3.16k | return nullptr; | 394 | 2.38k | m_pCurrent = nullptr; | 395 | 2.38k | return Next(); | 396 | 5.55k | } |
SwIterator<SwCellFrame, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 254k | { | 391 | 254k | GoStart(); | 392 | 254k | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 254k | m_pCurrent = nullptr; | 395 | 254k | return Next(); | 396 | 254k | } |
SwIterator<SwSectionFrame, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 18 | { | 391 | 18 | GoStart(); | 392 | 18 | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 18 | m_pCurrent = nullptr; | 395 | 18 | return Next(); | 396 | 18 | } |
SwIterator<SwCursorShell, SwContentNode, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 2.45k | { | 391 | 2.45k | GoStart(); | 392 | 2.45k | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 2.45k | m_pCurrent = nullptr; | 395 | 2.45k | return Next(); | 396 | 2.45k | } |
Unexecuted instantiation: SwIterator<SwFrame, SwFrameFormat, (sw::IteratorMode)0>::First() SwIterator<SwFrame, sw::BroadcastingModify, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 54.9k | { | 391 | 54.9k | GoStart(); | 392 | 54.9k | if(!m_pPosition) | 393 | 46.5k | return nullptr; | 394 | 8.38k | m_pCurrent = nullptr; | 395 | 8.38k | return Next(); | 396 | 54.9k | } |
SwIterator<SwTableLine, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 92.0k | { | 391 | 92.0k | GoStart(); | 392 | 92.0k | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 92.0k | m_pCurrent = nullptr; | 395 | 92.0k | return Next(); | 396 | 92.0k | } |
SwIterator<SwTableBox, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 664k | { | 391 | 664k | GoStart(); | 392 | 664k | if(!m_pPosition) | 393 | 59 | return nullptr; | 394 | 664k | m_pCurrent = nullptr; | 395 | 664k | return Next(); | 396 | 664k | } |
SwIterator<SwTable, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 490k | { | 391 | 490k | GoStart(); | 392 | 490k | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 490k | m_pCurrent = nullptr; | 395 | 490k | return Next(); | 396 | 490k | } |
SwIterator<SwContentFrame, SwTextNode, (sw::IteratorMode)1>::First() Line | Count | Source | 390 | 4.14k | { | 391 | 4.14k | GoStart(); | 392 | 4.14k | if(!m_pPosition) | 393 | 2.49k | return nullptr; | 394 | 1.65k | m_pCurrent = nullptr; | 395 | 1.65k | return Next(); | 396 | 4.14k | } |
Unexecuted instantiation: SwIterator<SwFrame, SwGrfNode, (sw::IteratorMode)0>::First() Unexecuted instantiation: SwIterator<SwTabFrame, SwFrameFormat, (sw::IteratorMode)0>::First() Unexecuted instantiation: SwIterator<SwFrame, SwTableFormat, (sw::IteratorMode)0>::First() Unexecuted instantiation: SwIterator<SwTextNode, SwFormatColl, (sw::IteratorMode)0>::First() Unexecuted instantiation: SwIterator<SwTextFrame, SwContentNode, (sw::IteratorMode)1>::First() SwIterator<SwLayoutFrame, SwFormat, (sw::IteratorMode)0>::First() Line | Count | Source | 390 | 57 | { | 391 | 57 | GoStart(); | 392 | 57 | if(!m_pPosition) | 393 | 0 | return nullptr; | 394 | 57 | m_pCurrent = nullptr; | 395 | 57 | return Next(); | 396 | 57 | } |
Unexecuted instantiation: SwIterator<SwFormatField, SwFieldType, (sw::IteratorMode)0>::First() |
397 | | TElementType* Next() |
398 | 16.9M | { |
399 | 16.9M | if(!IsChanged()) |
400 | 975k | m_pPosition = GetRightOfPos(); |
401 | 16.9M | sw::WriterListener *pCurrent(m_pPosition); |
402 | 22.2M | while (m_pPosition) |
403 | 20.8M | { |
404 | 20.8M | if (eMode == sw::IteratorMode::UnwrapMulti) |
405 | 1.05M | { |
406 | 1.05M | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) |
407 | 310 | { |
408 | 310 | pCurrent = pLE->m_pToTell; |
409 | 310 | } |
410 | 1.05M | } |
411 | 20.8M | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) |
412 | 5.23M | { |
413 | 5.23M | m_pPosition = GetRightOfPos(); |
414 | 5.23M | pCurrent = m_pPosition; |
415 | 5.23M | } |
416 | 15.5M | else |
417 | 15.5M | break; |
418 | 20.8M | } |
419 | 16.9M | Sync(); |
420 | 16.9M | return static_cast<TElementType*>(pCurrent); |
421 | 16.9M | } SwIterator<SwTextFrame, SwTextNode, (sw::IteratorMode)1>::Next() Line | Count | Source | 398 | 187k | { | 399 | 187k | if(!IsChanged()) | 400 | 790 | m_pPosition = GetRightOfPos(); | 401 | 187k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 372k | while (m_pPosition) | 403 | 186k | { | 404 | 186k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 186k | { | 406 | 186k | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 186k | } | 411 | 186k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 185k | { | 413 | 185k | m_pPosition = GetRightOfPos(); | 414 | 185k | pCurrent = m_pPosition; | 415 | 185k | } | 416 | 1.69k | else | 417 | 1.69k | break; | 418 | 186k | } | 419 | 187k | Sync(); | 420 | 187k | return static_cast<TElementType*>(pCurrent); | 421 | 187k | } |
SwIterator<SwFrame, sw::BroadcastingModify, (sw::IteratorMode)1>::Next() Line | Count | Source | 398 | 791k | { | 399 | 791k | if(!IsChanged()) | 400 | 388k | m_pPosition = GetRightOfPos(); | 401 | 791k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 827k | while (m_pPosition) | 403 | 786k | { | 404 | 786k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 786k | { | 406 | 786k | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 310 | { | 408 | 310 | pCurrent = pLE->m_pToTell; | 409 | 310 | } | 410 | 786k | } | 411 | 786k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 36.4k | { | 413 | 36.4k | m_pPosition = GetRightOfPos(); | 414 | 36.4k | pCurrent = m_pPosition; | 415 | 36.4k | } | 416 | 750k | else | 417 | 750k | break; | 418 | 786k | } | 419 | 791k | Sync(); | 420 | 791k | return static_cast<TElementType*>(pCurrent); | 421 | 791k | } |
Unexecuted instantiation: SwIterator<SwFrame, SwModify, (sw::IteratorMode)0>::Next() SwIterator<SwContentNode, SwFormatColl, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 17 | { | 399 | 17 | if(!IsChanged()) | 400 | 0 | m_pPosition = GetRightOfPos(); | 401 | 17 | sw::WriterListener *pCurrent(m_pPosition); | 402 | 17 | while (m_pPosition) | 403 | 17 | { | 404 | 17 | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 17 | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 0 | { | 413 | 0 | m_pPosition = GetRightOfPos(); | 414 | 0 | pCurrent = m_pPosition; | 415 | 0 | } | 416 | 17 | else | 417 | 17 | break; | 418 | 17 | } | 419 | 17 | Sync(); | 420 | 17 | return static_cast<TElementType*>(pCurrent); | 421 | 17 | } |
SwIterator<SwTextFormatColl, SwFormatColl, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 12.7k | { | 399 | 12.7k | if(!IsChanged()) | 400 | 4.76k | m_pPosition = GetRightOfPos(); | 401 | 12.7k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 30.0k | while (m_pPosition) | 403 | 22.0k | { | 404 | 22.0k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 22.0k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 17.2k | { | 413 | 17.2k | m_pPosition = GetRightOfPos(); | 414 | 17.2k | pCurrent = m_pPosition; | 415 | 17.2k | } | 416 | 4.76k | else | 417 | 4.76k | break; | 418 | 22.0k | } | 419 | 12.7k | Sync(); | 420 | 12.7k | return static_cast<TElementType*>(pCurrent); | 421 | 12.7k | } |
SwIterator<SwRowFrame, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 13.1k | { | 399 | 13.1k | if(!IsChanged()) | 400 | 0 | m_pPosition = GetRightOfPos(); | 401 | 13.1k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 107k | while (m_pPosition) | 403 | 94.6k | { | 404 | 94.6k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 94.6k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 94.2k | { | 413 | 94.2k | m_pPosition = GetRightOfPos(); | 414 | 94.2k | pCurrent = m_pPosition; | 415 | 94.2k | } | 416 | 350 | else | 417 | 350 | break; | 418 | 94.6k | } | 419 | 13.1k | Sync(); | 420 | 13.1k | return static_cast<TElementType*>(pCurrent); | 421 | 13.1k | } |
SwIterator<SwTabFrame, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 122k | { | 399 | 122k | if(!IsChanged()) | 400 | 2.73k | m_pPosition = GetRightOfPos(); | 401 | 122k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 242k | while (m_pPosition) | 403 | 125k | { | 404 | 125k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 125k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 120k | { | 413 | 120k | m_pPosition = GetRightOfPos(); | 414 | 120k | pCurrent = m_pPosition; | 415 | 120k | } | 416 | 4.92k | else | 417 | 4.92k | break; | 418 | 125k | } | 419 | 122k | Sync(); | 420 | 122k | return static_cast<TElementType*>(pCurrent); | 421 | 122k | } |
SwIterator<SwFrame, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 113k | { | 399 | 113k | if(!IsChanged()) | 400 | 0 | m_pPosition = GetRightOfPos(); | 401 | 113k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 226k | while (m_pPosition) | 403 | 113k | { | 404 | 113k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 113k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 113k | { | 413 | 113k | m_pPosition = GetRightOfPos(); | 414 | 113k | pCurrent = m_pPosition; | 415 | 113k | } | 416 | 0 | else | 417 | 0 | break; | 418 | 113k | } | 419 | 113k | Sync(); | 420 | 113k | return static_cast<TElementType*>(pCurrent); | 421 | 113k | } |
SwIterator<SwContentFrame, SwContentNode, (sw::IteratorMode)1>::Next() Line | Count | Source | 398 | 3.70k | { | 399 | 3.70k | if(!IsChanged()) | 400 | 0 | m_pPosition = GetRightOfPos(); | 401 | 3.70k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 6.35k | while (m_pPosition) | 403 | 3.73k | { | 404 | 3.73k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 3.73k | { | 406 | 3.73k | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 3.73k | } | 411 | 3.73k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 2.64k | { | 413 | 2.64k | m_pPosition = GetRightOfPos(); | 414 | 2.64k | pCurrent = m_pPosition; | 415 | 2.64k | } | 416 | 1.09k | else | 417 | 1.09k | break; | 418 | 3.73k | } | 419 | 3.70k | Sync(); | 420 | 3.70k | return static_cast<TElementType*>(pCurrent); | 421 | 3.70k | } |
SwIterator<SwFrame, SwContentNode, (sw::IteratorMode)1>::Next() Line | Count | Source | 398 | 7.22k | { | 399 | 7.22k | if(!IsChanged()) | 400 | 1.32k | m_pPosition = GetRightOfPos(); | 401 | 7.22k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 7.53k | while (m_pPosition) | 403 | 5.97k | { | 404 | 5.97k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 5.97k | { | 406 | 5.97k | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 5.97k | } | 411 | 5.97k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 312 | { | 413 | 312 | m_pPosition = GetRightOfPos(); | 414 | 312 | pCurrent = m_pPosition; | 415 | 312 | } | 416 | 5.66k | else | 417 | 5.66k | break; | 418 | 5.97k | } | 419 | 7.22k | Sync(); | 420 | 7.22k | return static_cast<TElementType*>(pCurrent); | 421 | 7.22k | } |
SwIterator<SwSection, SwSectionFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 13.4M | { | 399 | 13.4M | if(!IsChanged()) | 400 | 0 | m_pPosition = GetRightOfPos(); | 401 | 13.4M | sw::WriterListener *pCurrent(m_pPosition); | 402 | 13.4M | while (m_pPosition) | 403 | 13.4M | { | 404 | 13.4M | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 13.4M | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 0 | { | 413 | 0 | m_pPosition = GetRightOfPos(); | 414 | 0 | pCurrent = m_pPosition; | 415 | 0 | } | 416 | 13.4M | else | 417 | 13.4M | break; | 418 | 13.4M | } | 419 | 13.4M | Sync(); | 420 | 13.4M | return static_cast<TElementType*>(pCurrent); | 421 | 13.4M | } |
SwIterator<SwSectionFormat, SwSectionFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 156k | { | 399 | 156k | if(!IsChanged()) | 400 | 76.4k | m_pPosition = GetRightOfPos(); | 401 | 156k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 237k | while (m_pPosition) | 403 | 156k | { | 404 | 156k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 156k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 80.3k | { | 413 | 80.3k | m_pPosition = GetRightOfPos(); | 414 | 80.3k | pCurrent = m_pPosition; | 415 | 80.3k | } | 416 | 76.4k | else | 417 | 76.4k | break; | 418 | 156k | } | 419 | 156k | Sync(); | 420 | 156k | return static_cast<TElementType*>(pCurrent); | 421 | 156k | } |
SwIterator<SwFlyFrame, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 162k | { | 399 | 162k | if(!IsChanged()) | 400 | 1.01k | m_pPosition = GetRightOfPos(); | 401 | 162k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 323k | while (m_pPosition) | 403 | 163k | { | 404 | 163k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 163k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 161k | { | 413 | 161k | m_pPosition = GetRightOfPos(); | 414 | 161k | pCurrent = m_pPosition; | 415 | 161k | } | 416 | 1.92k | else | 417 | 1.92k | break; | 418 | 163k | } | 419 | 162k | Sync(); | 420 | 162k | return static_cast<TElementType*>(pCurrent); | 421 | 162k | } |
SwIterator<SwTextINetFormat, SwCharFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 2.44k | { | 399 | 2.44k | if(!IsChanged()) | 400 | 55 | m_pPosition = GetRightOfPos(); | 401 | 2.44k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 7.04k | while (m_pPosition) | 403 | 4.65k | { | 404 | 4.65k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 4.65k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 4.59k | { | 413 | 4.59k | m_pPosition = GetRightOfPos(); | 414 | 4.59k | pCurrent = m_pPosition; | 415 | 4.59k | } | 416 | 55 | else | 417 | 55 | break; | 418 | 4.65k | } | 419 | 2.44k | Sync(); | 420 | 2.44k | return static_cast<TElementType*>(pCurrent); | 421 | 2.44k | } |
SwIterator<SwCellFrame, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 254k | { | 399 | 254k | if(!IsChanged()) | 400 | 0 | m_pPosition = GetRightOfPos(); | 401 | 254k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 4.66M | while (m_pPosition) | 403 | 4.40M | { | 404 | 4.40M | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 4.40M | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 4.40M | { | 413 | 4.40M | m_pPosition = GetRightOfPos(); | 414 | 4.40M | pCurrent = m_pPosition; | 415 | 4.40M | } | 416 | 0 | else | 417 | 0 | break; | 418 | 4.40M | } | 419 | 254k | Sync(); | 420 | 254k | return static_cast<TElementType*>(pCurrent); | 421 | 254k | } |
SwIterator<SwSectionFrame, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 36 | { | 399 | 36 | if(!IsChanged()) | 400 | 18 | m_pPosition = GetRightOfPos(); | 401 | 36 | sw::WriterListener *pCurrent(m_pPosition); | 402 | 54 | while (m_pPosition) | 403 | 54 | { | 404 | 54 | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 54 | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 18 | { | 413 | 18 | m_pPosition = GetRightOfPos(); | 414 | 18 | pCurrent = m_pPosition; | 415 | 18 | } | 416 | 36 | else | 417 | 36 | break; | 418 | 54 | } | 419 | 36 | Sync(); | 420 | 36 | return static_cast<TElementType*>(pCurrent); | 421 | 36 | } |
SwIterator<SwCursorShell, SwContentNode, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 2.45k | { | 399 | 2.45k | if(!IsChanged()) | 400 | 0 | m_pPosition = GetRightOfPos(); | 401 | 2.45k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 4.91k | while (m_pPosition) | 403 | 2.45k | { | 404 | 2.45k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 2.45k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 2.45k | { | 413 | 2.45k | m_pPosition = GetRightOfPos(); | 414 | 2.45k | pCurrent = m_pPosition; | 415 | 2.45k | } | 416 | 0 | else | 417 | 0 | break; | 418 | 2.45k | } | 419 | 2.45k | Sync(); | 420 | 2.45k | return static_cast<TElementType*>(pCurrent); | 421 | 2.45k | } |
Unexecuted instantiation: SwIterator<SwFrame, SwFrameFormat, (sw::IteratorMode)0>::Next() SwIterator<SwFrame, sw::BroadcastingModify, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 8.38k | { | 399 | 8.38k | if(!IsChanged()) | 400 | 0 | m_pPosition = GetRightOfPos(); | 401 | 8.38k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 16.6k | while (m_pPosition) | 403 | 8.38k | { | 404 | 8.38k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 8.38k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 8.21k | { | 413 | 8.21k | m_pPosition = GetRightOfPos(); | 414 | 8.21k | pCurrent = m_pPosition; | 415 | 8.21k | } | 416 | 168 | else | 417 | 168 | break; | 418 | 8.38k | } | 419 | 8.38k | Sync(); | 420 | 8.38k | return static_cast<TElementType*>(pCurrent); | 421 | 8.38k | } |
SwIterator<SwTableLine, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 172k | { | 399 | 172k | if(!IsChanged()) | 400 | 80.9k | m_pPosition = GetRightOfPos(); | 401 | 172k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 172k | while (m_pPosition) | 403 | 93.7k | { | 404 | 93.7k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 93.7k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 0 | { | 413 | 0 | m_pPosition = GetRightOfPos(); | 414 | 0 | pCurrent = m_pPosition; | 415 | 0 | } | 416 | 93.7k | else | 417 | 93.7k | break; | 418 | 93.7k | } | 419 | 172k | Sync(); | 420 | 172k | return static_cast<TElementType*>(pCurrent); | 421 | 172k | } |
SwIterator<SwTableBox, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 1.00M | { | 399 | 1.00M | if(!IsChanged()) | 400 | 343k | m_pPosition = GetRightOfPos(); | 401 | 1.00M | sw::WriterListener *pCurrent(m_pPosition); | 402 | 1.00M | while (m_pPosition) | 403 | 669k | { | 404 | 669k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 669k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 0 | { | 413 | 0 | m_pPosition = GetRightOfPos(); | 414 | 0 | pCurrent = m_pPosition; | 415 | 0 | } | 416 | 669k | else | 417 | 669k | break; | 418 | 669k | } | 419 | 1.00M | Sync(); | 420 | 1.00M | return static_cast<TElementType*>(pCurrent); | 421 | 1.00M | } |
SwIterator<SwTable, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 490k | { | 399 | 490k | if(!IsChanged()) | 400 | 0 | m_pPosition = GetRightOfPos(); | 401 | 490k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 490k | while (m_pPosition) | 403 | 490k | { | 404 | 490k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 490k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 0 | { | 413 | 0 | m_pPosition = GetRightOfPos(); | 414 | 0 | pCurrent = m_pPosition; | 415 | 0 | } | 416 | 490k | else | 417 | 490k | break; | 418 | 490k | } | 419 | 490k | Sync(); | 420 | 490k | return static_cast<TElementType*>(pCurrent); | 421 | 490k | } |
SwIterator<SwContentFrame, SwTextNode, (sw::IteratorMode)1>::Next() Line | Count | Source | 398 | 76.6k | { | 399 | 76.6k | if(!IsChanged()) | 400 | 74.9k | m_pPosition = GetRightOfPos(); | 401 | 76.6k | sw::WriterListener *pCurrent(m_pPosition); | 402 | 76.6k | while (m_pPosition) | 403 | 74.9k | { | 404 | 74.9k | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 74.9k | { | 406 | 74.9k | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 74.9k | } | 411 | 74.9k | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 0 | { | 413 | 0 | m_pPosition = GetRightOfPos(); | 414 | 0 | pCurrent = m_pPosition; | 415 | 0 | } | 416 | 74.9k | else | 417 | 74.9k | break; | 418 | 74.9k | } | 419 | 76.6k | Sync(); | 420 | 76.6k | return static_cast<TElementType*>(pCurrent); | 421 | 76.6k | } |
Unexecuted instantiation: SwIterator<SwFrame, SwGrfNode, (sw::IteratorMode)0>::Next() Unexecuted instantiation: SwIterator<SwTabFrame, SwFrameFormat, (sw::IteratorMode)0>::Next() Unexecuted instantiation: SwIterator<SwFrame, SwTableFormat, (sw::IteratorMode)0>::Next() Unexecuted instantiation: SwIterator<SwTextNode, SwFormatColl, (sw::IteratorMode)0>::Next() Unexecuted instantiation: SwIterator<SwTextFrame, SwContentNode, (sw::IteratorMode)1>::Next() SwIterator<SwLayoutFrame, SwFormat, (sw::IteratorMode)0>::Next() Line | Count | Source | 398 | 114 | { | 399 | 114 | if(!IsChanged()) | 400 | 57 | m_pPosition = GetRightOfPos(); | 401 | 114 | sw::WriterListener *pCurrent(m_pPosition); | 402 | 165 | while (m_pPosition) | 403 | 144 | { | 404 | 144 | if (eMode == sw::IteratorMode::UnwrapMulti) | 405 | 0 | { | 406 | 0 | if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) | 407 | 0 | { | 408 | 0 | pCurrent = pLE->m_pToTell; | 409 | 0 | } | 410 | 0 | } | 411 | 144 | if (sw::detail::internal_dyn_cast<TElementType>(pCurrent) == nullptr) | 412 | 51 | { | 413 | 51 | m_pPosition = GetRightOfPos(); | 414 | 51 | pCurrent = m_pPosition; | 415 | 51 | } | 416 | 93 | else | 417 | 93 | break; | 418 | 144 | } | 419 | 114 | Sync(); | 420 | 114 | return static_cast<TElementType*>(pCurrent); | 421 | 114 | } |
Unexecuted instantiation: SwIterator<SwFormatField, SwFieldType, (sw::IteratorMode)0>::Next() |
422 | | using sw::ClientIteratorBase::IsChanged; |
423 | | }; |
424 | | |
425 | | template< typename T, typename TSource > class SwIterator<sw::ClientBase<T>, TSource> final : private sw::ClientIteratorBase |
426 | | { |
427 | | static_assert(std::is_base_of<SwModify,TSource>::value, "TSource needs to be derived from SwModify"); |
428 | | public: |
429 | | SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} |
430 | | sw::ClientBase<T>* First() |
431 | | { |
432 | | auto pListener = GoStart(); |
433 | | assert(dynamic_cast<sw::ClientBase<T>*>(pListener)); |
434 | | return static_cast<sw::ClientBase<T>*>(pListener); |
435 | | } |
436 | | sw::ClientBase<T>* Next() |
437 | | { |
438 | | if(!IsChanged()) |
439 | | m_pPosition = GetRightOfPos(); |
440 | | auto pNext = Sync(); |
441 | | assert(dynamic_cast<sw::ClientBase<T>*>(pNext)); |
442 | | return static_cast<sw::ClientBase<T>*>(pNext); |
443 | | } |
444 | | using sw::ClientIteratorBase::IsChanged; |
445 | | }; |
446 | | |
447 | | template<typename T> |
448 | | void SwModify::Add(sw::ClientBase<T>& rDepend) |
449 | 17.5M | { |
450 | 17.5M | DBG_TESTSOLARMUTEX(); |
451 | | #ifdef DBG_UTIL |
452 | | EnsureBroadcasting(); |
453 | | assert(dynamic_cast<T*>(this)); |
454 | | #endif |
455 | | |
456 | 17.5M | if (rDepend.GetRegisteredIn() == this) |
457 | 660k | return; |
458 | | |
459 | | // deregister new client in case it is already registered elsewhere |
460 | 16.9M | if( rDepend.GetRegisteredIn() != nullptr ) |
461 | 1.36M | rDepend.m_pRegisteredIn->Remove(rDepend); |
462 | | |
463 | 16.9M | if( !m_pWriterListeners ) |
464 | 4.78M | { |
465 | | // first client added |
466 | 4.78M | m_pWriterListeners = &rDepend; |
467 | 4.78M | m_pWriterListeners->m_pLeft = nullptr; |
468 | 4.78M | m_pWriterListeners->m_pRight = nullptr; |
469 | 4.78M | } |
470 | 12.1M | else |
471 | 12.1M | { |
472 | | // append client |
473 | 12.1M | rDepend.m_pRight = m_pWriterListeners->m_pRight; |
474 | 12.1M | m_pWriterListeners->m_pRight = &rDepend; |
475 | 12.1M | rDepend.m_pLeft = m_pWriterListeners; |
476 | 12.1M | if( rDepend.m_pRight ) |
477 | 10.1M | rDepend.m_pRight->m_pLeft = &rDepend; |
478 | 12.1M | } |
479 | | |
480 | | // connect client to me |
481 | 16.9M | rDepend.m_pRegisteredIn = static_cast<T*>(this); |
482 | 16.9M | } void SwModify::Add<SwModify>(sw::ClientBase<SwModify>&) Line | Count | Source | 449 | 17.1M | { | 450 | 17.1M | DBG_TESTSOLARMUTEX(); | 451 | | #ifdef DBG_UTIL | 452 | | EnsureBroadcasting(); | 453 | | assert(dynamic_cast<T*>(this)); | 454 | | #endif | 455 | | | 456 | 17.1M | if (rDepend.GetRegisteredIn() == this) | 457 | 660k | return; | 458 | | | 459 | | // deregister new client in case it is already registered elsewhere | 460 | 16.4M | if( rDepend.GetRegisteredIn() != nullptr ) | 461 | 1.25M | rDepend.m_pRegisteredIn->Remove(rDepend); | 462 | | | 463 | 16.4M | if( !m_pWriterListeners ) | 464 | 4.58M | { | 465 | | // first client added | 466 | 4.58M | m_pWriterListeners = &rDepend; | 467 | 4.58M | m_pWriterListeners->m_pLeft = nullptr; | 468 | 4.58M | m_pWriterListeners->m_pRight = nullptr; | 469 | 4.58M | } | 470 | 11.8M | else | 471 | 11.8M | { | 472 | | // append client | 473 | 11.8M | rDepend.m_pRight = m_pWriterListeners->m_pRight; | 474 | 11.8M | m_pWriterListeners->m_pRight = &rDepend; | 475 | 11.8M | rDepend.m_pLeft = m_pWriterListeners; | 476 | 11.8M | if( rDepend.m_pRight ) | 477 | 10.1M | rDepend.m_pRight->m_pLeft = &rDepend; | 478 | 11.8M | } | 479 | | | 480 | | // connect client to me | 481 | 16.4M | rDepend.m_pRegisteredIn = static_cast<T*>(this); | 482 | 16.4M | } |
void SwModify::Add<SwFrameFormat>(sw::ClientBase<SwFrameFormat>&) Line | Count | Source | 449 | 463k | { | 450 | 463k | DBG_TESTSOLARMUTEX(); | 451 | | #ifdef DBG_UTIL | 452 | | EnsureBroadcasting(); | 453 | | assert(dynamic_cast<T*>(this)); | 454 | | #endif | 455 | | | 456 | 463k | if (rDepend.GetRegisteredIn() == this) | 457 | 0 | return; | 458 | | | 459 | | // deregister new client in case it is already registered elsewhere | 460 | 463k | if( rDepend.GetRegisteredIn() != nullptr ) | 461 | 106k | rDepend.m_pRegisteredIn->Remove(rDepend); | 462 | | | 463 | 463k | if( !m_pWriterListeners ) | 464 | 207k | { | 465 | | // first client added | 466 | 207k | m_pWriterListeners = &rDepend; | 467 | 207k | m_pWriterListeners->m_pLeft = nullptr; | 468 | 207k | m_pWriterListeners->m_pRight = nullptr; | 469 | 207k | } | 470 | 255k | else | 471 | 255k | { | 472 | | // append client | 473 | 255k | rDepend.m_pRight = m_pWriterListeners->m_pRight; | 474 | 255k | m_pWriterListeners->m_pRight = &rDepend; | 475 | 255k | rDepend.m_pLeft = m_pWriterListeners; | 476 | 255k | if( rDepend.m_pRight ) | 477 | 0 | rDepend.m_pRight->m_pLeft = &rDepend; | 478 | 255k | } | 479 | | | 480 | | // connect client to me | 481 | 463k | rDepend.m_pRegisteredIn = static_cast<T*>(this); | 482 | 463k | } |
|
483 | | |
484 | | template<typename T> |
485 | | void SwModify::Remove(sw::ClientBase<T>& rDepend) |
486 | 16.9M | { |
487 | 16.9M | DBG_TESTSOLARMUTEX(); |
488 | 16.9M | assert(rDepend.m_pRegisteredIn == this); |
489 | | |
490 | | // SwClient is my listener |
491 | | // remove it from my list |
492 | 16.9M | ::sw::WriterListener* pR = rDepend.m_pRight; |
493 | 16.9M | ::sw::WriterListener* pL = rDepend.m_pLeft; |
494 | 16.9M | if( m_pWriterListeners == &rDepend ) |
495 | 7.23M | m_pWriterListeners = pL ? pL : pR; |
496 | | |
497 | 16.9M | if( pL ) |
498 | 9.70M | pL->m_pRight = pR; |
499 | 16.9M | if( pR ) |
500 | 10.5M | pR->m_pLeft = pL; |
501 | | |
502 | | // update ClientIterators |
503 | 16.9M | if(sw::ClientIteratorBase::s_pClientIters) |
504 | 902k | { |
505 | 902k | for(auto& rIter : sw::ClientIteratorBase::s_pClientIters->GetRingContainer()) |
506 | 1.18M | { |
507 | 1.18M | if (&rIter.m_rRoot == this && |
508 | 1.16M | (rIter.m_pCurrent == &rDepend || rIter.m_pPosition == &rDepend)) |
509 | 635k | { |
510 | | // if object being removed is the current or next object in an |
511 | | // iterator, advance this iterator |
512 | 635k | rIter.m_pPosition = pR; |
513 | 635k | } |
514 | 1.18M | } |
515 | 902k | } |
516 | 16.9M | rDepend.m_pLeft = nullptr; |
517 | 16.9M | rDepend.m_pRight = nullptr; |
518 | 16.9M | rDepend.m_pRegisteredIn = nullptr; |
519 | 16.9M | } void SwModify::Remove<SwModify>(sw::ClientBase<SwModify>&) Line | Count | Source | 486 | 16.4M | { | 487 | 16.4M | DBG_TESTSOLARMUTEX(); | 488 | 16.4M | assert(rDepend.m_pRegisteredIn == this); | 489 | | | 490 | | // SwClient is my listener | 491 | | // remove it from my list | 492 | 16.4M | ::sw::WriterListener* pR = rDepend.m_pRight; | 493 | 16.4M | ::sw::WriterListener* pL = rDepend.m_pLeft; | 494 | 16.4M | if( m_pWriterListeners == &rDepend ) | 495 | 6.91M | m_pWriterListeners = pL ? pL : pR; | 496 | | | 497 | 16.4M | if( pL ) | 498 | 9.56M | pL->m_pRight = pR; | 499 | 16.4M | if( pR ) | 500 | 10.4M | pR->m_pLeft = pL; | 501 | | | 502 | | // update ClientIterators | 503 | 16.4M | if(sw::ClientIteratorBase::s_pClientIters) | 504 | 902k | { | 505 | 902k | for(auto& rIter : sw::ClientIteratorBase::s_pClientIters->GetRingContainer()) | 506 | 1.18M | { | 507 | 1.18M | if (&rIter.m_rRoot == this && | 508 | 1.16M | (rIter.m_pCurrent == &rDepend || rIter.m_pPosition == &rDepend)) | 509 | 635k | { | 510 | | // if object being removed is the current or next object in an | 511 | | // iterator, advance this iterator | 512 | 635k | rIter.m_pPosition = pR; | 513 | 635k | } | 514 | 1.18M | } | 515 | 902k | } | 516 | 16.4M | rDepend.m_pLeft = nullptr; | 517 | 16.4M | rDepend.m_pRight = nullptr; | 518 | 16.4M | rDepend.m_pRegisteredIn = nullptr; | 519 | 16.4M | } |
void SwModify::Remove<SwFrameFormat>(sw::ClientBase<SwFrameFormat>&) Line | Count | Source | 486 | 463k | { | 487 | 463k | DBG_TESTSOLARMUTEX(); | 488 | 463k | assert(rDepend.m_pRegisteredIn == this); | 489 | | | 490 | | // SwClient is my listener | 491 | | // remove it from my list | 492 | 463k | ::sw::WriterListener* pR = rDepend.m_pRight; | 493 | 463k | ::sw::WriterListener* pL = rDepend.m_pLeft; | 494 | 463k | if( m_pWriterListeners == &rDepend ) | 495 | 322k | m_pWriterListeners = pL ? pL : pR; | 496 | | | 497 | 463k | if( pL ) | 498 | 140k | pL->m_pRight = pR; | 499 | 463k | if( pR ) | 500 | 115k | pR->m_pLeft = pL; | 501 | | | 502 | | // update ClientIterators | 503 | 463k | if(sw::ClientIteratorBase::s_pClientIters) | 504 | 0 | { | 505 | 0 | for(auto& rIter : sw::ClientIteratorBase::s_pClientIters->GetRingContainer()) | 506 | 0 | { | 507 | 0 | if (&rIter.m_rRoot == this && | 508 | 0 | (rIter.m_pCurrent == &rDepend || rIter.m_pPosition == &rDepend)) | 509 | 0 | { | 510 | | // if object being removed is the current or next object in an | 511 | | // iterator, advance this iterator | 512 | 0 | rIter.m_pPosition = pR; | 513 | 0 | } | 514 | 0 | } | 515 | 0 | } | 516 | 463k | rDepend.m_pLeft = nullptr; | 517 | 463k | rDepend.m_pRight = nullptr; | 518 | 463k | rDepend.m_pRegisteredIn = nullptr; | 519 | 463k | } |
|
520 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |