1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: attrib.hxx,v $
10 * $Revision: 1.10.32.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <svtools/poolitem.hxx>
35 #include <svtools/intitem.hxx>
36 #include <svtools/eitem.hxx>
39 #include "address.hxx"
41 //------------------------------------------------------------------------
43 // Flags fuer durch Merge verdeckte Zellen
44 // und Control fuer Auto-Filter
45 #define SC_MF_HOR 0x0001
46 #define SC_MF_VER 0x0002
47 #define SC_MF_AUTO 0x0004 /// autofilter arrow
48 #define SC_MF_BUTTON 0x0008 /// field button for datapilot
49 #define SC_MF_SCENARIO 0x0010
50 #define SC_MF_BUTTON_POPUP 0x0020 /// dp button with popup arrow
51 #define SC_MF_HIDDEN_MEMBER 0x0040 /// dp field button with presence of hidden member
52 #define SC_MF_DP_TABLE 0x0080 /// dp table output
54 #define SC_MF_ALL 0x00FF
60 BOOL SC_DLLPUBLIC
ScHasPriority( const SvxBorderLine
* pThis
, const SvxBorderLine
* pOther
);
62 //------------------------------------------------------------------------
64 class SC_DLLPUBLIC ScMergeAttr
: public SfxPoolItem
71 ScMergeAttr( SCsCOL nCol
, SCsROW nRow
= 0);
72 ScMergeAttr( const ScMergeAttr
& );
75 virtual String
GetValueText() const;
77 virtual int operator==( const SfxPoolItem
& ) const;
78 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
79 virtual SfxPoolItem
* Create( SvStream
& rStream
, USHORT nVer
) const;
81 SCsCOL
GetColMerge() const {return nColMerge
; }
82 SCsROW
GetRowMerge() const {return nRowMerge
; }
84 BOOL
IsMerged() const { return nColMerge
>1 || nRowMerge
>1; }
86 inline ScMergeAttr
& operator=(const ScMergeAttr
& rMerge
)
88 nColMerge
= rMerge
.nColMerge
;
89 nRowMerge
= rMerge
.nRowMerge
;
94 //------------------------------------------------------------------------
96 class SC_DLLPUBLIC ScMergeFlagAttr
: public SfxInt16Item
100 ScMergeFlagAttr(INT16 nFlags
);
103 BOOL
IsHorOverlapped() const { return ( GetValue() & SC_MF_HOR
) != 0; }
104 BOOL
IsVerOverlapped() const { return ( GetValue() & SC_MF_VER
) != 0; }
105 BOOL
IsOverlapped() const { return ( GetValue() & ( SC_MF_HOR
| SC_MF_VER
) ) != 0; }
107 BOOL
HasAutoFilter() const { return ( GetValue() & SC_MF_AUTO
) != 0; }
108 BOOL
HasButton() const { return ( GetValue() & SC_MF_BUTTON
) != 0; }
109 bool HasDPTable() const { return ( GetValue() & SC_MF_DP_TABLE
) != 0; }
111 BOOL
IsScenario() const { return ( GetValue() & SC_MF_SCENARIO
) != 0; }
114 //------------------------------------------------------------------------
115 class SC_DLLPUBLIC ScProtectionAttr
: public SfxPoolItem
117 BOOL bProtection
; // Zelle schuetzen
118 BOOL bHideFormula
; // Formel nicht Anzeigen
119 BOOL bHideCell
; // Zelle nicht Anzeigen
120 BOOL bHidePrint
; // Zelle nicht Ausdrucken
124 ScProtectionAttr( BOOL bProtect
,
125 BOOL bHFormula
= FALSE
,
127 BOOL bHPrint
= FALSE
);
128 ScProtectionAttr( const ScProtectionAttr
& );
131 virtual String
GetValueText() const;
132 virtual SfxItemPresentation
GetPresentation(
133 SfxItemPresentation ePres
,
134 SfxMapUnit eCoreMetric
,
135 SfxMapUnit ePresMetric
,
137 const IntlWrapper
* pIntl
= 0 ) const;
139 virtual int operator==( const SfxPoolItem
& ) const;
140 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
141 virtual SfxPoolItem
* Create( SvStream
& rStream
, USHORT nVer
) const;
143 virtual BOOL
QueryValue( com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 ) const;
144 virtual BOOL
PutValue( const com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 );
146 BOOL
GetProtection() const { return bProtection
; }
147 BOOL
SetProtection( BOOL bProtect
);
148 BOOL
GetHideFormula() const { return bHideFormula
; }
149 BOOL
SetHideFormula( BOOL bHFormula
);
150 BOOL
GetHideCell() const { return bHideCell
; }
151 BOOL
SetHideCell( BOOL bHCell
);
152 BOOL
GetHidePrint() const { return bHidePrint
; }
153 BOOL
SetHidePrint( BOOL bHPrint
);
154 inline ScProtectionAttr
& operator=(const ScProtectionAttr
& rProtection
)
156 bProtection
= rProtection
.bProtection
;
157 bHideFormula
= rProtection
.bHideFormula
;
158 bHideCell
= rProtection
.bHideCell
;
159 bHidePrint
= rProtection
.bHidePrint
;
165 //----------------------------------------------------------------------------
166 // ScRangeItem: verwaltet einen Tabellenbereich
168 #define SCR_INVALID 0x01
169 #define SCR_ALLTABS 0x02
170 #define SCR_TONEWTAB 0x04
172 class ScRangeItem
: public SfxPoolItem
177 inline ScRangeItem( const USHORT nWhich
);
178 inline ScRangeItem( const USHORT nWhich
,
179 const ScRange
& rRange
,
180 const USHORT nNewFlags
= 0 );
181 inline ScRangeItem( const ScRangeItem
& rCpy
);
183 inline ScRangeItem
& operator=( const ScRangeItem
&rCpy
);
185 // "pure virtual Methoden" vom SfxPoolItem
186 virtual int operator==( const SfxPoolItem
& ) const;
187 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
188 SfxMapUnit eCoreMetric
,
189 SfxMapUnit ePresMetric
,
191 const IntlWrapper
* pIntl
= 0 ) const;
192 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
194 const ScRange
& GetRange() const { return aRange
; }
195 void SetRange( const ScRange
& rNew
) { aRange
= rNew
; }
197 USHORT
GetFlags() const { return nFlags
; }
198 void SetFlags( USHORT nNew
) { nFlags
= nNew
; }
205 inline ScRangeItem::ScRangeItem( const USHORT nWhichP
)
206 : SfxPoolItem( nWhichP
), nFlags( SCR_INVALID
) // == ungueltige Area
210 inline ScRangeItem::ScRangeItem( const USHORT nWhichP
,
211 const ScRange
& rRange
,
213 : SfxPoolItem( nWhichP
), aRange( rRange
), nFlags( nNew
)
217 inline ScRangeItem::ScRangeItem( const ScRangeItem
& rCpy
)
218 : SfxPoolItem( rCpy
.Which() ), aRange( rCpy
.aRange
), nFlags( rCpy
.nFlags
)
221 inline ScRangeItem
& ScRangeItem::operator=( const ScRangeItem
&rCpy
)
223 aRange
= rCpy
.aRange
;
227 //----------------------------------------------------------------------------
228 // ScTableListItem: verwaltet eine Liste von Tabellen
229 //----------------------------------------------------------------------------
230 class ScTableListItem
: public SfxPoolItem
235 inline ScTableListItem( const USHORT nWhich
);
236 ScTableListItem( const ScTableListItem
& rCpy
);
237 //UNUSED2008-05 ScTableListItem( const USHORT nWhich, const List& rList );
240 ScTableListItem
& operator=( const ScTableListItem
&rCpy
);
242 // "pure virtual Methoden" vom SfxPoolItem
243 virtual int operator==( const SfxPoolItem
& ) const;
244 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
245 SfxMapUnit eCoreMetric
,
246 SfxMapUnit ePresMetric
,
248 const IntlWrapper
* pIntl
= 0 ) const;
249 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
251 //UNUSED2009-05 BOOL GetTableList( List& aList ) const;
252 //UNUSED2009-05 void SetTableList( const List& aList );
259 inline ScTableListItem::ScTableListItem( const USHORT nWhichP
)
260 : SfxPoolItem(nWhichP
), nCount(0), pTabArr(NULL
)
263 //----------------------------------------------------------------------------
264 // Seitenformat-Item: Kopf-/Fusszeileninhalte
266 #define SC_HF_LEFTAREA 1
267 #define SC_HF_CENTERAREA 2
268 #define SC_HF_RIGHTAREA 3
270 class SC_DLLPUBLIC ScPageHFItem
: public SfxPoolItem
272 EditTextObject
* pLeftArea
;
273 EditTextObject
* pCenterArea
;
274 EditTextObject
* pRightArea
;
278 ScPageHFItem( USHORT nWhich
);
279 ScPageHFItem( const ScPageHFItem
& rItem
);
282 virtual String
GetValueText() const;
283 virtual int operator==( const SfxPoolItem
& ) const;
284 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
286 virtual SfxPoolItem
* Create( SvStream
& rStream
, USHORT nVer
) const;
288 virtual BOOL
QueryValue( com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 ) const;
289 virtual BOOL
PutValue( const com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 );
291 const EditTextObject
* GetLeftArea() const { return pLeftArea
; }
292 const EditTextObject
* GetCenterArea() const { return pCenterArea
; }
293 const EditTextObject
* GetRightArea() const { return pRightArea
; }
295 void SetLeftArea( const EditTextObject
& rNew
);
296 void SetCenterArea( const EditTextObject
& rNew
);
297 void SetRightArea( const EditTextObject
& rNew
);
299 //Set mit Uebereignung der Pointer, nArea siehe defines oben
300 void SetArea( EditTextObject
*pNew
, int nArea
);
304 //----------------------------------------------------------------------------
305 // Seitenformat-Item: Kopf-/Fusszeileninhalte
307 class SC_DLLPUBLIC ScViewObjectModeItem
: public SfxEnumItem
312 ScViewObjectModeItem( USHORT nWhich
);
313 ScViewObjectModeItem( USHORT nWhich
, ScVObjMode eMode
);
314 ~ScViewObjectModeItem();
316 virtual USHORT
GetValueCount() const;
317 virtual String
GetValueText( USHORT nVal
) const;
318 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
319 virtual SfxPoolItem
* Create(SvStream
&, USHORT
) const;
320 virtual USHORT
GetVersion( USHORT nFileVersion
) const;
321 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
322 SfxMapUnit eCoreMetric
,
323 SfxMapUnit ePresMetric
,
325 const IntlWrapper
* pIntl
= 0 ) const;
328 //----------------------------------------------------------------------------
331 class ScDoubleItem
: public SfxPoolItem
335 ScDoubleItem( USHORT nWhich
, double nVal
=0 );
336 ScDoubleItem( const ScDoubleItem
& rItem
);
339 virtual String
GetValueText() const;
340 virtual int operator==( const SfxPoolItem
& ) const;
341 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
343 virtual SfxPoolItem
* Create( SvStream
& rStream
, USHORT nVer
) const;
345 double GetValue() const { return nValue
; }
347 void SetValue( const double nVal
) { nValue
= nVal
;}
354 // ============================================================================
356 /** Member ID for "page scale to width" value in QueryValue() and PutValue(). */
357 const BYTE SC_MID_PAGE_SCALETO_WIDTH
= 1;
358 /** Member ID for "page scale to height" value in QueryValue() and PutValue(). */
359 const BYTE SC_MID_PAGE_SCALETO_HEIGHT
= 2;
362 /** Contains the "scale to width/height" attribute in page styles. */
363 class SC_DLLPUBLIC ScPageScaleToItem
: public SfxPoolItem
368 /** Default c'tor sets the width and height to 0. */
369 explicit ScPageScaleToItem();
370 explicit ScPageScaleToItem( sal_uInt16 nWidth
, sal_uInt16 nHeight
);
372 virtual ~ScPageScaleToItem();
374 virtual ScPageScaleToItem
* Clone( SfxItemPool
* = 0 ) const;
376 virtual int operator==( const SfxPoolItem
& rCmp
) const;
378 inline sal_uInt16
GetWidth() const { return mnWidth
; }
379 inline sal_uInt16
GetHeight() const { return mnHeight
; }
380 inline bool IsValid() const { return mnWidth
|| mnHeight
; }
382 inline void SetWidth( sal_uInt16 nWidth
) { mnWidth
= nWidth
; }
383 inline void SetHeight( sal_uInt16 nHeight
) { mnHeight
= nHeight
; }
384 inline void Set( sal_uInt16 nWidth
, sal_uInt16 nHeight
)
385 { mnWidth
= nWidth
; mnHeight
= nHeight
; }
386 inline void SetInvalid() { mnWidth
= mnHeight
= 0; }
388 virtual SfxItemPresentation
GetPresentation(
389 SfxItemPresentation ePresentation
,
390 SfxMapUnit
, SfxMapUnit
,
392 const IntlWrapper
* = 0 ) const;
394 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rAny
, BYTE nMemberId
= 0 ) const;
395 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rAny
, BYTE nMemberId
= 0 );
402 // ============================================================================