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 bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
60 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
61 : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const SAL_OVERRIDE;
62 :
63 313451 : SCsCOL GetColMerge() const {return nColMerge; }
64 1161405 : SCsROW GetRowMerge() const {return nRowMerge; }
65 :
66 77367 : bool IsMerged() const { return nColMerge>1 || nRowMerge>1; }
67 :
68 : inline ScMergeAttr& operator=(const ScMergeAttr& rMerge)
69 : {
70 : nColMerge = rMerge.nColMerge;
71 : nRowMerge = rMerge.nRowMerge;
72 : return *this;
73 : }
74 : };
75 :
76 386 : class SC_DLLPUBLIC ScMergeFlagAttr: public SfxInt16Item
77 : {
78 : public:
79 : ScMergeFlagAttr();
80 : ScMergeFlagAttr(sal_Int16 nFlags);
81 : virtual ~ScMergeFlagAttr();
82 :
83 : SfxPoolItem * Clone(SfxItemPool * pPool) const SAL_OVERRIDE;
84 :
85 3120 : bool IsHorOverlapped() const { return ( GetValue() & SC_MF_HOR ) != 0; }
86 51445 : bool IsVerOverlapped() const { return ( GetValue() & SC_MF_VER ) != 0; }
87 1106281 : bool IsOverlapped() const { return ( GetValue() & ( SC_MF_HOR | SC_MF_VER ) ) != 0; }
88 :
89 35645 : bool HasAutoFilter() const { return ( GetValue() & SC_MF_AUTO ) != 0; }
90 :
91 3114 : 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 : 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 328 : bool GetProtection() const { return bProtection; }
129 : bool SetProtection( bool bProtect);
130 312 : bool GetHideFormula() const { return bHideFormula; }
131 : bool SetHideFormula( bool bHFormula);
132 312 : bool GetHideCell() const { return bHideCell; }
133 : bool SetHideCell( bool bHCell);
134 63 : 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 :
150 7854 : class ScRangeItem : public SfxPoolItem
151 : {
152 : public:
153 : TYPEINFO_OVERRIDE();
154 :
155 : inline ScRangeItem( const sal_uInt16 nWhich );
156 : inline ScRangeItem( const sal_uInt16 nWhich,
157 : const ScRange& rRange,
158 : const sal_uInt16 nNewFlags = 0 );
159 : inline ScRangeItem( const ScRangeItem& rCpy );
160 :
161 : inline ScRangeItem& operator=( const ScRangeItem &rCpy );
162 :
163 : // "pure virtual methods" from SfxPoolItem
164 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
165 : virtual bool GetPresentation( SfxItemPresentation ePres,
166 : SfxMapUnit eCoreMetric,
167 : SfxMapUnit ePresMetric,
168 : OUString &rText,
169 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
170 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
171 :
172 : const ScRange& GetRange() const { return aRange; }
173 : void SetRange( const ScRange& rNew ) { aRange = rNew; }
174 :
175 : sal_uInt16 GetFlags() const { return nFlags; }
176 : void SetFlags( sal_uInt16 nNew ) { nFlags = nNew; }
177 :
178 : private:
179 : ScRange aRange;
180 : sal_uInt16 nFlags;
181 : };
182 :
183 4134 : inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP )
184 4134 : : SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == invalid area
185 : {
186 4134 : }
187 :
188 : inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP,
189 : const ScRange& rRange,
190 : const sal_uInt16 nNew )
191 : : SfxPoolItem( nWhichP ), aRange( rRange ), nFlags( nNew )
192 : {
193 : }
194 :
195 0 : inline ScRangeItem::ScRangeItem( const ScRangeItem& rCpy )
196 0 : : SfxPoolItem( rCpy.Which() ), aRange( rCpy.aRange ), nFlags( rCpy.nFlags )
197 0 : {}
198 :
199 : inline ScRangeItem& ScRangeItem::operator=( const ScRangeItem &rCpy )
200 : {
201 : aRange = rCpy.aRange;
202 : return *this;
203 : }
204 :
205 : // ScTableListItem: manages a list of tables
206 :
207 : class ScTableListItem : public SfxPoolItem
208 : {
209 : public:
210 : TYPEINFO_OVERRIDE();
211 :
212 : inline ScTableListItem( const sal_uInt16 nWhich );
213 : ScTableListItem( const ScTableListItem& rCpy );
214 : virtual ~ScTableListItem();
215 :
216 : ScTableListItem& operator=( const ScTableListItem &rCpy );
217 :
218 : // "pure virtual Methoden" from SfxPoolItem
219 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
220 : virtual bool GetPresentation( SfxItemPresentation ePres,
221 : SfxMapUnit eCoreMetric,
222 : SfxMapUnit ePresMetric,
223 : OUString &rText,
224 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
225 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
226 :
227 : public:
228 : sal_uInt16 nCount;
229 : SCTAB* pTabArr;
230 : };
231 :
232 1378 : inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP )
233 1378 : : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL)
234 1378 : {}
235 :
236 : // page format item: contents of header and footer
237 :
238 : #define SC_HF_LEFTAREA 1
239 : #define SC_HF_CENTERAREA 2
240 : #define SC_HF_RIGHTAREA 3
241 :
242 : class SC_DLLPUBLIC ScPageHFItem : public SfxPoolItem
243 : {
244 : EditTextObject* pLeftArea;
245 : EditTextObject* pCenterArea;
246 : EditTextObject* pRightArea;
247 :
248 : public:
249 : TYPEINFO_OVERRIDE();
250 : ScPageHFItem( sal_uInt16 nWhich );
251 : ScPageHFItem( const ScPageHFItem& rItem );
252 : virtual ~ScPageHFItem();
253 :
254 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
255 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
256 :
257 : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const SAL_OVERRIDE;
258 :
259 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
260 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
261 :
262 2561 : const EditTextObject* GetLeftArea() const { return pLeftArea; }
263 2561 : const EditTextObject* GetCenterArea() const { return pCenterArea; }
264 2561 : const EditTextObject* GetRightArea() const { return pRightArea; }
265 :
266 : void SetLeftArea( const EditTextObject& rNew );
267 : void SetCenterArea( const EditTextObject& rNew );
268 : void SetRightArea( const EditTextObject& rNew );
269 :
270 : // Set method with pointer assignment, nArea see defines above
271 : void SetArea( EditTextObject *pNew, int nArea );
272 : };
273 :
274 : // page format item: contents of header and footer
275 :
276 30 : class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem
277 : {
278 : public:
279 : TYPEINFO_OVERRIDE();
280 :
281 : ScViewObjectModeItem( sal_uInt16 nWhich );
282 : ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
283 : virtual ~ScViewObjectModeItem();
284 :
285 : virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE;
286 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
287 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
288 : virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const SAL_OVERRIDE;
289 : virtual bool GetPresentation( SfxItemPresentation ePres,
290 : SfxMapUnit eCoreMetric,
291 : SfxMapUnit ePresMetric,
292 : OUString& rText,
293 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
294 : };
295 :
296 : class ScDoubleItem : public SfxPoolItem
297 : {
298 : public:
299 : TYPEINFO_OVERRIDE();
300 : ScDoubleItem( sal_uInt16 nWhich, double nVal=0 );
301 : ScDoubleItem( const ScDoubleItem& rItem );
302 : virtual ~ScDoubleItem();
303 :
304 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
305 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
306 :
307 : virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const SAL_OVERRIDE;
308 :
309 : double GetValue() const { return nValue; }
310 :
311 : void SetValue( const double nVal ) { nValue = nVal;}
312 :
313 : private:
314 : double nValue;
315 : };
316 :
317 : /** Member ID for "page scale to width" value in QueryValue() and PutValue(). */
318 : const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH = 1;
319 : /** Member ID for "page scale to height" value in QueryValue() and PutValue(). */
320 : const sal_uInt8 SC_MID_PAGE_SCALETO_HEIGHT = 2;
321 :
322 : /** Contains the "scale to width/height" attribute in page styles. */
323 1849 : class SC_DLLPUBLIC ScPageScaleToItem : public SfxPoolItem
324 : {
325 : public:
326 : TYPEINFO_OVERRIDE();
327 :
328 : /** Default c'tor sets the width and height to 0. */
329 : explicit ScPageScaleToItem();
330 : explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
331 :
332 : virtual ~ScPageScaleToItem();
333 :
334 : virtual ScPageScaleToItem* Clone( SfxItemPool* = 0 ) const SAL_OVERRIDE;
335 :
336 : virtual bool operator==( const SfxPoolItem& rCmp ) const SAL_OVERRIDE;
337 :
338 410 : inline sal_uInt16 GetWidth() const { return mnWidth; }
339 410 : inline sal_uInt16 GetHeight() const { return mnHeight; }
340 407 : inline bool IsValid() const { return mnWidth || mnHeight; }
341 :
342 8 : inline void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
343 8 : inline void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
344 0 : inline void Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
345 0 : { mnWidth = nWidth; mnHeight = nHeight; }
346 : inline void SetInvalid() { mnWidth = mnHeight = 0; }
347 :
348 : virtual bool GetPresentation(
349 : SfxItemPresentation ePresentation,
350 : SfxMapUnit, SfxMapUnit,
351 : OUString& rText,
352 : const IntlWrapper* = 0 ) const SAL_OVERRIDE;
353 :
354 : virtual bool QueryValue( ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
355 : virtual bool PutValue( const ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
356 :
357 : private:
358 : sal_uInt16 mnWidth;
359 : sal_uInt16 mnHeight;
360 : };
361 :
362 : class ScCondFormatItem : public SfxPoolItem
363 : {
364 : public:
365 : TYPEINFO_OVERRIDE();
366 :
367 : explicit ScCondFormatItem();
368 : explicit ScCondFormatItem(const std::vector<sal_uInt32>& nIndex);
369 :
370 : virtual ~ScCondFormatItem();
371 :
372 : virtual bool operator==(const SfxPoolItem& rCmp ) const SAL_OVERRIDE;
373 : virtual ScCondFormatItem* Clone( SfxItemPool* = 0 ) const SAL_OVERRIDE;
374 :
375 11515709 : const std::vector<sal_uInt32>& GetCondFormatData() const { return maIndex;}
376 : void AddCondFormatData( sal_uInt32 nIndex );
377 : void SetCondFormatData( const std::vector<sal_uInt32>& aIndex );
378 :
379 : private:
380 : std::vector<sal_uInt32> maIndex;
381 : };
382 :
383 : #endif
384 :
385 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|