merged tag ooo/OOO330_m14
[LibreOffice.git] / sw / inc / grfatr.hxx
blobbee336490450bb06d89d34474616065adf59a544
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef _GRFATR_HXX
28 #define _GRFATR_HXX
30 #include <hintids.hxx> // fuer die WhichIds @@@ must be included first @@@
31 #include <tools/gen.hxx>
32 #include <svl/eitem.hxx>
33 #include <svl/intitem.hxx>
34 #include <svx/grfcrop.hxx>
35 #include "swdllapi.h"
36 #include <swatrset.hxx> // fuer inlines
37 #include <format.hxx> // fuer inlines
39 /******************************************************************************
40 * class SwMirrorGrf
41 ******************************************************************************/
43 enum MirrorGraph
45 RES_MIRROR_GRAPH_BEGIN,
46 RES_MIRROR_GRAPH_DONT = RES_MIRROR_GRAPH_BEGIN,
47 RES_MIRROR_GRAPH_VERT,
48 RES_MIRROR_GRAPH_HOR,
49 RES_MIRROR_GRAPH_BOTH,
50 RES_MIRROR_GRAPH_END
53 class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
55 BOOL bGrfToggle; // auf geraden Seiten Grafiken spiegeln
57 public:
58 SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
59 : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< USHORT >(eMiro) ), bGrfToggle( sal_False )
61 SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
62 : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
63 bGrfToggle( rMirrorGrf.IsGrfToggle() )
66 // pure virtual-Methoden von SfxPoolItem
67 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
69 // pure virtual-Methiden von SfxEnumItem
70 virtual USHORT GetValueCount() const;
71 virtual int operator==( const SfxPoolItem& ) const;
72 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
73 SfxMapUnit eCoreMetric,
74 SfxMapUnit ePresMetric,
75 String &rText,
76 const IntlWrapper* pIntl = 0 ) const;
78 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
79 BYTE nMemberId = 0 ) const;
80 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
81 BYTE nMemberId = 0 );
83 inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
85 SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
86 bGrfToggle = rMirrorGrf.IsGrfToggle();
87 return *this;
90 inline BOOL IsGrfToggle() const { return bGrfToggle; }
91 inline void SetGrfToggle( BOOL bNew ) { bGrfToggle = bNew; }
95 /******************************************************************************
96 * class SwAttrCropGrf
97 ******************************************************************************/
99 class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
101 public:
102 TYPEINFO();
103 SwCropGrf();
104 SwCropGrf( sal_Int32 nLeft, sal_Int32 nRight,
105 sal_Int32 nTop, sal_Int32 nBottom );
107 // "pure virtual Methoden" vom SfxPoolItem
108 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
111 class SwRotationGrf : public SfxUInt16Item
113 Size aUnrotatedSize;
114 public:
115 SwRotationGrf( sal_Int16 nVal = 0 )
116 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
118 SwRotationGrf( sal_Int16 nVal, const Size& rSz )
119 : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
122 // pure virtual-Methiden from SfxInt16Item
123 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
124 virtual int operator==( const SfxPoolItem& ) const;
125 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
126 SfxMapUnit eCoreMetric,
127 SfxMapUnit ePresMetric,
128 String &rText,
129 const IntlWrapper* pIntl = 0 ) const;
130 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
131 BYTE nMemberId = 0 ) const;
132 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
133 BYTE nMemberId = 0 );
135 void SetUnrotatedSize( const Size& rSz ) { aUnrotatedSize = rSz; }
136 const Size& GetUnrotatedSize() const { return aUnrotatedSize; }
139 class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
141 public:
142 SwLuminanceGrf( sal_Int16 nVal = 0 )
143 : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
146 // pure virtual-Methiden from SfxInt16Item
147 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
148 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
149 SfxMapUnit eCoreMetric,
150 SfxMapUnit ePresMetric,
151 String &rText,
152 const IntlWrapper* pIntl = 0 ) const;
155 class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
157 public:
158 SwContrastGrf( sal_Int16 nVal = 0 )
159 : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
162 // pure virtual-Methiden from SfxInt16Item
163 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
164 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
165 SfxMapUnit eCoreMetric,
166 SfxMapUnit ePresMetric,
167 String &rText,
168 const IntlWrapper* pIntl = 0 ) const;
171 class SwChannelGrf : public SfxInt16Item
173 protected:
174 SwChannelGrf( sal_Int16 nVal, USHORT nWhichL )
175 : SfxInt16Item( nWhichL, nVal )
178 public:
179 // pure virtual-Methiden from SfxInt16Item
180 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
181 SfxMapUnit eCoreMetric,
182 SfxMapUnit ePresMetric,
183 String &rText,
184 const IntlWrapper* pIntl = 0 ) const;
187 class SwChannelRGrf : public SwChannelGrf
189 public:
190 SwChannelRGrf( sal_Int16 nVal = 0 )
191 : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
193 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
195 class SwChannelGGrf : public SwChannelGrf
197 public:
198 SwChannelGGrf( sal_Int16 nVal = 0 )
199 : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
201 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
203 class SwChannelBGrf : public SwChannelGrf
205 public:
206 SwChannelBGrf( sal_Int16 nVal = 0 )
207 : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
209 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
212 class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
214 double nValue;
215 public:
216 TYPEINFO();
217 SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
220 SwGammaGrf( const double& rVal )
221 : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
224 inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
226 SetValue( rCopy.GetValue() );
227 return *this;
230 // pure virtual-Methiden von SfxEnumItem
231 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
232 virtual int operator==( const SfxPoolItem& ) const;
233 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
234 SfxMapUnit eCoreMetric,
235 SfxMapUnit ePresMetric,
236 String &rText,
237 const IntlWrapper* pIntl = 0 ) const;
239 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
240 BYTE nMemberId = 0 ) const;
241 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
242 BYTE nMemberId = 0 );
245 const double& GetValue() const { return nValue; }
246 void SetValue( const double& rVal ) { nValue = rVal; }
249 class SwInvertGrf: public SfxBoolItem
251 public:
252 SwInvertGrf( sal_Bool bVal = sal_False )
253 : SfxBoolItem( RES_GRFATR_INVERT, bVal )
256 // pure virtual-Methiden from SfxInt16Item
257 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
258 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
259 SfxMapUnit eCoreMetric,
260 SfxMapUnit ePresMetric,
261 String &rText,
262 const IntlWrapper* pIntl = 0 ) const;
265 class SwTransparencyGrf : public SfxByteItem
267 public:
268 SwTransparencyGrf( sal_Int8 nVal = 0 )
269 : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
272 // pure virtual-Methiden from SfxInt16Item
273 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
274 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
275 SfxMapUnit eCoreMetric,
276 SfxMapUnit ePresMetric,
277 String &rText,
278 const IntlWrapper* pIntl = 0 ) const;
279 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
280 BYTE nMemberId = 0 ) const;
281 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
282 BYTE nMemberId = 0 );
285 class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
287 public:
288 SwDrawModeGrf( USHORT nMode = 0 )
289 : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
292 // pure virtual-Methoden von SfxPoolItem
293 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
295 // pure virtual-Methiden von SfxEnumItem
296 virtual USHORT GetValueCount() const;
297 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
298 SfxMapUnit eCoreMetric,
299 SfxMapUnit ePresMetric,
300 String &rText,
301 const IntlWrapper* pIntl = 0 ) const;
303 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
304 BYTE nMemberId = 0 ) const;
305 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal,
306 BYTE nMemberId = 0 );
311 /******************************************************************************
312 * Implementierung der GrafikAttribut Methoden vom SwAttrSet
313 ******************************************************************************/
315 inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(BOOL bInP) const
316 { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
317 inline const SwCropGrf &SwAttrSet::GetCropGrf(BOOL bInP) const
318 { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
319 inline const SwRotationGrf &SwAttrSet::GetRotationGrf(BOOL bInP) const
320 { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
321 inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(BOOL bInP) const
322 { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
323 inline const SwContrastGrf &SwAttrSet::GetContrastGrf(BOOL bInP) const
324 { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
325 inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(BOOL bInP) const
326 { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
327 inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(BOOL bInP) const
328 { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
329 inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(BOOL bInP) const
330 { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
331 inline const SwGammaGrf &SwAttrSet::GetGammaGrf(BOOL bInP) const
332 { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
333 inline const SwInvertGrf &SwAttrSet::GetInvertGrf(BOOL bInP) const
334 { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
335 inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(BOOL bInP) const
336 { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
337 inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(BOOL bInP) const
338 { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
340 /******************************************************************************
341 * Implementierung der GrafikAttribut Methoden vom SwFmt
342 ******************************************************************************/
344 inline const SwMirrorGrf &SwFmt::GetMirrorGrf(BOOL bInP) const
345 { return aSet.GetMirrorGrf(bInP); }
346 inline const SwCropGrf &SwFmt::GetCropGrf(BOOL bInP) const
347 { return aSet.GetCropGrf(bInP); }
348 inline const SwRotationGrf &SwFmt::GetRotationGrf(BOOL bInP) const
349 { return aSet.GetRotationGrf(bInP); }
350 inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(BOOL bInP) const
351 { return aSet.GetLuminanceGrf( bInP); }
352 inline const SwContrastGrf &SwFmt::GetContrastGrf(BOOL bInP) const
353 { return aSet.GetContrastGrf( bInP); }
354 inline const SwChannelRGrf &SwFmt::GetChannelRGrf(BOOL bInP) const
355 { return aSet.GetChannelRGrf( bInP); }
356 inline const SwChannelGGrf &SwFmt::GetChannelGGrf(BOOL bInP) const
357 { return aSet.GetChannelGGrf( bInP); }
358 inline const SwChannelBGrf &SwFmt::GetChannelBGrf(BOOL bInP) const
359 { return aSet.GetChannelBGrf( bInP); }
360 inline const SwGammaGrf &SwFmt::GetGammaGrf(BOOL bInP) const
361 { return aSet.GetGammaGrf( bInP); }
362 inline const SwInvertGrf &SwFmt::GetInvertGrf(BOOL bInP) const
363 { return aSet.GetInvertGrf( bInP); }
364 inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(BOOL bInP) const
365 { return aSet.GetTransparencyGrf( bInP); }
366 inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(BOOL bInP) const
367 { return aSet.GetDrawModeGrf(bInP); }
370 #endif // _GRFATR_HXX