xref: /aoo42x/main/editeng/inc/editeng/bulitem.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 #ifndef _SVX_BULITEM_HXX
28 #define _SVX_BULITEM_HXX
29 
30 // include ---------------------------------------------------------------
31 
32 #include "editeng/editengdllapi.h"
33 
34 
35 // define ----------------------------------------------------------------
36 
37 // Styles
38 #define BS_ABC_BIG          0
39 #define BS_ABC_SMALL        1
40 #define BS_ROMAN_BIG        2
41 #define BS_ROMAN_SMALL      3
42 #define BS_123              4
43 #define BS_NONE             5
44 #define BS_BULLET           6
45 #define BS_BMP              128
46 
47 // Justification
48 #define BJ_HLEFT            0x01
49 #define BJ_HRIGHT           0x02
50 #define BJ_HCENTER          0x04
51 #define BJ_VTOP             0x08
52 #define BJ_VBOTTOM          0x10
53 #define BJ_VCENTER          0x20
54 
55 // Valid-Bits
56 // Erstmal nur die Werte, die vom Dialog geaendert werden...
57 #define VALID_FONTCOLOR     0x0001
58 #define VALID_FONTNAME      0x0002
59 #define VALID_SYMBOL        0x0004
60 #define VALID_BITMAP        0x0008
61 #define VALID_SCALE         0x0010
62 #define VALID_START         0x0020
63 #define VALID_STYLE         0x0040
64 #define VALID_PREVTEXT      0x0080
65 #define VALID_FOLLOWTEXT    0x0100
66 #include <svl/poolitem.hxx>
67 #include <vcl/font.hxx>
68 #include <svtools/grfmgr.hxx>
69 
70 // class SvxBulletItem ---------------------------------------------------
71 
72 class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem
73 {
74     Font            aFont;
75     GraphicObject*  pGraphicObject;
76     String          aPrevText;
77     String          aFollowText;
78     sal_uInt16          nStart;
79     sal_uInt16          nStyle;
80     long            nWidth;
81     sal_uInt16          nScale;
82     sal_Unicode     cSymbol;
83     sal_uInt8            nJustify;
84     sal_uInt16          nValidMask; // Nur temporaer fuer GetAttribs/SetAttribs, wegen des grossen Bullets
85 
86 #ifdef _SVX_BULITEM_CXX
87     void    SetDefaultFont_Impl();
88     void    SetDefaults_Impl();
89 #endif
90 
91 public:
92     TYPEINFO();
93 
94     SvxBulletItem( sal_uInt16 nWhich = 0 );
95     SvxBulletItem( sal_uInt8 nStyle, const Font& rFont, sal_uInt16 nStart = 0, sal_uInt16 nWhich = 0 );
96     SvxBulletItem( const Font& rFont, sal_Unicode cSymbol, sal_uInt16 nWhich=0 );
97     SvxBulletItem( const Bitmap&, sal_uInt16 nWhich = 0 );
98     SvxBulletItem( const GraphicObject&, sal_uInt16 nWhich = 0 );
99     SvxBulletItem( SvStream& rStrm, sal_uInt16 nWhich = 0 );
100     SvxBulletItem( const SvxBulletItem& );
101     ~SvxBulletItem();
102 
103     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
104     virtual SfxPoolItem*    Create( SvStream&, sal_uInt16 nVersion ) const;
105     virtual SvStream&       Store( SvStream & , sal_uInt16 nItemVersion ) const;
106 
107     String              GetFullText() const;
108     sal_Unicode         GetSymbol() const { return cSymbol; }
109     String              GetPrevText() const { return aPrevText; }
110     String              GetFollowText() const { return aFollowText; }
111 
112     sal_uInt16              GetStart() const { return nStart; }
113     long                GetWidth() const { return nWidth; }
114     sal_uInt16              GetStyle() const { return nStyle; }
115     sal_uInt8                GetJustification() const { return nJustify; }
116     Font                GetFont() const { return aFont; }
117     sal_uInt16              GetScale() const { return nScale; }
118 
119     Bitmap              GetBitmap() const;
120     void                SetBitmap( const Bitmap& rBmp );
121 
122     const GraphicObject& GetGraphicObject() const;
123     void                 SetGraphicObject( const GraphicObject& rGraphicObject );
124 
125     void                SetSymbol( sal_Unicode c) { cSymbol = c; }
126     void                SetPrevText( const String& rStr) { aPrevText = rStr;}
127     void                SetFollowText(const String& rStr) { aFollowText=rStr;}
128 
129     void                SetStart( sal_uInt16 nNew ) { nStart = nNew; }
130     void                SetWidth( long nNew ) { nWidth = nNew; }
131     void                SetStyle( sal_uInt16 nNew ) { nStyle = nNew; }
132     void                SetJustification( sal_uInt8 nNew ) { nJustify = nNew; }
133     void                SetFont( const Font& rNew) { aFont = rNew; }
134     void                SetScale( sal_uInt16 nNew ) { nScale = nNew; }
135 
136     virtual sal_uInt16      GetVersion(sal_uInt16 nFileVersion) const;
137     virtual int         operator==( const SfxPoolItem& ) const;
138     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
139                                     SfxMapUnit eCoreMetric,
140                                     SfxMapUnit ePresMetric,
141                                     String &rText, const IntlWrapper * = 0 ) const;
142 
143     static void         StoreFont( SvStream&, const Font& );
144     static Font         CreateFont( SvStream&, sal_uInt16 nVer );
145 
146     sal_uInt16&             GetValidMask()                  { return nValidMask;    }
147     sal_uInt16              GetValidMask() const            { return nValidMask;    }
148     sal_uInt16              IsValid( sal_uInt16 nFlag ) const   { return nValidMask & nFlag; }
149     void                SetValid( sal_uInt16 nFlag, sal_Bool bValid )
150                         {
151                             if ( bValid )
152                                 nValidMask |= nFlag;
153                             else
154                                 nValidMask &= ~nFlag;
155                         }
156     void                CopyValidProperties( const SvxBulletItem& rCopyFrom );
157 };
158 
159 
160 #endif
161