1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: grfatr.hxx,v $
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 ************************************************************************/
34 #include <hintids.hxx> // fuer die WhichIds
38 #include <tools/gen.hxx>
40 #ifndef _SFXENUMITEM_HXX
41 #include <bf_svtools/eitem.hxx>
43 #ifndef _SFXINTITEM_HXX
44 #include <bf_svtools/intitem.hxx>
46 #ifndef _SVX_GRFCROP_HXX
47 #include <bf_svx/grfcrop.hxx>
51 #include <swatrset.hxx> // fuer inlines
54 #include <format.hxx> // fuer inlines
58 /******************************************************************************
60 ******************************************************************************/
65 RES_DONT_MIRROR_GRF
= RES_GRFMIRROR_BEGIN
,
72 class SwMirrorGrf
: public SfxEnumItem
74 BOOL bGrfToggle
; // auf geraden Seiten Grafiken spiegeln
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
,
100 inline SwMirrorGrf
& operator=( const SwMirrorGrf
& rMirrorGrf
)
102 SfxEnumItem::SetValue( rMirrorGrf
.GetValue() );
103 bGrfToggle
= rMirrorGrf
.IsGrfToggle();
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
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
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
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
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
182 SwChannelGrf( sal_Int16 nVal
, USHORT nWhich
)
183 : SfxInt16Item( nWhich
, nVal
)
187 // pure virtual-Methiden from SfxInt16Item
188 virtual USHORT
GetVersion( USHORT nFFVer
) const;
191 class SwChannelRGrf
: public SwChannelGrf
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
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
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
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() );
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
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
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
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
); }
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
); }
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