Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_SCATTR_HXX
30 : : #define SC_SCATTR_HXX
31 : :
32 : : #include <svl/poolitem.hxx>
33 : : #include <svl/intitem.hxx>
34 : : #include <svl/eitem.hxx>
35 : : #include "scdllapi.h"
36 : : #include "global.hxx"
37 : : #include "address.hxx"
38 : :
39 : : //------------------------------------------------------------------------
40 : :
41 : : // flags for cells hidden by merge
42 : : // and control for auto filter
43 : : #define SC_MF_HOR 0x0001
44 : : #define SC_MF_VER 0x0002
45 : : #define SC_MF_AUTO 0x0004 /// autofilter arrow
46 : : #define SC_MF_BUTTON 0x0008 /// field button for datapilot
47 : : #define SC_MF_SCENARIO 0x0010
48 : : #define SC_MF_BUTTON_POPUP 0x0020 /// dp button with popup arrow
49 : : #define SC_MF_HIDDEN_MEMBER 0x0040 /// dp field button with presence of hidden member
50 : : #define SC_MF_DP_TABLE 0x0080 /// dp table output
51 : :
52 : : #define SC_MF_ALL 0x00FF
53 : :
54 : :
55 : : class EditTextObject;
56 : : namespace editeng { class SvxBorderLine; }
57 : :
58 : : bool SC_DLLPUBLIC ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxBorderLine* pOther );
59 : :
60 : : //------------------------------------------------------------------------
61 : :
62 : : class SC_DLLPUBLIC ScMergeAttr: public SfxPoolItem
63 : : {
64 : : SCsCOL nColMerge;
65 : : SCsROW nRowMerge;
66 : : public:
67 : : TYPEINFO();
68 : : ScMergeAttr();
69 : : ScMergeAttr( SCsCOL nCol, SCsROW nRow = 0);
70 : : ScMergeAttr( const ScMergeAttr& );
71 : : ~ScMergeAttr();
72 : :
73 : : virtual String GetValueText() const;
74 : :
75 : : virtual int operator==( const SfxPoolItem& ) const;
76 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
77 : : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
78 : :
79 : 50592 : SCsCOL GetColMerge() const {return nColMerge; }
80 : 1897088 : SCsROW GetRowMerge() const {return nRowMerge; }
81 : :
82 [ + - ][ - + ]: 34076 : bool IsMerged() const { return nColMerge>1 || nRowMerge>1; }
83 : :
84 : : inline ScMergeAttr& operator=(const ScMergeAttr& rMerge)
85 : : {
86 : : nColMerge = rMerge.nColMerge;
87 : : nRowMerge = rMerge.nRowMerge;
88 : : return *this;
89 : : }
90 : : };
91 : :
92 : : //------------------------------------------------------------------------
93 : :
94 : : class SC_DLLPUBLIC ScMergeFlagAttr: public SfxInt16Item
95 : : {
96 : : public:
97 : : ScMergeFlagAttr();
98 : : ScMergeFlagAttr(sal_Int16 nFlags);
99 : : ~ScMergeFlagAttr();
100 : :
101 : 8428 : bool IsHorOverlapped() const { return ( GetValue() & SC_MF_HOR ) != 0; }
102 : 25379 : bool IsVerOverlapped() const { return ( GetValue() & SC_MF_VER ) != 0; }
103 : 1862605 : bool IsOverlapped() const { return ( GetValue() & ( SC_MF_HOR | SC_MF_VER ) ) != 0; }
104 : :
105 : 11359 : bool HasAutoFilter() const { return ( GetValue() & SC_MF_AUTO ) != 0; }
106 : 14 : bool HasButton() const { return ( GetValue() & SC_MF_BUTTON ) != 0; }
107 : 863 : bool HasDPTable() const { return ( GetValue() & SC_MF_DP_TABLE ) != 0; }
108 : :
109 : 1038 : bool IsScenario() const { return ( GetValue() & SC_MF_SCENARIO ) != 0; }
110 : : };
111 : :
112 : : //------------------------------------------------------------------------
113 : : class SC_DLLPUBLIC ScProtectionAttr: public SfxPoolItem
114 : : {
115 : : bool bProtection; // protect cell
116 : : bool bHideFormula; // hide formula
117 : : bool bHideCell; // hide cell
118 : : bool bHidePrint; // don't print cell
119 : : public:
120 : : TYPEINFO();
121 : : ScProtectionAttr();
122 : : ScProtectionAttr( bool bProtect,
123 : : bool bHFormula = false,
124 : : bool bHCell = false,
125 : : bool bHPrint = false);
126 : : ScProtectionAttr( const ScProtectionAttr& );
127 : : ~ScProtectionAttr();
128 : :
129 : : virtual String GetValueText() const;
130 : : virtual SfxItemPresentation GetPresentation(
131 : : SfxItemPresentation ePres,
132 : : SfxMapUnit eCoreMetric,
133 : : SfxMapUnit ePresMetric,
134 : : String& rText,
135 : : const IntlWrapper* pIntl = 0 ) const;
136 : :
137 : : virtual int operator==( const SfxPoolItem& ) const;
138 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
139 : : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
140 : :
141 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
142 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
143 : :
144 : 20 : bool GetProtection() const { return bProtection; }
145 : : bool SetProtection( bool bProtect);
146 : 0 : bool GetHideFormula() const { return bHideFormula; }
147 : : bool SetHideFormula( bool bHFormula);
148 : 0 : bool GetHideCell() const { return bHideCell; }
149 : : bool SetHideCell( bool bHCell);
150 : 63 : bool GetHidePrint() const { return bHidePrint; }
151 : : bool SetHidePrint( bool bHPrint);
152 : : inline ScProtectionAttr& operator=(const ScProtectionAttr& rProtection)
153 : : {
154 : : bProtection = rProtection.bProtection;
155 : : bHideFormula = rProtection.bHideFormula;
156 : : bHideCell = rProtection.bHideCell;
157 : : bHidePrint = rProtection.bHidePrint;
158 : : return *this;
159 : : }
160 : : };
161 : :
162 : :
163 : : //----------------------------------------------------------------------------
164 : : // ScRangeItem: manages an area of a table
165 : :
166 : : #define SCR_INVALID 0x01
167 : : #define SCR_ALLTABS 0x02
168 : : #define SCR_TONEWTAB 0x04
169 : :
170 [ - + ]: 4296 : class ScRangeItem : public SfxPoolItem
171 : : {
172 : : public:
173 : : TYPEINFO();
174 : :
175 : : inline ScRangeItem( const sal_uInt16 nWhich );
176 : : inline ScRangeItem( const sal_uInt16 nWhich,
177 : : const ScRange& rRange,
178 : : const sal_uInt16 nNewFlags = 0 );
179 : : inline ScRangeItem( const ScRangeItem& rCpy );
180 : :
181 : : inline ScRangeItem& operator=( const ScRangeItem &rCpy );
182 : :
183 : : // "pure virtual methods" from SfxPoolItem
184 : : virtual int operator==( const SfxPoolItem& ) const;
185 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
186 : : SfxMapUnit eCoreMetric,
187 : : SfxMapUnit ePresMetric,
188 : : String &rText,
189 : : const IntlWrapper* pIntl = 0 ) const;
190 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
191 : :
192 : : const ScRange& GetRange() const { return aRange; }
193 : : void SetRange( const ScRange& rNew ) { aRange = rNew; }
194 : :
195 : : sal_uInt16 GetFlags() const { return nFlags; }
196 : : void SetFlags( sal_uInt16 nNew ) { nFlags = nNew; }
197 : :
198 : : private:
199 : : ScRange aRange;
200 : : sal_uInt16 nFlags;
201 : : };
202 : :
203 : 2700 : inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP )
204 : 2700 : : SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == invalid area
205 : : {
206 : 2700 : }
207 : :
208 : : inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP,
209 : : const ScRange& rRange,
210 : : const sal_uInt16 nNew )
211 : : : SfxPoolItem( nWhichP ), aRange( rRange ), nFlags( nNew )
212 : : {
213 : : }
214 : :
215 : 0 : inline ScRangeItem::ScRangeItem( const ScRangeItem& rCpy )
216 : 0 : : SfxPoolItem( rCpy.Which() ), aRange( rCpy.aRange ), nFlags( rCpy.nFlags )
217 : 0 : {}
218 : :
219 : : inline ScRangeItem& ScRangeItem::operator=( const ScRangeItem &rCpy )
220 : : {
221 : : aRange = rCpy.aRange;
222 : : return *this;
223 : : }
224 : :
225 : : //----------------------------------------------------------------------------
226 : : // ScTableListItem: manages a list of tables
227 : : //----------------------------------------------------------------------------
228 : : class ScTableListItem : public SfxPoolItem
229 : : {
230 : : public:
231 : : TYPEINFO();
232 : :
233 : : inline ScTableListItem( const sal_uInt16 nWhich );
234 : : ScTableListItem( const ScTableListItem& rCpy );
235 : : ~ScTableListItem();
236 : :
237 : : ScTableListItem& operator=( const ScTableListItem &rCpy );
238 : :
239 : : // "pure virtual Methoden" from SfxPoolItem
240 : : virtual int operator==( const SfxPoolItem& ) const;
241 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
242 : : SfxMapUnit eCoreMetric,
243 : : SfxMapUnit ePresMetric,
244 : : String &rText,
245 : : const IntlWrapper* pIntl = 0 ) const;
246 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
247 : :
248 : : public:
249 : : sal_uInt16 nCount;
250 : : SCTAB* pTabArr;
251 : : };
252 : :
253 : 900 : inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP )
254 : 900 : : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL)
255 : 900 : {}
256 : :
257 : : //----------------------------------------------------------------------------
258 : : // page format item: contents of header and footer
259 : :
260 : : #define SC_HF_LEFTAREA 1
261 : : #define SC_HF_CENTERAREA 2
262 : : #define SC_HF_RIGHTAREA 3
263 : :
264 : : class SC_DLLPUBLIC ScPageHFItem : public SfxPoolItem
265 : : {
266 : : EditTextObject* pLeftArea;
267 : : EditTextObject* pCenterArea;
268 : : EditTextObject* pRightArea;
269 : :
270 : : public:
271 : : TYPEINFO();
272 : : ScPageHFItem( sal_uInt16 nWhich );
273 : : ScPageHFItem( const ScPageHFItem& rItem );
274 : : ~ScPageHFItem();
275 : :
276 : : virtual String GetValueText() const;
277 : : virtual int operator==( const SfxPoolItem& ) const;
278 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
279 : :
280 : : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
281 : :
282 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
283 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
284 : :
285 : 1442 : const EditTextObject* GetLeftArea() const { return pLeftArea; }
286 : 1442 : const EditTextObject* GetCenterArea() const { return pCenterArea; }
287 : 1442 : const EditTextObject* GetRightArea() const { return pRightArea; }
288 : :
289 : : void SetLeftArea( const EditTextObject& rNew );
290 : : void SetCenterArea( const EditTextObject& rNew );
291 : : void SetRightArea( const EditTextObject& rNew );
292 : :
293 : : // Set method with pointer assignment, nArea see defines above
294 : : void SetArea( EditTextObject *pNew, int nArea );
295 : : };
296 : :
297 : :
298 : : //----------------------------------------------------------------------------
299 : : // page format item: contents of header and footer
300 : :
301 : 15 : class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem
302 : : {
303 : : public:
304 : : TYPEINFO();
305 : :
306 : : ScViewObjectModeItem( sal_uInt16 nWhich );
307 : : ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
308 : : ~ScViewObjectModeItem();
309 : :
310 : : virtual sal_uInt16 GetValueCount() const;
311 : : virtual String GetValueText( sal_uInt16 nVal ) const;
312 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
313 : : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
314 : : virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
315 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
316 : : SfxMapUnit eCoreMetric,
317 : : SfxMapUnit ePresMetric,
318 : : String& rText,
319 : : const IntlWrapper* pIntl = 0 ) const;
320 : : };
321 : :
322 : : //----------------------------------------------------------------------------
323 : : //
324 : :
325 : : class ScDoubleItem : public SfxPoolItem
326 : : {
327 : : public:
328 : : TYPEINFO();
329 : : ScDoubleItem( sal_uInt16 nWhich, double nVal=0 );
330 : : ScDoubleItem( const ScDoubleItem& rItem );
331 : : ~ScDoubleItem();
332 : :
333 : : virtual String GetValueText() const;
334 : : virtual int operator==( const SfxPoolItem& ) const;
335 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
336 : :
337 : : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
338 : :
339 : : double GetValue() const { return nValue; }
340 : :
341 : : void SetValue( const double nVal ) { nValue = nVal;}
342 : :
343 : : private:
344 : : double nValue;
345 : : };
346 : :
347 : :
348 : : // ============================================================================
349 : :
350 : : /** Member ID for "page scale to width" value in QueryValue() and PutValue(). */
351 : : const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH = 1;
352 : : /** Member ID for "page scale to height" value in QueryValue() and PutValue(). */
353 : : const sal_uInt8 SC_MID_PAGE_SCALETO_HEIGHT = 2;
354 : :
355 : :
356 : : /** Contains the "scale to width/height" attribute in page styles. */
357 : 1055 : class SC_DLLPUBLIC ScPageScaleToItem : public SfxPoolItem
358 : : {
359 : : public:
360 : : TYPEINFO();
361 : :
362 : : /** Default c'tor sets the width and height to 0. */
363 : : explicit ScPageScaleToItem();
364 : : explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
365 : :
366 : : virtual ~ScPageScaleToItem();
367 : :
368 : : virtual ScPageScaleToItem* Clone( SfxItemPool* = 0 ) const;
369 : :
370 : : virtual int operator==( const SfxPoolItem& rCmp ) const;
371 : :
372 : 210 : inline sal_uInt16 GetWidth() const { return mnWidth; }
373 : 210 : inline sal_uInt16 GetHeight() const { return mnHeight; }
374 [ + - ][ - + ]: 210 : inline bool IsValid() const { return mnWidth || mnHeight; }
375 : :
376 : 0 : inline void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
377 : 0 : inline void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
378 : 0 : inline void Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
379 : 0 : { mnWidth = nWidth; mnHeight = nHeight; }
380 : : inline void SetInvalid() { mnWidth = mnHeight = 0; }
381 : :
382 : : virtual SfxItemPresentation GetPresentation(
383 : : SfxItemPresentation ePresentation,
384 : : SfxMapUnit, SfxMapUnit,
385 : : XubString& rText,
386 : : const IntlWrapper* = 0 ) const;
387 : :
388 : : virtual bool QueryValue( ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) const;
389 : : virtual bool PutValue( const ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 );
390 : :
391 : : private:
392 : : sal_uInt16 mnWidth;
393 : : sal_uInt16 mnHeight;
394 : : };
395 : :
396 : : // ============================================================================
397 : :
398 : : #endif
399 : :
400 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|