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
;
38 class SwTableBoxFormat
;
40 class SwTableLineFormat
;
43 // Base class for all Message-Hints:
44 // "Overhead" of SfxPoolItem is handled here
45 class SwMsgPoolItem
: public SfxPoolItem
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
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
74 SwFormat
*pChangedFormat
;
75 SwFormatChg( SwFormat
*pFormat
);
78 class SwInsText final
: public SwMsgPoolItem
83 bool isInsideFieldmarkCommand
;
84 bool isInsideFieldmarkResult
;
86 SwInsText(sal_Int32 nP
, sal_Int32 nL
, bool isInFMCommand
, bool isInFMResult
);
89 class SwDelChr final
: public SwMsgPoolItem
94 SwDelChr( sal_Int32 nP
);
97 class SwDelText final
: public SwMsgPoolItem
103 SwDelText( sal_Int32 nS
, sal_Int32 nL
);
108 /// text is moved into pDestNode
109 class MoveText final
: public SfxHint
112 SwTextNode
* pDestNode
;
113 sal_Int32 nDestStart
;
114 sal_Int32 nSourceStart
;
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
127 RedlineDelText(sal_Int32 nS
, sal_Int32 nL
);
130 /// delete redline is removed
131 class RedlineUnDelText final
: public SfxHint
137 RedlineUnDelText(sal_Int32 nS
, sal_Int32 nL
);
140 class CondCollCondChg final
: public SfxHint
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
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
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
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
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
200 sal_uInt16 m_nWhichAttr
;
201 std::vector
<sal_uInt16
> m_aWhichFmtAttrs
; // attributes changed inside RES_TXTATR_AUTOFMT
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
212 sal_Int32
getEnd() const
217 sal_uInt16
getWhichAttr() const
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
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
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,
260 class SwTableFormulaUpdate final
: public SwMsgPoolItem
263 const SwTable
* m_pTable
; ///< Pointer to the current table
265 const SwTable
* pDelTable
; ///< Merge: Pointer to the table to be removed
266 const OUString
* pNewTableNm
; ///< Split: the name of the new table
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
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
293 SwAttrSet
* m_pChgSet
; ///< what has changed
294 const SwAttrSet
* m_pTheChgdSet
; ///< is only used to compare
296 SwAttrSetChg( const SwAttrSet
& rTheSet
, SwAttrSet
& rSet
);
297 SwAttrSetChg( const SwAttrSetChg
& );
298 virtual ~SwAttrSetChg() override
;
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
)
312 { m_pChgSet
->ClearItem( nWhichL
); }
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 */
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
;
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
348 const OUString
& GetString() const { return m_sStr
; }
350 SwStringMsgPoolItem( sal_uInt16 nId
, const OUString
& rStr
)
351 : SwMsgPoolItem( nId
), m_sStr( rStr
)
356 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */