xref: /trunk/main/sc/source/ui/inc/uiitems.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_UIITEMS_HXX
29 #define SC_UIITEMS_HXX
30 
31 #include "scdllapi.h"
32 #include "conditio.hxx"
33 #include "sortparam.hxx"
34 #include "queryparam.hxx"
35 #include "paramisc.hxx"
36 #include <svl/poolitem.hxx>
37 
38 class ScEditEngineDefaulter;
39 class EditTextObject;
40 class ScViewData;
41 class ScDPSaveData;
42 
43 // ---------------------------------------------------------------------------
44 
45 //  Items
46 
47 class ScInputStatusItem : public SfxPoolItem
48 {
49 	ScAddress           aCursorPos;
50 	ScAddress           aStartPos;
51 	ScAddress           aEndPos;
52 	String              aString;
53 	EditTextObject*		pEditData;
54 
55 public:
56 							TYPEINFO();
57 //UNUSED2008-05     		ScInputStatusItem( sal_uInt16 nWhich,
58 //UNUSED2008-05     						   SCTAB nTab,
59 //UNUSED2008-05     						   SCCOL nCol, SCROW nRow,
60 //UNUSED2008-05     						   SCCOL nStartCol, SCROW nStartRow,
61 //UNUSED2008-05     						   SCCOL nEndCol,   SCROW nSEndRow,
62 //UNUSED2008-05     						   const String& rString,
63 //UNUSED2008-05     						   const EditTextObject* pData );
64 
65 							ScInputStatusItem( sal_uInt16 nWhich,
66 											   const ScAddress& rCurPos,
67 											   const ScAddress& rStartPos,
68 											   const ScAddress& rEndPos,
69 											   const String& rString,
70 											   const EditTextObject* pData );
71 							ScInputStatusItem( const ScInputStatusItem& rItem );
72 							~ScInputStatusItem();
73 
74 	virtual String          GetValueText() const;
75 
76 	virtual int             operator==( const SfxPoolItem& ) const;
77 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
78 
79 	const ScAddress&        GetPos() const		{ return aCursorPos; }
80 	const ScAddress&        GetStartPos() const { return aStartPos; }
81 	const ScAddress&        GetEndPos() const	{ return aEndPos; }
82 	SCTAB                   GetTab() const      { return aCursorPos.Tab(); }
83 	SCCOL                   GetCol() const      { return aCursorPos.Col(); }
84 	SCROW                   GetRow() const      { return aCursorPos.Row(); }
85 	SCCOL                   GetStartCol() const { return aStartPos.Col(); }
86 	SCROW                   GetStartRow() const { return aStartPos.Row(); }
87 	SCCOL                   GetEndCol() const	{ return aEndPos.Col(); }
88 	SCROW                   GetEndRow() const	{ return aEndPos.Row(); }
89 
90 	const String&           GetString() const   { return aString; }
91 	const EditTextObject*	GetEditData() const	{ return pEditData; }
92 };
93 
94 
95 #define SC_TAB_INSERTED		1
96 #define SC_TAB_DELETED		2
97 #define SC_TAB_MOVED		3
98 #define SC_TAB_COPIED		4
99 #define SC_TAB_HIDDEN		5
100 
101 class ScTablesHint : public SfxHint
102 {
103 	sal_uInt16 nId;
104 	SCTAB nTab1;
105 	SCTAB nTab2;
106 
107 public:
108 					TYPEINFO();
109 					ScTablesHint(sal_uInt16 nNewId, SCTAB nTable1, SCTAB nTable2=0);
110 					~ScTablesHint();
111 
112 	sal_uInt16			GetId() const			{ return nId; }
113 	SCTAB			GetTab1() const			{ return nTab1; }
114 	SCTAB			GetTab2() const			{ return nTab2; }
115 };
116 
117 class ScEditViewHint : public SfxHint
118 {
119 	ScEditEngineDefaulter*	pEditEngine;
120 	ScAddress       			aCursorPos;
121 
122 public:
123 					TYPEINFO();
124 					ScEditViewHint( ScEditEngineDefaulter* pEngine, const ScAddress& rCurPos );
125 					~ScEditViewHint();
126 
127 	SCCOL           GetCol() const      { return aCursorPos.Col(); }
128 	SCROW           GetRow() const      { return aCursorPos.Row(); }
129 	SCTAB           GetTab() const      { return aCursorPos.Tab(); }
130 	ScEditEngineDefaulter*	GetEngine() const   { return pEditEngine; }
131 
132 private:
133 	ScEditViewHint(); // disabled
134 };
135 
136 class ScIndexHint : public SfxHint
137 {
138 	sal_uInt16 nId;
139 	sal_uInt16 nIndex;
140 
141 public:
142 					TYPEINFO();
143 					ScIndexHint(sal_uInt16 nNewId, sal_uInt16 nIdx);
144 					~ScIndexHint();
145 
146 	sal_uInt16			GetId() const			{ return nId; }
147 	sal_uInt16			GetIndex() const		{ return nIndex; }
148 };
149 
150 //----------------------------------------------------------------------------
151 // Parameter-Item fuer den Sortierdialog:
152 
153 class SC_DLLPUBLIC ScSortItem : public SfxPoolItem
154 {
155 public:
156 							TYPEINFO();
157 							ScSortItem( sal_uInt16				nWhich,
158 										ScViewData*			ptrViewData,
159 										const ScSortParam*	pSortData );
160 							ScSortItem( sal_uInt16				nWhich,
161 										const ScSortParam*	pSortData );
162 							ScSortItem( const ScSortItem& rItem );
163 							~ScSortItem();
164 
165 	virtual String          GetValueText() const;
166 	virtual int             operator==( const SfxPoolItem& ) const;
167 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
168     virtual sal_Bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberUd ) const;
169 
170 	ScViewData*			GetViewData () const { return pViewData; }
171 	const ScSortParam&	GetSortData	() const { return theSortData; }
172 
173 private:
174 	ScViewData* 	pViewData;
175 	ScSortParam		theSortData;
176 };
177 
178 //----------------------------------------------------------------------------
179 // Parameter-Item fuer den Filterdialog:
180 
181 class SC_DLLPUBLIC ScQueryItem : public SfxPoolItem
182 {
183 public:
184 							TYPEINFO();
185 							ScQueryItem( sal_uInt16					nWhich,
186 										 ScViewData*			ptrViewData,
187 										 const ScQueryParam*	pQueryData );
188 							ScQueryItem( sal_uInt16					nWhich,
189 										 const ScQueryParam*	pQueryData );
190 							ScQueryItem( const ScQueryItem& rItem );
191 							~ScQueryItem();
192 
193 	virtual String          GetValueText() const;
194 	virtual int             operator==( const SfxPoolItem& ) const;
195 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
196 
197 	ScViewData*			GetViewData () const { return pViewData; }
198 	const ScQueryParam&	GetQueryData() const { return theQueryData; }
199 
200 	sal_Bool		GetAdvancedQuerySource(ScRange& rSource) const;
201 	void		SetAdvancedQuerySource(const ScRange* pSource);
202 
203 private:
204 	ScViewData* 	pViewData;
205 	ScQueryParam	theQueryData;
206 	sal_Bool			bIsAdvanced;
207 	ScRange			aAdvSource;
208 };
209 
210 //----------------------------------------------------------------------------
211 // Parameter-Item fuer den Zwischenergebnisdialog:
212 
213 class SC_DLLPUBLIC ScSubTotalItem : public SfxPoolItem
214 {
215 public:
216 				TYPEINFO();
217 				ScSubTotalItem( sal_uInt16					nWhich,
218 								ScViewData*				ptrViewData,
219 								const ScSubTotalParam*	pSubTotalData );
220 				ScSubTotalItem( sal_uInt16					nWhich,
221 								const ScSubTotalParam*	pSubTotalData );
222 				ScSubTotalItem( const ScSubTotalItem&	rItem );
223 				~ScSubTotalItem();
224 
225 	virtual String          GetValueText() const;
226 	virtual int             operator==( const SfxPoolItem& ) const;
227 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
228     virtual sal_Bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberUd ) const;
229 
230 	ScViewData*				GetViewData () const { return pViewData; }
231 	const ScSubTotalParam&	GetSubTotalData() const { return theSubTotalData; }
232 
233 private:
234 	ScViewData* 	pViewData;
235 	ScSubTotalParam	theSubTotalData;
236 };
237 
238 //----------------------------------------------------------------------------
239 // Parameter-Item fuer die Benutzerlisten-TabPage:
240 
241 class SC_DLLPUBLIC ScUserListItem : public SfxPoolItem
242 {
243 public:
244 				TYPEINFO();
245 				ScUserListItem( sal_uInt16 nWhich );
246 				ScUserListItem( const ScUserListItem& rItem );
247 				~ScUserListItem();
248 
249 	virtual String          GetValueText() const;
250 	virtual int             operator==( const SfxPoolItem& ) const;
251 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
252 
253 	void		SetUserList ( const ScUserList& rUserList );
254 	ScUserList*	GetUserList () const { return pUserList; }
255 
256 private:
257 	ScUserList*	pUserList;
258 };
259 
260 //----------------------------------------------------------------------------
261 // Parameter-Item fuer die Konsolidieren-Dialog
262 
263 class ScConsolidateItem : public SfxPoolItem
264 {
265 public:
266 				TYPEINFO();
267 				ScConsolidateItem( sal_uInt16					 nWhich,
268 								   const ScConsolidateParam* pParam );
269 				ScConsolidateItem( const ScConsolidateItem&	rItem );
270 				~ScConsolidateItem();
271 
272 	virtual String          GetValueText() const;
273 	virtual int             operator==( const SfxPoolItem& ) const;
274 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
275 
276 	const ScConsolidateParam& GetData() const { return theConsData; }
277 
278 private:
279 	ScConsolidateParam	theConsData;
280 };
281 
282 //----------------------------------------------------------------------------
283 // Parameter-Item fuer den Pivot-Dialog
284 
285 class ScPivotItem : public SfxPoolItem
286 {
287 public:
288 				TYPEINFO();
289 				ScPivotItem( sal_uInt16 nWhich, const ScDPSaveData* pData,
290 							 const ScRange* pRange, sal_Bool bNew );
291 				ScPivotItem( const ScPivotItem&	rItem );
292 				~ScPivotItem();
293 
294 	virtual String          GetValueText() const;
295 	virtual int             operator==( const SfxPoolItem& ) const;
296 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
297 
298 	const ScDPSaveData& GetData() const			{ return *pSaveData; }
299 	const ScRange&		GetDestRange() const	{ return aDestRange; }
300 	sal_Bool				IsNewSheet() const		{ return bNewSheet; }
301 
302 private:
303 	ScDPSaveData*	pSaveData;
304 	ScRange			aDestRange;
305 	sal_Bool			bNewSheet;
306 };
307 
308 //----------------------------------------------------------------------------
309 // Parameter-Item fuer den Solver-Dialog
310 
311 class ScSolveItem : public SfxPoolItem
312 {
313 public:
314 				TYPEINFO();
315 				ScSolveItem( sal_uInt16				 nWhich,
316 							 const ScSolveParam* pParam );
317 				ScSolveItem( const ScSolveItem&	rItem );
318 				~ScSolveItem();
319 
320 	virtual String          GetValueText() const;
321 	virtual int             operator==( const SfxPoolItem& ) const;
322 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
323 
324 	const ScSolveParam& GetData() const { return theSolveData; }
325 
326 private:
327 	ScSolveParam	theSolveData;
328 };
329 
330 //----------------------------------------------------------------------------
331 // Parameter-Item fuer den Mehrfachoperationen-Dialog
332 
333 class ScTabOpItem : public SfxPoolItem
334 {
335 public:
336 				TYPEINFO();
337 				ScTabOpItem( sal_uInt16				 nWhich,
338 							 const ScTabOpParam* pParam );
339 				ScTabOpItem( const ScTabOpItem&	rItem );
340 				~ScTabOpItem();
341 
342 	virtual String          GetValueText() const;
343 	virtual int             operator==( const SfxPoolItem& ) const;
344 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
345 
346 	const ScTabOpParam& GetData() const { return theTabOpData; }
347 
348 private:
349 	ScTabOpParam	theTabOpData;
350 };
351 
352 //----------------------------------------------------------------------------
353 // Parameter-Item fuer den Dialog bedingte Formatierung
354 
355 class ScCondFrmtItem : public SfxPoolItem
356 {
357 public:
358 				TYPEINFO();
359 				ScCondFrmtItem( sal_uInt16 nWhich,
360 //!								const ScConditionalFormat* pCondFrmt );
361 								const ScConditionalFormat& rCondFrmt );
362 				ScCondFrmtItem( const ScCondFrmtItem& rItem );
363 				~ScCondFrmtItem();
364 
365 	virtual String          GetValueText() const;
366 	virtual int             operator==( const SfxPoolItem& ) const;
367 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
368 
369 	const ScConditionalFormat&	GetData() const { return theCondFrmtData; }
370 
371 private:
372 	ScConditionalFormat	theCondFrmtData;
373 };
374 
375 
376 
377 #endif
378 
379