Bump version to 4.3-4
[LibreOffice.git] / sc / inc / attrib.hxx
blobbb14668a045fa711a48c060863cf85ffd4572df7
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 INCLUDED_SC_INC_ATTRIB_HXX
21 #define INCLUDED_SC_INC_ATTRIB_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 // 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
41 #define SC_MF_ALL 0x00FF
43 class EditTextObject;
44 namespace editeng { class SvxBorderLine; }
46 bool SC_DLLPUBLIC ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxBorderLine* pOther );
48 class SC_DLLPUBLIC ScMergeAttr: public SfxPoolItem
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();
59 virtual OUString GetValueText() const;
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;
65 SCsCOL GetColMerge() const {return nColMerge; }
66 SCsROW GetRowMerge() const {return nRowMerge; }
68 bool IsMerged() const { return nColMerge>1 || nRowMerge>1; }
70 inline ScMergeAttr& operator=(const ScMergeAttr& rMerge)
72 nColMerge = rMerge.nColMerge;
73 nRowMerge = rMerge.nRowMerge;
74 return *this;
78 class SC_DLLPUBLIC ScMergeFlagAttr: public SfxInt16Item
80 public:
81 ScMergeFlagAttr();
82 ScMergeFlagAttr(sal_Int16 nFlags);
83 virtual ~ScMergeFlagAttr();
85 bool IsHorOverlapped() const { return ( GetValue() & SC_MF_HOR ) != 0; }
86 bool IsVerOverlapped() const { return ( GetValue() & SC_MF_VER ) != 0; }
87 bool IsOverlapped() const { return ( GetValue() & ( SC_MF_HOR | SC_MF_VER ) ) != 0; }
89 bool HasAutoFilter() const { return ( GetValue() & SC_MF_AUTO ) != 0; }
91 bool IsScenario() const { return ( GetValue() & SC_MF_SCENARIO ) != 0; }
93 bool HasPivotButton() const;
94 bool HasPivotPopupButton() const;
97 class SC_DLLPUBLIC ScProtectionAttr: public SfxPoolItem
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();
113 virtual OUString GetValueText() const;
114 virtual SfxItemPresentation GetPresentation(
115 SfxItemPresentation ePres,
116 SfxMapUnit eCoreMetric,
117 SfxMapUnit ePresMetric,
118 OUString& rText,
119 const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
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;
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;
128 bool GetProtection() const { return bProtection; }
129 bool SetProtection( bool bProtect);
130 bool GetHideFormula() const { return bHideFormula; }
131 bool SetHideFormula( bool bHFormula);
132 bool GetHideCell() const { return bHideCell; }
133 bool SetHideCell( bool bHCell);
134 bool GetHidePrint() const { return bHidePrint; }
135 bool SetHidePrint( bool bHPrint);
136 inline ScProtectionAttr& operator=(const ScProtectionAttr& rProtection)
138 bProtection = rProtection.bProtection;
139 bHideFormula = rProtection.bHideFormula;
140 bHideCell = rProtection.bHideCell;
141 bHidePrint = rProtection.bHidePrint;
142 return *this;
146 // ScRangeItem: manages an area of a table
148 #define SCR_INVALID 0x01
149 #define SCR_ALLTABS 0x02
150 #define SCR_TONEWTAB 0x04
152 class ScRangeItem : public SfxPoolItem
154 public:
155 TYPEINFO_OVERRIDE();
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 );
163 inline ScRangeItem& operator=( const ScRangeItem &rCpy );
165 // "pure virtual methods" from SfxPoolItem
166 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
167 virtual SfxItemPresentation 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;
174 const ScRange& GetRange() const { return aRange; }
175 void SetRange( const ScRange& rNew ) { aRange = rNew; }
177 sal_uInt16 GetFlags() const { return nFlags; }
178 void SetFlags( sal_uInt16 nNew ) { nFlags = nNew; }
180 private:
181 ScRange aRange;
182 sal_uInt16 nFlags;
185 inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP )
186 : SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == invalid area
190 inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP,
191 const ScRange& rRange,
192 const sal_uInt16 nNew )
193 : SfxPoolItem( nWhichP ), aRange( rRange ), nFlags( nNew )
197 inline ScRangeItem::ScRangeItem( const ScRangeItem& rCpy )
198 : SfxPoolItem( rCpy.Which() ), aRange( rCpy.aRange ), nFlags( rCpy.nFlags )
201 inline ScRangeItem& ScRangeItem::operator=( const ScRangeItem &rCpy )
203 aRange = rCpy.aRange;
204 return *this;
207 // ScTableListItem: manages a list of tables
209 class ScTableListItem : public SfxPoolItem
211 public:
212 TYPEINFO_OVERRIDE();
214 inline ScTableListItem( const sal_uInt16 nWhich );
215 ScTableListItem( const ScTableListItem& rCpy );
216 virtual ~ScTableListItem();
218 ScTableListItem& operator=( const ScTableListItem &rCpy );
220 // "pure virtual Methoden" from SfxPoolItem
221 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
222 virtual SfxItemPresentation 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;
229 public:
230 sal_uInt16 nCount;
231 SCTAB* pTabArr;
234 inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP )
235 : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL)
238 // page format item: contents of header and footer
240 #define SC_HF_LEFTAREA 1
241 #define SC_HF_CENTERAREA 2
242 #define SC_HF_RIGHTAREA 3
244 class SC_DLLPUBLIC ScPageHFItem : public SfxPoolItem
246 EditTextObject* pLeftArea;
247 EditTextObject* pCenterArea;
248 EditTextObject* pRightArea;
250 public:
251 TYPEINFO_OVERRIDE();
252 ScPageHFItem( sal_uInt16 nWhich );
253 ScPageHFItem( const ScPageHFItem& rItem );
254 virtual ~ScPageHFItem();
256 virtual OUString GetValueText() const;
257 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
258 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
260 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const SAL_OVERRIDE;
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;
265 const EditTextObject* GetLeftArea() const { return pLeftArea; }
266 const EditTextObject* GetCenterArea() const { return pCenterArea; }
267 const EditTextObject* GetRightArea() const { return pRightArea; }
269 void SetLeftArea( const EditTextObject& rNew );
270 void SetCenterArea( const EditTextObject& rNew );
271 void SetRightArea( const EditTextObject& rNew );
273 // Set method with pointer assignment, nArea see defines above
274 void SetArea( EditTextObject *pNew, int nArea );
277 // page format item: contents of header and footer
279 class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem
281 public:
282 TYPEINFO_OVERRIDE();
284 ScViewObjectModeItem( sal_uInt16 nWhich );
285 ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
286 virtual ~ScViewObjectModeItem();
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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
294 SfxMapUnit eCoreMetric,
295 SfxMapUnit ePresMetric,
296 OUString& rText,
297 const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
300 class ScDoubleItem : public SfxPoolItem
302 public:
303 TYPEINFO_OVERRIDE();
304 ScDoubleItem( sal_uInt16 nWhich, double nVal=0 );
305 ScDoubleItem( const ScDoubleItem& rItem );
306 virtual ~ScDoubleItem();
308 virtual OUString GetValueText() const;
309 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
310 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
312 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const SAL_OVERRIDE;
314 double GetValue() const { return nValue; }
316 void SetValue( const double nVal ) { nValue = nVal;}
318 private:
319 double nValue;
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;
327 /** Contains the "scale to width/height" attribute in page styles. */
328 class SC_DLLPUBLIC ScPageScaleToItem : public SfxPoolItem
330 public:
331 TYPEINFO_OVERRIDE();
333 /** Default c'tor sets the width and height to 0. */
334 explicit ScPageScaleToItem();
335 explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
337 virtual ~ScPageScaleToItem();
339 virtual ScPageScaleToItem* Clone( SfxItemPool* = 0 ) const SAL_OVERRIDE;
341 virtual bool operator==( const SfxPoolItem& rCmp ) const SAL_OVERRIDE;
343 inline sal_uInt16 GetWidth() const { return mnWidth; }
344 inline sal_uInt16 GetHeight() const { return mnHeight; }
345 inline bool IsValid() const { return mnWidth || mnHeight; }
347 inline void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
348 inline void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
349 inline void Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
350 { mnWidth = nWidth; mnHeight = nHeight; }
351 inline void SetInvalid() { mnWidth = mnHeight = 0; }
353 virtual SfxItemPresentation GetPresentation(
354 SfxItemPresentation ePresentation,
355 SfxMapUnit, SfxMapUnit,
356 OUString& rText,
357 const IntlWrapper* = 0 ) const SAL_OVERRIDE;
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;
362 private:
363 sal_uInt16 mnWidth;
364 sal_uInt16 mnHeight;
367 class ScCondFormatItem : public SfxPoolItem
369 public:
370 TYPEINFO_OVERRIDE();
372 explicit ScCondFormatItem();
373 explicit ScCondFormatItem(const std::vector<sal_uInt32>& nIndex);
375 virtual ~ScCondFormatItem();
377 virtual bool operator==(const SfxPoolItem& rCmp ) const SAL_OVERRIDE;
378 virtual ScCondFormatItem* Clone( SfxItemPool* = 0 ) const SAL_OVERRIDE;
380 const std::vector<sal_uInt32>& GetCondFormatData() const;
381 void AddCondFormatData( sal_uInt32 nIndex );
382 void SetCondFormatData( const std::vector<sal_uInt32>& aIndex );
383 void RemoveCondFormatData( sal_uInt32 nIndex );
385 private:
387 std::vector<sal_uInt32> maIndex;
390 #endif
392 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */