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