update credits
[LibreOffice.git] / sw / inc / grfatr.hxx
blobd4190465e10e13d34e864a353917c98bb99b75a0
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 _GRFATR_HXX
20 #define _GRFATR_HXX
22 #include <hintids.hxx> // For the WhichIds @@@ must be included first @@@
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> // For inlines.
29 #include <format.hxx> // For inlines.
31 /******************************************************************************
32 * class SwMirrorGrf
33 ******************************************************************************/
35 enum MirrorGraph
37 RES_MIRROR_GRAPH_BEGIN,
38 RES_MIRROR_GRAPH_DONT = RES_MIRROR_GRAPH_BEGIN,
39 RES_MIRROR_GRAPH_VERT,
40 RES_MIRROR_GRAPH_HOR,
41 RES_MIRROR_GRAPH_BOTH,
42 RES_MIRROR_GRAPH_END
45 class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
47 sal_Bool bGrfToggle; // Flip graphics on even pages.
49 public:
50 SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
51 : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< sal_uInt16 >(eMiro) ), bGrfToggle( sal_False )
53 SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
54 : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
55 bGrfToggle( rMirrorGrf.IsGrfToggle() )
58 // pure virtual methods of SfxPoolItem
59 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
61 // pure virtual methods of SfxEnumItem
62 virtual sal_uInt16 GetValueCount() const;
63 virtual int operator==( const SfxPoolItem& ) const;
64 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
65 SfxMapUnit eCoreMetric,
66 SfxMapUnit ePresMetric,
67 OUString &rText,
68 const IntlWrapper* pIntl = 0 ) const;
70 virtual bool QueryValue( com::sun::star::uno::Any& rVal,
71 sal_uInt8 nMemberId = 0 ) const;
72 virtual bool PutValue( const com::sun::star::uno::Any& rVal,
73 sal_uInt8 nMemberId = 0 );
75 inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
77 SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
78 bGrfToggle = rMirrorGrf.IsGrfToggle();
79 return *this;
82 inline sal_Bool IsGrfToggle() const { return bGrfToggle; }
83 inline void SetGrfToggle( sal_Bool bNew ) { bGrfToggle = bNew; }
87 /******************************************************************************
88 * class SwAttrCropGrf
89 ******************************************************************************/
91 class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
93 public:
94 TYPEINFO();
95 SwCropGrf();
96 SwCropGrf( sal_Int32 nLeft, sal_Int32 nRight,
97 sal_Int32 nTop, sal_Int32 nBottom );
99 // "pure virtual methods" of SfxPoolItem
100 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
103 class SwRotationGrf : public SfxUInt16Item
105 Size aUnrotatedSize;
106 public:
107 SwRotationGrf( sal_Int16 nVal = 0 )
108 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
110 SwRotationGrf( sal_Int16 nVal, const Size& rSz )
111 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
114 // pure virtual methods from SfxInt16Item
115 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
116 virtual int operator==( const SfxPoolItem& ) const;
117 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
118 SfxMapUnit eCoreMetric,
119 SfxMapUnit ePresMetric,
120 OUString &rText,
121 const IntlWrapper* pIntl = 0 ) const;
122 virtual bool QueryValue( com::sun::star::uno::Any& rVal,
123 sal_uInt8 nMemberId = 0 ) const;
124 virtual bool PutValue( const com::sun::star::uno::Any& rVal,
125 sal_uInt8 nMemberId = 0 );
127 void SetUnrotatedSize( const Size& rSz ) { aUnrotatedSize = rSz; }
128 const Size& GetUnrotatedSize() const { return aUnrotatedSize; }
131 class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
133 public:
134 SwLuminanceGrf( sal_Int16 nVal = 0 )
135 : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
138 // pure virtual methods from SfxInt16Item
139 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
140 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
141 SfxMapUnit eCoreMetric,
142 SfxMapUnit ePresMetric,
143 OUString &rText,
144 const IntlWrapper* pIntl = 0 ) const;
147 class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
149 public:
150 SwContrastGrf( sal_Int16 nVal = 0 )
151 : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
154 // pure virtual methods from SfxInt16Item
155 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
156 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
157 SfxMapUnit eCoreMetric,
158 SfxMapUnit ePresMetric,
159 OUString &rText,
160 const IntlWrapper* pIntl = 0 ) const;
163 class SwChannelGrf : public SfxInt16Item
165 protected:
166 SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL )
167 : SfxInt16Item( nWhichL, nVal )
170 public:
171 // pure virtual methods from SfxInt16Item
172 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
173 SfxMapUnit eCoreMetric,
174 SfxMapUnit ePresMetric,
175 OUString &rText,
176 const IntlWrapper* pIntl = 0 ) const;
179 class SwChannelRGrf : public SwChannelGrf
181 public:
182 SwChannelRGrf( sal_Int16 nVal = 0 )
183 : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
185 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
187 class SwChannelGGrf : public SwChannelGrf
189 public:
190 SwChannelGGrf( sal_Int16 nVal = 0 )
191 : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
193 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
195 class SwChannelBGrf : public SwChannelGrf
197 public:
198 SwChannelBGrf( sal_Int16 nVal = 0 )
199 : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
201 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
204 class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
206 double nValue;
207 public:
208 TYPEINFO();
209 SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
212 SwGammaGrf( const double& rVal )
213 : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
216 inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
218 SetValue( rCopy.GetValue() );
219 return *this;
222 // pure virtual methods from SfxEnumItem
223 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
224 virtual int operator==( const SfxPoolItem& ) const;
225 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
226 SfxMapUnit eCoreMetric,
227 SfxMapUnit ePresMetric,
228 OUString &rText,
229 const IntlWrapper* pIntl = 0 ) const;
231 virtual bool QueryValue( com::sun::star::uno::Any& rVal,
232 sal_uInt8 nMemberId = 0 ) const;
233 virtual bool PutValue( const com::sun::star::uno::Any& rVal,
234 sal_uInt8 nMemberId = 0 );
237 const double& GetValue() const { return nValue; }
238 void SetValue( const double& rVal ) { nValue = rVal; }
241 class SwInvertGrf: public SfxBoolItem
243 public:
244 SwInvertGrf( sal_Bool bVal = sal_False )
245 : SfxBoolItem( RES_GRFATR_INVERT, bVal )
248 // pure virtual methods from SfxInt16Item
249 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
250 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
251 SfxMapUnit eCoreMetric,
252 SfxMapUnit ePresMetric,
253 OUString &rText,
254 const IntlWrapper* pIntl = 0 ) const;
257 class SwTransparencyGrf : public SfxByteItem
259 public:
260 SwTransparencyGrf( sal_Int8 nVal = 0 )
261 : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
264 // pure virtual methods from SfxInt16Item
265 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
266 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
267 SfxMapUnit eCoreMetric,
268 SfxMapUnit ePresMetric,
269 OUString &rText,
270 const IntlWrapper* pIntl = 0 ) const;
271 virtual bool QueryValue( com::sun::star::uno::Any& rVal,
272 sal_uInt8 nMemberId = 0 ) const;
273 virtual bool PutValue( const com::sun::star::uno::Any& rVal,
274 sal_uInt8 nMemberId = 0 );
277 class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
279 public:
280 SwDrawModeGrf( sal_uInt16 nMode = 0 )
281 : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
284 // pure virtual methods of SfxPoolItem
285 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
287 // pure virtual methods of SfxEnumItem
288 virtual sal_uInt16 GetValueCount() const;
289 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
290 SfxMapUnit eCoreMetric,
291 SfxMapUnit ePresMetric,
292 OUString &rText,
293 const IntlWrapper* pIntl = 0 ) const;
295 virtual bool QueryValue( com::sun::star::uno::Any& rVal,
296 sal_uInt8 nMemberId = 0 ) const;
297 virtual bool PutValue( const com::sun::star::uno::Any& rVal,
298 sal_uInt8 nMemberId = 0 );
303 /******************************************************************************
304 * Implementation of graphics attributes methods of SwAttr
305 ******************************************************************************/
307 inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(sal_Bool bInP) const
308 { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
309 inline const SwCropGrf &SwAttrSet::GetCropGrf(sal_Bool bInP) const
310 { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
311 inline const SwRotationGrf &SwAttrSet::GetRotationGrf(sal_Bool bInP) const
312 { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
313 inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(sal_Bool bInP) const
314 { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
315 inline const SwContrastGrf &SwAttrSet::GetContrastGrf(sal_Bool bInP) const
316 { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
317 inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(sal_Bool bInP) const
318 { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
319 inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(sal_Bool bInP) const
320 { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
321 inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(sal_Bool bInP) const
322 { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
323 inline const SwGammaGrf &SwAttrSet::GetGammaGrf(sal_Bool bInP) const
324 { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
325 inline const SwInvertGrf &SwAttrSet::GetInvertGrf(sal_Bool bInP) const
326 { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
327 inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(sal_Bool bInP) const
328 { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
329 inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(sal_Bool bInP) const
330 { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
332 /******************************************************************************
333 * Implementation of graphics attributes methods of SwFmt
334 ******************************************************************************/
336 inline const SwMirrorGrf &SwFmt::GetMirrorGrf(sal_Bool bInP) const
337 { return aSet.GetMirrorGrf(bInP); }
338 inline const SwCropGrf &SwFmt::GetCropGrf(sal_Bool bInP) const
339 { return aSet.GetCropGrf(bInP); }
340 inline const SwRotationGrf &SwFmt::GetRotationGrf(sal_Bool bInP) const
341 { return aSet.GetRotationGrf(bInP); }
342 inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(sal_Bool bInP) const
343 { return aSet.GetLuminanceGrf( bInP); }
344 inline const SwContrastGrf &SwFmt::GetContrastGrf(sal_Bool bInP) const
345 { return aSet.GetContrastGrf( bInP); }
346 inline const SwChannelRGrf &SwFmt::GetChannelRGrf(sal_Bool bInP) const
347 { return aSet.GetChannelRGrf( bInP); }
348 inline const SwChannelGGrf &SwFmt::GetChannelGGrf(sal_Bool bInP) const
349 { return aSet.GetChannelGGrf( bInP); }
350 inline const SwChannelBGrf &SwFmt::GetChannelBGrf(sal_Bool bInP) const
351 { return aSet.GetChannelBGrf( bInP); }
352 inline const SwGammaGrf &SwFmt::GetGammaGrf(sal_Bool bInP) const
353 { return aSet.GetGammaGrf( bInP); }
354 inline const SwInvertGrf &SwFmt::GetInvertGrf(sal_Bool bInP) const
355 { return aSet.GetInvertGrf( bInP); }
356 inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(sal_Bool bInP) const
357 { return aSet.GetTransparencyGrf( bInP); }
358 inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(sal_Bool bInP) const
359 { return aSet.GetDrawModeGrf(bInP); }
362 #endif // _GRFATR_HXX
364 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */