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"
25 #include <vcl/vclptr.hxx>
36 class SwTextFormatColl
;
39 class SwTableBoxFormat
;
41 class SwTableLineFormat
;
44 // Base class for all Message-Hints:
45 // "Overhead" of SfxPoolItem is handled here
46 class SwMsgPoolItem
: public SfxPoolItem
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
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
75 SwFormat
*pChangedFormat
;
76 SwFormatChg( SwFormat
*pFormat
);
83 /// text is moved into pDestNode
84 class MoveText final
: public SfxHint
87 SwTextNode
* pDestNode
;
89 sal_Int32 nSourceStart
;
92 MoveText(SwTextNode
*pD
, sal_Int32 nD
, sal_Int32 nS
, sal_Int32 nL
);
95 class InsertText final
: public SfxHint
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
109 const sal_Int32 nStart
;
110 const sal_Int32 nLen
;
112 DeleteText( sal_Int32 nS
, sal_Int32 nL
);
115 class DeleteChar final
: public SfxHint
118 const sal_Int32 m_nPos
;
120 DeleteChar( const sal_Int32 nPos
);
123 /// new delete redline is created
124 class RedlineDelText final
: public SfxHint
130 RedlineDelText(sal_Int32 nS
, sal_Int32 nL
);
133 /// delete redline is removed
134 class RedlineUnDelText final
: public SfxHint
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
148 const SwTwips m_nDocPos
;
149 DocPosUpdate(const SwTwips nDocPos
)
150 : SfxHint(SfxHintId::SwDocPosUpdate
)
154 class DocPosUpdateAtIndex final
: public SfxHint
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
)
167 class CondCollCondChg final
: public SfxHint
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
181 PreGraphicArrivedHint() : SfxHint(SfxHintId::SwPreGraphicArrived
) {}
184 class PostGraphicArrivedHint final
: public SfxHint
188 class GraphicPieceArrivedHint final
: public SfxHint
191 GraphicPieceArrivedHint() : SfxHint(SfxHintId::SwGraphicPieceArrived
) {}
194 class LinkedGraphicStreamArrivedHint final
: public SfxHint
197 LinkedGraphicStreamArrivedHint() : SfxHint(SfxHintId::SwLinkedGraphicStreamArrived
) {}
200 class MoveTableLineHint final
: public SfxHint
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
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
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
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
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
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
251 DescriptionChanged() : SfxHint(SfxHintId::SwDescriptionChanged
) {}
253 class SectionHidden final
: public SfxHint
256 const bool m_isHidden
;
257 SectionHidden(const bool isHidden
= true) : SfxHint(SfxHintId::SwSectionHidden
), m_isHidden(isHidden
) {};
259 class TableHeadingChange final
: public SfxHint
262 TableHeadingChange() : SfxHint(SfxHintId::SwTableHeadingChange
) {};
266 class SwUpdateAttr final
: public SwMsgPoolItem
271 sal_uInt16 m_nWhichAttr
;
272 std::vector
<sal_uInt16
> m_aWhichFmtAttrs
; // attributes changed inside RES_TXTATR_AUTOFMT
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
283 sal_Int32
getEnd() const
288 sal_uInt16
getWhichAttr() const
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,
307 class SwTableFormulaUpdate final
310 const SwTable
* m_pTable
; ///< Pointer to the current table
312 const SwTable
* pDelTable
; ///< Merge: Pointer to the table to be removed
313 const OUString
* pNewTableNm
; ///< Split: the name of the new table
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
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
339 SwAttrSet
* m_pChgSet
; ///< what has changed
340 const SwAttrSet
* m_pTheChgdSet
; ///< is only used to compare
342 SwAttrSetChg( const SwAttrSet
& rTheSet
, SwAttrSet
& rSet
);
343 SwAttrSetChg( const SwAttrSetChg
& );
344 virtual ~SwAttrSetChg() override
;
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
)
358 { m_pChgSet
->ClearItem( nWhichL
); }
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 */
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
;
383 SwFindNearestNode( const SwNode
& rNd
);
384 void CheckNode( const SwNode
& rNd
);
386 const SwNode
* GetFoundNode() const { return m_pFound
; }
391 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */