xref: /trunk/main/sw/inc/grfatr.hxx (revision cea84f56765a2ac06f0f5a2718f45f6430edc781)
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     SwGammaGrf(const SwGammaGrf&) = default;
226 
227     // pure virtual-Methiden von SfxEnumItem
228     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
229     virtual int             operator==( const SfxPoolItem& ) const;
230     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
231                                     SfxMapUnit eCoreMetric,
232                                     SfxMapUnit ePresMetric,
233                                     String &rText,
234                                     const IntlWrapper* pIntl = 0 ) const;
235 
236     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal,
237                                             sal_uInt8 nMemberId = 0 ) const;
238     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal,
239                                             sal_uInt8 nMemberId = 0 );
240 
241 
GetValue() const242     const double& GetValue() const              { return nValue; }
SetValue(const double & rVal)243     void SetValue( const double& rVal )         { nValue = rVal; }
244 };
245 
246 class SwInvertGrf: public SfxBoolItem
247 {
248 public:
SwInvertGrf(sal_Bool bVal=sal_False)249     SwInvertGrf( sal_Bool bVal = sal_False )
250         : SfxBoolItem( RES_GRFATR_INVERT, bVal )
251     {}
252 
253     // pure virtual-Methiden from SfxInt16Item
254     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
255     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
256                                     SfxMapUnit eCoreMetric,
257                                     SfxMapUnit ePresMetric,
258                                     String &rText,
259                                     const IntlWrapper* pIntl = 0 ) const;
260 };
261 
262 class SwTransparencyGrf : public SfxByteItem
263 {
264 public:
SwTransparencyGrf(sal_Int8 nVal=0)265     SwTransparencyGrf( sal_Int8 nVal = 0 )
266         : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
267     {}
268 
269     // pure virtual-Methiden from SfxInt16Item
270     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
271     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
272                                     SfxMapUnit eCoreMetric,
273                                     SfxMapUnit ePresMetric,
274                                     String &rText,
275                                     const IntlWrapper* pIntl = 0 ) const;
276     virtual sal_Bool            QueryValue( com::sun::star::uno::Any& rVal,
277                                         sal_uInt8 nMemberId = 0 ) const;
278     virtual sal_Bool            PutValue( const com::sun::star::uno::Any& rVal,
279                                         sal_uInt8 nMemberId = 0 );
280 };
281 
282 class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
283 {
284 public:
SwDrawModeGrf(sal_uInt16 nMode=0)285     SwDrawModeGrf( sal_uInt16 nMode = 0 )
286         : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
287     {}
288 
289     // pure virtual-Methoden von SfxPoolItem
290     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
291 
292     // pure virtual-Methiden von SfxEnumItem
293     virtual sal_uInt16          GetValueCount() const;
294     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
295                                     SfxMapUnit eCoreMetric,
296                                     SfxMapUnit ePresMetric,
297                                     String &rText,
298                                     const IntlWrapper*    pIntl = 0 ) const;
299 
300     virtual sal_Bool            QueryValue( com::sun::star::uno::Any& rVal,
301                                         sal_uInt8 nMemberId = 0 ) const;
302     virtual sal_Bool            PutValue( const com::sun::star::uno::Any& rVal,
303                                         sal_uInt8 nMemberId = 0 );
304 };
305 
306 
307 
308 /******************************************************************************
309  *  Implementierung der GrafikAttribut Methoden vom SwAttrSet
310  ******************************************************************************/
311 
GetMirrorGrf(sal_Bool bInP) const312 inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(sal_Bool bInP) const
313     { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
GetCropGrf(sal_Bool bInP) const314 inline const SwCropGrf   &SwAttrSet::GetCropGrf(sal_Bool bInP) const
315     { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
GetRotationGrf(sal_Bool bInP) const316 inline const SwRotationGrf &SwAttrSet::GetRotationGrf(sal_Bool bInP) const
317     { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
GetLuminanceGrf(sal_Bool bInP) const318 inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(sal_Bool bInP) const
319     { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
GetContrastGrf(sal_Bool bInP) const320 inline const SwContrastGrf &SwAttrSet::GetContrastGrf(sal_Bool bInP) const
321     { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
GetChannelRGrf(sal_Bool bInP) const322 inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(sal_Bool bInP) const
323     { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
GetChannelGGrf(sal_Bool bInP) const324 inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(sal_Bool bInP) const
325     { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
GetChannelBGrf(sal_Bool bInP) const326 inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(sal_Bool bInP) const
327     { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
GetGammaGrf(sal_Bool bInP) const328 inline const SwGammaGrf &SwAttrSet::GetGammaGrf(sal_Bool bInP) const
329     { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
GetInvertGrf(sal_Bool bInP) const330 inline const SwInvertGrf &SwAttrSet::GetInvertGrf(sal_Bool bInP) const
331     { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
GetTransparencyGrf(sal_Bool bInP) const332 inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(sal_Bool bInP) const
333     { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
GetDrawModeGrf(sal_Bool bInP) const334 inline const SwDrawModeGrf      &SwAttrSet::GetDrawModeGrf(sal_Bool bInP) const
335     { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
336 
337 /******************************************************************************
338  *  Implementierung der GrafikAttribut Methoden vom SwFmt
339  ******************************************************************************/
340 
GetMirrorGrf(sal_Bool bInP) const341 inline const SwMirrorGrf &SwFmt::GetMirrorGrf(sal_Bool bInP) const
342     { return aSet.GetMirrorGrf(bInP); }
GetCropGrf(sal_Bool bInP) const343 inline const SwCropGrf   &SwFmt::GetCropGrf(sal_Bool bInP) const
344     { return aSet.GetCropGrf(bInP); }
GetRotationGrf(sal_Bool bInP) const345 inline const SwRotationGrf &SwFmt::GetRotationGrf(sal_Bool bInP) const
346     { return aSet.GetRotationGrf(bInP); }
GetLuminanceGrf(sal_Bool bInP) const347 inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(sal_Bool bInP) const
348     { return aSet.GetLuminanceGrf( bInP); }
GetContrastGrf(sal_Bool bInP) const349 inline const SwContrastGrf &SwFmt::GetContrastGrf(sal_Bool bInP) const
350     { return aSet.GetContrastGrf( bInP); }
GetChannelRGrf(sal_Bool bInP) const351 inline const SwChannelRGrf &SwFmt::GetChannelRGrf(sal_Bool bInP) const
352     { return aSet.GetChannelRGrf( bInP); }
GetChannelGGrf(sal_Bool bInP) const353 inline const SwChannelGGrf &SwFmt::GetChannelGGrf(sal_Bool bInP) const
354     { return aSet.GetChannelGGrf( bInP); }
GetChannelBGrf(sal_Bool bInP) const355 inline const SwChannelBGrf &SwFmt::GetChannelBGrf(sal_Bool bInP) const
356     { return aSet.GetChannelBGrf( bInP); }
GetGammaGrf(sal_Bool bInP) const357 inline const SwGammaGrf &SwFmt::GetGammaGrf(sal_Bool bInP) const
358     { return aSet.GetGammaGrf( bInP); }
GetInvertGrf(sal_Bool bInP) const359 inline const SwInvertGrf &SwFmt::GetInvertGrf(sal_Bool bInP) const
360     { return aSet.GetInvertGrf( bInP); }
GetTransparencyGrf(sal_Bool bInP) const361 inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(sal_Bool bInP) const
362     { return aSet.GetTransparencyGrf( bInP); }
GetDrawModeGrf(sal_Bool bInP) const363 inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(sal_Bool bInP) const
364     { return aSet.GetDrawModeGrf(bInP); }
365 
366 
367 #endif  // _GRFATR_HXX
368