tdf#149609 release mouse before showing popups from calc grid window
[LibreOffice.git] / sw / inc / hints.hxx
blob9c37399f68f66b19fb48faddca47eb5b7bd2fd1c
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 <vcl/vclptr.hxx>
26 class SwFormat;
27 class OutputDevice;
28 class SwTable;
29 class SwNode;
30 class SwNodes;
31 class SwPageFrame;
32 class SwFrame;
33 class SwHistory;
34 class SwTextNode;
35 class SwTextFormatColl;
36 class SwFrameFormat;
37 class SwTableBox;
38 class SwTableBoxFormat;
39 class SwTableLine;
40 class SwTableLineFormat;
41 class SwTableBox;
43 // Base class for all Message-Hints:
44 // "Overhead" of SfxPoolItem is handled here
45 class SwMsgPoolItem : public SfxPoolItem
47 public:
48 SwMsgPoolItem( sal_uInt16 nWhich );
50 // "Overhead" of SfxPoolItem
51 virtual bool operator==( const SfxPoolItem& ) const override;
52 virtual SwMsgPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
55 // SwPtrMsgPoolItem (old SwObjectDying!)
57 class SwPtrMsgPoolItem final : public SwMsgPoolItem
59 public:
60 void * pObject;
62 SwPtrMsgPoolItem( sal_uInt16 nId, void * pObj )
63 : SwMsgPoolItem( nId ), pObject( pObj )
68 * SwFormatChg is sent when a format has changed to another format. 2 Hints are always sent
69 * the old and the new format
71 class SwFormatChg final : public SwMsgPoolItem
73 public:
74 SwFormat *pChangedFormat;
75 SwFormatChg( SwFormat *pFormat );
78 class SwInsText final : public SwMsgPoolItem
80 public:
81 sal_Int32 nPos;
82 sal_Int32 nLen;
83 bool isInsideFieldmarkCommand;
84 bool isInsideFieldmarkResult;
86 SwInsText(sal_Int32 nP, sal_Int32 nL, bool isInFMCommand, bool isInFMResult);
89 class SwDelChr final : public SwMsgPoolItem
91 public:
92 sal_Int32 nPos;
94 SwDelChr( sal_Int32 nP );
97 class SwDelText final : public SwMsgPoolItem
99 public:
100 sal_Int32 nStart;
101 sal_Int32 nLen;
103 SwDelText( sal_Int32 nS, sal_Int32 nL );
106 namespace sw {
108 /// text is moved into pDestNode
109 class MoveText final : public SfxHint
111 public:
112 SwTextNode * pDestNode;
113 sal_Int32 nDestStart;
114 sal_Int32 nSourceStart;
115 sal_Int32 nLen;
117 MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL);
120 /// new delete redline is created
121 class RedlineDelText final : public SfxHint
123 public:
124 sal_Int32 nStart;
125 sal_Int32 nLen;
127 RedlineDelText(sal_Int32 nS, sal_Int32 nL);
130 /// delete redline is removed
131 class RedlineUnDelText final : public SfxHint
133 public:
134 sal_Int32 nStart;
135 sal_Int32 nLen;
137 RedlineUnDelText(sal_Int32 nS, sal_Int32 nL);
140 class CondCollCondChg final : public SfxHint
142 public:
143 const SwTextFormatColl& m_rColl;
144 CondCollCondChg(const SwTextFormatColl& rColl) : m_rColl(rColl) {};
147 class GrfRereadAndInCacheHint final : public SfxHint
151 class PreGraphicArrivedHint final : public SfxHint
155 class PostGraphicArrivedHint final : public SfxHint
159 class MoveTableLineHint final : public SfxHint
161 public:
162 const SwFrameFormat& m_rNewFormat;
163 const SwTableLine& m_rTableLine;
164 MoveTableLineHint(const SwFrameFormat& rNewFormat, const SwTableLine& rTableLine): m_rNewFormat(rNewFormat), m_rTableLine(rTableLine) {};
167 class MoveTableBoxHint final : public SfxHint
169 public:
170 const SwFrameFormat& m_rNewFormat;
171 const SwTableBox& m_rTableBox;
172 MoveTableBoxHint(const SwFrameFormat& rNewFormat, const SwTableBox& rTableBox): m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {};
175 class DocumentDyingHint final : public SfxHint
179 class TableLineFormatChanged final : public SfxHint
181 public:
182 const SwTableLineFormat& m_rNewFormat;
183 const SwTableLine& m_rTabLine;
184 TableLineFormatChanged(const SwTableLineFormat& rNewFormat, const SwTableLine& rTabLine) : m_rNewFormat(rNewFormat), m_rTabLine(rTabLine) {};
186 class TableBoxFormatChanged final : public SfxHint
188 public:
189 const SwTableBoxFormat& m_rNewFormat;
190 const SwTableBox& m_rTableBox;
191 TableBoxFormatChanged(const SwTableBoxFormat& rNewFormat, const SwTableBox& rTableBox) : m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {};
195 class SwUpdateAttr final : public SwMsgPoolItem
197 private:
198 sal_Int32 m_nStart;
199 sal_Int32 m_nEnd;
200 sal_uInt16 m_nWhichAttr;
201 std::vector<sal_uInt16> m_aWhichFmtAttrs; // attributes changed inside RES_TXTATR_AUTOFMT
203 public:
204 SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW );
205 SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW );
207 sal_Int32 getStart() const
209 return m_nStart;
212 sal_Int32 getEnd() const
214 return m_nEnd;
217 sal_uInt16 getWhichAttr() const
219 return m_nWhichAttr;
222 const std::vector<sal_uInt16>& getFmtAttrs() const
224 return m_aWhichFmtAttrs;
228 /** SwRefMarkFieldUpdate is sent when the referencemarks should be updated.
229 To determine Page- / chapternumbers the current frame has to be asked.
230 For this we need the current outputdevice */
231 class SwRefMarkFieldUpdate final : public SwMsgPoolItem
233 VclPtr<OutputDevice> pOut; ///< pointer to the current output device
234 public:
235 /** Is sent if reference marks should be updated.
237 To get the page/chapter number, the frame has to be asked. For that we need
238 the current OutputDevice.
240 SwRefMarkFieldUpdate( OutputDevice* );
243 /** SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position
244 have to be updated. At the moment this is only needed when updating pagenumber fields. */
245 class SwDocPosUpdate final : public SwMsgPoolItem
247 public:
248 const SwTwips nDocPos;
249 SwDocPosUpdate( const SwTwips nDocPos );
252 /// SwTableFormulaUpdate is sent when the table has to be newly calculated or when a table itself is merged or split
253 enum TableFormulaUpdateFlags { TBL_CALC = 0,
254 TBL_BOXNAME,
255 TBL_BOXPTR,
256 TBL_RELBOXNAME,
257 TBL_MERGETBL,
258 TBL_SPLITTBL
260 class SwTableFormulaUpdate final : public SwMsgPoolItem
262 public:
263 const SwTable* m_pTable; ///< Pointer to the current table
264 union {
265 const SwTable* pDelTable; ///< Merge: Pointer to the table to be removed
266 const OUString* pNewTableNm; ///< Split: the name of the new table
267 } m_aData;
268 SwHistory* m_pHistory;
269 sal_uInt16 m_nSplitLine; ///< Split: from this BaseLine on will be split
270 TableFormulaUpdateFlags m_eFlags;
271 bool m_bModified : 1;
272 bool m_bBehindSplitLine : 1;
274 /** Is sent if a table should be recalculated */
275 SwTableFormulaUpdate( const SwTable* );
278 class SwAutoFormatGetDocNode final : public SwMsgPoolItem
280 public:
281 const SwNodes* pNodes;
283 SwAutoFormatGetDocNode( const SwNodes* pNds );
287 * SwAttrSetChg is sent when something has changed in the SwAttrSet rTheChgdSet.
288 * 2 Hints are always sent, the old and the new items in the rTheChgdSet.
290 class SwAttrSetChg final : public SwMsgPoolItem
292 bool m_bDelSet;
293 SwAttrSet* m_pChgSet; ///< what has changed
294 const SwAttrSet* m_pTheChgdSet; ///< is only used to compare
295 public:
296 SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet );
297 SwAttrSetChg( const SwAttrSetChg& );
298 virtual ~SwAttrSetChg() override;
300 /// What has changed
301 const SwAttrSet* GetChgSet() const { return m_pChgSet; }
302 SwAttrSet* GetChgSet() { return m_pChgSet; }
304 /// Where it has changed
305 const SwAttrSet* GetTheChgdSet() const { return m_pTheChgdSet; }
307 sal_uInt16 Count() const { return m_pChgSet->Count(); }
308 void ClearItem( sal_uInt16 nWhichL )
309 #ifdef DBG_UTIL
311 #else
312 { m_pChgSet->ClearItem( nWhichL ); }
313 #endif
316 class SwVirtPageNumInfo final : public SwMsgPoolItem
318 const SwPageFrame *m_pPage;
319 const SwPageFrame *m_pOrigPage;
320 const SwFrame *m_pFrame;
321 /** Multiple attributes can be attached to a single paragraph / table
322 The frame, in the end, has to decide which attribute takes effect and which physical page it involves */
323 public:
324 SwVirtPageNumInfo( const SwPageFrame *pPg );
326 const SwPageFrame *GetPage() const { return m_pPage; }
327 const SwPageFrame *GetOrigPage() const { return m_pOrigPage;}
328 const SwFrame *GetFrame() const { return m_pFrame; }
329 void SetInfo( const SwPageFrame *pPg,
330 const SwFrame *pF ) { m_pFrame = pF; m_pPage = pPg; }
333 class SwFindNearestNode final : public SwMsgPoolItem
335 const SwNode *m_pNode, *m_pFound;
336 public:
337 SwFindNearestNode( const SwNode& rNd );
338 void CheckNode( const SwNode& rNd );
340 const SwNode* GetFoundNode() const { return m_pFound; }
343 class SwStringMsgPoolItem final : public SwMsgPoolItem
345 OUString m_sStr;
346 public:
348 const OUString& GetString() const { return m_sStr; }
350 SwStringMsgPoolItem( sal_uInt16 nId, const OUString& rStr )
351 : SwMsgPoolItem( nId ), m_sStr( rStr )
354 #endif
356 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */