Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / inc / hints.hxx
blob46a3c586771fa583f288d02f66584c49b416d7a5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_HINTS_HXX
20 #define INCLUDED_SW_INC_HINTS_HXX
22 #include "swatrset.hxx"
23 #include "swtypes.hxx"
24 #include <utility>
25 #include <vcl/vclptr.hxx>
27 class SwFormat;
28 class OutputDevice;
29 class SwTable;
30 class SwNode;
31 class SwNodes;
32 class SwPageFrame;
33 class SwFrame;
34 class SwHistory;
35 class SwTextNode;
36 class SwTextFormatColl;
37 class SwFrameFormat;
38 class SwTableBox;
39 class SwTableBoxFormat;
40 class SwTableLine;
41 class SwTableLineFormat;
42 class SwTableBox;
44 // Base class for all Message-Hints:
45 // "Overhead" of SfxPoolItem is handled here
46 class SwMsgPoolItem : public SfxPoolItem
48 public:
49 SwMsgPoolItem( sal_uInt16 nWhich );
51 // "Overhead" of SfxPoolItem
52 virtual bool operator==( const SfxPoolItem& ) const override;
53 virtual SwMsgPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
56 // SwPtrMsgPoolItem (old SwObjectDying!)
58 class SwPtrMsgPoolItem final : public SwMsgPoolItem
60 public:
61 void * pObject;
63 SwPtrMsgPoolItem( sal_uInt16 nId, void * pObj )
64 : SwMsgPoolItem( nId ), pObject( pObj )
69 * SwFormatChg is sent when a format has changed to another format. 2 Hints are always sent
70 * the old and the new format
72 class SwFormatChg final : public SwMsgPoolItem
74 public:
75 SwFormat *pChangedFormat;
76 SwFormatChg( SwFormat *pFormat );
81 namespace sw {
83 /// text is moved into pDestNode
84 class MoveText final : public SfxHint
86 public:
87 SwTextNode * pDestNode;
88 sal_Int32 nDestStart;
89 sal_Int32 nSourceStart;
90 sal_Int32 nLen;
92 MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL);
95 class InsertText final : public SfxHint
97 public:
98 const sal_Int32 nPos;
99 const sal_Int32 nLen;
100 const bool isInsideFieldmarkCommand;
101 const bool isInsideFieldmarkResult;
103 InsertText(sal_Int32 nP, sal_Int32 nL, bool isInFMCommand, bool isInFMResult);
106 class DeleteText final : public SfxHint
108 public:
109 const sal_Int32 nStart;
110 const sal_Int32 nLen;
112 DeleteText( sal_Int32 nS, sal_Int32 nL );
115 class DeleteChar final : public SfxHint
117 public:
118 const sal_Int32 m_nPos;
120 DeleteChar( const sal_Int32 nPos );
123 /// new delete redline is created
124 class RedlineDelText final : public SfxHint
126 public:
127 sal_Int32 nStart;
128 sal_Int32 nLen;
130 RedlineDelText(sal_Int32 nS, sal_Int32 nL);
133 /// delete redline is removed
134 class RedlineUnDelText final : public SfxHint
136 public:
137 sal_Int32 nStart;
138 sal_Int32 nLen;
140 RedlineUnDelText(sal_Int32 nS, sal_Int32 nL);
143 /** DocPosUpdate is sent to signal that only the frames from or to a specified document-global position
144 have to be updated. At the moment this is only needed when updating pagenumber fields. */
145 class DocPosUpdate final : public SfxHint
147 public:
148 const SwTwips m_nDocPos;
149 DocPosUpdate(const SwTwips nDocPos)
150 : SfxHint(SfxHintId::SwDocPosUpdate)
151 , m_nDocPos(nDocPos)
154 class DocPosUpdateAtIndex final : public SfxHint
156 public:
157 const SwTwips m_nDocPos;
158 const SwTextNode& m_rNode;
159 const sal_uInt32 m_nIndex;
160 DocPosUpdateAtIndex(const SwTwips nDocPos, const SwTextNode& rNode, sal_uInt32 nIndex)
161 : SfxHint(SfxHintId::SwDocPosUpdateAtIndex)
162 , m_nDocPos(nDocPos)
163 , m_rNode(rNode)
164 , m_nIndex(nIndex)
167 class CondCollCondChg final : public SfxHint
169 public:
170 const SwTextFormatColl& m_rColl;
171 CondCollCondChg(const SwTextFormatColl& rColl) : m_rColl(rColl) {};
174 class GrfRereadAndInCacheHint final : public SfxHint
178 class PreGraphicArrivedHint final : public SfxHint
180 public:
181 PreGraphicArrivedHint() : SfxHint(SfxHintId::SwPreGraphicArrived) {}
184 class PostGraphicArrivedHint final : public SfxHint
188 class GraphicPieceArrivedHint final : public SfxHint
190 public:
191 GraphicPieceArrivedHint() : SfxHint(SfxHintId::SwGraphicPieceArrived) {}
194 class LinkedGraphicStreamArrivedHint final : public SfxHint
196 public:
197 LinkedGraphicStreamArrivedHint() : SfxHint(SfxHintId::SwLinkedGraphicStreamArrived) {}
200 class MoveTableLineHint final : public SfxHint
202 public:
203 const SwFrameFormat& m_rNewFormat;
204 const SwTableLine& m_rTableLine;
205 MoveTableLineHint(const SwFrameFormat& rNewFormat, const SwTableLine& rTableLine): m_rNewFormat(rNewFormat), m_rTableLine(rTableLine) {};
208 class MoveTableBoxHint final : public SfxHint
210 public:
211 const SwFrameFormat& m_rNewFormat;
212 const SwTableBox& m_rTableBox;
213 MoveTableBoxHint(const SwFrameFormat& rNewFormat, const SwTableBox& rTableBox): m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {};
216 class DocumentDyingHint final : public SfxHint
220 class TableLineFormatChanged final : public SfxHint
222 public:
223 const SwTableLineFormat& m_rNewFormat;
224 const SwTableLine& m_rTabLine;
225 TableLineFormatChanged(const SwTableLineFormat& rNewFormat, const SwTableLine& rTabLine) : m_rNewFormat(rNewFormat), m_rTabLine(rTabLine) {};
227 class TableBoxFormatChanged final : public SfxHint
229 public:
230 const SwTableBoxFormat& m_rNewFormat;
231 const SwTableBox& m_rTableBox;
232 TableBoxFormatChanged(const SwTableBoxFormat& rNewFormat, const SwTableBox& rTableBox) : m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {};
234 class NameChanged final : public SfxHint
236 public:
237 const OUString m_sOld;
238 const OUString m_sNew;
239 NameChanged(const OUString& rOld, const OUString& rNew) : SfxHint(SfxHintId::SwNameChanged), m_sOld(rOld), m_sNew(rNew) {};
241 class TitleChanged final : public SfxHint
243 public:
244 const OUString m_sOld;
245 const OUString m_sNew;
246 TitleChanged(const OUString& rOld, const OUString& rNew) : SfxHint(SfxHintId::SwTitleChanged), m_sOld(rOld), m_sNew(rNew) {};
248 class DescriptionChanged final : public SfxHint
250 public:
251 DescriptionChanged() : SfxHint(SfxHintId::SwDescriptionChanged) {}
253 class SectionHidden final: public SfxHint
255 public:
256 const bool m_isHidden;
257 SectionHidden(const bool isHidden = true) : SfxHint(SfxHintId::SwSectionHidden), m_isHidden(isHidden) {};
259 class TableHeadingChange final: public SfxHint
261 public:
262 TableHeadingChange() : SfxHint(SfxHintId::SwTableHeadingChange) {};
266 class SwUpdateAttr final : public SwMsgPoolItem
268 private:
269 sal_Int32 m_nStart;
270 sal_Int32 m_nEnd;
271 sal_uInt16 m_nWhichAttr;
272 std::vector<sal_uInt16> m_aWhichFmtAttrs; // attributes changed inside RES_TXTATR_AUTOFMT
274 public:
275 SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW );
276 SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW );
278 sal_Int32 getStart() const
280 return m_nStart;
283 sal_Int32 getEnd() const
285 return m_nEnd;
288 sal_uInt16 getWhichAttr() const
290 return m_nWhichAttr;
293 const std::vector<sal_uInt16>& getFmtAttrs() const
295 return m_aWhichFmtAttrs;
299 /// SwTableFormulaUpdate is sent when the table has to be newly calculated or when a table itself is merged or split
300 enum TableFormulaUpdateFlags { TBL_CALC = 0,
301 TBL_BOXNAME,
302 TBL_BOXPTR,
303 TBL_RELBOXNAME,
304 TBL_MERGETBL,
305 TBL_SPLITTBL
307 class SwTableFormulaUpdate final
309 public:
310 const SwTable* m_pTable; ///< Pointer to the current table
311 union {
312 const SwTable* pDelTable; ///< Merge: Pointer to the table to be removed
313 const OUString* pNewTableNm; ///< Split: the name of the new table
314 } m_aData;
315 sal_uInt16 m_nSplitLine; ///< Split: from this BaseLine on will be split
316 TableFormulaUpdateFlags m_eFlags;
317 bool m_bModified : 1;
318 bool m_bBehindSplitLine : 1;
320 /** Is sent if a table should be recalculated */
321 SwTableFormulaUpdate( const SwTable* );
324 class SwAutoFormatGetDocNode final : public SwMsgPoolItem
326 public:
327 const SwNodes* pNodes;
329 SwAutoFormatGetDocNode( const SwNodes* pNds );
333 * SwAttrSetChg is sent when something has changed in the SwAttrSet rTheChgdSet.
334 * 2 Hints are always sent, the old and the new items in the rTheChgdSet.
336 class SwAttrSetChg final : public SwMsgPoolItem
338 bool m_bDelSet;
339 SwAttrSet* m_pChgSet; ///< what has changed
340 const SwAttrSet* m_pTheChgdSet; ///< is only used to compare
341 public:
342 SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet );
343 SwAttrSetChg( const SwAttrSetChg& );
344 virtual ~SwAttrSetChg() override;
346 /// What has changed
347 const SwAttrSet* GetChgSet() const { return m_pChgSet; }
348 SwAttrSet* GetChgSet() { return m_pChgSet; }
350 /// Where it has changed
351 const SwAttrSet* GetTheChgdSet() const { return m_pTheChgdSet; }
353 sal_uInt16 Count() const { return m_pChgSet->Count(); }
354 void ClearItem( sal_uInt16 nWhichL )
355 #ifdef DBG_UTIL
357 #else
358 { m_pChgSet->ClearItem( nWhichL ); }
359 #endif
362 class SwVirtPageNumInfo final : public SwMsgPoolItem
364 const SwPageFrame *m_pPage;
365 const SwPageFrame *m_pOrigPage;
366 const SwFrame *m_pFrame;
367 /** Multiple attributes can be attached to a single paragraph / table
368 The frame, in the end, has to decide which attribute takes effect and which physical page it involves */
369 public:
370 SwVirtPageNumInfo( const SwPageFrame *pPg );
372 const SwPageFrame *GetPage() const { return m_pPage; }
373 const SwPageFrame *GetOrigPage() const { return m_pOrigPage;}
374 const SwFrame *GetFrame() const { return m_pFrame; }
375 void SetInfo( const SwPageFrame *pPg,
376 const SwFrame *pF ) { m_pFrame = pF; m_pPage = pPg; }
379 class SwFindNearestNode final : public SwMsgPoolItem
381 const SwNode *m_pNode, *m_pFound;
382 public:
383 SwFindNearestNode( const SwNode& rNd );
384 void CheckNode( const SwNode& rNd );
386 const SwNode* GetFoundNode() const { return m_pFound; }
389 #endif
391 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */