Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / grfatr.hxx
blob3b7fed9b6df67579da496f9de0457fe9abd5d11f
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 .
19 #ifndef INCLUDED_SW_INC_GRFATR_HXX
20 #define INCLUDED_SW_INC_GRFATR_HXX
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>
31 enum MirrorGraph
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
41 class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
43 bool bGrfToggle; // Flip graphics on even pages.
45 public:
46 SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
47 : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< sal_uInt16 >(eMiro) ), bGrfToggle( false )
49 SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
50 : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
51 bGrfToggle( rMirrorGrf.IsGrfToggle() )
54 // pure virtual methods of SfxPoolItem
55 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
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;
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;
71 inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
73 SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
74 bGrfToggle = rMirrorGrf.IsGrfToggle();
75 return *this;
78 inline bool IsGrfToggle() const { return bGrfToggle; }
79 inline void SetGrfToggle( bool bNew ) { bGrfToggle = bNew; }
82 class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
84 public:
85 TYPEINFO_OVERRIDE();
86 SwCropGrf();
87 SwCropGrf( sal_Int32 nLeft, sal_Int32 nRight,
88 sal_Int32 nTop, sal_Int32 nBottom );
90 // "pure virtual methods" of SfxPoolItem
91 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
94 class SwRotationGrf : public SfxUInt16Item
96 Size aUnrotatedSize;
97 public:
98 SwRotationGrf( sal_Int16 nVal = 0 )
99 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
101 SwRotationGrf( sal_Int16 nVal, const Size& rSz )
102 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
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;
118 void SetUnrotatedSize( const Size& rSz ) { aUnrotatedSize = rSz; }
119 const Size& GetUnrotatedSize() const { return aUnrotatedSize; }
122 class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
124 public:
125 SwLuminanceGrf( sal_Int16 nVal = 0 )
126 : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
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;
138 class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
140 public:
141 SwContrastGrf( sal_Int16 nVal = 0 )
142 : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
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;
154 class SwChannelGrf : public SfxInt16Item
156 protected:
157 SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL )
158 : SfxInt16Item( nWhichL, nVal )
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;
170 class SwChannelRGrf : public SwChannelGrf
172 public:
173 SwChannelRGrf( sal_Int16 nVal = 0 )
174 : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
176 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
178 class SwChannelGGrf : public SwChannelGrf
180 public:
181 SwChannelGGrf( sal_Int16 nVal = 0 )
182 : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
184 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
186 class SwChannelBGrf : public SwChannelGrf
188 public:
189 SwChannelBGrf( sal_Int16 nVal = 0 )
190 : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
192 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
195 class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
197 double nValue;
198 public:
199 TYPEINFO_OVERRIDE();
200 SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
203 SwGammaGrf( const double& rVal )
204 : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
207 inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
209 SetValue( rCopy.GetValue() );
210 return *this;
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;
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;
227 const double& GetValue() const { return nValue; }
228 void SetValue( const double& rVal ) { nValue = rVal; }
231 class SwInvertGrf: public SfxBoolItem
233 public:
234 SwInvertGrf( bool bVal = false )
235 : SfxBoolItem( RES_GRFATR_INVERT, bVal )
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;
247 class SwTransparencyGrf : public SfxByteItem
249 public:
250 SwTransparencyGrf( sal_Int8 nVal = 0 )
251 : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
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;
267 class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
269 public:
270 SwDrawModeGrf( sal_uInt16 nMode = 0 )
271 : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
274 // pure virtual methods of SfxPoolItem
275 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
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;
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;
291 // Implementation of graphics attributes methods of SwAttr
292 inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(bool bInP) const
293 { return static_cast<const SwMirrorGrf&>(Get( RES_GRFATR_MIRRORGRF,bInP)); }
294 inline const SwCropGrf &SwAttrSet::GetCropGrf(bool bInP) const
295 { return static_cast<const SwCropGrf&>(Get( RES_GRFATR_CROPGRF,bInP)); }
296 inline const SwRotationGrf &SwAttrSet::GetRotationGrf(bool bInP) const
297 { return static_cast<const SwRotationGrf&>(Get( RES_GRFATR_ROTATION,bInP)); }
298 inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(bool bInP) const
299 { return static_cast<const SwLuminanceGrf&>(Get( RES_GRFATR_LUMINANCE,bInP)); }
300 inline const SwContrastGrf &SwAttrSet::GetContrastGrf(bool bInP) const
301 { return static_cast<const SwContrastGrf&>(Get( RES_GRFATR_CONTRAST,bInP)); }
302 inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(bool bInP) const
303 { return static_cast<const SwChannelRGrf&>(Get( RES_GRFATR_CHANNELR,bInP)); }
304 inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(bool bInP) const
305 { return static_cast<const SwChannelGGrf&>(Get( RES_GRFATR_CHANNELG,bInP)); }
306 inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(bool bInP) const
307 { return static_cast<const SwChannelBGrf&>(Get( RES_GRFATR_CHANNELB,bInP)); }
308 inline const SwGammaGrf &SwAttrSet::GetGammaGrf(bool bInP) const
309 { return static_cast<const SwGammaGrf&>(Get( RES_GRFATR_GAMMA,bInP)); }
310 inline const SwInvertGrf &SwAttrSet::GetInvertGrf(bool bInP) const
311 { return static_cast<const SwInvertGrf&>(Get( RES_GRFATR_INVERT,bInP)); }
312 inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(bool bInP) const
313 { return static_cast<const SwTransparencyGrf&>(Get( RES_GRFATR_TRANSPARENCY,bInP)); }
314 inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(bool bInP) const
315 { return static_cast<const SwDrawModeGrf&>(Get( RES_GRFATR_DRAWMODE,bInP)); }
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); }
343 #endif // INCLUDED_SW_INC_GRFATR_HXX
345 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */