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 DpCollapse = 0x0100,
45 DpExpand = 0x0200,
46 ButtonPopup2 = 0x0400,
47 All = 0x07FF
48};
49namespace o3tl {
50 template<> struct typed_flags<ScMF> : is_typed_flags<ScMF, 0x07ff> {};
51}
52
53class EditTextObject;
54namespace editeng { class SvxBorderLine; }
55
56bool SC_DLLPUBLIC ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxBorderLine* pOther );
57
59{
62public:
64 ScMergeAttr( SCCOL nCol, SCROW nRow );
65 ScMergeAttr( const ScMergeAttr& );
66 virtual ~ScMergeAttr() override;
67
68 virtual bool operator==( const SfxPoolItem& ) const override;
69 virtual ScMergeAttr* Clone( SfxItemPool *pPool = nullptr ) const override;
70
71 SCCOL GetColMerge() const {return nColMerge; }
72 SCROW GetRowMerge() const {return nRowMerge; }
73
74 bool IsMerged() const { return nColMerge>1 || nRowMerge>1; }
75
77 {
78 nColMerge = rMerge.nColMerge;
79 nRowMerge = rMerge.nRowMerge;
80 return *this;
81 }
82
83 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
84};
85
87{
88public:
90 ScMergeFlagAttr(ScMF nFlags);
91 virtual ~ScMergeFlagAttr() override;
92
93 ScMergeFlagAttr(ScMergeFlagAttr const &) = default;
95 ScMergeFlagAttr & operator =(ScMergeFlagAttr const &) = delete; // due to SfxInt16Item
96 ScMergeFlagAttr & operator =(ScMergeFlagAttr &&) = delete; // due to SfxInt16Item
97
98 ScMergeFlagAttr* Clone(SfxItemPool * pPool = nullptr) const override;
99
100 ScMF GetValue() const { return static_cast<ScMF>(SfxInt16Item::GetValue()); }
101
102 bool IsHorOverlapped() const { return bool( GetValue() & ScMF::Hor ); }
103 bool IsVerOverlapped() const { return bool( GetValue() & ScMF::Ver ); }
104 bool IsOverlapped() const { return bool( GetValue() & ( ScMF::Hor | ScMF::Ver ) ); }
105
106 bool HasAutoFilter() const { return bool( GetValue() & ScMF::Auto ); }
107
108 bool IsScenario() const { return bool( GetValue() & ScMF::Scenario ); }
109
110 bool HasPivotButton() const;
111 bool HasPivotPopupButton() const;
112 bool HasPivotToggle() const;
113 bool HasPivotMultiFieldPopupButton() const;
114
115 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
116};
117
119{
124public:
125 static SfxPoolItem* CreateDefault();
127 ScProtectionAttr( bool bProtect,
128 bool bHFormula = false,
129 bool bHCell = false,
130 bool bHPrint = false);
132 virtual ~ScProtectionAttr() override;
133
134 OUString GetValueText() const;
135 virtual bool GetPresentation(
137 MapUnit eCoreMetric,
138 MapUnit ePresMetric,
139 OUString& rText,
140 const IntlWrapper& rIntl ) const override;
141
142 virtual bool operator==( const SfxPoolItem& ) const override;
143 virtual ScProtectionAttr* Clone( SfxItemPool *pPool = nullptr ) const override;
144
145 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
146 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
147
148 bool GetProtection() const { return bProtection; }
149 void SetProtection( bool bProtect);
150 bool GetHideFormula() const { return bHideFormula; }
151 void SetHideFormula( bool bHFormula);
152 bool GetHideCell() const { return bHideCell; }
153 void SetHideCell( bool bHCell);
154 bool GetHidePrint() const { return bHidePrint; }
155 void SetHidePrint( bool bHPrint);
157 {
158 bProtection = rProtection.bProtection;
159 bHideFormula = rProtection.bHideFormula;
160 bHideCell = rProtection.bHideCell;
161 bHidePrint = rProtection.bHidePrint;
162 return *this;
163 }
164 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
165};
166
167// page format item: contents of header and footer
168
169#define SC_HF_LEFTAREA 1
170#define SC_HF_CENTERAREA 2
171#define SC_HF_RIGHTAREA 3
172
174{
175 std::unique_ptr<EditTextObject> pLeftArea;
176 std::unique_ptr<EditTextObject> pCenterArea;
177 std::unique_ptr<EditTextObject> pRightArea;
178
179public:
180 ScPageHFItem( sal_uInt16 nWhich );
181 ScPageHFItem( const ScPageHFItem& rItem );
182 virtual ~ScPageHFItem() override;
183
184 virtual bool operator==( const SfxPoolItem& ) const override;
185 virtual ScPageHFItem* Clone( SfxItemPool *pPool = nullptr ) const override;
186
187 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
188 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
189
190 const EditTextObject* GetLeftArea() const { return pLeftArea.get(); }
191 const EditTextObject* GetCenterArea() const { return pCenterArea.get(); }
192 const EditTextObject* GetRightArea() const { return pRightArea.get(); }
193
194 void SetLeftArea( const EditTextObject& rNew );
195 void SetCenterArea( const EditTextObject& rNew );
196 void SetRightArea( const EditTextObject& rNew );
197 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
198};
199
200// page format item: contents of header and footer
201
202class SC_DLLPUBLIC ScViewObjectModeItem final : public SfxEnumItem<ScVObjMode>
203{
204public:
205 ScViewObjectModeItem( sal_uInt16 nWhich );
206 ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode );
207 virtual ~ScViewObjectModeItem() override;
208
211 ScViewObjectModeItem & operator =(ScViewObjectModeItem const &) = delete; // due to SfxEnumItem<ScVObjMode>
212 ScViewObjectModeItem & operator =(ScViewObjectModeItem &&) = delete; // due to SfxEnumItem<ScVObjMode>
213
214 virtual sal_uInt16 GetValueCount() const override;
215 virtual ScViewObjectModeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
216 virtual bool GetPresentation( SfxItemPresentation ePres,
217 MapUnit eCoreMetric,
218 MapUnit ePresMetric,
219 OUString& rText,
220 const IntlWrapper& rIntl ) const override;
221};
222
227
230{
231public:
233 explicit ScPageScaleToItem();
234 explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight );
235
236 virtual ~ScPageScaleToItem() override;
237
240 ScPageScaleToItem & operator =(ScPageScaleToItem const &) = delete; // due to SfxPoolItem
241 ScPageScaleToItem & operator =(ScPageScaleToItem &&) = delete; // due to SfxPoolItem
242
243 virtual ScPageScaleToItem* Clone( SfxItemPool* = nullptr ) const override;
244
245 virtual bool operator==( const SfxPoolItem& rCmp ) const override;
246
247 sal_uInt16 GetWidth() const { return mnWidth; }
248 sal_uInt16 GetHeight() const { return mnHeight; }
249 bool IsValid() const { return mnWidth || mnHeight; }
250
251 void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; }
252 void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; }
253 void Set( sal_uInt16 nWidth, sal_uInt16 nHeight )
254 { mnWidth = nWidth; mnHeight = nHeight; }
255
256 virtual bool GetPresentation( SfxItemPresentation ePresentation,
258 OUString& rText,
259 const IntlWrapper& ) const override;
260
261 virtual bool QueryValue( css::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) const override;
262 virtual bool PutValue( const css::uno::Any& rAny, sal_uInt8 nMemberId ) override;
263 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
264
265private:
266 sal_uInt16 mnWidth;
267 sal_uInt16 mnHeight;
268};
269
271
272class SAL_DLLPUBLIC_RTTI ScCondFormatItem final : public SfxPoolItem
273{
274public:
275 explicit ScCondFormatItem();
276 explicit ScCondFormatItem(sal_uInt32 nIndex);
277 explicit ScCondFormatItem(const ScCondFormatIndexes& );
278 explicit ScCondFormatItem(ScCondFormatIndexes&&) noexcept;
279
280 virtual ~ScCondFormatItem() override;
281
282 virtual bool operator==(const SfxPoolItem& rCmp ) const override;
283 virtual bool operator<(const SfxPoolItem& rCmp) const override;
284 virtual bool IsSortable() const override { return true; }
285 virtual ScCondFormatItem* Clone( SfxItemPool* = nullptr ) const override;
286
287 const ScCondFormatIndexes& GetCondFormatData() const { return maIndex;}
288
289 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
290
291private:
293};
294
296{
297public:
299 virtual ScRotateValueItem* Clone(SfxItemPool* pPool=nullptr) const override;
300
301 virtual bool GetPresentation( SfxItemPresentation ePresentation,
303 OUString& rText,
304 const IntlWrapper& rIntl) const override;
305};
306
308{
309public:
310 ScShrinkToFitCell(bool bShrink = false);
311 virtual ScShrinkToFitCell* Clone(SfxItemPool *pPool = nullptr) const override;
312 virtual bool GetPresentation(SfxItemPresentation ePres,
313 MapUnit eCoreMetric,
314 MapUnit ePresMetric,
315 OUString &rText,
316 const IntlWrapper& rIntl) const override;
317};
318
320{
321public:
322 ScVerticalStackCell(bool bStack = false);
323 virtual ScVerticalStackCell* Clone(SfxItemPool *pPool = nullptr) const override;
324 virtual bool GetPresentation(SfxItemPresentation ePres,
325 MapUnit eCoreMetric,
326 MapUnit ePresMetric,
327 OUString &rText,
328 const IntlWrapper& rIntl) const override;
329};
330
332{
333public:
334 ScLineBreakCell(bool bLineBreak = false);
335 virtual ScLineBreakCell* Clone(SfxItemPool *pPool = nullptr) const override;
336 virtual bool GetPresentation(SfxItemPresentation ePres,
337 MapUnit eCoreMetric,
338 MapUnit ePresMetric,
339 OUString &rText,
340 const IntlWrapper& rIntl) const override;
341};
342
343class ScHyphenateCell final : public SfxBoolItem
344{
345public:
346 ScHyphenateCell(bool bHyphenate= false);
347 virtual ScHyphenateCell* Clone(SfxItemPool *pPool = nullptr) const override;
348 virtual bool GetPresentation(SfxItemPresentation ePres,
349 MapUnit eCoreMetric,
350 MapUnit ePresMetric,
351 OUString &rText,
352 const IntlWrapper& rIntl) const override;
353};
354
356{
357public:
358 ScIndentItem(sal_uInt16 nIndent = 0);
359 virtual ScIndentItem* Clone(SfxItemPool* pPool=nullptr) const override;
360
361 virtual bool GetPresentation( SfxItemPresentation ePresentation,
363 OUString& rText,
364 const IntlWrapper& rIntl) const override;
365};
366
367/* 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:226
o3tl::sorted_vector< sal_uInt32 > ScCondFormatIndexes
Definition: attrib.hxx:270
const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH
Member ID for "page scale to width" value in QueryValue() and PutValue().
Definition: attrib.hxx:224
ScMF
Definition: attrib.hxx:34
@ DpCollapse
dp table output
@ DpExpand
dp compact layout collapse button
@ HiddenMember
dp button with popup arrow
@ Scenario
field button for datapilot
@ DpTable
dp field button with presence of hidden member
@ ButtonPopup
@ ButtonPopup2
dp compact layout expand button
ScCondFormatIndexes maIndex
Definition: attrib.hxx:292
virtual bool IsSortable() const override
Definition: attrib.hxx:284
const ScCondFormatIndexes & GetCondFormatData() const
Definition: attrib.hxx:287
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:859
ScHyphenateCell(bool bHyphenate=false)
Definition: attrib.cxx:849
virtual ScHyphenateCell * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:854
SCCOL GetColMerge() const
Definition: attrib.hxx:71
bool IsMerged() const
Definition: attrib.hxx:74
SCROW GetRowMerge() const
Definition: attrib.hxx:72
SCCOL nColMerge
Definition: attrib.hxx:60
SCROW nRowMerge
Definition: attrib.hxx:61
ScMergeAttr & operator=(const ScMergeAttr &rMerge)
Definition: attrib.hxx:76
ScMF GetValue() const
Definition: attrib.hxx:100
bool HasAutoFilter() const
Definition: attrib.hxx:106
bool IsScenario() const
Definition: attrib.hxx:108
bool IsHorOverlapped() const
Definition: attrib.hxx:102
bool IsOverlapped() const
Definition: attrib.hxx:104
ScMergeFlagAttr(ScMergeFlagAttr const &)=default
ScMergeFlagAttr(ScMergeFlagAttr &&)=default
bool IsVerOverlapped() const
Definition: attrib.hxx:103
const EditTextObject * GetCenterArea() const
Definition: attrib.hxx:191
std::unique_ptr< EditTextObject > pCenterArea
Definition: attrib.hxx:176
std::unique_ptr< EditTextObject > pRightArea
Definition: attrib.hxx:177
std::unique_ptr< EditTextObject > pLeftArea
Definition: attrib.hxx:175
const EditTextObject * GetLeftArea() const
Definition: attrib.hxx:190
const EditTextObject * GetRightArea() const
Definition: attrib.hxx:192
Contains the "scale to width/height" attribute in page styles.
Definition: attrib.hxx:230
sal_uInt16 mnHeight
Definition: attrib.hxx:267
bool IsValid() const
Definition: attrib.hxx:249
void Set(sal_uInt16 nWidth, sal_uInt16 nHeight)
Definition: attrib.hxx:253
sal_uInt16 mnWidth
Definition: attrib.hxx:266
sal_uInt16 GetHeight() const
Definition: attrib.hxx:248
ScPageScaleToItem(ScPageScaleToItem const &)=default
sal_uInt16 GetWidth() const
Definition: attrib.hxx:247
void SetHeight(sal_uInt16 nHeight)
Definition: attrib.hxx:252
ScPageScaleToItem(ScPageScaleToItem &&)=default
void SetWidth(sal_uInt16 nWidth)
Definition: attrib.hxx:251
bool bHideCell
hide cell
Definition: attrib.hxx:122
bool GetHideFormula() const
Definition: attrib.hxx:150
ScProtectionAttr & operator=(const ScProtectionAttr &rProtection)
Definition: attrib.hxx:156
bool GetHideCell() const
Definition: attrib.hxx:152
bool bProtection
protect cell
Definition: attrib.hxx:120
bool bHideFormula
hide formula
Definition: attrib.hxx:121
bool GetHidePrint() const
Definition: attrib.hxx:154
bool GetProtection() const
Definition: attrib.hxx:148
bool bHidePrint
don't print cell
Definition: attrib.hxx:123
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)
virtual bool operator<(const SfxPoolItem &) const
SfxPoolItem & operator=(const SfxPoolItem &)=delete
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
struct _xmlTextWriter * xmlTextWriterPtr
ScVObjMode
Definition: global.hxx:368
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