Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / sc / inc / attrib.hxx
blob9b12f085955a5195056d18f1ddb31e91b9d4f18e
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; }
97 bool HasDPTable() const { return ( GetValue() & SC_MF_DP_TABLE ) != 0; }
99 bool IsScenario() const { return ( GetValue() & SC_MF_SCENARIO ) != 0; }
101 bool HasPivotButton() const;
102 bool HasPivotPopupButton() const;
105 //------------------------------------------------------------------------
106 class SC_DLLPUBLIC ScProtectionAttr: public SfxPoolItem
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();
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;
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;
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 );
137 bool GetProtection() const { return bProtection; }
138 bool SetProtection( bool bProtect);
139 bool GetHideFormula() const { return bHideFormula; }
140 bool SetHideFormula( bool bHFormula);
141 bool GetHideCell() const { return bHideCell; }
142 bool SetHideCell( bool bHCell);
143 bool GetHidePrint() const { return bHidePrint; }
144 bool SetHidePrint( bool bHPrint);
145 inline ScProtectionAttr& operator=(const ScProtectionAttr& rProtection)
147 bProtection = rProtection.bProtection;
148 bHideFormula = rProtection.bHideFormula;
149 bHideCell = rProtection.bHideCell;
150 bHidePrint = rProtection.bHidePrint;
151 return *this;
156 //----------------------------------------------------------------------------
157 // ScRangeItem: manages an area of a table
159 #define SCR_INVALID 0x01
160 #define SCR_ALLTABS 0x02
161 #define SCR_TONEWTAB 0x04
163 class ScRangeItem : public SfxPoolItem
165 public:
166 TYPEINFO();
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 );
174 inline ScRangeItem& operator=( const ScRangeItem &rCpy );
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;
185 const ScRange& GetRange() const { return aRange; }
186 void SetRange( const ScRange& rNew ) { aRange = rNew; }
188 sal_uInt16 GetFlags() const { return nFlags; }
189 void SetFlags( sal_uInt16 nNew ) { nFlags = nNew; }
191 private:
192 ScRange aRange;
193 sal_uInt16 nFlags;
196 inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP )
197 : SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == invalid area
201 inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP,
202 const ScRange& rRange,
203 const sal_uInt16 nNew )
204 : SfxPoolItem( nWhichP ), aRange( rRange ), nFlags( nNew )
208 inline ScRangeItem::ScRangeItem( const ScRangeItem& rCpy )
209 : SfxPoolItem( rCpy.Which() ), aRange( rCpy.aRange ), nFlags( rCpy.nFlags )
212 inline ScRangeItem& ScRangeItem::operator=( const ScRangeItem &rCpy )
214 aRange = rCpy.aRange;
215 return *this;
218 //----------------------------------------------------------------------------
219 // ScTableListItem: manages a list of tables
220 //----------------------------------------------------------------------------
221 class ScTableListItem : public SfxPoolItem
223 public:
224 TYPEINFO();
226 inline ScTableListItem( const sal_uInt16 nWhich );
227 ScTableListItem( const ScTableListItem& rCpy );
228 ~ScTableListItem();
230 ScTableListItem& operator=( const ScTableListItem &rCpy );
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;
241 public:
242 sal_uInt16 nCount;
243 SCTAB* pTabArr;
246 inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP )
247 : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL)
250 //----------------------------------------------------------------------------
251 // page format item: contents of header and footer
253 #define SC_HF_LEFTAREA 1
254 #define SC_HF_CENTERAREA 2
255 #define SC_HF_RIGHTAREA 3
257 class SC_DLLPUBLIC ScPageHFItem : public SfxPoolItem
259 EditTextObject* pLeftArea;
260 EditTextObject* pCenterArea;
261 EditTextObject* pRightArea;
263 public:
264 TYPEINFO();
265 ScPageHFItem( sal_uInt16 nWhich );
266 ScPageHFItem( const ScPageHFItem& rItem );
267 ~ScPageHFItem();
269 virtual String GetValueText() const;
270 virtual int operator==( const SfxPoolItem& ) const;
271 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
273 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
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 );
278 const EditTextObject* GetLeftArea() const { return pLeftArea; }
279 const EditTextObject* GetCenterArea() const { return pCenterArea; }
280 const EditTextObject* GetRightArea() const { return pRightArea; }
282 void SetLeftArea( const EditTextObject& rNew );
283 void SetCenterArea( const EditTextObject& rNew );
284 void SetRightArea( const EditTextObject& rNew );
286 // Set method with pointer assignment, nArea see defines above
287 void SetArea( EditTextObject *pNew, int nArea );
291 //----------------------------------------------------------------------------
292 // page format item: contents of header and footer
294 class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem
296 public:
297 TYPEINFO();
299 ScViewObjectModeItem( sal_uInt16 nWhich );
300 ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
301 ~ScViewObjectModeItem();
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;
315 //----------------------------------------------------------------------------
318 class ScDoubleItem : public SfxPoolItem
320 public:
321 TYPEINFO();
322 ScDoubleItem( sal_uInt16 nWhich, double nVal=0 );
323 ScDoubleItem( const ScDoubleItem& rItem );
324 ~ScDoubleItem();
326 virtual String GetValueText() const;
327 virtual int operator==( const SfxPoolItem& ) const;
328 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
330 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
332 double GetValue() const { return nValue; }
334 void SetValue( const double nVal ) { nValue = nVal;}
336 private:
337 double nValue;
341 // ============================================================================
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;
349 /** Contains the "scale to width/height" attribute in page styles. */
350 class SC_DLLPUBLIC ScPageScaleToItem : public SfxPoolItem
352 public:
353 TYPEINFO();
355 /** Default c'tor sets the width and height to 0. */
356 explicit ScPageScaleToItem();
357 explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
359 virtual ~ScPageScaleToItem();
361 virtual ScPageScaleToItem* Clone( SfxItemPool* = 0 ) const;
363 virtual int operator==( const SfxPoolItem& rCmp ) const;
365 inline sal_uInt16 GetWidth() const { return mnWidth; }
366 inline sal_uInt16 GetHeight() const { return mnHeight; }
367 inline bool IsValid() const { return mnWidth || mnHeight; }
369 inline void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
370 inline void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
371 inline void Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
372 { mnWidth = nWidth; mnHeight = nHeight; }
373 inline void SetInvalid() { mnWidth = mnHeight = 0; }
375 virtual SfxItemPresentation GetPresentation(
376 SfxItemPresentation ePresentation,
377 SfxMapUnit, SfxMapUnit,
378 XubString& rText,
379 const IntlWrapper* = 0 ) const;
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 );
384 private:
385 sal_uInt16 mnWidth;
386 sal_uInt16 mnHeight;
389 class ScCondFormatItem : public SfxPoolItem
391 public:
392 TYPEINFO();
394 explicit ScCondFormatItem();
395 explicit ScCondFormatItem(const std::vector<sal_uInt32>& nIndex);
397 virtual ~ScCondFormatItem();
399 virtual int operator==(const SfxPoolItem& rCmp ) const;
400 virtual ScCondFormatItem* Clone( SfxItemPool* = 0 ) const;
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 );
407 private:
409 std::vector<sal_uInt32> maIndex;
412 // ============================================================================
414 #endif
416 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */