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 * This is typically owned by an sw::LegacyModifyHint, which knows if this pool item is the old or
75 class SwFormatChg final
: public SwMsgPoolItem
78 SwFormat
*pChangedFormat
;
79 SwFormatChg( SwFormat
*pFormat
);
86 /// text is moved into pDestNode
87 class MoveText final
: public SfxHint
90 SwTextNode
* pDestNode
;
92 sal_Int32 nSourceStart
;
95 MoveText(SwTextNode
*pD
, sal_Int32 nD
, sal_Int32 nS
, sal_Int32 nL
)
96 : SfxHint(SfxHintId::SwMoveText
), pDestNode(pD
), nDestStart(nD
), nSourceStart(nS
), nLen(nL
) {}
99 class InsertText final
: public SfxHint
102 const sal_Int32 nPos
;
103 const sal_Int32 nLen
;
104 const bool isInsideFieldmarkCommand
;
105 const bool isInsideFieldmarkResult
;
107 InsertText(sal_Int32 nP
, sal_Int32 nL
, bool isInFMCommand
, bool isInFMResult
);
110 class DeleteText final
: public SfxHint
113 const sal_Int32 nStart
;
114 const sal_Int32 nLen
;
116 DeleteText( sal_Int32 nS
, sal_Int32 nL
);
119 class DeleteChar final
: public SfxHint
122 const sal_Int32 m_nPos
;
124 DeleteChar( const sal_Int32 nPos
);
127 /// new delete redline is created
128 class RedlineDelText final
: public SfxHint
134 RedlineDelText(sal_Int32 nS
, sal_Int32 nL
) : SfxHint(SfxHintId::SwRedlineDelText
), nStart(nS
), nLen(nL
) {}
137 /// delete redline is removed
138 class RedlineUnDelText final
: public SfxHint
144 RedlineUnDelText(sal_Int32 nS
, sal_Int32 nL
) : SfxHint(SfxHintId::SwRedlineUnDelText
), nStart(nS
), nLen(nL
) {}
147 /** DocPosUpdate is sent to signal that only the frames from or to a specified document-global position
148 have to be updated. At the moment this is only needed when updating pagenumber fields. */
149 class DocPosUpdate final
: public SfxHint
152 const SwTwips m_nDocPos
;
153 DocPosUpdate(const SwTwips nDocPos
)
154 : SfxHint(SfxHintId::SwDocPosUpdate
)
158 class DocPosUpdateAtIndex final
: public SfxHint
161 const SwTwips m_nDocPos
;
162 const SwTextNode
& m_rNode
;
163 const sal_uInt32 m_nIndex
;
164 DocPosUpdateAtIndex(const SwTwips nDocPos
, const SwTextNode
& rNode
, sal_uInt32 nIndex
)
165 : SfxHint(SfxHintId::SwDocPosUpdateAtIndex
)
171 class CondCollCondChg final
: public SfxHint
174 const SwTextFormatColl
& m_rColl
;
175 CondCollCondChg(const SwTextFormatColl
& rColl
) : SfxHint(SfxHintId::SwCondCollCondChg
), m_rColl(rColl
) {};
178 class GrfRereadAndInCacheHint final
: public SfxHint
181 GrfRereadAndInCacheHint() : SfxHint(SfxHintId::SwGrfRereadAndInCache
) {}
184 class PreGraphicArrivedHint final
: public SfxHint
187 PreGraphicArrivedHint() : SfxHint(SfxHintId::SwPreGraphicArrived
) {}
190 class PostGraphicArrivedHint final
: public SfxHint
193 PostGraphicArrivedHint() : SfxHint(SfxHintId::SwPostGraphicArrived
) {}
196 class GraphicPieceArrivedHint final
: public SfxHint
199 GraphicPieceArrivedHint() : SfxHint(SfxHintId::SwGraphicPieceArrived
) {}
202 class LinkedGraphicStreamArrivedHint final
: public SfxHint
205 LinkedGraphicStreamArrivedHint() : SfxHint(SfxHintId::SwLinkedGraphicStreamArrived
) {}
208 class MoveTableLineHint final
: public SfxHint
211 const SwFrameFormat
& m_rNewFormat
;
212 const SwTableLine
& m_rTableLine
;
213 MoveTableLineHint(const SwFrameFormat
& rNewFormat
, const SwTableLine
& rTableLine
)
214 : SfxHint(SfxHintId::SwMoveTableLine
), m_rNewFormat(rNewFormat
), m_rTableLine(rTableLine
) {};
217 class MoveTableBoxHint final
: public SfxHint
220 const SwFrameFormat
& m_rNewFormat
;
221 const SwTableBox
& m_rTableBox
;
222 MoveTableBoxHint(const SwFrameFormat
& rNewFormat
, const SwTableBox
& rTableBox
)
223 : SfxHint(SfxHintId::SwMoveTableBox
), m_rNewFormat(rNewFormat
), m_rTableBox(rTableBox
) {};
226 class DocumentDyingHint final
: public SfxHint
229 DocumentDyingHint() : SfxHint(SfxHintId::SwDocumentDying
) {}
232 class TableLineFormatChanged final
: public SfxHint
235 const SwTableLineFormat
& m_rNewFormat
;
236 const SwTableLine
& m_rTabLine
;
237 TableLineFormatChanged(const SwTableLineFormat
& rNewFormat
, const SwTableLine
& rTabLine
)
238 : SfxHint(SfxHintId::SwTableLineFormatChanged
), m_rNewFormat(rNewFormat
), m_rTabLine(rTabLine
) {};
240 class TableBoxFormatChanged final
: public SfxHint
243 const SwTableBoxFormat
& m_rNewFormat
;
244 const SwTableBox
& m_rTableBox
;
245 TableBoxFormatChanged(const SwTableBoxFormat
& rNewFormat
, const SwTableBox
& rTableBox
)
246 : SfxHint(SfxHintId::SwTableBoxFormatChanged
), m_rNewFormat(rNewFormat
), m_rTableBox(rTableBox
) {};
248 class NameChanged final
: public SfxHint
251 const OUString m_sOld
;
252 const OUString m_sNew
;
253 NameChanged(const OUString
& rOld
, const OUString
& rNew
) : SfxHint(SfxHintId::SwNameChanged
), m_sOld(rOld
), m_sNew(rNew
) {};
255 class TitleChanged final
: public SfxHint
258 const OUString m_sOld
;
259 const OUString m_sNew
;
260 TitleChanged(const OUString
& rOld
, const OUString
& rNew
) : SfxHint(SfxHintId::SwTitleChanged
), m_sOld(rOld
), m_sNew(rNew
) {};
262 class DescriptionChanged final
: public SfxHint
265 DescriptionChanged() : SfxHint(SfxHintId::SwDescriptionChanged
) {}
267 class SectionHidden final
: public SfxHint
270 const bool m_isHidden
;
271 SectionHidden(const bool isHidden
= true) : SfxHint(SfxHintId::SwSectionHidden
), m_isHidden(isHidden
) {};
273 class TableHeadingChange final
: public SfxHint
276 TableHeadingChange() : SfxHint(SfxHintId::SwTableHeadingChange
) {};
278 class VirtPageNumHint final
: public SfxHint
280 const SwPageFrame
* m_pPage
;
281 const SwPageFrame
* m_pOrigPage
;
282 const SwFrame
* m_pFrame
;
284 /** Multiple attributes can be attached to a single paragraph / table
285 The frame, in the end, has to decide which attribute takes effect and which physical page it involves */
287 VirtPageNumHint(const SwPageFrame
* pPg
);
288 const SwPageFrame
* GetPage() const
290 const SwPageFrame
* GetOrigPage() const
291 { return m_pOrigPage
; }
292 const SwFrame
* GetFrame() const
294 void SetInfo(const SwPageFrame
* pPg
, const SwFrame
*pF
)
295 { m_pFrame
= pF
; m_pPage
= pPg
; }
304 class AutoFormatUsedHint final
: public SfxHint
307 const SwNodes
& m_rNodes
;
309 AutoFormatUsedHint(bool& isUsed
, const SwNodes
& rNodes
) : SfxHint(SfxHintId::SwAutoFormatUsedHint
), m_isUsed(isUsed
), m_rNodes(rNodes
) {}
310 void SetUsed() const { m_isUsed
= true; }
311 void CheckNode(const SwNode
*) const;
315 class SwUpdateAttr final
: public SwMsgPoolItem
320 sal_uInt16 m_nWhichAttr
;
321 std::vector
<sal_uInt16
> m_aWhichFmtAttrs
; // attributes changed inside RES_TXTATR_AUTOFMT
324 SwUpdateAttr( sal_Int32 nS
, sal_Int32 nE
, sal_uInt16 nW
);
325 SwUpdateAttr( sal_Int32 nS
, sal_Int32 nE
, sal_uInt16 nW
, std::vector
<sal_uInt16
> aW
);
327 sal_Int32
getStart() const
332 sal_Int32
getEnd() const
337 sal_uInt16
getWhichAttr() const
342 const std::vector
<sal_uInt16
>& getFmtAttrs() const
344 return m_aWhichFmtAttrs
;
348 /// SwTableFormulaUpdate is sent when the table has to be newly calculated or when a table itself is merged or split
349 enum TableFormulaUpdateFlags
{ TBL_CALC
= 0,
356 class SwTableFormulaUpdate final
359 const SwTable
* m_pTable
; ///< Pointer to the current table
361 const SwTable
* pDelTable
; ///< Merge: Pointer to the table to be removed
362 const OUString
* pNewTableNm
; ///< Split: the name of the new table
364 sal_uInt16 m_nSplitLine
; ///< Split: from this BaseLine on will be split
365 TableFormulaUpdateFlags m_eFlags
;
366 bool m_bModified
: 1;
367 bool m_bBehindSplitLine
: 1;
369 /** Is sent if a table should be recalculated */
370 SwTableFormulaUpdate( const SwTable
* );
374 * SwAttrSetChg is sent when something has changed in the SwAttrSet rTheChgdSet.
375 * 2 Hints are always sent, the old and the new items in the rTheChgdSet.
377 class SwAttrSetChg final
: public SwMsgPoolItem
380 SwAttrSet
* m_pChgSet
; ///< what has changed
381 const SwAttrSet
* m_pTheChgdSet
; ///< is only used to compare
383 SwAttrSetChg( const SwAttrSet
& rTheSet
, SwAttrSet
& rSet
);
384 SwAttrSetChg( const SwAttrSetChg
& );
385 virtual ~SwAttrSetChg() override
;
388 const SwAttrSet
* GetChgSet() const { return m_pChgSet
; }
389 SwAttrSet
* GetChgSet() { return m_pChgSet
; }
391 /// Where it has changed
392 const SwAttrSet
* GetTheChgdSet() const { return m_pTheChgdSet
; }
394 sal_uInt16
Count() const { return m_pChgSet
->Count(); }
395 void ClearItem( sal_uInt16 nWhichL
)
399 { m_pChgSet
->ClearItem( nWhichL
); }
404 class SwFindNearestNode final
406 const SwNode
*m_pNode
, *m_pFound
;
408 SwFindNearestNode( const SwNode
& rNd
) : m_pNode(&rNd
), m_pFound(nullptr) {}
409 void CheckNode( const SwNode
& rNd
);
411 const SwNode
* GetFoundNode() const { return m_pFound
; }
416 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */