Line data Source code
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>
26 : #include <svx/grfcrop.hxx>
27 : #include "swdllapi.h"
28 : #include <swatrset.hxx>
29 : #include <format.hxx>
30 :
31 : enum MirrorGraph
32 : {
33 : RES_MIRROR_GRAPH_BEGIN,
34 : RES_MIRROR_GRAPH_DONT = RES_MIRROR_GRAPH_BEGIN,
35 : RES_MIRROR_GRAPH_VERT,
36 : RES_MIRROR_GRAPH_HOR,
37 : RES_MIRROR_GRAPH_BOTH,
38 : RES_MIRROR_GRAPH_END
39 : };
40 :
41 334 : class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
42 : {
43 : bool bGrfToggle; // Flip graphics on even pages.
44 :
45 : public:
46 59 : SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
47 59 : : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< sal_uInt16 >(eMiro) ), bGrfToggle( false )
48 59 : {}
49 144 : SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
50 144 : : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
51 144 : bGrfToggle( rMirrorGrf.IsGrfToggle() )
52 144 : {}
53 :
54 : // pure virtual methods of SfxPoolItem
55 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
56 :
57 : // pure virtual methods of SfxEnumItem
58 : virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE;
59 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
60 : virtual bool GetPresentation( SfxItemPresentation ePres,
61 : SfxMapUnit eCoreMetric,
62 : SfxMapUnit ePresMetric,
63 : OUString &rText,
64 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
65 :
66 : virtual bool QueryValue( com::sun::star::uno::Any& rVal,
67 : sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
68 : virtual bool PutValue( const com::sun::star::uno::Any& rVal,
69 : sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
70 :
71 : inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
72 : {
73 : SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
74 : bGrfToggle = rMirrorGrf.IsGrfToggle();
75 : return *this;
76 : }
77 :
78 515 : inline bool IsGrfToggle() const { return bGrfToggle; }
79 144 : inline void SetGrfToggle( bool bNew ) { bGrfToggle = bNew; }
80 : };
81 :
82 2428 : class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
83 : {
84 : public:
85 : TYPEINFO_OVERRIDE();
86 : SwCropGrf();
87 : SwCropGrf( sal_Int32 nLeft, sal_Int32 nRight,
88 : sal_Int32 nTop, sal_Int32 nBottom );
89 :
90 : // "pure virtual methods" of SfxPoolItem
91 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
92 : };
93 :
94 704 : class SwRotationGrf : public SfxUInt16Item
95 : {
96 : Size aUnrotatedSize;
97 : public:
98 59 : SwRotationGrf( sal_Int16 nVal = 0 )
99 59 : : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
100 59 : {}
101 293 : SwRotationGrf( sal_Int16 nVal, const Size& rSz )
102 293 : : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
103 293 : {}
104 :
105 : // pure virtual methods from SfxInt16Item
106 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
107 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
108 : virtual bool GetPresentation( SfxItemPresentation ePres,
109 : SfxMapUnit eCoreMetric,
110 : SfxMapUnit ePresMetric,
111 : OUString &rText,
112 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
113 : virtual bool QueryValue( com::sun::star::uno::Any& rVal,
114 : sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
115 : virtual bool PutValue( const com::sun::star::uno::Any& rVal,
116 : sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
117 :
118 : void SetUnrotatedSize( const Size& rSz ) { aUnrotatedSize = rSz; }
119 632 : const Size& GetUnrotatedSize() const { return aUnrotatedSize; }
120 : };
121 :
122 2371 : class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
123 : {
124 : public:
125 59 : SwLuminanceGrf( sal_Int16 nVal = 0 )
126 59 : : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
127 59 : {}
128 :
129 : // pure virtual methods from SfxInt16Item
130 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
131 : virtual bool GetPresentation( SfxItemPresentation ePres,
132 : SfxMapUnit eCoreMetric,
133 : SfxMapUnit ePresMetric,
134 : OUString &rText,
135 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
136 : };
137 :
138 2371 : class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
139 : {
140 : public:
141 59 : SwContrastGrf( sal_Int16 nVal = 0 )
142 59 : : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
143 59 : {}
144 :
145 : // pure virtual methods from SfxInt16Item
146 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
147 : virtual bool GetPresentation( SfxItemPresentation ePres,
148 : SfxMapUnit eCoreMetric,
149 : SfxMapUnit ePresMetric,
150 : OUString &rText,
151 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
152 : };
153 :
154 1041 : class SwChannelGrf : public SfxInt16Item
155 : {
156 : protected:
157 177 : SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL )
158 177 : : SfxInt16Item( nWhichL, nVal )
159 177 : {}
160 :
161 : public:
162 : // pure virtual methods from SfxInt16Item
163 : virtual bool GetPresentation( SfxItemPresentation ePres,
164 : SfxMapUnit eCoreMetric,
165 : SfxMapUnit ePresMetric,
166 : OUString &rText,
167 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
168 : };
169 :
170 550 : class SwChannelRGrf : public SwChannelGrf
171 : {
172 : public:
173 59 : SwChannelRGrf( sal_Int16 nVal = 0 )
174 59 : : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
175 59 : {}
176 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
177 : };
178 550 : class SwChannelGGrf : public SwChannelGrf
179 : {
180 : public:
181 59 : SwChannelGGrf( sal_Int16 nVal = 0 )
182 59 : : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
183 59 : {}
184 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
185 : };
186 550 : class SwChannelBGrf : public SwChannelGrf
187 : {
188 : public:
189 59 : SwChannelBGrf( sal_Int16 nVal = 0 )
190 59 : : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
191 59 : {}
192 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
193 : };
194 :
195 687 : class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
196 : {
197 : double nValue;
198 : public:
199 : TYPEINFO_OVERRIDE();
200 59 : SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
201 59 : {}
202 :
203 26 : SwGammaGrf( const double& rVal )
204 26 : : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
205 26 : {}
206 :
207 : inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
208 : {
209 : SetValue( rCopy.GetValue() );
210 : return *this;
211 : }
212 :
213 : // pure virtual methods from SfxEnumItem
214 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
215 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
216 : virtual bool GetPresentation( SfxItemPresentation ePres,
217 : SfxMapUnit eCoreMetric,
218 : SfxMapUnit ePresMetric,
219 : OUString &rText,
220 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
221 :
222 : virtual bool QueryValue( com::sun::star::uno::Any& rVal,
223 : sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
224 : virtual bool PutValue( const com::sun::star::uno::Any& rVal,
225 : sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
226 :
227 206 : const double& GetValue() const { return nValue; }
228 : void SetValue( const double& rVal ) { nValue = rVal; }
229 : };
230 :
231 550 : class SwInvertGrf: public SfxBoolItem
232 : {
233 : public:
234 59 : SwInvertGrf( bool bVal = false )
235 59 : : SfxBoolItem( RES_GRFATR_INVERT, bVal )
236 59 : {}
237 :
238 : // pure virtual methods from SfxInt16Item
239 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
240 : virtual bool GetPresentation( SfxItemPresentation ePres,
241 : SfxMapUnit eCoreMetric,
242 : SfxMapUnit ePresMetric,
243 : OUString &rText,
244 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
245 : };
246 :
247 550 : class SwTransparencyGrf : public SfxByteItem
248 : {
249 : public:
250 59 : SwTransparencyGrf( sal_Int8 nVal = 0 )
251 59 : : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
252 59 : {}
253 :
254 : // pure virtual methods from SfxInt16Item
255 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
256 : virtual bool GetPresentation( SfxItemPresentation ePres,
257 : SfxMapUnit eCoreMetric,
258 : SfxMapUnit ePresMetric,
259 : OUString &rText,
260 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
261 : virtual bool QueryValue( com::sun::star::uno::Any& rVal,
262 : sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
263 : virtual bool PutValue( const com::sun::star::uno::Any& rVal,
264 : sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
265 : };
266 :
267 595 : class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
268 : {
269 : public:
270 59 : SwDrawModeGrf( sal_uInt16 nMode = 0 )
271 59 : : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
272 59 : {}
273 :
274 : // pure virtual methods of SfxPoolItem
275 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
276 :
277 : // pure virtual methods of SfxEnumItem
278 : virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE;
279 : virtual bool GetPresentation( SfxItemPresentation ePres,
280 : SfxMapUnit eCoreMetric,
281 : SfxMapUnit ePresMetric,
282 : OUString &rText,
283 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
284 :
285 : virtual bool QueryValue( com::sun::star::uno::Any& rVal,
286 : sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
287 : virtual bool PutValue( const com::sun::star::uno::Any& rVal,
288 : sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
289 : };
290 :
291 : // Implementation of graphics attributes methods of SwAttr
292 122 : inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(bool bInP) const
293 122 : { return static_cast<const SwMirrorGrf&>(Get( RES_GRFATR_MIRRORGRF,bInP)); }
294 107 : inline const SwCropGrf &SwAttrSet::GetCropGrf(bool bInP) const
295 107 : { return static_cast<const SwCropGrf&>(Get( RES_GRFATR_CROPGRF,bInP)); }
296 101 : inline const SwRotationGrf &SwAttrSet::GetRotationGrf(bool bInP) const
297 101 : { return static_cast<const SwRotationGrf&>(Get( RES_GRFATR_ROTATION,bInP)); }
298 101 : inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(bool bInP) const
299 101 : { return static_cast<const SwLuminanceGrf&>(Get( RES_GRFATR_LUMINANCE,bInP)); }
300 101 : inline const SwContrastGrf &SwAttrSet::GetContrastGrf(bool bInP) const
301 101 : { return static_cast<const SwContrastGrf&>(Get( RES_GRFATR_CONTRAST,bInP)); }
302 101 : inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(bool bInP) const
303 101 : { return static_cast<const SwChannelRGrf&>(Get( RES_GRFATR_CHANNELR,bInP)); }
304 101 : inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(bool bInP) const
305 101 : { return static_cast<const SwChannelGGrf&>(Get( RES_GRFATR_CHANNELG,bInP)); }
306 101 : inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(bool bInP) const
307 101 : { return static_cast<const SwChannelBGrf&>(Get( RES_GRFATR_CHANNELB,bInP)); }
308 101 : inline const SwGammaGrf &SwAttrSet::GetGammaGrf(bool bInP) const
309 101 : { return static_cast<const SwGammaGrf&>(Get( RES_GRFATR_GAMMA,bInP)); }
310 101 : inline const SwInvertGrf &SwAttrSet::GetInvertGrf(bool bInP) const
311 101 : { return static_cast<const SwInvertGrf&>(Get( RES_GRFATR_INVERT,bInP)); }
312 148 : inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(bool bInP) const
313 148 : { return static_cast<const SwTransparencyGrf&>(Get( RES_GRFATR_TRANSPARENCY,bInP)); }
314 101 : inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(bool bInP) const
315 101 : { return static_cast<const SwDrawModeGrf&>(Get( RES_GRFATR_DRAWMODE,bInP)); }
316 :
317 : // Implementation of graphics attributes methods of SwFormat
318 : inline const SwMirrorGrf &SwFormat::GetMirrorGrf(bool bInP) const
319 : { return m_aSet.GetMirrorGrf(bInP); }
320 : inline const SwCropGrf &SwFormat::GetCropGrf(bool bInP) const
321 : { return m_aSet.GetCropGrf(bInP); }
322 : inline const SwRotationGrf &SwFormat::GetRotationGrf(bool bInP) const
323 : { return m_aSet.GetRotationGrf(bInP); }
324 : inline const SwLuminanceGrf &SwFormat::GetLuminanceGrf(bool bInP) const
325 : { return m_aSet.GetLuminanceGrf( bInP); }
326 : inline const SwContrastGrf &SwFormat::GetContrastGrf(bool bInP) const
327 : { return m_aSet.GetContrastGrf( bInP); }
328 : inline const SwChannelRGrf &SwFormat::GetChannelRGrf(bool bInP) const
329 : { return m_aSet.GetChannelRGrf( bInP); }
330 : inline const SwChannelGGrf &SwFormat::GetChannelGGrf(bool bInP) const
331 : { return m_aSet.GetChannelGGrf( bInP); }
332 : inline const SwChannelBGrf &SwFormat::GetChannelBGrf(bool bInP) const
333 : { return m_aSet.GetChannelBGrf( bInP); }
334 : inline const SwGammaGrf &SwFormat::GetGammaGrf(bool bInP) const
335 : { return m_aSet.GetGammaGrf( bInP); }
336 : inline const SwInvertGrf &SwFormat::GetInvertGrf(bool bInP) const
337 : { return m_aSet.GetInvertGrf( bInP); }
338 : inline const SwTransparencyGrf &SwFormat::GetTransparencyGrf(bool bInP) const
339 : { return m_aSet.GetTransparencyGrf( bInP); }
340 : inline const SwDrawModeGrf &SwFormat::GetDrawModeGrf(bool bInP) const
341 : { return m_aSet.GetDrawModeGrf(bInP); }
342 :
343 : #endif // INCLUDED_SW_INC_GRFATR_HXX
344 :
345 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|