xref: /AOO41X/main/sc/inc/attrib.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_SCATTR_HXX
25 #define SC_SCATTR_HXX
26 
27 #include <svl/poolitem.hxx>
28 #include <svl/intitem.hxx>
29 #include <svl/eitem.hxx>
30 #include "scdllapi.h"
31 #include "global.hxx"
32 #include "address.hxx"
33 
34 //------------------------------------------------------------------------
35 
36                                         // Flags fuer durch Merge verdeckte Zellen
37                                         // und Control fuer Auto-Filter
38 #define SC_MF_HOR               0x0001
39 #define SC_MF_VER               0x0002
40 #define SC_MF_AUTO              0x0004  /// autofilter arrow
41 #define SC_MF_BUTTON            0x0008  /// field button for datapilot
42 #define SC_MF_SCENARIO          0x0010
43 #define SC_MF_BUTTON_POPUP      0x0020  /// dp button with popup arrow
44 #define SC_MF_HIDDEN_MEMBER     0x0040  /// dp field button with presence of hidden member
45 #define SC_MF_DP_TABLE          0x0080  /// dp table output
46 
47 #define SC_MF_ALL               0x00FF
48 
49 
50 class EditTextObject;
51 class SvxBorderLine;
52 
53 sal_Bool SC_DLLPUBLIC ScHasPriority( const SvxBorderLine* pThis, const SvxBorderLine* pOther );
54 
55 //------------------------------------------------------------------------
56 
57 class SC_DLLPUBLIC ScMergeAttr: public SfxPoolItem
58 {
59     SCsCOL      nColMerge;
60     SCsROW      nRowMerge;
61 public:
62                 TYPEINFO();
63                 ScMergeAttr();
64                 ScMergeAttr( SCsCOL nCol, SCsROW nRow = 0);
65                 ScMergeAttr( const ScMergeAttr& );
66                 ~ScMergeAttr();
67 
68     virtual String              GetValueText() const;
69 
70     virtual int             operator==( const SfxPoolItem& ) const;
71     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
72     virtual SfxPoolItem*    Create( SvStream& rStream, sal_uInt16 nVer ) const;
73 
GetColMerge() const74             SCsCOL          GetColMerge() const {return nColMerge; }
GetRowMerge() const75             SCsROW          GetRowMerge() const {return nRowMerge; }
76 
IsMerged() const77             sal_Bool            IsMerged() const { return nColMerge>1 || nRowMerge>1; }
78 
operator =(const ScMergeAttr & rMerge)79     inline  ScMergeAttr& operator=(const ScMergeAttr& rMerge)
80             {
81                 nColMerge = rMerge.nColMerge;
82                 nRowMerge = rMerge.nRowMerge;
83                 return *this;
84             }
85 };
86 
87 //------------------------------------------------------------------------
88 
89 class SC_DLLPUBLIC ScMergeFlagAttr: public SfxInt16Item
90 {
91 public:
92             ScMergeFlagAttr();
93             ScMergeFlagAttr(sal_Int16 nFlags);
94             ~ScMergeFlagAttr();
95 
IsHorOverlapped() const96     sal_Bool    IsHorOverlapped() const     { return ( GetValue() & SC_MF_HOR ) != 0;  }
IsVerOverlapped() const97     sal_Bool    IsVerOverlapped() const     { return ( GetValue() & SC_MF_VER ) != 0;  }
IsOverlapped() const98     sal_Bool    IsOverlapped() const        { return ( GetValue() & ( SC_MF_HOR | SC_MF_VER ) ) != 0; }
99 
HasAutoFilter() const100     sal_Bool    HasAutoFilter() const       { return ( GetValue() & SC_MF_AUTO ) != 0; }
HasButton() const101     sal_Bool    HasButton() const           { return ( GetValue() & SC_MF_BUTTON ) != 0; }
HasDPTable() const102     bool    HasDPTable() const          { return ( GetValue() & SC_MF_DP_TABLE ) != 0; }
103 
IsScenario() const104     sal_Bool    IsScenario() const          { return ( GetValue() & SC_MF_SCENARIO ) != 0; }
105 };
106 
107 //------------------------------------------------------------------------
108 class SC_DLLPUBLIC ScProtectionAttr: public SfxPoolItem
109 {
110     sal_Bool        bProtection;    // Zelle schuetzen
111     sal_Bool        bHideFormula;   // Formel nicht Anzeigen
112     sal_Bool        bHideCell;      // Zelle nicht Anzeigen
113     sal_Bool        bHidePrint;     // Zelle nicht Ausdrucken
114 public:
115                             TYPEINFO();
116                             ScProtectionAttr();
117                             ScProtectionAttr(   sal_Bool bProtect,
118                                                 sal_Bool bHFormula = sal_False,
119                                                 sal_Bool bHCell = sal_False,
120                                                 sal_Bool bHPrint = sal_False);
121                             ScProtectionAttr( const ScProtectionAttr& );
122                             ~ScProtectionAttr();
123 
124     virtual String              GetValueText() const;
125     virtual SfxItemPresentation GetPresentation(
126                                     SfxItemPresentation ePres,
127                                     SfxMapUnit eCoreMetric,
128                                     SfxMapUnit ePresMetric,
129                                     String& rText,
130                                     const IntlWrapper* pIntl = 0 ) const;
131 
132     virtual int             operator==( const SfxPoolItem& ) const;
133     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
134     virtual SfxPoolItem*    Create( SvStream& rStream, sal_uInt16 nVer ) const;
135 
136     virtual sal_Bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
137     virtual sal_Bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
138 
GetProtection() const139             sal_Bool            GetProtection() const { return bProtection; }
140             sal_Bool            SetProtection( sal_Bool bProtect);
GetHideFormula() const141             sal_Bool            GetHideFormula() const { return bHideFormula; }
142             sal_Bool            SetHideFormula( sal_Bool bHFormula);
GetHideCell() const143             sal_Bool            GetHideCell() const { return bHideCell; }
144             sal_Bool            SetHideCell( sal_Bool bHCell);
GetHidePrint() const145             sal_Bool            GetHidePrint() const { return bHidePrint; }
146             sal_Bool            SetHidePrint( sal_Bool bHPrint);
operator =(const ScProtectionAttr & rProtection)147     inline  ScProtectionAttr& operator=(const ScProtectionAttr& rProtection)
148             {
149                 bProtection = rProtection.bProtection;
150                 bHideFormula = rProtection.bHideFormula;
151                 bHideCell = rProtection.bHideCell;
152                 bHidePrint = rProtection.bHidePrint;
153                 return *this;
154             }
155 };
156 
157 
158 //----------------------------------------------------------------------------
159 // ScRangeItem: verwaltet einen Tabellenbereich
160 
161 #define SCR_INVALID     0x01
162 #define SCR_ALLTABS     0x02
163 #define SCR_TONEWTAB    0x04
164 
165 class ScRangeItem : public SfxPoolItem
166 {
167 public:
168             TYPEINFO();
169 
170             inline  ScRangeItem( const sal_uInt16 nWhich );
171             inline  ScRangeItem( const sal_uInt16   nWhich,
172                                  const ScRange& rRange,
173                                  const sal_uInt16   nNewFlags = 0 );
174             inline  ScRangeItem( const ScRangeItem& rCpy );
175 
176     inline ScRangeItem& operator=( const ScRangeItem &rCpy );
177 
178     // "pure virtual Methoden" vom SfxPoolItem
179     virtual int                 operator==( const SfxPoolItem& ) const;
180     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
181                                                  SfxMapUnit eCoreMetric,
182                                                  SfxMapUnit ePresMetric,
183                                                  String &rText,
184                                                  const IntlWrapper* pIntl = 0 ) const;
185     virtual SfxPoolItem*        Clone( SfxItemPool *pPool = 0 ) const;
186 
GetRange() const187     const ScRange&  GetRange() const                { return aRange;  }
SetRange(const ScRange & rNew)188     void            SetRange( const ScRange& rNew ) { aRange = rNew; }
189 
GetFlags() const190     sal_uInt16          GetFlags() const                { return nFlags;  }
SetFlags(sal_uInt16 nNew)191     void            SetFlags( sal_uInt16 nNew )         { nFlags = nNew; }
192 
193 private:
194     ScRange aRange;
195     sal_uInt16  nFlags;
196 };
197 
ScRangeItem(const sal_uInt16 nWhichP)198 inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP )
199     :   SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == ungueltige Area
200 {
201 }
202 
ScRangeItem(const sal_uInt16 nWhichP,const ScRange & rRange,const sal_uInt16 nNew)203 inline ScRangeItem::ScRangeItem( const sal_uInt16   nWhichP,
204                                  const ScRange& rRange,
205                                  const sal_uInt16   nNew )
206     : SfxPoolItem( nWhichP ), aRange( rRange ), nFlags( nNew )
207 {
208 }
209 
ScRangeItem(const ScRangeItem & rCpy)210 inline ScRangeItem::ScRangeItem( const ScRangeItem& rCpy )
211     : SfxPoolItem( rCpy.Which() ), aRange( rCpy.aRange ), nFlags( rCpy.nFlags )
212 {}
213 
operator =(const ScRangeItem & rCpy)214 inline ScRangeItem& ScRangeItem::operator=( const ScRangeItem &rCpy )
215 {
216     aRange = rCpy.aRange;
217     return *this;
218 }
219 
220 //----------------------------------------------------------------------------
221 // ScTableListItem: verwaltet eine Liste von Tabellen
222 //----------------------------------------------------------------------------
223 class ScTableListItem : public SfxPoolItem
224 {
225 public:
226     TYPEINFO();
227 
228     inline  ScTableListItem( const sal_uInt16 nWhich );
229             ScTableListItem( const ScTableListItem& rCpy );
230 //UNUSED2008-05  ScTableListItem( const sal_uInt16 nWhich, const List& rList );
231             ~ScTableListItem();
232 
233     ScTableListItem& operator=( const ScTableListItem &rCpy );
234 
235     // "pure virtual Methoden" vom SfxPoolItem
236     virtual int                 operator==( const SfxPoolItem& ) const;
237     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
238                                                  SfxMapUnit eCoreMetric,
239                                                  SfxMapUnit ePresMetric,
240                                                  String &rText,
241                                                  const IntlWrapper* pIntl = 0 ) const;
242     virtual SfxPoolItem*        Clone( SfxItemPool *pPool = 0 ) const;
243 
244 //UNUSED2009-05 sal_Bool    GetTableList( List& aList ) const;
245 //UNUSED2009-05 void    SetTableList( const List& aList );
246 
247 public:
248     sal_uInt16  nCount;
249     SCTAB*  pTabArr;
250 };
251 
ScTableListItem(const sal_uInt16 nWhichP)252 inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP )
253     : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL)
254 {}
255 
256 //----------------------------------------------------------------------------
257 // Seitenformat-Item: Kopf-/Fusszeileninhalte
258 
259 #define SC_HF_LEFTAREA   1
260 #define SC_HF_CENTERAREA 2
261 #define SC_HF_RIGHTAREA  3
262 
263 class SC_DLLPUBLIC ScPageHFItem : public SfxPoolItem
264 {
265     EditTextObject* pLeftArea;
266     EditTextObject* pCenterArea;
267     EditTextObject* pRightArea;
268 
269 public:
270                 TYPEINFO();
271                 ScPageHFItem( sal_uInt16 nWhich );
272                 ScPageHFItem( const ScPageHFItem& rItem );
273                 ~ScPageHFItem();
274 
275     virtual String          GetValueText() const;
276     virtual int             operator==( const SfxPoolItem& ) const;
277     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
278 
279     virtual SfxPoolItem*    Create( SvStream& rStream, sal_uInt16 nVer ) const;
280 
281     virtual sal_Bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
282     virtual sal_Bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
283 
GetLeftArea() const284     const EditTextObject* GetLeftArea() const       { return pLeftArea; }
GetCenterArea() const285     const EditTextObject* GetCenterArea() const     { return pCenterArea; }
GetRightArea() const286     const EditTextObject* GetRightArea() const      { return pRightArea; }
287 
288     void SetLeftArea( const EditTextObject& rNew );
289     void SetCenterArea( const EditTextObject& rNew );
290     void SetRightArea( const EditTextObject& rNew );
291 
292     //Set mit Uebereignung der Pointer, nArea siehe defines oben
293     void SetArea( EditTextObject *pNew, int nArea );
294 };
295 
296 
297 //----------------------------------------------------------------------------
298 // Seitenformat-Item: Kopf-/Fusszeileninhalte
299 
300 class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem
301 {
302 public:
303                 TYPEINFO();
304 
305                 ScViewObjectModeItem( sal_uInt16 nWhich );
306                 ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
307                 ~ScViewObjectModeItem();
308 
309     virtual sal_uInt16              GetValueCount() const;
310     virtual String              GetValueText( sal_uInt16 nVal ) const;
311     virtual SfxPoolItem*        Clone( SfxItemPool *pPool = 0 ) const;
312     virtual SfxPoolItem*        Create(SvStream &, sal_uInt16) const;
313     virtual sal_uInt16              GetVersion( sal_uInt16 nFileVersion ) const;
314     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
315                                                  SfxMapUnit eCoreMetric,
316                                                  SfxMapUnit ePresMetric,
317                                                  String& rText,
318                                                  const IntlWrapper* pIntl = 0 ) const;
319 };
320 
321 //----------------------------------------------------------------------------
322 //
323 
324 class ScDoubleItem : public SfxPoolItem
325 {
326 public:
327                 TYPEINFO();
328                 ScDoubleItem( sal_uInt16 nWhich, double nVal=0 );
329                 ScDoubleItem( const ScDoubleItem& rItem );
330                 ~ScDoubleItem();
331 
332     virtual String          GetValueText() const;
333     virtual int             operator==( const SfxPoolItem& ) const;
334     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
335 
336     virtual SfxPoolItem*    Create( SvStream& rStream, sal_uInt16 nVer ) const;
337 
GetValue() const338     double GetValue() const     { return nValue; }
339 
SetValue(const double nVal)340     void SetValue( const double nVal ) { nValue = nVal;}
341 
342 private:
343     double  nValue;
344 };
345 
346 
347 // ============================================================================
348 
349 /** Member ID for "page scale to width" value in QueryValue() and PutValue(). */
350 const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH    = 1;
351 /** Member ID for "page scale to height" value in QueryValue() and PutValue(). */
352 const sal_uInt8 SC_MID_PAGE_SCALETO_HEIGHT   = 2;
353 
354 
355 /** Contains the "scale to width/height" attribute in page styles. */
356 class SC_DLLPUBLIC ScPageScaleToItem : public SfxPoolItem
357 {
358 public:
359                                 TYPEINFO();
360 
361     /** Default c'tor sets the width and height to 0. */
362     explicit                    ScPageScaleToItem();
363     explicit                    ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
364 
365     virtual                     ~ScPageScaleToItem();
366 
367     virtual ScPageScaleToItem*  Clone( SfxItemPool* = 0 ) const;
368 
369     virtual int                 operator==( const SfxPoolItem& rCmp ) const;
370 
GetWidth() const371     inline sal_uInt16           GetWidth() const { return mnWidth; }
GetHeight() const372     inline sal_uInt16           GetHeight() const { return mnHeight; }
IsValid() const373     inline bool                 IsValid() const { return mnWidth || mnHeight; }
374 
SetWidth(sal_uInt16 nWidth)375     inline void                 SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
SetHeight(sal_uInt16 nHeight)376     inline void                 SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
Set(sal_uInt16 nWidth,sal_uInt16 nHeight)377     inline void                 Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
378                                     { mnWidth = nWidth; mnHeight = nHeight; }
SetInvalid()379     inline void                 SetInvalid() { mnWidth = mnHeight = 0; }
380 
381     virtual SfxItemPresentation GetPresentation(
382                                     SfxItemPresentation ePresentation,
383                                     SfxMapUnit, SfxMapUnit,
384                                     XubString& rText,
385                                     const IntlWrapper* = 0 ) const;
386 
387     virtual sal_Bool                QueryValue( ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) const;
388     virtual sal_Bool                PutValue( const ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 );
389 
390 private:
391     sal_uInt16                  mnWidth;
392     sal_uInt16                  mnHeight;
393 };
394 
395 // ============================================================================
396 
397 #endif
398 
399