Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / sw / inc / hints.hxx
blobce7c6444e11c9884f14c2c7ca308a11abfbe9d11
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
25 #include <vector>
27 class SwFormat;
28 class OutputDevice;
29 class SwTable;
30 class SwNode;
31 class SwNodes;
32 class SwContentNode;
33 class SwPageFrame;
34 class SwFrame;
35 class SwTextNode;
36 class SwHistory;
38 // Base class for all Message-Hints:
39 // "Overhead" of SfxPoolItem is handled here
40 class SwMsgPoolItem : public SfxPoolItem
42 public:
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
54 public:
55 void * pObject;
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
68 public:
69 SwFormat *pChangedFormat;
70 SwFormatChg( SwFormat *pFormat );
73 class SwInsText: public SwMsgPoolItem
75 public:
76 sal_Int32 nPos;
77 sal_Int32 nLen;
79 SwInsText( sal_Int32 nP, sal_Int32 nL );
82 class SwDelChr: public SwMsgPoolItem
84 public:
85 sal_Int32 nPos;
87 SwDelChr( sal_Int32 nP );
90 class SwDelText: public SwMsgPoolItem
92 public:
93 sal_Int32 nStart;
94 sal_Int32 nLen;
96 SwDelText( sal_Int32 nS, sal_Int32 nL );
99 class SwUpdateAttr : public SwMsgPoolItem
101 private:
102 sal_Int32 m_nStart;
103 sal_Int32 m_nEnd;
104 sal_uInt16 m_nWhichAttr;
105 std::vector<sal_uInt16> m_aWhichFormatAttr; // attributes changed inside RES_TXTATR_AUTOFMT
107 public:
108 SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW );
110 sal_Int32 getStart() const
112 return m_nStart;
115 sal_Int32 getEnd() const
117 return m_nEnd;
120 sal_uInt16 getWhichAttr() const
122 return m_nWhichAttr;
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
136 public:
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
150 public:
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,
157 TBL_BOXNAME,
158 TBL_BOXPTR,
159 TBL_RELBOXNAME,
160 TBL_MERGETBL,
161 TBL_SPLITTBL
163 class SwTableFormulaUpdate : public SwMsgPoolItem
165 public:
166 const SwTable* m_pTable; ///< Pointer to the current table
167 union {
168 const SwTable* pDelTable; ///< Merge: Pointer to the table to be removed
169 const OUString* pNewTableNm; ///< Split: the name of the new table
170 } m_aData;
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
183 public:
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
196 bool m_bDelSet;
197 SwAttrSet* m_pChgSet; ///< what has changed
198 const SwAttrSet* m_pTheChgdSet; ///< is only used to compare
199 public:
200 SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet );
201 SwAttrSetChg( const SwAttrSetChg& );
202 virtual ~SwAttrSetChg() override;
204 /// What has changed
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 )
213 #ifdef DBG_UTIL
215 #else
216 { m_pChgSet->ClearItem( nWhichL ); }
217 #endif
220 class SwCondCollCondChg: public SwMsgPoolItem
222 public:
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 */
234 public:
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;
247 public:
248 SwFindNearestNode( const SwNode& rNd );
249 void CheckNode( const SwNode& rNd );
251 const SwNode* GetFoundNode() const { return m_pFound; }
254 class SwStringMsgPoolItem : public SwMsgPoolItem
256 OUString m_sStr;
257 public:
259 const OUString& GetString() const { return m_sStr; }
261 SwStringMsgPoolItem( sal_uInt16 nId, const OUString& rStr )
262 : SwMsgPoolItem( nId ), m_sStr( rStr )
265 #endif
267 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */