LibreOffice Module sc (master) 1
attrib.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <memory>
23#include <svl/poolitem.hxx>
24#include <svl/intitem.hxx>
25#include <svl/eitem.hxx>
26#include <svx/sdangitm.hxx>
29#include "scdllapi.h"
30#include "global.hxx"
31
32// flags for cells hidden by merge
33// and control for auto filter
34enum class ScMF {
35 NONE = 0x0000,
36 Hor = 0x0001,
37 Ver = 0x0002,
38 Auto = 0x0004,
39 Button = 0x0008,
40 Scenario = 0x0010,
41 ButtonPopup = 0x0020,
42 HiddenMember = 0x0040,
43 DpTable = 0x0080,
44 All = 0x00FF
45};
46namespace o3tl {
47 template<> struct typed_flags<ScMF> : is_typed_flags<ScMF, 0xff> {};
48}
49
50class EditTextObject;
51namespace editeng { class SvxBorderLine; }
52
53bool SC_DLLPUBLIC ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxBorderLine* pOther );
54
56{
59public:
61 ScMergeAttr( SCCOL nCol, SCROW nRow );
62 ScMergeAttr( const ScMergeAttr& );
63 virtual ~ScMergeAttr() override;
64
65 virtual bool operator==( const SfxPoolItem& ) const override;
66 virtual ScMergeAttr* Clone( SfxItemPool *pPool = nullptr ) const override;
67
68 SCCOL GetColMerge() const {return nColMerge; }
69 SCROW GetRowMerge() const {return nRowMerge; }
70
71 bool IsMerged() const { return nColMerge>1 || nRowMerge>1; }
72
74 {
75 nColMerge = rMerge.nColMerge;
76 nRowMerge = rMerge.nRowMerge;
77 return *this;
78 }
79
80 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
81};
82
84{
85public:
87 ScMergeFlagAttr(ScMF nFlags);
88 virtual ~ScMergeFlagAttr() override;
89
90 ScMergeFlagAttr(ScMergeFlagAttr const &) = default;
92 ScMergeFlagAttr & operator =(ScMergeFlagAttr const &) = delete; // due to SfxInt16Item
93 ScMergeFlagAttr & operator =(ScMergeFlagAttr &&) = delete; // due to SfxInt16Item
94
95 ScMergeFlagAttr* Clone(SfxItemPool * pPool = nullptr) const override;
96
97 ScMF GetValue() const { return static_cast<ScMF>(SfxInt16Item::GetValue()); }
98
99 bool IsHorOverlapped() const { return bool( GetValue() & ScMF::Hor ); }
100 bool IsVerOverlapped() const { return bool( GetValue() & ScMF::Ver ); }
101 bool IsOverlapped() const { return bool( GetValue() & ( ScMF::Hor | ScMF::Ver ) ); }
102
103 bool HasAutoFilter() const { return bool( GetValue() & ScMF::Auto ); }
104
105 bool IsScenario() const { return bool( GetValue() & ScMF::Scenario ); }
106
107 bool HasPivotButton() const;
108 bool HasPivotPopupButton() const;
109
110 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
111};
112
114{
119public:
120 static SfxPoolItem* CreateDefault();
122 ScProtectionAttr( bool bProtect,
123 bool bHFormula = false,
124 bool bHCell = false,
125 bool bHPrint = false);
127 virtual ~ScProtectionAttr() override;
128
129 OUString GetValueText() const;
130 virtual bool GetPresentation(
132 MapUnit eCoreMetric,
133 MapUnit ePresMetric,
134 OUString& rText,
135 const IntlWrapper& rIntl ) const override;
136
137 virtual bool operator==( const SfxPoolItem& ) const override;
138 virtual ScProtectionAttr* Clone( SfxItemPool *pPool = nullptr ) const override;
139
140 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
141 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
142
143 bool GetProtection() const { return bProtection; }
144 void SetProtection( bool bProtect);
145 bool GetHideFormula() const { return bHideFormula; }
146 void SetHideFormula( bool bHFormula);
147 bool GetHideCell() const { return bHideCell; }
148 void SetHideCell( bool bHCell);
149 bool GetHidePrint() const { return bHidePrint; }
150 void SetHidePrint( bool bHPrint);
152 {
153 bProtection = rProtection.bProtection;
154 bHideFormula = rProtection.bHideFormula;
155 bHideCell = rProtection.bHideCell;
156 bHidePrint = rProtection.bHidePrint;
157 return *this;
158 }
159 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
160};
161
162// page format item: contents of header and footer
163
164#define SC_HF_LEFTAREA 1
165#define SC_HF_CENTERAREA 2
166#define SC_HF_RIGHTAREA 3
167
169{
170 std::unique_ptr<EditTextObject> pLeftArea;
171 std::unique_ptr<EditTextObject> pCenterArea;
172 std::unique_ptr<EditTextObject> pRightArea;
173
174public:
175 ScPageHFItem( sal_uInt16 nWhich );
176 ScPageHFItem( const ScPageHFItem& rItem );
177 virtual ~ScPageHFItem() override;
178
179 virtual bool operator==( const SfxPoolItem& ) const override;
180 virtual ScPageHFItem* Clone( SfxItemPool *pPool = nullptr ) const override;
181
182 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
183 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
184
185 const EditTextObject* GetLeftArea() const { return pLeftArea.get(); }
186 const EditTextObject* GetCenterArea() const { return pCenterArea.get(); }
187 const EditTextObject* GetRightArea() const { return pRightArea.get(); }
188
189 void SetLeftArea( const EditTextObject& rNew );
190 void SetCenterArea( const EditTextObject& rNew );
191 void SetRightArea( const EditTextObject& rNew );
192 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
193};
194
195// page format item: contents of header and footer
196
197class SC_DLLPUBLIC ScViewObjectModeItem final : public SfxEnumItem<ScVObjMode>
198{
199public:
200 ScViewObjectModeItem( sal_uInt16 nWhich );
201 ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
202 virtual ~ScViewObjectModeItem() override;
203
206 ScViewObjectModeItem & operator =(ScViewObjectModeItem const &) = delete; // due to SfxEnumItem<ScVObjMode>
207 ScViewObjectModeItem & operator =(ScViewObjectModeItem &&) = delete; // due to SfxEnumItem<ScVObjMode>
208
209 virtual sal_uInt16 GetValueCount() const override;
210 virtual ScViewObjectModeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
211 virtual bool GetPresentation( SfxItemPresentation ePres,
212 MapUnit eCoreMetric,
213 MapUnit ePresMetric,
214 OUString& rText,
215 const IntlWrapper& rIntl ) const override;
216};
217
222
225{
226public:
228 explicit ScPageScaleToItem();
229 explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
230
231 virtual ~ScPageScaleToItem() override;
232
235 ScPageScaleToItem & operator =(ScPageScaleToItem const &) = delete; // due to SfxPoolItem
236 ScPageScaleToItem & operator =(ScPageScaleToItem &&) = delete; // due to SfxPoolItem
237
238 virtual ScPageScaleToItem* Clone( SfxItemPool* = nullptr ) const override;
239
240 virtual bool operator==( const SfxPoolItem& rCmp ) const override;
241
242 sal_uInt16 GetWidth() const { return mnWidth; }
243 sal_uInt16 GetHeight() const { return mnHeight; }
244 bool IsValid() const { return mnWidth || mnHeight; }
245
246 void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
247 void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
248 void Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
249 { mnWidth = nWidth; mnHeight = nHeight; }
250
251 virtual bool GetPresentation( SfxItemPresentation ePresentation,
253 OUString& rText,
254 const IntlWrapper& ) const override;
255
256 virtual bool QueryValue( css::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) const override;
257 virtual bool PutValue( const css::uno::Any& rAny, sal_uInt8 nMemberId ) override;
258 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
259
260private:
261 sal_uInt16 mnWidth;
262 sal_uInt16 mnHeight;
263};
264
266
267class ScCondFormatItem final : public SfxPoolItem
268{
269public:
270 explicit ScCondFormatItem();
271 explicit ScCondFormatItem(sal_uInt32 nIndex);
272 explicit ScCondFormatItem(const ScCondFormatIndexes& );
273 explicit ScCondFormatItem(ScCondFormatIndexes&&) noexcept;
274
275 virtual ~ScCondFormatItem() override;
276
277 virtual bool operator==(const SfxPoolItem& rCmp ) const override;
278 virtual bool operator<(const SfxPoolItem& rCmp) const override;
279 virtual bool IsSortable() const override { return true; }
280 virtual ScCondFormatItem* Clone( SfxItemPool* = nullptr ) const override;
281
283
284 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
285
286private:
288};
289
291{
292public:
294 virtual ScRotateValueItem* Clone(SfxItemPool* pPool=nullptr) const override;
295
296 virtual bool GetPresentation( SfxItemPresentation ePresentation,
298 OUString& rText,
299 const IntlWrapper& rIntl) const override;
300};
301
303{
304public:
305 ScShrinkToFitCell(bool bShrink = false);
306 virtual ScShrinkToFitCell* Clone(SfxItemPool *pPool = nullptr) const override;
307 virtual bool GetPresentation(SfxItemPresentation ePres,
308 MapUnit eCoreMetric,
309 MapUnit ePresMetric,
310 OUString &rText,
311 const IntlWrapper& rIntl) const override;
312};
313
315{
316public:
317 ScVerticalStackCell(bool bStack = false);
318 virtual ScVerticalStackCell* Clone(SfxItemPool *pPool = nullptr) const override;
319 virtual bool GetPresentation(SfxItemPresentation ePres,
320 MapUnit eCoreMetric,
321 MapUnit ePresMetric,
322 OUString &rText,
323 const IntlWrapper& rIntl) const override;
324};
325
327{
328public:
329 ScLineBreakCell(bool bLineBreak = false);
330 virtual ScLineBreakCell* Clone(SfxItemPool *pPool = nullptr) const override;
331 virtual bool GetPresentation(SfxItemPresentation ePres,
332 MapUnit eCoreMetric,
333 MapUnit ePresMetric,
334 OUString &rText,
335 const IntlWrapper& rIntl) const override;
336};
337
338class ScHyphenateCell final : public SfxBoolItem
339{
340public:
341 ScHyphenateCell(bool bHyphenate= false);
342 virtual ScHyphenateCell* Clone(SfxItemPool *pPool = nullptr) const override;
343 virtual bool GetPresentation(SfxItemPresentation ePres,
344 MapUnit eCoreMetric,
345 MapUnit ePresMetric,
346 OUString &rText,
347 const IntlWrapper& rIntl) const override;
348};
349
351{
352public:
353 ScIndentItem(sal_uInt16 nIndent = 0);
354 virtual ScIndentItem* Clone(SfxItemPool* pPool=nullptr) const override;
355
356 virtual bool GetPresentation( SfxItemPresentation ePresentation,
358 OUString& rText,
359 const IntlWrapper& rIntl) const override;
360};
361
362/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool SC_DLLPUBLIC ScHasPriority(const ::editeng::SvxBorderLine *pThis, const ::editeng::SvxBorderLine *pOther)
General Help Function.
Definition: attrib.cxx:49
const sal_uInt8 SC_MID_PAGE_SCALETO_HEIGHT
Member ID for "page scale to height" value in QueryValue() and PutValue().
Definition: attrib.hxx:221
o3tl::sorted_vector< sal_uInt32 > ScCondFormatIndexes
Definition: attrib.hxx:265
const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH
Member ID for "page scale to width" value in QueryValue() and PutValue().
Definition: attrib.hxx:219
ScMF
Definition: attrib.hxx:34
@ HiddenMember
dp button with popup arrow
@ Scenario
field button for datapilot
@ DpTable
dp field button with presence of hidden member
@ ButtonPopup
virtual ~ScCondFormatItem() override
Definition: attrib.cxx:709
virtual bool operator<(const SfxPoolItem &rCmp) const override
Definition: attrib.cxx:725
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: attrib.cxx:745
virtual ScCondFormatItem * Clone(SfxItemPool *=nullptr) const override
Definition: attrib.cxx:740
ScCondFormatIndexes maIndex
Definition: attrib.hxx:287
virtual bool IsSortable() const override
Definition: attrib.hxx:279
virtual bool operator==(const SfxPoolItem &rCmp) const override
Definition: attrib.cxx:713
const ScCondFormatIndexes & GetCondFormatData() const
Definition: attrib.hxx:282
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:848
ScHyphenateCell(bool bHyphenate=false)
Definition: attrib.cxx:838
virtual ScHyphenateCell * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:843
SCCOL GetColMerge() const
Definition: attrib.hxx:68
bool IsMerged() const
Definition: attrib.hxx:71
SCROW GetRowMerge() const
Definition: attrib.hxx:69
SCCOL nColMerge
Definition: attrib.hxx:57
SCROW nRowMerge
Definition: attrib.hxx:58
ScMergeAttr & operator=(const ScMergeAttr &rMerge)
Definition: attrib.hxx:73
ScMF GetValue() const
Definition: attrib.hxx:97
bool HasAutoFilter() const
Definition: attrib.hxx:103
bool IsScenario() const
Definition: attrib.hxx:105
bool IsHorOverlapped() const
Definition: attrib.hxx:99
bool IsOverlapped() const
Definition: attrib.hxx:101
ScMergeFlagAttr(ScMergeFlagAttr const &)=default
ScMergeFlagAttr(ScMergeFlagAttr &&)=default
bool IsVerOverlapped() const
Definition: attrib.hxx:100
const EditTextObject * GetCenterArea() const
Definition: attrib.hxx:186
std::unique_ptr< EditTextObject > pCenterArea
Definition: attrib.hxx:171
std::unique_ptr< EditTextObject > pRightArea
Definition: attrib.hxx:172
std::unique_ptr< EditTextObject > pLeftArea
Definition: attrib.hxx:170
const EditTextObject * GetLeftArea() const
Definition: attrib.hxx:185
const EditTextObject * GetRightArea() const
Definition: attrib.hxx:187
Contains the "scale to width/height" attribute in page styles.
Definition: attrib.hxx:225
sal_uInt16 mnHeight
Definition: attrib.hxx:262
bool IsValid() const
Definition: attrib.hxx:244
void Set(sal_uInt16 nWidth, sal_uInt16 nHeight)
Definition: attrib.hxx:248
sal_uInt16 mnWidth
Definition: attrib.hxx:261
sal_uInt16 GetHeight() const
Definition: attrib.hxx:243
ScPageScaleToItem(ScPageScaleToItem const &)=default
sal_uInt16 GetWidth() const
Definition: attrib.hxx:242
void SetHeight(sal_uInt16 nHeight)
Definition: attrib.hxx:247
ScPageScaleToItem(ScPageScaleToItem &&)=default
void SetWidth(sal_uInt16 nWidth)
Definition: attrib.hxx:246
bool bHideCell
hide cell
Definition: attrib.hxx:117
bool GetHideFormula() const
Definition: attrib.hxx:145
ScProtectionAttr & operator=(const ScProtectionAttr &rProtection)
Definition: attrib.hxx:151
bool GetHideCell() const
Definition: attrib.hxx:147
bool bProtection
protect cell
Definition: attrib.hxx:115
bool bHideFormula
hide formula
Definition: attrib.hxx:116
bool GetHidePrint() const
Definition: attrib.hxx:149
bool GetProtection() const
Definition: attrib.hxx:143
bool bHidePrint
don't print cell
Definition: attrib.hxx:118
ScViewObjectModeItem(ScViewObjectModeItem const &)=default
ScViewObjectModeItem(ScViewObjectModeItem &&)=default
sal_Int16 GetValue() const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
virtual bool operator==(const SfxPoolItem &) const=0
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
SfxPoolItem & operator=(const SfxPoolItem &)=delete
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
struct _xmlTextWriter * xmlTextWriterPtr
ScVObjMode
Definition: global.hxx:367
sal_Int32 nIndex
Mode eMode
MapUnit
NONE
const char GetValue[]
SfxItemPresentation
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
double mnWidth
double mnHeight
unsigned char sal_uInt8
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17