xref: /AOO41X/main/editeng/inc/editeng/udlnitem.hxx (revision 4c5491ea21520f5347760e8fc7d072f082fcde5f)
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_UDLNITEM_HXX
24 #define _SVX_UDLNITEM_HXX
25 
26 // include ---------------------------------------------------------------
27 
28 #include <svl/eitem.hxx>
29 #include <vcl/vclenum.hxx>
30 #include <tools/color.hxx>
31 #include <editeng/editengdllapi.h>
32 
33 class SvXMLUnitConverter;
34 namespace rtl
35 {
36     class OUString;
37 }
38 
39 // class SvxTextLineItem ------------------------------------------------
40 
41 /* Value container for underline and overline font effects */
42 
43 class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem
44 {
45     Color mColor;
46 public:
47     TYPEINFO();
48 
49     SvxTextLineItem( const FontUnderline eSt,
50                      const sal_uInt16 nId );
51 
52     // "pure virtual Methoden" vom SfxPoolItem
53     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
54                             SfxMapUnit eCoreMetric,
55                             SfxMapUnit ePresMetric,
56                             String &rText, const IntlWrapper * = 0 ) const;
57 
58     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
59     virtual SfxPoolItem*    Create(SvStream &, sal_uInt16) const;
60     virtual SvStream&       Store(SvStream &, sal_uInt16 nItemVersion) const;
61     virtual String          GetValueTextByPos( sal_uInt16 nPos ) const;
62     virtual sal_uInt16          GetValueCount() const;
63 
64     virtual sal_Bool        QueryValue( com::sun::star::uno::Any& rVal,
65                                         sal_uInt8 nMemberId = 0 ) const;
66     virtual sal_Bool        PutValue( const com::sun::star::uno::Any& rVal,
67                                         sal_uInt8 nMemberId = 0 );
68 
69     // MS VC4.0 kommt durcheinander
SetValue(sal_uInt16 nNewVal)70     void                    SetValue( sal_uInt16 nNewVal )
71                                 {SfxEnumItem::SetValue(nNewVal); }
72     virtual int             HasBoolValue() const;
73     virtual sal_Bool            GetBoolValue() const;
74     virtual void            SetBoolValue( sal_Bool bVal );
75 
76     virtual int             operator==( const SfxPoolItem& ) const;
77 
operator =(const SvxTextLineItem & rTextLine)78     inline SvxTextLineItem& operator=(const SvxTextLineItem& rTextLine)
79         {
80             SetValue( rTextLine.GetValue() );
81             SetColor( rTextLine.GetColor() );
82             return *this;
83         }
84 
85     // enum cast
GetLineStyle() const86     FontUnderline           GetLineStyle() const
87                                 { return (FontUnderline)GetValue(); }
SetLineStyle(FontUnderline eNew)88     void                    SetLineStyle( FontUnderline eNew )
89                                 { SetValue((sal_uInt16) eNew); }
90 
GetColor() const91     const Color&            GetColor() const                { return mColor; }
SetColor(const Color & rCol)92     void                    SetColor( const Color& rCol )   { mColor = rCol; }
93 };
94 
95 // class SvxUnderlineItem ------------------------------------------------
96 
97 /* Value container for underline font effects */
98 
99 class EDITENG_DLLPUBLIC SvxUnderlineItem : public SvxTextLineItem
100 {
101 public:
102     TYPEINFO();
103 
104     SvxUnderlineItem( const FontUnderline eSt,
105                       const sal_uInt16 nId );
106 
107     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
108     virtual SfxPoolItem*    Create(SvStream &, sal_uInt16) const;
109     virtual String          GetValueTextByPos( sal_uInt16 nPos ) const;
110 };
111 
112 // class SvxOverlineItem ------------------------------------------------
113 
114 /* Value container for overline font effects */
115 
116 class EDITENG_DLLPUBLIC SvxOverlineItem : public SvxTextLineItem
117 {
118 public:
119     TYPEINFO();
120 
121     SvxOverlineItem( const FontUnderline eSt,
122                      const sal_uInt16 nId );
123 
124     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
125     virtual SfxPoolItem*    Create(SvStream &, sal_uInt16) const;
126     virtual String          GetValueTextByPos( sal_uInt16 nPos ) const;
127 };
128 
129 #endif // #ifndef _SVX_UDLNITEM_HXX
130