LibreOffice Module sw (master) 1
grfatr.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#ifndef INCLUDED_SW_INC_GRFATR_HXX
20#define INCLUDED_SW_INC_GRFATR_HXX
21
22#include "hintids.hxx"
23#include <tools/gen.hxx>
24#include <svl/eitem.hxx>
25#include <svl/intitem.hxx>
27#include <svx/grfcrop.hxx>
28#include "swdllapi.h"
29#include "swatrset.hxx"
30
31enum class MirrorGraph
32{
33 Dont,
36 Both
37};
38
39class SW_DLLPUBLIC SwMirrorGrf final : public SfxEnumItem<MirrorGraph>
40{
41 bool m_bGrfToggle; // Flip graphics on even pages.
42
43public:
45 : SfxEnumItem( RES_GRFATR_MIRRORGRF, eMiro ), m_bGrfToggle( false )
46 {}
47
48 // pure virtual methods of SfxPoolItem
49 virtual SwMirrorGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
50
51 // pure virtual methods of SfxEnumItem
52 virtual sal_uInt16 GetValueCount() const override;
53 virtual bool operator==( const SfxPoolItem& ) const override;
54 virtual bool GetPresentation( SfxItemPresentation ePres,
55 MapUnit eCoreMetric,
56 MapUnit ePresMetric,
57 OUString &rText,
58 const IntlWrapper& rIntl ) const override;
59
60 virtual bool QueryValue( css::uno::Any& rVal,
61 sal_uInt8 nMemberId = 0 ) const override;
62 virtual bool PutValue( const css::uno::Any& rVal,
63 sal_uInt8 nMemberId ) override;
64
65 bool IsGrfToggle() const { return m_bGrfToggle; }
66 void SetGrfToggle( bool bNew ) { m_bGrfToggle = bNew; }
67};
68
69class SW_DLLPUBLIC SwCropGrf final : public SvxGrfCrop
70{
71public:
72 SwCropGrf();
73 SwCropGrf( sal_Int32 nLeft, sal_Int32 nRight,
74 sal_Int32 nTop, sal_Int32 nBottom );
75
76 // "pure virtual methods" of SfxPoolItem
77 virtual SwCropGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
78};
79
80class SAL_DLLPUBLIC_RTTI SwRotationGrf final : public SfxUInt16Item
81{
82private:
84
85 // tdf#115529 check and evtl. correct value, it is in 10th
86 // degrees and *has* to be in the range [0 .. 3600[
87 static Degree10 checkAndCorrectValue(Degree10 nValue);
88
89public:
92 {}
93 SwRotationGrf( Degree10 nVal, const Size& rSz );
94
95 // pure virtual methods from SfxInt16Item
96 virtual SwRotationGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
97 virtual bool operator==( const SfxPoolItem& ) const override;
98 virtual bool GetPresentation( SfxItemPresentation ePres,
99 MapUnit eCoreMetric,
100 MapUnit ePresMetric,
101 OUString &rText,
102 const IntlWrapper& rIntl ) const override;
103 virtual bool QueryValue( css::uno::Any& rVal,
104 sal_uInt8 nMemberId = 0 ) const override;
105 virtual bool PutValue( const css::uno::Any& rVal,
106 sal_uInt8 nMemberId ) override;
107
108 const Size& GetUnrotatedSize() const { return m_aUnrotatedSize; }
111};
112
114{
115public:
116 SwLuminanceGrf( sal_Int16 nVal = 0 )
118 {}
119
120 // pure virtual methods from SfxInt16Item
121 virtual SwLuminanceGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
122 virtual bool GetPresentation( SfxItemPresentation ePres,
123 MapUnit eCoreMetric,
124 MapUnit ePresMetric,
125 OUString &rText,
126 const IntlWrapper& rIntl ) const override;
127};
128
130{
131public:
132 SwContrastGrf( sal_Int16 nVal = 0 )
134 {}
135
136 // pure virtual methods from SfxInt16Item
137 virtual SwContrastGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
138 virtual bool GetPresentation( SfxItemPresentation ePres,
139 MapUnit eCoreMetric,
140 MapUnit ePresMetric,
141 OUString &rText,
142 const IntlWrapper& rIntl ) const override;
143};
144
146{
147protected:
148 SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL )
149 : SfxInt16Item( nWhichL, nVal )
150 {}
151
152public:
153 // pure virtual methods from SfxInt16Item
154 virtual bool GetPresentation( SfxItemPresentation ePres,
155 MapUnit eCoreMetric,
156 MapUnit ePresMetric,
157 OUString &rText,
158 const IntlWrapper& rIntl ) const override;
159};
160
161class SwChannelRGrf final : public SwChannelGrf
162{
163public:
164 SwChannelRGrf( sal_Int16 nVal = 0 )
166 {}
167 virtual SwChannelRGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
168};
169class SwChannelGGrf final : public SwChannelGrf
170{
171public:
172 SwChannelGGrf( sal_Int16 nVal = 0 )
174 {}
175 virtual SwChannelGGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
176};
177class SwChannelBGrf final : public SwChannelGrf
178{
179public:
180 SwChannelBGrf( sal_Int16 nVal = 0 )
182 {}
183 virtual SwChannelBGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
184};
185
187{
188 double m_nValue;
189public:
191 {}
192
193 SwGammaGrf( const double& rVal )
194 : SfxPoolItem( RES_GRFATR_GAMMA ), m_nValue( rVal )
195 {}
196
197 // pure virtual methods from SfxEnumItem
198 virtual SwGammaGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
199 virtual bool operator==( const SfxPoolItem& ) const override;
200 virtual bool GetPresentation( SfxItemPresentation ePres,
201 MapUnit eCoreMetric,
202 MapUnit ePresMetric,
203 OUString &rText,
204 const IntlWrapper& rIntl ) const override;
205
206 virtual bool QueryValue( css::uno::Any& rVal,
207 sal_uInt8 nMemberId = 0 ) const override;
208 virtual bool PutValue( const css::uno::Any& rVal,
209 sal_uInt8 nMemberId ) override;
210
211 const double& GetValue() const { return m_nValue; }
212};
213
214class SwInvertGrf final : public SfxBoolItem
215{
216public:
217 SwInvertGrf( bool bVal = false )
219 {}
220
221 // pure virtual methods from SfxInt16Item
222 virtual SwInvertGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
223 virtual bool GetPresentation( SfxItemPresentation ePres,
224 MapUnit eCoreMetric,
225 MapUnit ePresMetric,
226 OUString &rText,
227 const IntlWrapper& rIntl ) const override;
228};
229
230class SwTransparencyGrf final : public SfxByteItem
231{
232public:
235 {}
236
237 // pure virtual methods from SfxInt16Item
238 virtual SwTransparencyGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
239 virtual bool GetPresentation( SfxItemPresentation ePres,
240 MapUnit eCoreMetric,
241 MapUnit ePresMetric,
242 OUString &rText,
243 const IntlWrapper& rIntl ) const override;
244 virtual bool QueryValue( css::uno::Any& rVal,
245 sal_uInt8 nMemberId = 0 ) const override;
246 virtual bool PutValue( const css::uno::Any& rVal,
247 sal_uInt8 nMemberId ) override;
248};
249
250// MSVC hack:
251class SwDrawModeGrf_Base: public SfxEnumItem<GraphicDrawMode> {
252protected:
255};
256
258{
259public:
260 SwDrawModeGrf( GraphicDrawMode nMode = GraphicDrawMode::Standard )
261 : SwDrawModeGrf_Base( nMode )
262 {}
263
264 // pure virtual methods of SfxPoolItem
265 virtual SwDrawModeGrf* Clone( SfxItemPool *pPool = nullptr ) const override;
266
267 // pure virtual methods of SfxEnumItem
268 virtual sal_uInt16 GetValueCount() const override;
269 virtual bool GetPresentation( SfxItemPresentation ePres,
270 MapUnit eCoreMetric,
271 MapUnit ePresMetric,
272 OUString &rText,
273 const IntlWrapper& rIntl ) const override;
274
275 virtual bool QueryValue( css::uno::Any& rVal,
276 sal_uInt8 nMemberId = 0 ) const override;
277 virtual bool PutValue( const css::uno::Any& rVal,
278 sal_uInt8 nMemberId ) override;
279};
280
281// Implementation of graphics attributes methods of SwAttr
282inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(bool bInP) const
283 { return Get( RES_GRFATR_MIRRORGRF,bInP); }
284inline const SwCropGrf &SwAttrSet::GetCropGrf(bool bInP) const
285 { return Get( RES_GRFATR_CROPGRF,bInP); }
286inline const SwRotationGrf &SwAttrSet::GetRotationGrf(bool bInP) const
287 { return Get( RES_GRFATR_ROTATION,bInP); }
288inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(bool bInP) const
289 { return Get( RES_GRFATR_LUMINANCE,bInP); }
290inline const SwContrastGrf &SwAttrSet::GetContrastGrf(bool bInP) const
291 { return Get( RES_GRFATR_CONTRAST,bInP); }
292inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(bool bInP) const
293 { return Get( RES_GRFATR_CHANNELR,bInP); }
294inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(bool bInP) const
295 { return Get( RES_GRFATR_CHANNELG,bInP); }
296inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(bool bInP) const
297 { return Get( RES_GRFATR_CHANNELB,bInP); }
298inline const SwGammaGrf &SwAttrSet::GetGammaGrf(bool bInP) const
299 { return Get( RES_GRFATR_GAMMA,bInP); }
300inline const SwInvertGrf &SwAttrSet::GetInvertGrf(bool bInP) const
301 { return Get( RES_GRFATR_INVERT,bInP); }
303 { return Get( RES_GRFATR_TRANSPARENCY,bInP); }
304inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(bool bInP) const
305 { return Get( RES_GRFATR_DRAWMODE,bInP); }
306
307#endif // INCLUDED_SW_INC_GRFATR_HXX
308
309/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
GraphicDrawMode
double d
sal_uInt16 GetValue() const
virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool operator==(const SfxPoolItem &rItem) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
void SetValue(sal_uInt16 nTheValue)
virtual sal_uInt16 GetValueCount() const=0
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8=0) const override
virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
EnumT m_nValue
virtual bool operator==(SfxPoolItem const &other) const override
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
virtual SfxUInt16Item * Clone(SfxItemPool *=nullptr) const override
const SwChannelRGrf & GetChannelRGrf(bool=true) const
Definition: grfatr.hxx:292
const SwLuminanceGrf & GetLuminanceGrf(bool=true) const
Definition: grfatr.hxx:288
const SwMirrorGrf & GetMirrorGrf(bool=true) const
Definition: grfatr.hxx:282
const SwDrawModeGrf & GetDrawModeGrf(bool=true) const
Definition: grfatr.hxx:304
const SwTransparencyGrf & GetTransparencyGrf(bool=true) const
Definition: grfatr.hxx:302
const SwChannelGGrf & GetChannelGGrf(bool=true) const
Definition: grfatr.hxx:294
const SwInvertGrf & GetInvertGrf(bool=true) const
Definition: grfatr.hxx:300
const SwContrastGrf & GetContrastGrf(bool=true) const
Definition: grfatr.hxx:290
const SwGammaGrf & GetGammaGrf(bool=true) const
Definition: grfatr.hxx:298
const SwCropGrf & GetCropGrf(bool=true) const
Definition: grfatr.hxx:284
const SwChannelBGrf & GetChannelBGrf(bool=true) const
Definition: grfatr.hxx:296
const SwRotationGrf & GetRotationGrf(bool=true) const
Definition: grfatr.hxx:286
SwChannelBGrf(sal_Int16 nVal=0)
Definition: grfatr.hxx:180
virtual SwChannelBGrf * Clone(SfxItemPool *pPool=nullptr) const override
Definition: grfatr.cxx:232
SwChannelGGrf(sal_Int16 nVal=0)
Definition: grfatr.hxx:172
virtual SwChannelGGrf * Clone(SfxItemPool *pPool=nullptr) const override
Definition: grfatr.cxx:227
SwChannelGrf(sal_Int16 nVal, sal_uInt16 nWhichL)
Definition: grfatr.hxx:148
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrdesc.cxx:737
SwChannelRGrf(sal_Int16 nVal=0)
Definition: grfatr.hxx:164
virtual SwChannelRGrf * Clone(SfxItemPool *pPool=nullptr) const override
Definition: grfatr.cxx:222
SwContrastGrf(sal_Int16 nVal=0)
Definition: grfatr.hxx:132
SwDrawModeGrf_Base(GraphicDrawMode nMode)
Definition: grfatr.hxx:253
SwDrawModeGrf(GraphicDrawMode nMode=GraphicDrawMode::Standard)
Definition: grfatr.hxx:260
const double & GetValue() const
Definition: grfatr.hxx:211
double m_nValue
Definition: grfatr.hxx:188
SwGammaGrf()
Definition: grfatr.hxx:190
SwGammaGrf(const double &rVal)
Definition: grfatr.hxx:193
virtual SwInvertGrf * Clone(SfxItemPool *pPool=nullptr) const override
Definition: grfatr.cxx:263
SwInvertGrf(bool bVal=false)
Definition: grfatr.hxx:217
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrdesc.cxx:776
SwLuminanceGrf(sal_Int16 nVal=0)
Definition: grfatr.hxx:116
SwMirrorGrf(MirrorGraph eMiro=MirrorGraph::Dont)
Definition: grfatr.hxx:44
bool IsGrfToggle() const
Definition: grfatr.hxx:65
bool m_bGrfToggle
Definition: grfatr.hxx:41
void SetGrfToggle(bool bNew)
Definition: grfatr.hxx:66
Size m_aUnrotatedSize
Definition: grfatr.hxx:83
const Size & GetUnrotatedSize() const
Definition: grfatr.hxx:108
void SetValue(Degree10 d)
Definition: grfatr.hxx:110
Degree10 GetValue() const
Definition: grfatr.hxx:109
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: grfatr.cxx:275
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: grfatr.cxx:284
SwTransparencyGrf(sal_Int8 nVal=0)
Definition: grfatr.hxx:233
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrdesc.cxx:789
virtual SwTransparencyGrf * Clone(SfxItemPool *pPool=nullptr) const override
Definition: grfatr.cxx:268
MirrorGraph
Definition: grfatr.hxx:32
constexpr TypedWhichId< SwLuminanceGrf > RES_GRFATR_LUMINANCE(144)
constexpr TypedWhichId< SwTransparencyGrf > RES_GRFATR_TRANSPARENCY(151)
constexpr TypedWhichId< SwChannelRGrf > RES_GRFATR_CHANNELR(146)
constexpr TypedWhichId< SwContrastGrf > RES_GRFATR_CONTRAST(145)
constexpr TypedWhichId< SwDrawModeGrf > RES_GRFATR_DRAWMODE(152)
constexpr TypedWhichId< SwChannelBGrf > RES_GRFATR_CHANNELB(148)
constexpr TypedWhichId< SwInvertGrf > RES_GRFATR_INVERT(150)
constexpr TypedWhichId< SwMirrorGrf > RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN)
constexpr TypedWhichId< SwChannelGGrf > RES_GRFATR_CHANNELG(147)
constexpr TypedWhichId< SwRotationGrf > RES_GRFATR_ROTATION(143)
constexpr TypedWhichId< SwCropGrf > RES_GRFATR_CROPGRF(142)
constexpr TypedWhichId< SwGammaGrf > RES_GRFATR_GAMMA(149)
MapUnit
SfxItemPresentation
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
unsigned char sal_uInt8
signed char sal_Int8