1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
35 class SwTextFormatColl
;
40 // Base class for all Message-Hints:
41 // "Overhead" of SfxPoolItem is handled here
42 class SwMsgPoolItem
: public SfxPoolItem
45 SwMsgPoolItem( sal_uInt16 nWhich
);
47 // "Overhead" of SfxPoolItem
48 virtual bool operator==( const SfxPoolItem
& ) const override
;
49 virtual SwMsgPoolItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
52 // SwPtrMsgPoolItem (old SwObjectDying!)
54 class SwPtrMsgPoolItem final
: public SwMsgPoolItem
59 SwPtrMsgPoolItem( sal_uInt16 nId
, void * pObj
)
60 : SwMsgPoolItem( nId
), pObject( pObj
)
65 * SwFormatChg is sent when a format has changed to another format. 2 Hints are always sent
66 * the old and the new format
68 class SwFormatChg final
: public SwMsgPoolItem
71 SwFormat
*pChangedFormat
;
72 SwFormatChg( SwFormat
*pFormat
);
75 class SwInsText final
: public SwMsgPoolItem
81 SwInsText( sal_Int32 nP
, sal_Int32 nL
);
84 class SwDelChr final
: public SwMsgPoolItem
89 SwDelChr( sal_Int32 nP
);
92 class SwDelText final
: public SwMsgPoolItem
98 SwDelText( sal_Int32 nS
, sal_Int32 nL
);
103 /// text is moved into pDestNode
104 class MoveText final
: public SfxHint
107 SwTextNode
* pDestNode
;
108 sal_Int32 nDestStart
;
109 sal_Int32 nSourceStart
;
112 MoveText(SwTextNode
*pD
, sal_Int32 nD
, sal_Int32 nS
, sal_Int32 nL
);
115 /// new delete redline is created
116 class RedlineDelText final
: public SfxHint
122 RedlineDelText(sal_Int32 nS
, sal_Int32 nL
);
125 /// delete redline is removed
126 class RedlineUnDelText final
: public SfxHint
132 RedlineUnDelText(sal_Int32 nS
, sal_Int32 nL
);
135 class CondCollCondChg final
: public SfxHint
138 const SwTextFormatColl
& m_rColl
;
139 CondCollCondChg(const SwTextFormatColl
& rColl
) : m_rColl(rColl
) {};
142 class GrfRereadAndInCacheHint final
: public SfxHint
146 class PreGraphicArrivedHint final
: public SfxHint
150 class PostGraphicArrivedHint final
: public SfxHint
154 class MoveTableLineHint final
: public SfxHint
157 const SwFrameFormat
& m_rNewFormat
;
158 const SwTableLine
& m_rTableLine
;
159 MoveTableLineHint(const SwFrameFormat
& rNewFormat
, const SwTableLine
& rTableLine
): m_rNewFormat(rNewFormat
), m_rTableLine(rTableLine
) {};
162 class MoveTableBoxHint final
: public SfxHint
165 const SwFrameFormat
& m_rNewFormat
;
166 const SwTableBox
& m_rTableBox
;
167 MoveTableBoxHint(const SwFrameFormat
& rNewFormat
, const SwTableBox
& rTableBox
): m_rNewFormat(rNewFormat
), m_rTableBox(rTableBox
) {};
171 class SwUpdateAttr final
: public SwMsgPoolItem
176 sal_uInt16 m_nWhichAttr
;
177 std::vector
<sal_uInt16
> m_aWhichFmtAttrs
; // attributes changed inside RES_TXTATR_AUTOFMT
180 SwUpdateAttr( sal_Int32 nS
, sal_Int32 nE
, sal_uInt16 nW
);
181 SwUpdateAttr( sal_Int32 nS
, sal_Int32 nE
, sal_uInt16 nW
, std::vector
<sal_uInt16
> aW
);
183 sal_Int32
getStart() const
188 sal_Int32
getEnd() const
193 sal_uInt16
getWhichAttr() const
198 const std::vector
<sal_uInt16
>& getFmtAttrs() const
200 return m_aWhichFmtAttrs
;
204 /** SwRefMarkFieldUpdate is sent when the referencemarks should be updated.
205 To determine Page- / chapternumbers the current frame has to be asked.
206 For this we need the current outputdevice */
207 class SwRefMarkFieldUpdate final
: public SwMsgPoolItem
209 VclPtr
<OutputDevice
> pOut
; ///< pointer to the current output device
211 /** Is sent if reference marks should be updated.
213 To get the page/chapter number, the frame has to be asked. For that we need
214 the current OutputDevice.
216 SwRefMarkFieldUpdate( OutputDevice
* );
219 /** SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position
220 have to be updated. At the moment this is only needed when updating pagenumber fields. */
221 class SwDocPosUpdate final
: public SwMsgPoolItem
224 const SwTwips nDocPos
;
225 SwDocPosUpdate( const SwTwips nDocPos
);
228 /// SwTableFormulaUpdate is sent when the table has to be newly calculated or when a table itself is merged or split
229 enum TableFormulaUpdateFlags
{ TBL_CALC
= 0,
236 class SwTableFormulaUpdate final
: public SwMsgPoolItem
239 const SwTable
* m_pTable
; ///< Pointer to the current table
241 const SwTable
* pDelTable
; ///< Merge: Pointer to the table to be removed
242 const OUString
* pNewTableNm
; ///< Split: the name of the new table
244 SwHistory
* m_pHistory
;
245 sal_uInt16 m_nSplitLine
; ///< Split: from this BaseLine on will be split
246 TableFormulaUpdateFlags m_eFlags
;
247 bool m_bModified
: 1;
248 bool m_bBehindSplitLine
: 1;
250 /** Is sent if a table should be recalculated */
251 SwTableFormulaUpdate( const SwTable
* );
254 class SwAutoFormatGetDocNode final
: public SwMsgPoolItem
257 const SwNodes
* pNodes
;
259 SwAutoFormatGetDocNode( const SwNodes
* pNds
);
263 * SwAttrSetChg is sent when something has changed in the SwAttrSet rTheChgdSet.
264 * 2 Hints are always sent, the old and the new items in the rTheChgdSet.
266 class SwAttrSetChg final
: public SwMsgPoolItem
269 SwAttrSet
* m_pChgSet
; ///< what has changed
270 const SwAttrSet
* m_pTheChgdSet
; ///< is only used to compare
272 SwAttrSetChg( const SwAttrSet
& rTheSet
, SwAttrSet
& rSet
);
273 SwAttrSetChg( const SwAttrSetChg
& );
274 virtual ~SwAttrSetChg() override
;
277 const SwAttrSet
* GetChgSet() const { return m_pChgSet
; }
278 SwAttrSet
* GetChgSet() { return m_pChgSet
; }
280 /// Where it has changed
281 const SwAttrSet
* GetTheChgdSet() const { return m_pTheChgdSet
; }
283 sal_uInt16
Count() const { return m_pChgSet
->Count(); }
284 void ClearItem( sal_uInt16 nWhichL
)
288 { m_pChgSet
->ClearItem( nWhichL
); }
292 class SwVirtPageNumInfo final
: public SwMsgPoolItem
294 const SwPageFrame
*m_pPage
;
295 const SwPageFrame
*m_pOrigPage
;
296 const SwFrame
*m_pFrame
;
297 /** Multiple attributes can be attached to a single paragraph / table
298 The frame, in the end, has to decide which attribute takes effect and which physical page it involves */
300 SwVirtPageNumInfo( const SwPageFrame
*pPg
);
302 const SwPageFrame
*GetPage() const { return m_pPage
; }
303 const SwPageFrame
*GetOrigPage() const { return m_pOrigPage
;}
304 const SwFrame
*GetFrame() const { return m_pFrame
; }
305 void SetInfo( const SwPageFrame
*pPg
,
306 const SwFrame
*pF
) { m_pFrame
= pF
; m_pPage
= pPg
; }
309 class SwFindNearestNode final
: public SwMsgPoolItem
311 const SwNode
*m_pNode
, *m_pFound
;
313 SwFindNearestNode( const SwNode
& rNd
);
314 void CheckNode( const SwNode
& rNd
);
316 const SwNode
* GetFoundNode() const { return m_pFound
; }
319 class SwStringMsgPoolItem final
: public SwMsgPoolItem
324 const OUString
& GetString() const { return m_sStr
; }
326 SwStringMsgPoolItem( sal_uInt16 nId
, const OUString
& rStr
)
327 : SwMsgPoolItem( nId
), m_sStr( rStr
)
332 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */