xref: /trunk/main/editeng/inc/editeng/shaditem.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
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 _SVX_SHADITEM_HXX
24 #define _SVX_SHADITEM_HXX
25 
26 // include ---------------------------------------------------------------
27 
28 #include <tools/color.hxx>
29 #include <svl/eitem.hxx>
30 #include <editeng/svxenum.hxx>
31 #include <editeng/editengdllapi.h>
32 
33 namespace rtl
34 {
35     class OUString;
36 }
37 
38 // class SvxShadowItem ---------------------------------------------------
39 
40 /*  [Beschreibung]
41 
42     Dieses Item beschreibt ein Schattenattribut (Farbe, Breite, Lage).
43 */
44 
45 #define SHADOW_TOP      ((sal_uInt16)0)
46 #define SHADOW_BOTTOM   ((sal_uInt16)1)
47 #define SHADOW_LEFT     ((sal_uInt16)2)
48 #define SHADOW_RIGHT    ((sal_uInt16)3)
49 
50 class EDITENG_DLLPUBLIC SvxShadowItem : public SfxEnumItemInterface
51 {
52     Color               aShadowColor;
53     sal_uInt16              nWidth;
54     SvxShadowLocation   eLocation;
55 public:
56     TYPEINFO();
57 
58     SvxShadowItem( const sal_uInt16 nId ,
59                  const Color *pColor = 0, const sal_uInt16 nWidth = 100 /*5pt*/,
60                  const SvxShadowLocation eLoc = SVX_SHADOW_NONE );
61 
62     inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow );
63 
64     // "pure virtual Methoden" vom SfxPoolItem
65     virtual int              operator==( const SfxPoolItem& ) const;
66     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
67     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
68 
69     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
70                                     SfxMapUnit eCoreMetric,
71                                     SfxMapUnit ePresMetric,
72                                     String &rText, const IntlWrapper * = 0 ) const;
73 
74     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const;
75     virtual SfxPoolItem*     Create(SvStream &, sal_uInt16) const;
76     virtual SvStream&        Store(SvStream &, sal_uInt16 nItemVersion ) const;
77     virtual int              ScaleMetrics( long nMult, long nDiv );
78     virtual int              HasMetrics() const;
79 
GetColor() const80     const Color& GetColor() const { return aShadowColor;}
SetColor(const Color & rNew)81     void SetColor( const Color &rNew ) { aShadowColor = rNew; }
82 
GetWidth() const83     sal_uInt16 GetWidth() const { return nWidth; }
GetLocation() const84     SvxShadowLocation GetLocation() const { return eLocation; }
85 
SetWidth(sal_uInt16 nNew)86     void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; }
SetLocation(SvxShadowLocation eNew)87     void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; }
88 
89         //Breite des Schattens auf der jeweiligen Seite berechnen.
90     sal_uInt16 CalcShadowSpace( sal_uInt16 nShadow ) const;
91 
92     virtual sal_uInt16          GetValueCount() const;
93     virtual String          GetValueTextByPos( sal_uInt16 nPos ) const;
94     virtual sal_uInt16          GetEnumValue() const;
95     virtual void            SetEnumValue( sal_uInt16 nNewVal );
96 };
97 
operator =(const SvxShadowItem & rFmtShadow)98 inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow )
99 {
100     aShadowColor = rFmtShadow.aShadowColor;
101     nWidth = rFmtShadow.GetWidth();
102     eLocation = rFmtShadow.GetLocation();
103     return *this;
104 }
105 
106 #endif // #ifndef _SVX_SHADITEM_HXX
107