update emoji autocorrect entries from po-files
[LibreOffice.git] / sc / inc / attrib.hxx
blob0c210f5661a27d7862ac0faf2b304672c5103e4d
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 bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
60 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
61 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const SAL_OVERRIDE;
63 SCsCOL GetColMerge() const {return nColMerge; }
64 SCsROW GetRowMerge() const {return nRowMerge; }
66 bool IsMerged() const { return nColMerge>1 || nRowMerge>1; }
68 inline ScMergeAttr& operator=(const ScMergeAttr& rMerge)
70 nColMerge = rMerge.nColMerge;
71 nRowMerge = rMerge.nRowMerge;
72 return *this;
76 class SC_DLLPUBLIC ScMergeFlagAttr: public SfxInt16Item
78 public:
79 ScMergeFlagAttr();
80 ScMergeFlagAttr(sal_Int16 nFlags);
81 virtual ~ScMergeFlagAttr();
83 SfxPoolItem * Clone(SfxItemPool * pPool) const SAL_OVERRIDE;
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 OUString GetValueText() const;
114 virtual bool 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
150 class ScRangeItem : public SfxPoolItem
152 public:
153 TYPEINFO_OVERRIDE();
155 inline ScRangeItem( const sal_uInt16 nWhich );
156 inline ScRangeItem( const sal_uInt16 nWhich,
157 const ScRange& rRange,
158 const sal_uInt16 nNewFlags = 0 );
159 inline ScRangeItem( const ScRangeItem& rCpy );
161 inline ScRangeItem& operator=( const ScRangeItem &rCpy );
163 // "pure virtual methods" from SfxPoolItem
164 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
165 virtual bool GetPresentation( SfxItemPresentation ePres,
166 SfxMapUnit eCoreMetric,
167 SfxMapUnit ePresMetric,
168 OUString &rText,
169 const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
170 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
172 const ScRange& GetRange() const { return aRange; }
173 void SetRange( const ScRange& rNew ) { aRange = rNew; }
175 sal_uInt16 GetFlags() const { return nFlags; }
176 void SetFlags( sal_uInt16 nNew ) { nFlags = nNew; }
178 private:
179 ScRange aRange;
180 sal_uInt16 nFlags;
183 inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP )
184 : SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == invalid area
188 inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP,
189 const ScRange& rRange,
190 const sal_uInt16 nNew )
191 : SfxPoolItem( nWhichP ), aRange( rRange ), nFlags( nNew )
195 inline ScRangeItem::ScRangeItem( const ScRangeItem& rCpy )
196 : SfxPoolItem( rCpy.Which() ), aRange( rCpy.aRange ), nFlags( rCpy.nFlags )
199 inline ScRangeItem& ScRangeItem::operator=( const ScRangeItem &rCpy )
201 aRange = rCpy.aRange;
202 return *this;
205 // ScTableListItem: manages a list of tables
207 class ScTableListItem : public SfxPoolItem
209 public:
210 TYPEINFO_OVERRIDE();
212 inline ScTableListItem( const sal_uInt16 nWhich );
213 ScTableListItem( const ScTableListItem& rCpy );
214 virtual ~ScTableListItem();
216 ScTableListItem& operator=( const ScTableListItem &rCpy );
218 // "pure virtual Methoden" from SfxPoolItem
219 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
220 virtual bool GetPresentation( SfxItemPresentation ePres,
221 SfxMapUnit eCoreMetric,
222 SfxMapUnit ePresMetric,
223 OUString &rText,
224 const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
225 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
227 public:
228 sal_uInt16 nCount;
229 SCTAB* pTabArr;
232 inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP )
233 : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL)
236 // page format item: contents of header and footer
238 #define SC_HF_LEFTAREA 1
239 #define SC_HF_CENTERAREA 2
240 #define SC_HF_RIGHTAREA 3
242 class SC_DLLPUBLIC ScPageHFItem : public SfxPoolItem
244 EditTextObject* pLeftArea;
245 EditTextObject* pCenterArea;
246 EditTextObject* pRightArea;
248 public:
249 TYPEINFO_OVERRIDE();
250 ScPageHFItem( sal_uInt16 nWhich );
251 ScPageHFItem( const ScPageHFItem& rItem );
252 virtual ~ScPageHFItem();
254 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
255 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
257 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const SAL_OVERRIDE;
259 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
260 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
262 const EditTextObject* GetLeftArea() const { return pLeftArea; }
263 const EditTextObject* GetCenterArea() const { return pCenterArea; }
264 const EditTextObject* GetRightArea() const { return pRightArea; }
266 void SetLeftArea( const EditTextObject& rNew );
267 void SetCenterArea( const EditTextObject& rNew );
268 void SetRightArea( const EditTextObject& rNew );
270 // Set method with pointer assignment, nArea see defines above
271 void SetArea( EditTextObject *pNew, int nArea );
274 // page format item: contents of header and footer
276 class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem
278 public:
279 TYPEINFO_OVERRIDE();
281 ScViewObjectModeItem( sal_uInt16 nWhich );
282 ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
283 virtual ~ScViewObjectModeItem();
285 virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE;
286 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
287 virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
288 virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const SAL_OVERRIDE;
289 virtual bool GetPresentation( SfxItemPresentation ePres,
290 SfxMapUnit eCoreMetric,
291 SfxMapUnit ePresMetric,
292 OUString& rText,
293 const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
296 class ScDoubleItem : public SfxPoolItem
298 public:
299 TYPEINFO_OVERRIDE();
300 ScDoubleItem( sal_uInt16 nWhich, double nVal=0 );
301 ScDoubleItem( const ScDoubleItem& rItem );
302 virtual ~ScDoubleItem();
304 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
305 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
307 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const SAL_OVERRIDE;
309 double GetValue() const { return nValue; }
311 void SetValue( const double nVal ) { nValue = nVal;}
313 private:
314 double nValue;
317 /** Member ID for "page scale to width" value in QueryValue() and PutValue(). */
318 const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH = 1;
319 /** Member ID for "page scale to height" value in QueryValue() and PutValue(). */
320 const sal_uInt8 SC_MID_PAGE_SCALETO_HEIGHT = 2;
322 /** Contains the "scale to width/height" attribute in page styles. */
323 class SC_DLLPUBLIC ScPageScaleToItem : public SfxPoolItem
325 public:
326 TYPEINFO_OVERRIDE();
328 /** Default c'tor sets the width and height to 0. */
329 explicit ScPageScaleToItem();
330 explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
332 virtual ~ScPageScaleToItem();
334 virtual ScPageScaleToItem* Clone( SfxItemPool* = 0 ) const SAL_OVERRIDE;
336 virtual bool operator==( const SfxPoolItem& rCmp ) const SAL_OVERRIDE;
338 inline sal_uInt16 GetWidth() const { return mnWidth; }
339 inline sal_uInt16 GetHeight() const { return mnHeight; }
340 inline bool IsValid() const { return mnWidth || mnHeight; }
342 inline void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
343 inline void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
344 inline void Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
345 { mnWidth = nWidth; mnHeight = nHeight; }
346 inline void SetInvalid() { mnWidth = mnHeight = 0; }
348 virtual bool GetPresentation(
349 SfxItemPresentation ePresentation,
350 SfxMapUnit, SfxMapUnit,
351 OUString& rText,
352 const IntlWrapper* = 0 ) const SAL_OVERRIDE;
354 virtual bool QueryValue( ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
355 virtual bool PutValue( const ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
357 private:
358 sal_uInt16 mnWidth;
359 sal_uInt16 mnHeight;
362 class ScCondFormatItem : public SfxPoolItem
364 public:
365 TYPEINFO_OVERRIDE();
367 explicit ScCondFormatItem();
368 explicit ScCondFormatItem(const std::vector<sal_uInt32>& nIndex);
370 virtual ~ScCondFormatItem();
372 virtual bool operator==(const SfxPoolItem& rCmp ) const SAL_OVERRIDE;
373 virtual ScCondFormatItem* Clone( SfxItemPool* = 0 ) const SAL_OVERRIDE;
375 const std::vector<sal_uInt32>& GetCondFormatData() const { return maIndex;}
376 void AddCondFormatData( sal_uInt32 nIndex );
377 void SetCondFormatData( const std::vector<sal_uInt32>& aIndex );
379 private:
380 std::vector<sal_uInt32> maIndex;
383 #endif
385 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */