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>
38 // Base class for all Message-Hints:
39 // "Overhead" of SfxPoolItem is handled here
40 class SwMsgPoolItem
: public SfxPoolItem
43 SwMsgPoolItem( sal_uInt16 nWhich
);
45 // "Overhead" of SfxPoolItem
46 virtual bool operator==( const SfxPoolItem
& ) const override
;
47 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
50 // SwPtrMsgPoolItem (old SwObjectDying!)
52 class SwPtrMsgPoolItem
: public SwMsgPoolItem
57 SwPtrMsgPoolItem( sal_uInt16 nId
, void * pObj
)
58 : SwMsgPoolItem( nId
), pObject( pObj
)
63 * SwFormatChg is sent when a format has changed to another format. 2 Hints are always sent
64 * the old and the new format
66 class SwFormatChg
: public SwMsgPoolItem
69 SwFormat
*pChangedFormat
;
70 SwFormatChg( SwFormat
*pFormat
);
73 class SwInsText
: public SwMsgPoolItem
79 SwInsText( sal_Int32 nP
, sal_Int32 nL
);
82 class SwDelChr
: public SwMsgPoolItem
87 SwDelChr( sal_Int32 nP
);
90 class SwDelText
: public SwMsgPoolItem
96 SwDelText( sal_Int32 nS
, sal_Int32 nL
);
99 class SwUpdateAttr
: public SwMsgPoolItem
104 sal_uInt16 m_nWhichAttr
;
105 std::vector
<sal_uInt16
> m_aWhichFormatAttr
; // attributes changed inside RES_TXTATR_AUTOFMT
108 SwUpdateAttr( sal_Int32 nS
, sal_Int32 nE
, sal_uInt16 nW
);
110 sal_Int32
getStart() const
115 sal_Int32
getEnd() const
120 sal_uInt16
getWhichAttr() const
125 const std::vector
<sal_uInt16
>& getFormatAttr() const
127 return m_aWhichFormatAttr
;
131 /** SwRefMarkFieldUpdate is sent when the referencemarks should be updated.
132 To determine Page- / chapternumbers the current frame has to be asked.
133 For this we need the current outputdevice */
134 class SwRefMarkFieldUpdate
: public SwMsgPoolItem
137 VclPtr
<OutputDevice
> pOut
; ///< pointer to the current output device
138 /** Is sent if reference marks should be updated.
140 To get the page/chapter number, the frame has to be asked. For that we need
141 the current OutputDevice.
143 SwRefMarkFieldUpdate( OutputDevice
* );
146 /** SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position
147 have to be updated. At the moment this is only needed when updating pagenumber fields. */
148 class SwDocPosUpdate
: public SwMsgPoolItem
151 const SwTwips nDocPos
;
152 SwDocPosUpdate( const SwTwips nDocPos
);
155 /// SwTableFormulaUpdate is sent when the table has to be newly calculated or when a table itself is merged or splitted
156 enum TableFormulaUpdateFlags
{ TBL_CALC
= 0,
163 class SwTableFormulaUpdate
: public SwMsgPoolItem
166 const SwTable
* m_pTable
; ///< Pointer to the current table
168 const SwTable
* pDelTable
; ///< Merge: Pointer to the table to be removed
169 const OUString
* pNewTableNm
; ///< Split: the name of the new table
171 SwHistory
* m_pHistory
;
172 sal_uInt16 m_nSplitLine
; ///< Split: from this BaseLine on will be splitted
173 TableFormulaUpdateFlags m_eFlags
;
174 bool m_bModified
: 1;
175 bool m_bBehindSplitLine
: 1;
177 /** Is sent if a table should be recalculated */
178 SwTableFormulaUpdate( const SwTable
* );
181 class SwAutoFormatGetDocNode
: public SwMsgPoolItem
184 const SwContentNode
* pContentNode
;
185 const SwNodes
* pNodes
;
187 SwAutoFormatGetDocNode( const SwNodes
* pNds
);
191 * SwAttrSetChg is sent when something has changed in the SwAttrSet rTheChgdSet.
192 * 2 Hints are always sent, the old and the new items in the rTheChgdSet.
194 class SwAttrSetChg
: public SwMsgPoolItem
197 SwAttrSet
* m_pChgSet
; ///< what has changed
198 const SwAttrSet
* m_pTheChgdSet
; ///< is only used to compare
200 SwAttrSetChg( const SwAttrSet
& rTheSet
, SwAttrSet
& rSet
);
201 SwAttrSetChg( const SwAttrSetChg
& );
202 virtual ~SwAttrSetChg() override
;
205 const SwAttrSet
* GetChgSet() const { return m_pChgSet
; }
206 SwAttrSet
* GetChgSet() { return m_pChgSet
; }
208 /// Where it has changed
209 const SwAttrSet
* GetTheChgdSet() const { return m_pTheChgdSet
; }
211 sal_uInt16
Count() const { return m_pChgSet
->Count(); }
212 void ClearItem( sal_uInt16 nWhichL
)
216 { m_pChgSet
->ClearItem( nWhichL
); }
220 class SwCondCollCondChg
: public SwMsgPoolItem
223 SwFormat
*pChangedFormat
;
224 SwCondCollCondChg( SwFormat
*pFormat
);
227 class SwVirtPageNumInfo
: public SwMsgPoolItem
229 const SwPageFrame
*m_pPage
;
230 const SwPageFrame
*m_pOrigPage
;
231 const SwFrame
*m_pFrame
;
232 /** Multiple attributes can be attached to a single paragraph / table
233 The frame, in the end, has to decide which attribute takes effect and which physical page it involves */
235 SwVirtPageNumInfo( const SwPageFrame
*pPg
);
237 const SwPageFrame
*GetPage() { return m_pPage
; }
238 const SwPageFrame
*GetOrigPage() { return m_pOrigPage
;}
239 const SwFrame
*GetFrame() { return m_pFrame
; }
240 void SetInfo( const SwPageFrame
*pPg
,
241 const SwFrame
*pF
) { m_pFrame
= pF
; m_pPage
= pPg
; }
244 class SwFindNearestNode
: public SwMsgPoolItem
246 const SwNode
*m_pNode
, *m_pFound
;
248 SwFindNearestNode( const SwNode
& rNd
);
249 void CheckNode( const SwNode
& rNd
);
251 const SwNode
* GetFoundNode() const { return m_pFound
; }
254 class SwStringMsgPoolItem
: public SwMsgPoolItem
259 const OUString
& GetString() const { return m_sStr
; }
261 SwStringMsgPoolItem( sal_uInt16 nId
, const OUString
& rStr
)
262 : SwMsgPoolItem( nId
), m_sStr( rStr
)
267 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */