xref: /trunk/main/sw/inc/grfatr.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _GRFATR_HXX
24 #define _GRFATR_HXX
25 
26 #include <hintids.hxx>		// fuer die WhichIds @@@ must be included first @@@
27 #include <tools/gen.hxx>
28 #include <svl/eitem.hxx>
29 #include <svl/intitem.hxx>
30 #include <svx/grfcrop.hxx>
31 #include "swdllapi.h"
32 #include <swatrset.hxx>		// fuer inlines
33 #include <format.hxx>		// fuer inlines
34 
35 /******************************************************************************
36  *	class SwMirrorGrf
37  ******************************************************************************/
38 
39 enum MirrorGraph
40 {
41 RES_MIRROR_GRAPH_BEGIN,
42     RES_MIRROR_GRAPH_DONT = RES_MIRROR_GRAPH_BEGIN,
43     RES_MIRROR_GRAPH_VERT,
44     RES_MIRROR_GRAPH_HOR,
45     RES_MIRROR_GRAPH_BOTH,
46 RES_MIRROR_GRAPH_END
47 };
48 
49 class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
50 {
51 	sal_Bool bGrfToggle; // auf geraden Seiten Grafiken spiegeln
52 
53 public:
SwMirrorGrf(MirrorGraph eMiro=RES_MIRROR_GRAPH_DONT)54     SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
55         : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< sal_uInt16 >(eMiro) ), bGrfToggle( sal_False )
56 	{}
SwMirrorGrf(const SwMirrorGrf & rMirrorGrf)57 	SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
58 		: SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
59 		bGrfToggle( rMirrorGrf.IsGrfToggle() )
60 	{}
61 
62 	// pure virtual-Methoden von SfxPoolItem
63 	virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
64 
65 	// pure virtual-Methiden von SfxEnumItem
66 	virtual sal_uInt16			GetValueCount() const;
67 	virtual int				operator==( const SfxPoolItem& ) const;
68 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
69 									SfxMapUnit eCoreMetric,
70 									SfxMapUnit ePresMetric,
71 									String &rText,
72                                     const IntlWrapper*    pIntl = 0 ) const;
73 
74 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal,
75 										sal_uInt8 nMemberId = 0 ) const;
76 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal,
77 										sal_uInt8 nMemberId = 0 );
78 
operator =(const SwMirrorGrf & rMirrorGrf)79 	inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
80 		{
81 			SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
82 			bGrfToggle = rMirrorGrf.IsGrfToggle();
83 			return *this;
84 		}
85 
IsGrfToggle() const86 	inline sal_Bool IsGrfToggle() const			{ return bGrfToggle; }
SetGrfToggle(sal_Bool bNew)87 	inline void SetGrfToggle( sal_Bool bNew )	{ bGrfToggle = bNew; }
88 };
89 
90 
91 /******************************************************************************
92  *	class SwAttrCropGrf
93  ******************************************************************************/
94 
95 class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
96 {
97 public:
98 	TYPEINFO();
99 	SwCropGrf();
100 	SwCropGrf(  sal_Int32 nLeft,	sal_Int32 nRight,
101 				sal_Int32 nTop,		sal_Int32 nBottom );
102 
103 	// "pure virtual Methoden" vom SfxPoolItem
104 	virtual SfxPoolItem*		Clone( SfxItemPool *pPool = 0 ) const;
105 };
106 
107 class SwRotationGrf : public SfxUInt16Item
108 {
109 	Size aUnrotatedSize;
110 public:
SwRotationGrf(sal_Int16 nVal=0)111 	SwRotationGrf( sal_Int16 nVal = 0 )
112 		: SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
113 	{}
SwRotationGrf(sal_Int16 nVal,const Size & rSz)114 	SwRotationGrf( sal_Int16 nVal, const Size& rSz )
115 		: SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
116 	{}
117 
118 	// pure virtual-Methiden from SfxInt16Item
119     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
120 	virtual int				operator==( const SfxPoolItem& ) const;
121 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
122 									SfxMapUnit eCoreMetric,
123 									SfxMapUnit ePresMetric,
124 									String &rText,
125                                     const IntlWrapper* pIntl = 0 ) const;
126 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal,
127 											sal_uInt8 nMemberId = 0 ) const;
128 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal,
129 											sal_uInt8 nMemberId = 0 );
130 
SetUnrotatedSize(const Size & rSz)131 	void SetUnrotatedSize( const Size& rSz ) 		{ aUnrotatedSize = rSz; }
GetUnrotatedSize() const132 	const Size& GetUnrotatedSize() const 			{ return aUnrotatedSize; }
133 };
134 
135 class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
136 {
137 public:
SwLuminanceGrf(sal_Int16 nVal=0)138 	SwLuminanceGrf( sal_Int16 nVal = 0 )
139 		: SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
140 	{}
141 
142 	// pure virtual-Methiden from SfxInt16Item
143     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
144 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
145 									SfxMapUnit eCoreMetric,
146 									SfxMapUnit ePresMetric,
147 									String &rText,
148                                     const IntlWrapper* pIntl = 0 ) const;
149 };
150 
151 class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
152 {
153 public:
SwContrastGrf(sal_Int16 nVal=0)154 	SwContrastGrf( sal_Int16 nVal = 0 )
155 		: SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
156 	{}
157 
158 	// pure virtual-Methiden from SfxInt16Item
159     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
160 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
161 									SfxMapUnit eCoreMetric,
162 									SfxMapUnit ePresMetric,
163 									String &rText,
164                                     const IntlWrapper* pIntl = 0 ) const;
165 };
166 
167 class SwChannelGrf : public SfxInt16Item
168 {
169 protected:
SwChannelGrf(sal_Int16 nVal,sal_uInt16 nWhichL)170     SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL )
171         : SfxInt16Item( nWhichL, nVal )
172 	{}
173 
174 public:
175 	// pure virtual-Methiden from SfxInt16Item
176 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
177 									SfxMapUnit eCoreMetric,
178 									SfxMapUnit ePresMetric,
179 									String &rText,
180                                     const IntlWrapper* pIntl = 0 ) const;
181 };
182 
183 class SwChannelRGrf : public SwChannelGrf
184 {
185 public:
SwChannelRGrf(sal_Int16 nVal=0)186     SwChannelRGrf( sal_Int16 nVal = 0 )
187 		: SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
188     {}
189     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
190 };
191 class SwChannelGGrf : public SwChannelGrf
192 {
193 public:
SwChannelGGrf(sal_Int16 nVal=0)194     SwChannelGGrf( sal_Int16 nVal = 0 )
195 		: SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
196     {}
197     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
198 };
199 class SwChannelBGrf : public SwChannelGrf
200 {
201 public:
SwChannelBGrf(sal_Int16 nVal=0)202     SwChannelBGrf( sal_Int16 nVal = 0 )
203 		: SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
204     {}
205     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
206 };
207 
208 class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
209 {
210 	double nValue;
211 public:
212 	TYPEINFO();
SwGammaGrf()213 	SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
214 	{}
215 
SwGammaGrf(const double & rVal)216 	SwGammaGrf( const double& rVal )
217 		: SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
218 	{}
219 
operator =(const SwGammaGrf & rCopy)220 	inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
221 		{
222 			SetValue( rCopy.GetValue() );
223 			return *this;
224 		}
225 
226 	// pure virtual-Methiden von SfxEnumItem
227     virtual SfxPoolItem* 	Clone( SfxItemPool *pPool = 0 ) const;
228 	virtual int				operator==( const SfxPoolItem& ) const;
229 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
230 									SfxMapUnit eCoreMetric,
231 									SfxMapUnit ePresMetric,
232 									String &rText,
233                                     const IntlWrapper* pIntl = 0 ) const;
234 
235 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal,
236 											sal_uInt8 nMemberId = 0 ) const;
237 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal,
238 											sal_uInt8 nMemberId = 0 );
239 
240 
GetValue() const241 	const double& GetValue() const				{ return nValue; }
SetValue(const double & rVal)242 	void SetValue( const double& rVal )			{ nValue = rVal; }
243 };
244 
245 class SwInvertGrf: public SfxBoolItem
246 {
247 public:
SwInvertGrf(sal_Bool bVal=sal_False)248 	SwInvertGrf( sal_Bool bVal = sal_False )
249 		: SfxBoolItem( RES_GRFATR_INVERT, bVal )
250 	{}
251 
252 	// pure virtual-Methiden from SfxInt16Item
253     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
254 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
255 									SfxMapUnit eCoreMetric,
256 									SfxMapUnit ePresMetric,
257 									String &rText,
258                                     const IntlWrapper* pIntl = 0 ) const;
259 };
260 
261 class SwTransparencyGrf : public SfxByteItem
262 {
263 public:
SwTransparencyGrf(sal_Int8 nVal=0)264 	SwTransparencyGrf( sal_Int8 nVal = 0 )
265 		: SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
266 	{}
267 
268 	// pure virtual-Methiden from SfxInt16Item
269     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
270 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
271 									SfxMapUnit eCoreMetric,
272 									SfxMapUnit ePresMetric,
273 									String &rText,
274                                     const IntlWrapper* pIntl = 0 ) const;
275 	virtual	sal_Bool        	QueryValue( com::sun::star::uno::Any& rVal,
276 										sal_uInt8 nMemberId = 0 ) const;
277 	virtual	sal_Bool			PutValue( const com::sun::star::uno::Any& rVal,
278 										sal_uInt8 nMemberId = 0 );
279 };
280 
281 class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
282 {
283 public:
SwDrawModeGrf(sal_uInt16 nMode=0)284 	SwDrawModeGrf( sal_uInt16 nMode = 0 )
285 		: SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
286 	{}
287 
288 	// pure virtual-Methoden von SfxPoolItem
289 	virtual SfxPoolItem*	Clone( SfxItemPool *pPool = 0 ) const;
290 
291 	// pure virtual-Methiden von SfxEnumItem
292 	virtual sal_uInt16			GetValueCount() const;
293 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
294 									SfxMapUnit eCoreMetric,
295 									SfxMapUnit ePresMetric,
296 									String &rText,
297                                     const IntlWrapper*    pIntl = 0 ) const;
298 
299 	virtual	sal_Bool        	QueryValue( com::sun::star::uno::Any& rVal,
300 										sal_uInt8 nMemberId = 0 ) const;
301 	virtual	sal_Bool			PutValue( const com::sun::star::uno::Any& rVal,
302 										sal_uInt8 nMemberId = 0 );
303 };
304 
305 
306 
307 /******************************************************************************
308  *	Implementierung der GrafikAttribut Methoden vom SwAttrSet
309  ******************************************************************************/
310 
GetMirrorGrf(sal_Bool bInP) const311 inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(sal_Bool bInP) const
312 	{ return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
GetCropGrf(sal_Bool bInP) const313 inline const SwCropGrf   &SwAttrSet::GetCropGrf(sal_Bool bInP) const
314 	{ return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
GetRotationGrf(sal_Bool bInP) const315 inline const SwRotationGrf &SwAttrSet::GetRotationGrf(sal_Bool bInP) const
316 	{ return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
GetLuminanceGrf(sal_Bool bInP) const317 inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(sal_Bool bInP) const
318 	{ return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
GetContrastGrf(sal_Bool bInP) const319 inline const SwContrastGrf &SwAttrSet::GetContrastGrf(sal_Bool bInP) const
320 	{ return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
GetChannelRGrf(sal_Bool bInP) const321 inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(sal_Bool bInP) const
322 	{ return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
GetChannelGGrf(sal_Bool bInP) const323 inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(sal_Bool bInP) const
324 	{ return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
GetChannelBGrf(sal_Bool bInP) const325 inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(sal_Bool bInP) const
326 	{ return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
GetGammaGrf(sal_Bool bInP) const327 inline const SwGammaGrf &SwAttrSet::GetGammaGrf(sal_Bool bInP) const
328 	{ return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
GetInvertGrf(sal_Bool bInP) const329 inline const SwInvertGrf &SwAttrSet::GetInvertGrf(sal_Bool bInP) const
330 	{ return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
GetTransparencyGrf(sal_Bool bInP) const331 inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(sal_Bool bInP) const
332 	{ return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
GetDrawModeGrf(sal_Bool bInP) const333 inline const SwDrawModeGrf		&SwAttrSet::GetDrawModeGrf(sal_Bool bInP) const
334 	{ return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
335 
336 /******************************************************************************
337  *	Implementierung der GrafikAttribut Methoden vom SwFmt
338  ******************************************************************************/
339 
GetMirrorGrf(sal_Bool bInP) const340 inline const SwMirrorGrf &SwFmt::GetMirrorGrf(sal_Bool bInP) const
341 	{ return aSet.GetMirrorGrf(bInP); }
GetCropGrf(sal_Bool bInP) const342 inline const SwCropGrf   &SwFmt::GetCropGrf(sal_Bool bInP) const
343 	{ return aSet.GetCropGrf(bInP); }
GetRotationGrf(sal_Bool bInP) const344 inline const SwRotationGrf &SwFmt::GetRotationGrf(sal_Bool bInP) const
345 	{ return aSet.GetRotationGrf(bInP); }
GetLuminanceGrf(sal_Bool bInP) const346 inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(sal_Bool bInP) const
347 	{ return aSet.GetLuminanceGrf( bInP); }
GetContrastGrf(sal_Bool bInP) const348 inline const SwContrastGrf &SwFmt::GetContrastGrf(sal_Bool bInP) const
349 	{ return aSet.GetContrastGrf( bInP); }
GetChannelRGrf(sal_Bool bInP) const350 inline const SwChannelRGrf &SwFmt::GetChannelRGrf(sal_Bool bInP) const
351 	{ return aSet.GetChannelRGrf( bInP); }
GetChannelGGrf(sal_Bool bInP) const352 inline const SwChannelGGrf &SwFmt::GetChannelGGrf(sal_Bool bInP) const
353 	{ return aSet.GetChannelGGrf( bInP); }
GetChannelBGrf(sal_Bool bInP) const354 inline const SwChannelBGrf &SwFmt::GetChannelBGrf(sal_Bool bInP) const
355 	{ return aSet.GetChannelBGrf( bInP); }
GetGammaGrf(sal_Bool bInP) const356 inline const SwGammaGrf	&SwFmt::GetGammaGrf(sal_Bool bInP) const
357 	{ return aSet.GetGammaGrf( bInP); }
GetInvertGrf(sal_Bool bInP) const358 inline const SwInvertGrf &SwFmt::GetInvertGrf(sal_Bool bInP) const
359 	{ return aSet.GetInvertGrf( bInP); }
GetTransparencyGrf(sal_Bool bInP) const360 inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(sal_Bool bInP) const
361 	{ return aSet.GetTransparencyGrf( bInP); }
GetDrawModeGrf(sal_Bool bInP) const362 inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(sal_Bool bInP) const
363 	{ return aSet.GetDrawModeGrf(bInP); }
364 
365 
366 #endif  // _GRFATR_HXX
367