Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / hints.hxx
blob5920b042f270224babb0dff5f3f46b4d5a1f4108
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 <vcl/vclptr.hxx>
24 #include <vector>
26 class SwFormat;
27 class OutputDevice;
28 class SwTable;
29 class SwNode;
30 class SwNodes;
31 class SwContentNode;
32 class SwPageFrm;
33 class SwFrm;
34 class SwTextNode;
35 class SwHistory;
37 // Base class for all Message-Hints:
38 // "Overhead" of SfxPoolItem is handled here
39 class SwMsgPoolItem : public SfxPoolItem
41 public:
42 SwMsgPoolItem( sal_uInt16 nWhich );
44 // "Overhead" of SfxPoolItem
45 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
46 virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
49 // SwPtrMsgPoolItem (old SwObjectDying!)
51 class SwPtrMsgPoolItem : public SwMsgPoolItem
53 public:
54 void * pObject;
56 SwPtrMsgPoolItem( sal_uInt16 nId, void * pObj )
57 : SwMsgPoolItem( nId ), pObject( pObj )
62 * SwFormatChg is sent when a format has changed to another format. 2 Hints are always sent
63 * the old and the new format
65 class SwFormatChg: public SwMsgPoolItem
67 public:
68 SwFormat *pChangedFormat;
69 SwFormatChg( SwFormat *pFormat );
72 class SwInsText: public SwMsgPoolItem
74 public:
75 sal_Int32 nPos;
76 sal_Int32 nLen;
78 SwInsText( sal_Int32 nP, sal_Int32 nL );
81 class SwDelChr: public SwMsgPoolItem
83 public:
84 sal_Int32 nPos;
86 SwDelChr( sal_Int32 nP );
89 class SwDelText: public SwMsgPoolItem
91 public:
92 sal_Int32 nStart;
93 sal_Int32 nLen;
95 SwDelText( sal_Int32 nS, sal_Int32 nL );
98 class SwUpdateAttr : public SwMsgPoolItem
100 private:
101 sal_Int32 nStart;
102 sal_Int32 nEnd;
103 sal_uInt16 nWhichAttr;
104 std::vector<sal_uInt16> aWhichFormatAttr; // attributes changed inside RES_TXTATR_AUTOFMT
106 public:
107 SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW );
109 sal_Int32 getStart() const
111 return nStart;
114 sal_Int32 getEnd() const
116 return nEnd;
119 sal_uInt16 getWhichAttr() const
121 return nWhichAttr;
124 const std::vector<sal_uInt16>& getFormatAttr() const
126 return aWhichFormatAttr;
130 /** SwRefMarkFieldUpdate is sent when the referencemarks should be updated.
131 To determine Page- / chapternumbers the current frame has to be asked.
132 For this we need the current outputdevice */
133 class SwRefMarkFieldUpdate : public SwMsgPoolItem
135 public:
136 VclPtr<OutputDevice> pOut; ///< pointer to the current output device
137 /** Is sent if reference marks should be updated.
139 To get the page/chapter number, the frame has to be asked. For that we need
140 the current OutputDevice.
142 SwRefMarkFieldUpdate( OutputDevice* );
145 /** SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position
146 have to be updated. At the moment this is only needed when updating pagenumber fields. */
147 class SwDocPosUpdate : public SwMsgPoolItem
149 public:
150 const long nDocPos;
151 SwDocPosUpdate( const long nDocPos );
154 /// SwTableFormulaUpdate is sent when the table has to be newly calculated or when a table itself is merged or splitted
155 enum TableFormulaUpdateFlags { TBL_CALC = 0,
156 TBL_BOXNAME,
157 TBL_BOXPTR,
158 TBL_RELBOXNAME,
159 TBL_MERGETBL,
160 TBL_SPLITTBL
162 class SwTableFormulaUpdate : public SwMsgPoolItem
164 public:
165 const SwTable* pTable; ///< Pointer to the current table
166 union {
167 const SwTable* pDelTable; ///< Merge: Pointer to the table to be removed
168 const OUString* pNewTableNm; ///< Split: the name of the new table
169 } DATA;
170 SwHistory* pHistory;
171 sal_uInt16 nSplitLine; ///< Split: from this BaseLine on will be splitted
172 TableFormulaUpdateFlags eFlags;
173 bool bModified : 1;
174 bool bBehindSplitLine : 1;
176 /** Is sent if a table should be recalculated */
177 SwTableFormulaUpdate( const SwTable* );
180 class SwAutoFormatGetDocNode: public SwMsgPoolItem
182 public:
183 const SwContentNode* pContentNode;
184 const SwNodes* pNodes;
186 SwAutoFormatGetDocNode( const SwNodes* pNds );
190 * SwAttrSetChg is sent when something has changed in the SwAttrSet rTheChgdSet.
191 * 2 Hints are always sent, the old and the new items in the rTheChgdSet.
193 class SwAttrSetChg: public SwMsgPoolItem
195 bool bDelSet;
196 SwAttrSet* pChgSet; ///< what has changed
197 const SwAttrSet* pTheChgdSet; ///< is only used to compare
198 public:
199 SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet );
200 SwAttrSetChg( const SwAttrSetChg& );
201 virtual ~SwAttrSetChg();
203 /// What has changed
204 const SwAttrSet* GetChgSet() const { return pChgSet; }
205 SwAttrSet* GetChgSet() { return pChgSet; }
207 /// Where it has changed
208 const SwAttrSet* GetTheChgdSet() const { return pTheChgdSet; }
210 sal_uInt16 Count() const { return pChgSet->Count(); }
211 void ClearItem( sal_uInt16 nWhichL = 0 )
212 #ifdef DBG_UTIL
214 #else
215 { pChgSet->ClearItem( nWhichL ); }
216 #endif
219 class SwCondCollCondChg: public SwMsgPoolItem
221 public:
222 SwFormat *pChangedFormat;
223 SwCondCollCondChg( SwFormat *pFormat );
226 class SwVirtPageNumInfo: public SwMsgPoolItem
228 const SwPageFrm *pPage;
229 const SwPageFrm *pOrigPage;
230 const SwFrm *pFrm;
231 /** Multiple attributes can be attached to a single paragraph / table
232 The frame, in the end, has to decide which attribute takes effect and which physical page it involves */
233 public:
234 SwVirtPageNumInfo( const SwPageFrm *pPg );
236 const SwPageFrm *GetPage() { return pPage; }
237 const SwPageFrm *GetOrigPage() { return pOrigPage;}
238 const SwFrm *GetFrm() { return pFrm; }
239 void SetInfo( const SwPageFrm *pPg,
240 const SwFrm *pF ) { pFrm = pF, pPage = pPg; }
243 class SwFindNearestNode : public SwMsgPoolItem
245 const SwNode *pNd, *pFnd;
246 public:
247 SwFindNearestNode( const SwNode& rNd );
248 void CheckNode( const SwNode& rNd );
250 const SwNode* GetFoundNode() const { return pFnd; }
253 class SwStringMsgPoolItem : public SwMsgPoolItem
255 OUString m_sStr;
256 public:
258 OUString GetString() const { return m_sStr; }
260 SwStringMsgPoolItem( sal_uInt16 nId, const OUString& rStr )
261 : SwMsgPoolItem( nId ), m_sStr( rStr )
264 #endif
266 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */