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