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