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 String 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 4609 : SCsCOL GetColMerge() const {return nColMerge; }
71 268006 : SCsROW GetRowMerge() const {return nRowMerge; }
72 :
73 6314 : 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 92 : bool IsHorOverlapped() const { return ( GetValue() & SC_MF_HOR ) != 0; }
93 6169 : bool IsVerOverlapped() const { return ( GetValue() & SC_MF_VER ) != 0; }
94 265938 : bool IsOverlapped() const { return ( GetValue() & ( SC_MF_HOR | SC_MF_VER ) ) != 0; }
95 :
96 2361 : bool HasAutoFilter() const { return ( GetValue() & SC_MF_AUTO ) != 0; }
97 0 : bool HasDPTable() const { return ( GetValue() & SC_MF_DP_TABLE ) != 0; }
98 :
99 0 : bool IsScenario() const { return ( GetValue() & SC_MF_SCENARIO ) != 0; }
100 :
101 : bool HasPivotButton() const;
102 : bool HasPivotPopupButton() const;
103 : };
104 :
105 : //------------------------------------------------------------------------
106 : class SC_DLLPUBLIC ScProtectionAttr: public SfxPoolItem
107 : {
108 : bool bProtection; ///< protect cell
109 : bool bHideFormula; ///< hide formula
110 : bool bHideCell; ///< hide cell
111 : bool bHidePrint; ///< don't print cell
112 : public:
113 : TYPEINFO();
114 : ScProtectionAttr();
115 : ScProtectionAttr( bool bProtect,
116 : bool bHFormula = false,
117 : bool bHCell = false,
118 : bool bHPrint = false);
119 : ScProtectionAttr( const ScProtectionAttr& );
120 : ~ScProtectionAttr();
121 :
122 : virtual String GetValueText() const;
123 : virtual SfxItemPresentation GetPresentation(
124 : SfxItemPresentation ePres,
125 : SfxMapUnit eCoreMetric,
126 : SfxMapUnit ePresMetric,
127 : String& rText,
128 : const IntlWrapper* pIntl = 0 ) const;
129 :
130 : virtual int operator==( const SfxPoolItem& ) const;
131 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
132 : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
133 :
134 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
135 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
136 :
137 18 : bool GetProtection() const { return bProtection; }
138 : bool SetProtection( bool bProtect);
139 18 : bool GetHideFormula() const { return bHideFormula; }
140 : bool SetHideFormula( bool bHFormula);
141 18 : bool GetHideCell() const { return bHideCell; }
142 : bool SetHideCell( bool bHCell);
143 1 : bool GetHidePrint() const { return bHidePrint; }
144 : bool SetHidePrint( bool bHPrint);
145 : inline ScProtectionAttr& operator=(const ScProtectionAttr& rProtection)
146 : {
147 : bProtection = rProtection.bProtection;
148 : bHideFormula = rProtection.bHideFormula;
149 : bHideCell = rProtection.bHideCell;
150 : bHidePrint = rProtection.bHidePrint;
151 : return *this;
152 : }
153 : };
154 :
155 :
156 : //----------------------------------------------------------------------------
157 : // ScRangeItem: manages an area of a table
158 :
159 : #define SCR_INVALID 0x01
160 : #define SCR_ALLTABS 0x02
161 : #define SCR_TONEWTAB 0x04
162 :
163 654 : class ScRangeItem : public SfxPoolItem
164 : {
165 : public:
166 : TYPEINFO();
167 :
168 : inline ScRangeItem( const sal_uInt16 nWhich );
169 : inline ScRangeItem( const sal_uInt16 nWhich,
170 : const ScRange& rRange,
171 : const sal_uInt16 nNewFlags = 0 );
172 : inline ScRangeItem( const ScRangeItem& rCpy );
173 :
174 : inline ScRangeItem& operator=( const ScRangeItem &rCpy );
175 :
176 : // "pure virtual methods" from SfxPoolItem
177 : virtual int operator==( const SfxPoolItem& ) const;
178 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
179 : SfxMapUnit eCoreMetric,
180 : SfxMapUnit ePresMetric,
181 : String &rText,
182 : const IntlWrapper* pIntl = 0 ) const;
183 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
184 :
185 : const ScRange& GetRange() const { return aRange; }
186 : void SetRange( const ScRange& rNew ) { aRange = rNew; }
187 :
188 : sal_uInt16 GetFlags() const { return nFlags; }
189 : void SetFlags( sal_uInt16 nNew ) { nFlags = nNew; }
190 :
191 : private:
192 : ScRange aRange;
193 : sal_uInt16 nFlags;
194 : };
195 :
196 585 : inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP )
197 585 : : SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == invalid area
198 : {
199 585 : }
200 :
201 : inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP,
202 : const ScRange& rRange,
203 : const sal_uInt16 nNew )
204 : : SfxPoolItem( nWhichP ), aRange( rRange ), nFlags( nNew )
205 : {
206 : }
207 :
208 0 : inline ScRangeItem::ScRangeItem( const ScRangeItem& rCpy )
209 0 : : SfxPoolItem( rCpy.Which() ), aRange( rCpy.aRange ), nFlags( rCpy.nFlags )
210 0 : {}
211 :
212 : inline ScRangeItem& ScRangeItem::operator=( const ScRangeItem &rCpy )
213 : {
214 : aRange = rCpy.aRange;
215 : return *this;
216 : }
217 :
218 : //----------------------------------------------------------------------------
219 : // ScTableListItem: manages a list of tables
220 : //----------------------------------------------------------------------------
221 : class ScTableListItem : public SfxPoolItem
222 : {
223 : public:
224 : TYPEINFO();
225 :
226 : inline ScTableListItem( const sal_uInt16 nWhich );
227 : ScTableListItem( const ScTableListItem& rCpy );
228 : ~ScTableListItem();
229 :
230 : ScTableListItem& operator=( const ScTableListItem &rCpy );
231 :
232 : // "pure virtual Methoden" from SfxPoolItem
233 : virtual int operator==( const SfxPoolItem& ) const;
234 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
235 : SfxMapUnit eCoreMetric,
236 : SfxMapUnit ePresMetric,
237 : String &rText,
238 : const IntlWrapper* pIntl = 0 ) const;
239 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
240 :
241 : public:
242 : sal_uInt16 nCount;
243 : SCTAB* pTabArr;
244 : };
245 :
246 195 : inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP )
247 195 : : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL)
248 195 : {}
249 :
250 : //----------------------------------------------------------------------------
251 : // page format item: contents of header and footer
252 :
253 : #define SC_HF_LEFTAREA 1
254 : #define SC_HF_CENTERAREA 2
255 : #define SC_HF_RIGHTAREA 3
256 :
257 : class SC_DLLPUBLIC ScPageHFItem : public SfxPoolItem
258 : {
259 : EditTextObject* pLeftArea;
260 : EditTextObject* pCenterArea;
261 : EditTextObject* pRightArea;
262 :
263 : public:
264 : TYPEINFO();
265 : ScPageHFItem( sal_uInt16 nWhich );
266 : ScPageHFItem( const ScPageHFItem& rItem );
267 : ~ScPageHFItem();
268 :
269 : virtual String GetValueText() const;
270 : virtual int operator==( const SfxPoolItem& ) const;
271 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
272 :
273 : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
274 :
275 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
276 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
277 :
278 336 : const EditTextObject* GetLeftArea() const { return pLeftArea; }
279 336 : const EditTextObject* GetCenterArea() const { return pCenterArea; }
280 336 : const EditTextObject* GetRightArea() const { return pRightArea; }
281 :
282 : void SetLeftArea( const EditTextObject& rNew );
283 : void SetCenterArea( const EditTextObject& rNew );
284 : void SetRightArea( const EditTextObject& rNew );
285 :
286 : // Set method with pointer assignment, nArea see defines above
287 : void SetArea( EditTextObject *pNew, int nArea );
288 : };
289 :
290 :
291 : //----------------------------------------------------------------------------
292 : // page format item: contents of header and footer
293 :
294 0 : class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem
295 : {
296 : public:
297 : TYPEINFO();
298 :
299 : ScViewObjectModeItem( sal_uInt16 nWhich );
300 : ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
301 : ~ScViewObjectModeItem();
302 :
303 : virtual sal_uInt16 GetValueCount() const;
304 : virtual String GetValueText( sal_uInt16 nVal ) const;
305 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
306 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
307 : virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
308 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
309 : SfxMapUnit eCoreMetric,
310 : SfxMapUnit ePresMetric,
311 : String& rText,
312 : const IntlWrapper* pIntl = 0 ) const;
313 : };
314 :
315 : //----------------------------------------------------------------------------
316 : //
317 :
318 : class ScDoubleItem : public SfxPoolItem
319 : {
320 : public:
321 : TYPEINFO();
322 : ScDoubleItem( sal_uInt16 nWhich, double nVal=0 );
323 : ScDoubleItem( const ScDoubleItem& rItem );
324 : ~ScDoubleItem();
325 :
326 : virtual String GetValueText() const;
327 : virtual int operator==( const SfxPoolItem& ) const;
328 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
329 :
330 : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
331 :
332 : double GetValue() const { return nValue; }
333 :
334 : void SetValue( const double nVal ) { nValue = nVal;}
335 :
336 : private:
337 : double nValue;
338 : };
339 :
340 :
341 : // ============================================================================
342 :
343 : /** Member ID for "page scale to width" value in QueryValue() and PutValue(). */
344 : const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH = 1;
345 : /** Member ID for "page scale to height" value in QueryValue() and PutValue(). */
346 : const sal_uInt8 SC_MID_PAGE_SCALETO_HEIGHT = 2;
347 :
348 :
349 : /** Contains the "scale to width/height" attribute in page styles. */
350 242 : class SC_DLLPUBLIC ScPageScaleToItem : public SfxPoolItem
351 : {
352 : public:
353 : TYPEINFO();
354 :
355 : /** Default c'tor sets the width and height to 0. */
356 : explicit ScPageScaleToItem();
357 : explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
358 :
359 : virtual ~ScPageScaleToItem();
360 :
361 : virtual ScPageScaleToItem* Clone( SfxItemPool* = 0 ) const;
362 :
363 : virtual int operator==( const SfxPoolItem& rCmp ) const;
364 :
365 69 : inline sal_uInt16 GetWidth() const { return mnWidth; }
366 69 : inline sal_uInt16 GetHeight() const { return mnHeight; }
367 69 : inline bool IsValid() const { return mnWidth || mnHeight; }
368 :
369 0 : inline void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
370 0 : inline void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
371 0 : inline void Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
372 0 : { mnWidth = nWidth; mnHeight = nHeight; }
373 : inline void SetInvalid() { mnWidth = mnHeight = 0; }
374 :
375 : virtual SfxItemPresentation GetPresentation(
376 : SfxItemPresentation ePresentation,
377 : SfxMapUnit, SfxMapUnit,
378 : XubString& rText,
379 : const IntlWrapper* = 0 ) const;
380 :
381 : virtual bool QueryValue( ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) const;
382 : virtual bool PutValue( const ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 );
383 :
384 : private:
385 : sal_uInt16 mnWidth;
386 : sal_uInt16 mnHeight;
387 : };
388 :
389 : class ScCondFormatItem : public SfxPoolItem
390 : {
391 : public:
392 : TYPEINFO();
393 :
394 : explicit ScCondFormatItem();
395 : explicit ScCondFormatItem(const std::vector<sal_uInt32>& nIndex);
396 :
397 : virtual ~ScCondFormatItem();
398 :
399 : virtual int operator==(const SfxPoolItem& rCmp ) const;
400 : virtual ScCondFormatItem* Clone( SfxItemPool* = 0 ) const;
401 :
402 : const std::vector<sal_uInt32>& GetCondFormatData() const;
403 : void AddCondFormatData( sal_uInt32 nIndex );
404 : void SetCondFormatData( const std::vector<sal_uInt32>& aIndex );
405 : void RemoveCondFormatData( sal_uInt32 nIndex );
406 :
407 : private:
408 :
409 : std::vector<sal_uInt32> maIndex;
410 : };
411 :
412 : // ============================================================================
413 :
414 : #endif
415 :
416 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|