Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sw / grfatr.hxx
blob5a231cd205d32c9373a728628593581436370487
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.10 $
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 #ifndef _HINTIDS_HXX
34 #include <hintids.hxx> // fuer die WhichIds
35 #endif
37 #ifndef _SV_GEN_HXX
38 #include <tools/gen.hxx>
39 #endif
40 #ifndef _SFXENUMITEM_HXX
41 #include <bf_svtools/eitem.hxx>
42 #endif
43 #ifndef _SFXINTITEM_HXX
44 #include <bf_svtools/intitem.hxx>
45 #endif
46 #ifndef _SVX_GRFCROP_HXX
47 #include <bf_svx/grfcrop.hxx>
48 #endif
50 #ifndef _SWATRSET_HXX
51 #include <swatrset.hxx> // fuer inlines
52 #endif
53 #ifndef _FORMAT_HXX
54 #include <format.hxx> // fuer inlines
55 #endif
56 namespace binfilter {
58 /******************************************************************************
59 * class SwMirrorGrf
60 ******************************************************************************/
62 enum GRFMIRROR
64 RES_GRFMIRROR_BEGIN,
65 RES_DONT_MIRROR_GRF = RES_GRFMIRROR_BEGIN,
66 RES_MIRROR_GRF_VERT,
67 RES_MIRROR_GRF_HOR,
68 RES_MIRROR_GRF_BOTH,
69 RES_GRFMIRROR_END
72 class SwMirrorGrf : public SfxEnumItem
74 BOOL bGrfToggle; // auf geraden Seiten Grafiken spiegeln
76 public:
77 SwMirrorGrf( USHORT nMiro = RES_DONT_MIRROR_GRF )
78 : SfxEnumItem( RES_GRFATR_MIRRORGRF, nMiro ), bGrfToggle( sal_False )
80 SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
81 : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
82 bGrfToggle( rMirrorGrf.IsGrfToggle() )
85 // pure virtual-Methoden von SfxPoolItem
86 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
88 // pure virtual-Methiden von SfxEnumItem
89 virtual USHORT GetValueCount() const;
90 virtual USHORT GetVersion( USHORT nFFVer ) const;
91 virtual SfxPoolItem* Create(SvStream &, USHORT nVer ) const;
92 virtual SvStream& Store(SvStream &, USHORT nIVer) const;
93 virtual int operator==( const SfxPoolItem& ) const;
95 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal,
96 BYTE nMemberId = 0 ) const;
97 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal,
98 BYTE nMemberId = 0 );
100 inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
102 SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
103 bGrfToggle = rMirrorGrf.IsGrfToggle();
104 return *this;
107 inline BOOL IsGrfToggle() const { return bGrfToggle; }
108 inline void SetGrfToggle( BOOL bNew ) { bGrfToggle = bNew; }
112 /******************************************************************************
113 * class SwAttrCropGrf
114 ******************************************************************************/
116 class SwCropGrf : public SvxGrfCrop
118 public:
119 TYPEINFO();
120 SwCropGrf();
121 SwCropGrf( sal_Int32 nLeft, sal_Int32 nRight,
122 sal_Int32 nTop, sal_Int32 nBottom );
124 // "pure virtual Methoden" vom SfxPoolItem
125 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
126 virtual USHORT GetVersion( USHORT nFileVersion ) const;
129 class SwRotationGrf : public SfxUInt16Item
131 Size aUnrotatedSize;
132 public:
133 SwRotationGrf( sal_Int16 nVal = 0 )
134 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
136 SwRotationGrf( sal_Int16 nVal, const Size& rSz )
137 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
140 // pure virtual-Methiden from SfxInt16Item
141 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
142 virtual USHORT GetVersion( USHORT nFFVer ) const;
143 virtual SfxPoolItem* Create(SvStream &, USHORT nVer ) const;
144 virtual SvStream& Store(SvStream &, USHORT nIVer) const;
145 virtual int operator==( const SfxPoolItem& ) const;
146 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal,
147 BYTE nMemberId = 0 ) const;
148 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal,
149 BYTE nMemberId = 0 );
151 void SetUnrotatedSize( const Size& rSz ) { aUnrotatedSize = rSz; }
152 const Size& GetUnrotatedSize() const { return aUnrotatedSize; }
155 class SwLuminanceGrf : public SfxInt16Item
157 public:
158 SwLuminanceGrf( sal_Int16 nVal = 0 )
159 : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
162 // pure virtual-Methiden from SfxInt16Item
163 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
164 virtual USHORT GetVersion( USHORT nFFVer ) const;
167 class SwContrastGrf : public SfxInt16Item
169 public:
170 SwContrastGrf( sal_Int16 nVal = 0 )
171 : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
174 // pure virtual-Methiden from SfxInt16Item
175 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
176 virtual USHORT GetVersion( USHORT nFFVer ) const;
179 class SwChannelGrf : public SfxInt16Item
181 protected:
182 SwChannelGrf( sal_Int16 nVal, USHORT nWhich )
183 : SfxInt16Item( nWhich, nVal )
186 public:
187 // pure virtual-Methiden from SfxInt16Item
188 virtual USHORT GetVersion( USHORT nFFVer ) const;
191 class SwChannelRGrf : public SwChannelGrf
193 public:
194 SwChannelRGrf( sal_Int16 nVal = 0 )
195 : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
197 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
199 class SwChannelGGrf : public SwChannelGrf
201 public:
202 SwChannelGGrf( sal_Int16 nVal = 0 )
203 : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
205 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
207 class SwChannelBGrf : public SwChannelGrf
209 public:
210 SwChannelBGrf( sal_Int16 nVal = 0 )
211 : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
213 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
216 class SwGammaGrf : public SfxPoolItem
218 double nValue;
219 public:
220 TYPEINFO();
221 SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
224 SwGammaGrf( const double& rVal )
225 : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
228 inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
230 SetValue( rCopy.GetValue() );
231 return *this;
234 // pure virtual-Methiden von SfxEnumItem
235 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
236 virtual USHORT GetVersion( USHORT nFFVer ) const;
237 virtual SfxPoolItem* Create(SvStream &, USHORT nVer ) const;
238 virtual SvStream& Store(SvStream &, USHORT nIVer) const;
239 virtual int operator==( const SfxPoolItem& ) const;
241 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal,
242 BYTE nMemberId = 0 ) const;
243 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal,
244 BYTE nMemberId = 0 );
247 const double& GetValue() const { return nValue; }
248 void SetValue( const double& rVal ) { nValue = rVal; }
251 class SwInvertGrf: public SfxBoolItem
253 public:
254 SwInvertGrf( sal_Bool bVal = sal_False )
255 : SfxBoolItem( RES_GRFATR_INVERT, bVal )
258 // pure virtual-Methiden from SfxInt16Item
259 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
260 virtual USHORT GetVersion( USHORT nFFVer ) const;
263 class SwTransparencyGrf : public SfxByteItem
265 public:
266 SwTransparencyGrf( sal_Int8 nVal = 0 )
267 : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
270 // pure virtual-Methiden from SfxInt16Item
271 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
272 virtual USHORT GetVersion( USHORT nFFVer ) const;
273 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal,
274 BYTE nMemberId = 0 ) const;
275 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal,
276 BYTE nMemberId = 0 );
279 class SwDrawModeGrf : public SfxEnumItem
281 public:
282 SwDrawModeGrf( USHORT nMode = 0 )
283 : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
286 // pure virtual-Methoden von SfxPoolItem
287 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
289 // pure virtual-Methiden von SfxEnumItem
290 virtual USHORT GetValueCount() const{DBG_BF_ASSERT(0, "STRIP"); return 0;} //STRIP001 virtual USHORT GetValueCount() const;
291 virtual USHORT GetVersion( USHORT nFFVer ) const;
293 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal,
294 BYTE nMemberId = 0 ) const;
295 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal,
296 BYTE nMemberId = 0 );
301 /******************************************************************************
302 * Implementierung der GrafikAttribut Methoden vom SwAttrSet
303 ******************************************************************************/
305 #if !(defined(MACOSX) && ( __GNUC__ < 3 ))
306 // GrP moved to gcc_outl.cxx; revisit with gcc3
307 inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(BOOL bInP) const
308 { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
309 #endif
310 inline const SwCropGrf &SwAttrSet::GetCropGrf(BOOL bInP) const
311 { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
312 inline const SwRotationGrf &SwAttrSet::GetRotationGrf(BOOL bInP) const
313 { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
314 inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(BOOL bInP) const
315 { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
316 inline const SwContrastGrf &SwAttrSet::GetContrastGrf(BOOL bInP) const
317 { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
318 inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(BOOL bInP) const
319 { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
320 inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(BOOL bInP) const
321 { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
322 inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(BOOL bInP) const
323 { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
324 inline const SwGammaGrf &SwAttrSet::GetGammaGrf(BOOL bInP) const
325 { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
326 inline const SwInvertGrf &SwAttrSet::GetInvertGrf(BOOL bInP) const
327 { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
328 inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(BOOL bInP) const
329 { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
330 inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(BOOL bInP) const
331 { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
333 /******************************************************************************
334 * Implementierung der GrafikAttribut Methoden vom SwFmt
335 ******************************************************************************/
337 #if ! (defined(MACOSX) && ( __GNUC__ < 3 ) )
338 // GrP moved to gcc_outl.cxx; revisit with gcc3
339 inline const SwMirrorGrf &SwFmt::GetMirrorGrf(BOOL bInP) const
340 { return aSet.GetMirrorGrf(bInP); }
341 #endif
342 inline const SwCropGrf &SwFmt::GetCropGrf(BOOL bInP) const
343 { return aSet.GetCropGrf(bInP); }
344 inline const SwRotationGrf &SwFmt::GetRotationGrf(BOOL bInP) const
345 { return aSet.GetRotationGrf(bInP); }
346 inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(BOOL bInP) const
347 { return aSet.GetLuminanceGrf( bInP); }
348 inline const SwContrastGrf &SwFmt::GetContrastGrf(BOOL bInP) const
349 { return aSet.GetContrastGrf( bInP); }
350 inline const SwChannelRGrf &SwFmt::GetChannelRGrf(BOOL bInP) const
351 { return aSet.GetChannelRGrf( bInP); }
352 inline const SwChannelGGrf &SwFmt::GetChannelGGrf(BOOL bInP) const
353 { return aSet.GetChannelGGrf( bInP); }
354 inline const SwChannelBGrf &SwFmt::GetChannelBGrf(BOOL bInP) const
355 { return aSet.GetChannelBGrf( bInP); }
356 inline const SwGammaGrf &SwFmt::GetGammaGrf(BOOL bInP) const
357 { return aSet.GetGammaGrf( bInP); }
358 inline const SwInvertGrf &SwFmt::GetInvertGrf(BOOL bInP) const
359 { return aSet.GetInvertGrf( bInP); }
360 inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(BOOL bInP) const
361 { return aSet.GetTransparencyGrf( bInP); }
362 inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(BOOL bInP) const
363 { return aSet.GetDrawModeGrf(bInP); }
366 } //namespace binfilter
367 #endif // _GRFATR_HXX