merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / grfatr.hxx
blob9f52a00675a8af456c2a6dc2d6c0b4e2dd491913
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: grfatr.hxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _GRFATR_HXX
31 #define _GRFATR_HXX
33 #include <hintids.hxx> // fuer die WhichIds @@@ must be included first @@@
34 #include <tools/gen.hxx>
35 #include <svtools/eitem.hxx>
36 #include <svtools/intitem.hxx>
37 #include <svx/grfcrop.hxx>
38 #include "swdllapi.h"
39 #include <swatrset.hxx> // fuer inlines
40 #include <format.hxx> // fuer inlines
42 /******************************************************************************
43 * class SwMirrorGrf
44 ******************************************************************************/
46 enum MirrorGraph
48 RES_MIRROR_GRAPH_BEGIN,
49 RES_MIRROR_GRAPH_DONT = RES_MIRROR_GRAPH_BEGIN,
50 RES_MIRROR_GRAPH_VERT,
51 RES_MIRROR_GRAPH_HOR,
52 RES_MIRROR_GRAPH_BOTH,
53 RES_MIRROR_GRAPH_END
56 class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
58 BOOL bGrfToggle; // auf geraden Seiten Grafiken spiegeln
60 public:
61 SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
62 : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< USHORT >(eMiro) ), bGrfToggle( sal_False )
64 SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
65 : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
66 bGrfToggle( rMirrorGrf.IsGrfToggle() )
69 // pure virtual-Methoden von SfxPoolItem
70 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
72 // pure virtual-Methiden von SfxEnumItem
73 virtual USHORT GetValueCount() const;
74 virtual int operator==( const SfxPoolItem& ) const;
75 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
76 SfxMapUnit eCoreMetric,
77 SfxMapUnit ePresMetric,
78 String &rText,
79 const IntlWrapper* pIntl = 0 ) const;
81 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
82 BYTE nMemberId = 0 ) const;
83 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
84 BYTE nMemberId = 0 );
86 inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
88 SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
89 bGrfToggle = rMirrorGrf.IsGrfToggle();
90 return *this;
93 inline BOOL IsGrfToggle() const { return bGrfToggle; }
94 inline void SetGrfToggle( BOOL bNew ) { bGrfToggle = bNew; }
98 /******************************************************************************
99 * class SwAttrCropGrf
100 ******************************************************************************/
102 class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
104 public:
105 TYPEINFO();
106 SwCropGrf();
107 SwCropGrf( sal_Int32 nLeft, sal_Int32 nRight,
108 sal_Int32 nTop, sal_Int32 nBottom );
110 // "pure virtual Methoden" vom SfxPoolItem
111 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
114 class SwRotationGrf : public SfxUInt16Item
116 Size aUnrotatedSize;
117 public:
118 SwRotationGrf( sal_Int16 nVal = 0 )
119 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
121 SwRotationGrf( sal_Int16 nVal, const Size& rSz )
122 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
125 // pure virtual-Methiden from SfxInt16Item
126 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
127 virtual int operator==( const SfxPoolItem& ) const;
128 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
129 SfxMapUnit eCoreMetric,
130 SfxMapUnit ePresMetric,
131 String &rText,
132 const IntlWrapper* pIntl = 0 ) const;
133 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
134 BYTE nMemberId = 0 ) const;
135 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
136 BYTE nMemberId = 0 );
138 void SetUnrotatedSize( const Size& rSz ) { aUnrotatedSize = rSz; }
139 const Size& GetUnrotatedSize() const { return aUnrotatedSize; }
142 class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
144 public:
145 SwLuminanceGrf( sal_Int16 nVal = 0 )
146 : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
149 // pure virtual-Methiden from SfxInt16Item
150 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
151 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
152 SfxMapUnit eCoreMetric,
153 SfxMapUnit ePresMetric,
154 String &rText,
155 const IntlWrapper* pIntl = 0 ) const;
158 class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
160 public:
161 SwContrastGrf( sal_Int16 nVal = 0 )
162 : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
165 // pure virtual-Methiden from SfxInt16Item
166 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
167 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
168 SfxMapUnit eCoreMetric,
169 SfxMapUnit ePresMetric,
170 String &rText,
171 const IntlWrapper* pIntl = 0 ) const;
174 class SwChannelGrf : public SfxInt16Item
176 protected:
177 SwChannelGrf( sal_Int16 nVal, USHORT nWhichL )
178 : SfxInt16Item( nWhichL, nVal )
181 public:
182 // pure virtual-Methiden from SfxInt16Item
183 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
184 SfxMapUnit eCoreMetric,
185 SfxMapUnit ePresMetric,
186 String &rText,
187 const IntlWrapper* pIntl = 0 ) const;
190 class SwChannelRGrf : public SwChannelGrf
192 public:
193 SwChannelRGrf( sal_Int16 nVal = 0 )
194 : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
196 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
198 class SwChannelGGrf : public SwChannelGrf
200 public:
201 SwChannelGGrf( sal_Int16 nVal = 0 )
202 : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
204 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
206 class SwChannelBGrf : public SwChannelGrf
208 public:
209 SwChannelBGrf( sal_Int16 nVal = 0 )
210 : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
212 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
215 class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
217 double nValue;
218 public:
219 TYPEINFO();
220 SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
223 SwGammaGrf( const double& rVal )
224 : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
227 inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
229 SetValue( rCopy.GetValue() );
230 return *this;
233 // pure virtual-Methiden von SfxEnumItem
234 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
235 virtual int operator==( const SfxPoolItem& ) const;
236 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
237 SfxMapUnit eCoreMetric,
238 SfxMapUnit ePresMetric,
239 String &rText,
240 const IntlWrapper* pIntl = 0 ) const;
242 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
243 BYTE nMemberId = 0 ) const;
244 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
245 BYTE nMemberId = 0 );
248 const double& GetValue() const { return nValue; }
249 void SetValue( const double& rVal ) { nValue = rVal; }
252 class SwInvertGrf: public SfxBoolItem
254 public:
255 SwInvertGrf( sal_Bool bVal = sal_False )
256 : SfxBoolItem( RES_GRFATR_INVERT, bVal )
259 // pure virtual-Methiden from SfxInt16Item
260 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
261 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
262 SfxMapUnit eCoreMetric,
263 SfxMapUnit ePresMetric,
264 String &rText,
265 const IntlWrapper* pIntl = 0 ) const;
268 class SwTransparencyGrf : public SfxByteItem
270 public:
271 SwTransparencyGrf( sal_Int8 nVal = 0 )
272 : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
275 // pure virtual-Methiden from SfxInt16Item
276 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
277 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
278 SfxMapUnit eCoreMetric,
279 SfxMapUnit ePresMetric,
280 String &rText,
281 const IntlWrapper* pIntl = 0 ) const;
282 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
283 BYTE nMemberId = 0 ) const;
284 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
285 BYTE nMemberId = 0 );
288 class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
290 public:
291 SwDrawModeGrf( USHORT nMode = 0 )
292 : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
295 // pure virtual-Methoden von SfxPoolItem
296 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
298 // pure virtual-Methiden von SfxEnumItem
299 virtual USHORT GetValueCount() const;
300 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
301 SfxMapUnit eCoreMetric,
302 SfxMapUnit ePresMetric,
303 String &rText,
304 const IntlWrapper* pIntl = 0 ) const;
306 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
307 BYTE nMemberId = 0 ) const;
308 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
309 BYTE nMemberId = 0 );
314 /******************************************************************************
315 * Implementierung der GrafikAttribut Methoden vom SwAttrSet
316 ******************************************************************************/
318 inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(BOOL bInP) const
319 { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
320 inline const SwCropGrf &SwAttrSet::GetCropGrf(BOOL bInP) const
321 { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
322 inline const SwRotationGrf &SwAttrSet::GetRotationGrf(BOOL bInP) const
323 { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
324 inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(BOOL bInP) const
325 { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
326 inline const SwContrastGrf &SwAttrSet::GetContrastGrf(BOOL bInP) const
327 { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
328 inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(BOOL bInP) const
329 { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
330 inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(BOOL bInP) const
331 { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
332 inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(BOOL bInP) const
333 { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
334 inline const SwGammaGrf &SwAttrSet::GetGammaGrf(BOOL bInP) const
335 { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
336 inline const SwInvertGrf &SwAttrSet::GetInvertGrf(BOOL bInP) const
337 { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
338 inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(BOOL bInP) const
339 { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
340 inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(BOOL bInP) const
341 { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
343 /******************************************************************************
344 * Implementierung der GrafikAttribut Methoden vom SwFmt
345 ******************************************************************************/
347 inline const SwMirrorGrf &SwFmt::GetMirrorGrf(BOOL bInP) const
348 { return aSet.GetMirrorGrf(bInP); }
349 inline const SwCropGrf &SwFmt::GetCropGrf(BOOL bInP) const
350 { return aSet.GetCropGrf(bInP); }
351 inline const SwRotationGrf &SwFmt::GetRotationGrf(BOOL bInP) const
352 { return aSet.GetRotationGrf(bInP); }
353 inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(BOOL bInP) const
354 { return aSet.GetLuminanceGrf( bInP); }
355 inline const SwContrastGrf &SwFmt::GetContrastGrf(BOOL bInP) const
356 { return aSet.GetContrastGrf( bInP); }
357 inline const SwChannelRGrf &SwFmt::GetChannelRGrf(BOOL bInP) const
358 { return aSet.GetChannelRGrf( bInP); }
359 inline const SwChannelGGrf &SwFmt::GetChannelGGrf(BOOL bInP) const
360 { return aSet.GetChannelGGrf( bInP); }
361 inline const SwChannelBGrf &SwFmt::GetChannelBGrf(BOOL bInP) const
362 { return aSet.GetChannelBGrf( bInP); }
363 inline const SwGammaGrf &SwFmt::GetGammaGrf(BOOL bInP) const
364 { return aSet.GetGammaGrf( bInP); }
365 inline const SwInvertGrf &SwFmt::GetInvertGrf(BOOL bInP) const
366 { return aSet.GetInvertGrf( bInP); }
367 inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(BOOL bInP) const
368 { return aSet.GetTransparencyGrf( bInP); }
369 inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(BOOL bInP) const
370 { return aSet.GetDrawModeGrf(bInP); }
373 #endif // _GRFATR_HXX