bump product version to 4.1.6.2
[LibreOffice.git] / sc / inc / attrib.hxx
blob562505de141a09a31f2cae4b7e603481ab5af943
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_SCATTR_HXX
21 #define SC_SCATTR_HXX
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"
30 //------------------------------------------------------------------------
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
43 #define SC_MF_ALL 0x00FF
46 class EditTextObject;
47 namespace editeng { class SvxBorderLine; }
49 bool SC_DLLPUBLIC ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxBorderLine* pOther );
51 //------------------------------------------------------------------------
53 class SC_DLLPUBLIC ScMergeAttr: public SfxPoolItem
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();
64 virtual String GetValueText() const;
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;
70 SCsCOL GetColMerge() const {return nColMerge; }
71 SCsROW GetRowMerge() const {return nRowMerge; }
73 bool IsMerged() const { return nColMerge>1 || nRowMerge>1; }
75 inline ScMergeAttr& operator=(const ScMergeAttr& rMerge)
77 nColMerge = rMerge.nColMerge;
78 nRowMerge = rMerge.nRowMerge;
79 return *this;
83 //------------------------------------------------------------------------
85 class SC_DLLPUBLIC ScMergeFlagAttr: public SfxInt16Item
87 public:
88 ScMergeFlagAttr();
89 ScMergeFlagAttr(sal_Int16 nFlags);
90 ~ScMergeFlagAttr();
92 bool IsHorOverlapped() const { return ( GetValue() & SC_MF_HOR ) != 0; }
93 bool IsVerOverlapped() const { return ( GetValue() & SC_MF_VER ) != 0; }
94 bool IsOverlapped() const { return ( GetValue() & ( SC_MF_HOR | SC_MF_VER ) ) != 0; }
96 bool HasAutoFilter() const { return ( GetValue() & SC_MF_AUTO ) != 0; }
98 bool IsScenario() const { return ( GetValue() & SC_MF_SCENARIO ) != 0; }
100 bool HasPivotButton() const;
101 bool HasPivotPopupButton() const;
104 //------------------------------------------------------------------------
105 class SC_DLLPUBLIC ScProtectionAttr: public SfxPoolItem
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();
121 virtual String GetValueText() const;
122 virtual SfxItemPresentation GetPresentation(
123 SfxItemPresentation ePres,
124 SfxMapUnit eCoreMetric,
125 SfxMapUnit ePresMetric,
126 OUString& rText,
127 const IntlWrapper* pIntl = 0 ) const;
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;
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 );
136 bool GetProtection() const { return bProtection; }
137 bool SetProtection( bool bProtect);
138 bool GetHideFormula() const { return bHideFormula; }
139 bool SetHideFormula( bool bHFormula);
140 bool GetHideCell() const { return bHideCell; }
141 bool SetHideCell( bool bHCell);
142 bool GetHidePrint() const { return bHidePrint; }
143 bool SetHidePrint( bool bHPrint);
144 inline ScProtectionAttr& operator=(const ScProtectionAttr& rProtection)
146 bProtection = rProtection.bProtection;
147 bHideFormula = rProtection.bHideFormula;
148 bHideCell = rProtection.bHideCell;
149 bHidePrint = rProtection.bHidePrint;
150 return *this;
155 //----------------------------------------------------------------------------
156 // ScRangeItem: manages an area of a table
158 #define SCR_INVALID 0x01
159 #define SCR_ALLTABS 0x02
160 #define SCR_TONEWTAB 0x04
162 class ScRangeItem : public SfxPoolItem
164 public:
165 TYPEINFO();
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 );
173 inline ScRangeItem& operator=( const ScRangeItem &rCpy );
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;
184 const ScRange& GetRange() const { return aRange; }
185 void SetRange( const ScRange& rNew ) { aRange = rNew; }
187 sal_uInt16 GetFlags() const { return nFlags; }
188 void SetFlags( sal_uInt16 nNew ) { nFlags = nNew; }
190 private:
191 ScRange aRange;
192 sal_uInt16 nFlags;
195 inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP )
196 : SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == invalid area
200 inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP,
201 const ScRange& rRange,
202 const sal_uInt16 nNew )
203 : SfxPoolItem( nWhichP ), aRange( rRange ), nFlags( nNew )
207 inline ScRangeItem::ScRangeItem( const ScRangeItem& rCpy )
208 : SfxPoolItem( rCpy.Which() ), aRange( rCpy.aRange ), nFlags( rCpy.nFlags )
211 inline ScRangeItem& ScRangeItem::operator=( const ScRangeItem &rCpy )
213 aRange = rCpy.aRange;
214 return *this;
217 //----------------------------------------------------------------------------
218 // ScTableListItem: manages a list of tables
219 //----------------------------------------------------------------------------
220 class ScTableListItem : public SfxPoolItem
222 public:
223 TYPEINFO();
225 inline ScTableListItem( const sal_uInt16 nWhich );
226 ScTableListItem( const ScTableListItem& rCpy );
227 ~ScTableListItem();
229 ScTableListItem& operator=( const ScTableListItem &rCpy );
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;
240 public:
241 sal_uInt16 nCount;
242 SCTAB* pTabArr;
245 inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP )
246 : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL)
249 //----------------------------------------------------------------------------
250 // page format item: contents of header and footer
252 #define SC_HF_LEFTAREA 1
253 #define SC_HF_CENTERAREA 2
254 #define SC_HF_RIGHTAREA 3
256 class SC_DLLPUBLIC ScPageHFItem : public SfxPoolItem
258 EditTextObject* pLeftArea;
259 EditTextObject* pCenterArea;
260 EditTextObject* pRightArea;
262 public:
263 TYPEINFO();
264 ScPageHFItem( sal_uInt16 nWhich );
265 ScPageHFItem( const ScPageHFItem& rItem );
266 ~ScPageHFItem();
268 virtual String GetValueText() const;
269 virtual int operator==( const SfxPoolItem& ) const;
270 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
272 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
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 );
277 const EditTextObject* GetLeftArea() const { return pLeftArea; }
278 const EditTextObject* GetCenterArea() const { return pCenterArea; }
279 const EditTextObject* GetRightArea() const { return pRightArea; }
281 void SetLeftArea( const EditTextObject& rNew );
282 void SetCenterArea( const EditTextObject& rNew );
283 void SetRightArea( const EditTextObject& rNew );
285 // Set method with pointer assignment, nArea see defines above
286 void SetArea( EditTextObject *pNew, int nArea );
290 //----------------------------------------------------------------------------
291 // page format item: contents of header and footer
293 class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem
295 public:
296 TYPEINFO();
298 ScViewObjectModeItem( sal_uInt16 nWhich );
299 ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
300 ~ScViewObjectModeItem();
302 virtual sal_uInt16 GetValueCount() const;
303 virtual String 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;
314 //----------------------------------------------------------------------------
317 class ScDoubleItem : public SfxPoolItem
319 public:
320 TYPEINFO();
321 ScDoubleItem( sal_uInt16 nWhich, double nVal=0 );
322 ScDoubleItem( const ScDoubleItem& rItem );
323 ~ScDoubleItem();
325 virtual String GetValueText() const;
326 virtual int operator==( const SfxPoolItem& ) const;
327 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
329 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
331 double GetValue() const { return nValue; }
333 void SetValue( const double nVal ) { nValue = nVal;}
335 private:
336 double nValue;
340 // ============================================================================
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;
348 /** Contains the "scale to width/height" attribute in page styles. */
349 class SC_DLLPUBLIC ScPageScaleToItem : public SfxPoolItem
351 public:
352 TYPEINFO();
354 /** Default c'tor sets the width and height to 0. */
355 explicit ScPageScaleToItem();
356 explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
358 virtual ~ScPageScaleToItem();
360 virtual ScPageScaleToItem* Clone( SfxItemPool* = 0 ) const;
362 virtual int operator==( const SfxPoolItem& rCmp ) const;
364 inline sal_uInt16 GetWidth() const { return mnWidth; }
365 inline sal_uInt16 GetHeight() const { return mnHeight; }
366 inline bool IsValid() const { return mnWidth || mnHeight; }
368 inline void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
369 inline void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
370 inline void Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
371 { mnWidth = nWidth; mnHeight = nHeight; }
372 inline void SetInvalid() { mnWidth = mnHeight = 0; }
374 virtual SfxItemPresentation GetPresentation(
375 SfxItemPresentation ePresentation,
376 SfxMapUnit, SfxMapUnit,
377 OUString& rText,
378 const IntlWrapper* = 0 ) const;
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 );
383 private:
384 sal_uInt16 mnWidth;
385 sal_uInt16 mnHeight;
388 class ScCondFormatItem : public SfxPoolItem
390 public:
391 TYPEINFO();
393 explicit ScCondFormatItem();
394 explicit ScCondFormatItem(const std::vector<sal_uInt32>& nIndex);
396 virtual ~ScCondFormatItem();
398 virtual int operator==(const SfxPoolItem& rCmp ) const;
399 virtual ScCondFormatItem* Clone( SfxItemPool* = 0 ) const;
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 );
406 private:
408 std::vector<sal_uInt32> maIndex;
411 // ============================================================================
413 #endif
415 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */