1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include <svl/poolitem.hxx>
24 #include <svl/intitem.hxx>
25 #include <svl/eitem.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
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
60 ScMergeAttr( SCsCOL nCol
, SCsROW nRow
= 0);
61 ScMergeAttr( const 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
;
83 //------------------------------------------------------------------------
85 class SC_DLLPUBLIC ScMergeFlagAttr
: public SfxInt16Item
89 ScMergeFlagAttr(sal_Int16 nFlags
);
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
114 ScProtectionAttr( bool bProtect
,
115 bool bHFormula
= false,
117 bool bHPrint
= false);
118 ScProtectionAttr( const ScProtectionAttr
& );
121 virtual String
GetValueText() const;
122 virtual SfxItemPresentation
GetPresentation(
123 SfxItemPresentation ePres
,
124 SfxMapUnit eCoreMetric
,
125 SfxMapUnit ePresMetric
,
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
;
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
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
,
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
; }
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
;
217 //----------------------------------------------------------------------------
218 // ScTableListItem: manages a list of tables
219 //----------------------------------------------------------------------------
220 class ScTableListItem
: public SfxPoolItem
225 inline ScTableListItem( const sal_uInt16 nWhich
);
226 ScTableListItem( const ScTableListItem
& rCpy
);
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
,
237 const IntlWrapper
* pIntl
= 0 ) const;
238 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
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
;
264 ScPageHFItem( sal_uInt16 nWhich
);
265 ScPageHFItem( const ScPageHFItem
& rItem
);
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
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
,
311 const IntlWrapper
* pIntl
= 0 ) const;
314 //----------------------------------------------------------------------------
317 class ScDoubleItem
: public SfxPoolItem
321 ScDoubleItem( sal_uInt16 nWhich
, double nVal
=0 );
322 ScDoubleItem( const ScDoubleItem
& rItem
);
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
;}
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
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
,
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 );
388 class ScCondFormatItem
: public SfxPoolItem
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
);
408 std::vector
<sal_uInt32
> maIndex
;
411 // ============================================================================
415 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */