/src/libreoffice/sw/inc/hints.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 | | #ifndef INCLUDED_SW_INC_HINTS_HXX |
20 | | #define INCLUDED_SW_INC_HINTS_HXX |
21 | | |
22 | | #include "swatrset.hxx" |
23 | | #include "swtypes.hxx" |
24 | | #include "names.hxx" |
25 | | #include <basegfx/units/Length.hxx> |
26 | | #include <utility> |
27 | | #include <vcl/vclptr.hxx> |
28 | | |
29 | | class SwFormat; |
30 | | class SwTable; |
31 | | class SwNode; |
32 | | class SwNodes; |
33 | | class SwPageFrame; |
34 | | class SwFrame; |
35 | | class SwTextNode; |
36 | | class SwTextFormatColl; |
37 | | class SwFrameFormat; |
38 | | class SwTableBox; |
39 | | class SwTableBoxFormat; |
40 | | class SwTableLine; |
41 | | class SwTableLineFormat; |
42 | | class SwAttrSetChg; |
43 | | class SwUpdateAttr; |
44 | | |
45 | | // Base class for all Message-Hints: |
46 | | // "Overhead" of SfxPoolItem is handled here |
47 | | class SwMsgPoolItem final : public SfxPoolItem |
48 | | { |
49 | | public: |
50 | | DECLARE_ITEM_TYPE_FUNCTION(SwMsgPoolItem) |
51 | | SwMsgPoolItem( sal_uInt16 nWhich ); |
52 | | |
53 | | // "Overhead" of SfxPoolItem |
54 | | virtual bool operator==( const SfxPoolItem& ) const override; |
55 | | virtual SwMsgPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; |
56 | | }; |
57 | | |
58 | | /** |
59 | | * SwFormatChg is sent when a format has changed to another format. |
60 | | */ |
61 | | class SwFormatChangeHint final : public SfxHint |
62 | | { |
63 | | public: |
64 | | SwFormat *m_pOldFormat; |
65 | | SwFormat *m_pNewFormat; |
66 | | SwFormatChangeHint(SwFormat* pOldFormat, SwFormat* pNewFormat) |
67 | 797k | : SfxHint(SfxHintId::SwFormatChange), m_pOldFormat(pOldFormat), m_pNewFormat(pNewFormat) {} |
68 | | }; |
69 | | |
70 | | |
71 | | |
72 | | namespace sw { |
73 | | |
74 | | /// text is moved into pDestNode |
75 | | class MoveText final : public SfxHint |
76 | | { |
77 | | public: |
78 | | SwTextNode * pDestNode; |
79 | | sal_Int32 nDestStart; |
80 | | sal_Int32 nSourceStart; |
81 | | sal_Int32 nLen; |
82 | | |
83 | | MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL) |
84 | 8.62k | : SfxHint(SfxHintId::SwMoveText), pDestNode(pD), nDestStart(nD), nSourceStart(nS), nLen(nL) {} |
85 | | }; |
86 | | |
87 | | class InsertText final : public SfxHint |
88 | | { |
89 | | public: |
90 | | const sal_Int32 nPos; |
91 | | const sal_Int32 nLen; |
92 | | const bool isInsideFieldmarkCommand; |
93 | | const bool isInsideFieldmarkResult; |
94 | | |
95 | | InsertText(sal_Int32 nP, sal_Int32 nL, bool isInFMCommand, bool isInFMResult); |
96 | | }; |
97 | | |
98 | | class DeleteText final : public SfxHint |
99 | | { |
100 | | public: |
101 | | const sal_Int32 nStart; |
102 | | const sal_Int32 nLen; |
103 | | |
104 | | DeleteText( sal_Int32 nS, sal_Int32 nL ); |
105 | | }; |
106 | | |
107 | | class DeleteChar final : public SfxHint |
108 | | { |
109 | | public: |
110 | | const sal_Int32 m_nPos; |
111 | | |
112 | | DeleteChar( const sal_Int32 nPos ); |
113 | | }; |
114 | | |
115 | | /// new delete redline is created |
116 | | class RedlineDelText final : public SfxHint |
117 | | { |
118 | | public: |
119 | | sal_Int32 nStart; |
120 | | sal_Int32 nLen; |
121 | | |
122 | 2.79M | RedlineDelText(sal_Int32 nS, sal_Int32 nL) : SfxHint(SfxHintId::SwRedlineDelText), nStart(nS), nLen(nL) {} |
123 | | }; |
124 | | |
125 | | /// delete redline is removed |
126 | | class RedlineUnDelText final : public SfxHint |
127 | | { |
128 | | public: |
129 | | sal_Int32 nStart; |
130 | | sal_Int32 nLen; |
131 | | |
132 | 43.3k | RedlineUnDelText(sal_Int32 nS, sal_Int32 nL) : SfxHint(SfxHintId::SwRedlineUnDelText), nStart(nS), nLen(nL) {} |
133 | | }; |
134 | | |
135 | | /** DocPosUpdate is sent to signal that only the frames from or to a specified document-global position |
136 | | have to be updated. At the moment this is only needed when updating pagenumber fields. */ |
137 | | class DocPosUpdate final : public SfxHint |
138 | | { |
139 | | public: |
140 | | const gfx::Length m_nDocPos; |
141 | | DocPosUpdate(const gfx::Length nDocPos) |
142 | 178k | : SfxHint(SfxHintId::SwDocPosUpdate) |
143 | 178k | , m_nDocPos(nDocPos) |
144 | 178k | {}; |
145 | | }; |
146 | | class DocPosUpdateAtIndex final : public SfxHint |
147 | | { |
148 | | public: |
149 | | const gfx::Length m_nDocPos; |
150 | | const SwTextNode& m_rNode; |
151 | | const sal_uInt32 m_nIndex; |
152 | | DocPosUpdateAtIndex(const gfx::Length nDocPos, const SwTextNode& rNode, sal_uInt32 nIndex) |
153 | 778 | : SfxHint(SfxHintId::SwDocPosUpdateAtIndex) |
154 | 778 | , m_nDocPos(nDocPos) |
155 | 778 | , m_rNode(rNode) |
156 | 778 | , m_nIndex(nIndex) |
157 | 778 | {}; |
158 | | }; |
159 | | class CondCollCondChg final : public SfxHint |
160 | | { |
161 | | public: |
162 | | const SwTextFormatColl& m_rColl; |
163 | 0 | CondCollCondChg(const SwTextFormatColl& rColl) : SfxHint(SfxHintId::SwCondCollCondChg), m_rColl(rColl) {}; |
164 | | }; |
165 | | |
166 | | class GrfRereadAndInCacheHint final : public SfxHint |
167 | | { |
168 | | public: |
169 | 0 | GrfRereadAndInCacheHint() : SfxHint(SfxHintId::SwGrfRereadAndInCache) {} |
170 | | }; |
171 | | |
172 | | class PreGraphicArrivedHint final : public SfxHint |
173 | | { |
174 | | public: |
175 | 0 | PreGraphicArrivedHint() : SfxHint(SfxHintId::SwPreGraphicArrived) {} |
176 | | }; |
177 | | |
178 | | class PostGraphicArrivedHint final : public SfxHint |
179 | | { |
180 | | public: |
181 | 0 | PostGraphicArrivedHint() : SfxHint(SfxHintId::SwPostGraphicArrived) {} |
182 | | }; |
183 | | |
184 | | class GraphicPieceArrivedHint final : public SfxHint |
185 | | { |
186 | | public: |
187 | 0 | GraphicPieceArrivedHint() : SfxHint(SfxHintId::SwGraphicPieceArrived) {} |
188 | | }; |
189 | | |
190 | | class LinkedGraphicStreamArrivedHint final : public SfxHint |
191 | | { |
192 | | public: |
193 | 0 | LinkedGraphicStreamArrivedHint() : SfxHint(SfxHintId::SwLinkedGraphicStreamArrived) {} |
194 | | }; |
195 | | |
196 | | class MoveTableLineHint final : public SfxHint |
197 | | { |
198 | | public: |
199 | | const SwFrameFormat& m_rNewFormat; |
200 | | const SwTableLine& m_rTableLine; |
201 | | MoveTableLineHint(const SwFrameFormat& rNewFormat, const SwTableLine& rTableLine) |
202 | 0 | : SfxHint(SfxHintId::SwMoveTableLine), m_rNewFormat(rNewFormat), m_rTableLine(rTableLine) {}; |
203 | | }; |
204 | | |
205 | | class MoveTableBoxHint final : public SfxHint |
206 | | { |
207 | | public: |
208 | | const SwFrameFormat& m_rNewFormat; |
209 | | const SwTableBox& m_rTableBox; |
210 | | MoveTableBoxHint(const SwFrameFormat& rNewFormat, const SwTableBox& rTableBox) |
211 | 0 | : SfxHint(SfxHintId::SwMoveTableBox), m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {}; |
212 | | }; |
213 | | |
214 | | class DocumentDyingHint final : public SfxHint |
215 | | { |
216 | | public: |
217 | 647k | DocumentDyingHint() : SfxHint(SfxHintId::SwDocumentDying) {} |
218 | | }; |
219 | | |
220 | | class TableLineFormatChanged final : public SfxHint |
221 | | { |
222 | | public: |
223 | | const SwTableLineFormat& m_rNewFormat; |
224 | | const SwTableLine& m_rTabLine; |
225 | | TableLineFormatChanged(const SwTableLineFormat& rNewFormat, const SwTableLine& rTabLine) |
226 | 0 | : SfxHint(SfxHintId::SwTableLineFormatChanged), m_rNewFormat(rNewFormat), m_rTabLine(rTabLine) {}; |
227 | | }; |
228 | | class TableBoxFormatChanged final : public SfxHint |
229 | | { |
230 | | public: |
231 | | const SwTableBoxFormat& m_rNewFormat; |
232 | | const SwTableBox& m_rTableBox; |
233 | | TableBoxFormatChanged(const SwTableBoxFormat& rNewFormat, const SwTableBox& rTableBox) |
234 | 122k | : SfxHint(SfxHintId::SwTableBoxFormatChanged), m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {}; |
235 | | }; |
236 | | class NameChanged final : public SfxHint |
237 | | { |
238 | | public: |
239 | | const UIName m_sOld; |
240 | | const UIName m_sNew; |
241 | 151k | NameChanged(const UIName& rOld, const UIName& rNew) : SfxHint(SfxHintId::SwNameChanged), m_sOld(rOld), m_sNew(rNew) {}; |
242 | | }; |
243 | | class TitleChanged final : public SfxHint |
244 | | { |
245 | | public: |
246 | | const OUString m_sOld; |
247 | | const OUString m_sNew; |
248 | 4.56k | TitleChanged(const OUString& rOld, const OUString& rNew) : SfxHint(SfxHintId::SwTitleChanged), m_sOld(rOld), m_sNew(rNew) {}; |
249 | | }; |
250 | | class DescriptionChanged final : public SfxHint |
251 | | { |
252 | | public: |
253 | 4.83k | DescriptionChanged() : SfxHint(SfxHintId::SwDescriptionChanged) {} |
254 | | }; |
255 | | class SectionHidden final: public SfxHint |
256 | | { |
257 | | public: |
258 | | const bool m_isHidden; |
259 | 2.23k | SectionHidden(const bool isHidden = true) : SfxHint(SfxHintId::SwSectionHidden), m_isHidden(isHidden) {}; |
260 | | }; |
261 | | class TableHeadingChange final: public SfxHint |
262 | | { |
263 | | public: |
264 | 1.33k | TableHeadingChange() : SfxHint(SfxHintId::SwTableHeadingChange) {}; |
265 | | }; |
266 | | class VirtPageNumHint final: public SfxHint |
267 | | { |
268 | | const SwPageFrame* m_pPage; |
269 | | const SwPageFrame* m_pOrigPage; |
270 | | const SwFrame* m_pFrame; |
271 | | bool m_bFound; |
272 | | /** Multiple attributes can be attached to a single paragraph / table |
273 | | The frame, in the end, has to decide which attribute takes effect and which physical page it involves */ |
274 | | public: |
275 | | VirtPageNumHint(const SwPageFrame* pPg); |
276 | | const SwPageFrame* GetPage() const |
277 | 0 | { return m_pPage; } |
278 | | const SwPageFrame* GetOrigPage() const |
279 | 0 | { return m_pOrigPage; } |
280 | | const SwFrame* GetFrame() const |
281 | 0 | { return m_pFrame; } |
282 | | void SetInfo(const SwPageFrame* pPg, const SwFrame *pF) |
283 | 0 | { m_pFrame = pF; m_pPage = pPg; } |
284 | | void SetFound() |
285 | 0 | { |
286 | 0 | assert(!m_bFound); |
287 | 0 | m_bFound = true; |
288 | 0 | } |
289 | | bool IsFound() |
290 | 0 | { return m_bFound; } |
291 | | }; |
292 | | class AutoFormatUsedHint final : public SfxHint |
293 | | { |
294 | | bool& m_isUsed; |
295 | | const SwNodes& m_rNodes; |
296 | | public: |
297 | 7.71M | AutoFormatUsedHint(bool& isUsed, const SwNodes& rNodes) : SfxHint(SfxHintId::SwAutoFormatUsedHint), m_isUsed(isUsed), m_rNodes(rNodes) {} |
298 | 7.51M | void SetUsed() const { m_isUsed = true; } |
299 | | void CheckNode(const SwNode*) const; |
300 | | }; |
301 | | class RemoveUnoObjectHint final : public SfxHint |
302 | | { |
303 | | public: |
304 | | const BroadcasterMixin* m_pObject; |
305 | 3.43k | RemoveUnoObjectHint(const BroadcasterMixin* pObject) : SfxHint(SfxHintId::SwRemoveUnoObject), m_pObject(pObject) {} |
306 | | }; |
307 | | class PrintHiddenParaHint final : public SfxHint |
308 | | { |
309 | | public: |
310 | 0 | PrintHiddenParaHint() : SfxHint(SfxHintId::SwHiddenParaPrint) {} |
311 | | }; |
312 | | class AttrSetChangeHint final : public SfxHint |
313 | | { |
314 | | public: |
315 | | const SwAttrSetChg* m_pOld; |
316 | | const SwAttrSetChg* m_pNew; |
317 | 42.4M | AttrSetChangeHint(const SwAttrSetChg* pOld, const SwAttrSetChg* pNew) : SfxHint(SfxHintId::SwAttrSetChange), m_pOld(pOld), m_pNew(pNew) {} |
318 | | }; |
319 | | class ObjectDyingHint final : public SfxHint |
320 | | { |
321 | | public: |
322 | | SwModify* m_pDying; |
323 | 55.3M | ObjectDyingHint(SwModify* pDead) : SfxHint(SfxHintId::SwObjectDying), m_pDying(pDead) {} |
324 | | }; |
325 | | class UpdateAttrHint final : public SfxHint |
326 | | { |
327 | | public: |
328 | | const SwUpdateAttr* m_pOld; |
329 | | const SwUpdateAttr* m_pNew; |
330 | 19.1M | UpdateAttrHint(const SwUpdateAttr* pOld, const SwUpdateAttr* pNew) : SfxHint(SfxHintId::SwUpdateAttr), m_pOld(pOld), m_pNew(pNew) {} |
331 | | }; |
332 | | } // namespace sw |
333 | | |
334 | | class SwUpdateAttr final |
335 | | { |
336 | | private: |
337 | | sal_Int32 m_nStart; |
338 | | sal_Int32 m_nEnd; |
339 | | sal_uInt16 m_nWhichAttr; |
340 | | std::vector<sal_uInt16> m_aWhichFmtAttrs; // attributes changed inside RES_TXTATR_AUTOFMT |
341 | | |
342 | | public: |
343 | | SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW ); |
344 | | SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW ); |
345 | | |
346 | | sal_Int32 getStart() const |
347 | 0 | { |
348 | 0 | return m_nStart; |
349 | 0 | } |
350 | | |
351 | | sal_Int32 getEnd() const |
352 | 0 | { |
353 | 0 | return m_nEnd; |
354 | 0 | } |
355 | | |
356 | | sal_uInt16 getWhichAttr() const |
357 | 9.34M | { |
358 | 9.34M | return m_nWhichAttr; |
359 | 9.34M | } |
360 | | |
361 | | const std::vector<sal_uInt16>& getFmtAttrs() const |
362 | 0 | { |
363 | 0 | return m_aWhichFmtAttrs; |
364 | 0 | } |
365 | | }; |
366 | | |
367 | | /// SwTableFormulaUpdate is sent when the table has to be newly calculated or when a table itself is merged or split |
368 | | enum TableFormulaUpdateFlags { TBL_CALC = 0, |
369 | | TBL_BOXNAME, |
370 | | TBL_BOXPTR, |
371 | | TBL_RELBOXNAME, |
372 | | TBL_MERGETBL, |
373 | | TBL_SPLITTBL |
374 | | }; |
375 | | class SwTableFormulaUpdate final |
376 | | { |
377 | | public: |
378 | | const SwTable* m_pTable; ///< Pointer to the current table |
379 | | union { |
380 | | const SwTable* pDelTable; ///< Merge: Pointer to the table to be removed |
381 | | const UIName* pNewTableNm; ///< Split: the name of the new table |
382 | | } m_aData; |
383 | | sal_uInt16 m_nSplitLine; ///< Split: from this BaseLine on will be split |
384 | | TableFormulaUpdateFlags m_eFlags; |
385 | | bool m_bModified : 1; |
386 | | bool m_bBehindSplitLine : 1; |
387 | | |
388 | | /** Is sent if a table should be recalculated */ |
389 | | SwTableFormulaUpdate( const SwTable* ); |
390 | | }; |
391 | | |
392 | | /* |
393 | | * SwAttrSetChg is sent when something has changed in the SwAttrSet rTheChgdSet. |
394 | | * 2 Hints are always sent, the old and the new items in the rTheChgdSet. |
395 | | */ |
396 | | class SwAttrSetChg final |
397 | | { |
398 | | bool m_bDelSet; |
399 | | SwAttrSet* m_pChgSet; ///< what has changed |
400 | | const SwAttrSet* m_pTheChgdSet; ///< is only used to compare |
401 | | public: |
402 | | SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet ); |
403 | | SwAttrSetChg( const SwAttrSetChg& ); |
404 | | ~SwAttrSetChg(); |
405 | | |
406 | | /// What has changed |
407 | 126M | const SwAttrSet* GetChgSet() const { return m_pChgSet; } |
408 | 15.0M | SwAttrSet* GetChgSet() { return m_pChgSet; } |
409 | | |
410 | | /// Where it has changed |
411 | 41.9M | const SwAttrSet* GetTheChgdSet() const { return m_pTheChgdSet; } |
412 | | |
413 | 7.52M | sal_uInt16 Count() const { return m_pChgSet->Count(); } |
414 | | void ClearItem( sal_uInt16 nWhichL ) |
415 | | #ifdef DBG_UTIL |
416 | | ; |
417 | | #else |
418 | 0 | { m_pChgSet->ClearItem( nWhichL ); } |
419 | | #endif |
420 | | }; |
421 | | |
422 | | |
423 | | class SwFindNearestNode final |
424 | | { |
425 | | const SwNode *m_pNode, *m_pFound; |
426 | | public: |
427 | 0 | SwFindNearestNode( const SwNode& rNd ) : m_pNode(&rNd), m_pFound(nullptr) {} |
428 | | void CheckNode( const SwNode& rNd ); |
429 | | |
430 | 0 | const SwNode* GetFoundNode() const { return m_pFound; } |
431 | | }; |
432 | | |
433 | | #endif |
434 | | |
435 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |