Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * The Contents of this file are made available subject to the terms of
5 : : * either of the following licenses
6 : : *
7 : : * - GNU Lesser General Public License Version 2.1
8 : : * - Sun Industry Standards Source License Version 1.1
9 : : *
10 : : * Sun Microsystems Inc., October, 2000
11 : : *
12 : : * GNU Lesser General Public License Version 2.1
13 : : * =============================================
14 : : * Copyright 2000 by Sun Microsystems, Inc.
15 : : * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 : : *
17 : : * This library is free software; you can redistribute it and/or
18 : : * modify it under the terms of the GNU Lesser General Public
19 : : * License version 2.1, as published by the Free Software Foundation.
20 : : *
21 : : * This library is distributed in the hope that it will be useful,
22 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 : : * Lesser General Public License for more details.
25 : : *
26 : : * You should have received a copy of the GNU Lesser General Public
27 : : * License along with this library; if not, write to the Free Software
28 : : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 : : * MA 02111-1307 USA
30 : : *
31 : : *
32 : : * Sun Industry Standards Source License Version 1.1
33 : : * =================================================
34 : : * The contents of this file are subject to the Sun Industry Standards
35 : : * Source License Version 1.1 (the "License"); You may not use this file
36 : : * except in compliance with the License. You may obtain a copy of the
37 : : * License at http://www.openoffice.org/license.html.
38 : : *
39 : : * Software provided under this License is provided on an "AS IS" basis,
40 : : * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 : : * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 : : * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 : : * See the License for the specific provisions governing your rights and
44 : : * obligations concerning the Software.
45 : : *
46 : : * The Initial Developer of the Original Code is: IBM Corporation
47 : : *
48 : : * Copyright: 2008 by IBM Corporation
49 : : *
50 : : * All Rights Reserved.
51 : : *
52 : : * Contributor(s): _______________________________________
53 : : *
54 : : *
55 : : ************************************************************************/
56 : : /*************************************************************************
57 : : * @file
58 : : * Styles for ordered list and unordered list.
59 : : ************************************************************************/
60 : : #ifndef _XFLISTSTYLE_HXX
61 : : #define _XFLISTSTYLE_HXX
62 : :
63 : : #include "xfglobal.hxx"
64 : : #include "xfstyle.hxx"
65 : : #include "xfnumfmt.hxx"
66 : : #include "unicode/utypes.h"
67 : : #include <vector>
68 : :
69 : : class IXFStream;
70 : :
71 : : enum enumXFListLevel
72 : : {
73 : : enumXFListLevelBullet,
74 : : enumXFListLevelNumber,
75 : : enumXFListLevelImage
76 : : };
77 : :
78 : : /**************************************************************************
79 : : * @descr
80 : : * Bullet style wrapper,the underline bullet type can be:
81 : : * number,image,or bullet.
82 : : *************************************************************************/
83 : 0 : class XFListLevel
84 : : {
85 : : public:
86 : : XFListLevel();
87 : :
88 [ - + ]: 1285 : virtual ~XFListLevel(){}
89 : :
90 : : void SetListlevelType(enumXFListLevel type);
91 : :
92 : : void SetLevel(sal_Int16 level);
93 : :
94 : : void SetDisplayLevel(sal_Int16 nDisplayLevel);
95 : :
96 : : void SetIndent(double indent);
97 : :
98 : : void SetMinLabelWidth(double labelWidth);
99 : :
100 : : void SetMinLabelDistance(double distance);
101 : :
102 : : void SetAlignType(enumXFAlignType align);
103 : :
104 : : virtual void ToXml(IXFStream *pStrm);
105 : :
106 : : friend class XFListStyle;
107 : : protected:
108 : : sal_Int16 m_nLevel;
109 : : sal_Int16 m_nDisplayLevel;
110 : : double m_fIndent;
111 : : double m_fMinLabelWidth;
112 : : double m_fMinLabelDistance;
113 : : enumXFAlignType m_eAlign;
114 : : enumXFListLevel m_eListType;
115 : : };
116 : :
117 [ - + ]: 2570 : class XFListlevelNumber : public XFListLevel
118 : : {
119 : : public:
120 : 1285 : XFListlevelNumber()
121 : 1285 : {
122 : 1285 : m_eListType = enumXFListLevelNumber;
123 : 1285 : }
124 : : public:
125 : 1285 : void SetNumFmt(XFNumFmt& fmt)
126 : : {
127 : 1285 : m_aNumFmt = fmt;
128 : 1285 : }
129 : :
130 : 585 : void SetStartValue(sal_Int16 start)
131 : : {
132 : 585 : m_aNumFmt.SetStartValue(start);
133 : 585 : }
134 : :
135 : : virtual void ToXml(IXFStream *pStrm);
136 : : private:
137 : : XFNumFmt m_aNumFmt;
138 : : };
139 : :
140 : :
141 [ # # ]: 0 : class XFListLevelBullet : public XFListLevel
142 : : {
143 : : public:
144 : 0 : XFListLevelBullet()
145 : 0 : {
146 : 0 : m_eListType = enumXFListLevelBullet;
147 : 0 : }
148 : :
149 : 0 : void SetBulletChar(UChar32 ch)
150 : : {
151 : 0 : m_chBullet = ch;
152 : 0 : }
153 : 0 : void SetPrefix(rtl::OUString prefix)
154 : : {
155 : 0 : m_aNumFmt.SetPrefix(prefix);
156 : 0 : }
157 : 0 : void SetSuffix(rtl::OUString suffix)
158 : : {
159 : 0 : m_aNumFmt.SetSuffix(suffix);
160 : 0 : }
161 : 0 : void SetFontName(rtl::OUString name)
162 : : {
163 : 0 : m_strFontName = name;
164 : 0 : }
165 : :
166 : : virtual void ToXml(IXFStream *pStrm);
167 : : private:
168 : : XFNumFmt m_aNumFmt;
169 : : int32_t m_chBullet;
170 : : rtl::OUString m_strFontName;
171 : : };
172 : :
173 : : //not complete.
174 : : class XFListLevelImage : public XFListLevel
175 : : {
176 : : public:
177 : : virtual void ToXml(IXFStream *pStrm);
178 : : private:
179 : : sal_Int16 m_nWidth;
180 : : sal_Int16 m_nHeight;
181 : : rtl::OUString m_strBinaryData;
182 : : };
183 : :
184 : :
185 : : class XFListStyle : public XFStyle
186 : : {
187 : : public:
188 : : XFListStyle();
189 : :
190 : : XFListStyle(const XFListStyle& other);
191 : :
192 : : XFListStyle& operator=(const XFListStyle& other);
193 : :
194 : : virtual ~XFListStyle();
195 : :
196 : : public:
197 : : void SetDisplayLevel(sal_Int32 level, sal_Int16 nShowLevel);
198 : :
199 : : void SetListPosition(sal_Int32 level,
200 : : double indent,
201 : : double minLabelWidth,
202 : : double minLabelDistance,
203 : : enumXFAlignType align=enumXFAlignStart
204 : : );
205 : :
206 : : void SetListBullet(sal_Int32 level,
207 : : UChar32 bullet_char,
208 : : rtl::OUString fontname = A2OUSTR(""),
209 : : rtl::OUString prefix = A2OUSTR(""),
210 : : rtl::OUString suffix = A2OUSTR("")
211 : : );
212 : :
213 : : void SetListNumber( sal_Int32 level, XFNumFmt& numFmt, sal_Int16 nStartValue = 1 );
214 : :
215 : : //not implemented now.
216 : : void SetListImage(){}
217 : :
218 : 420 : virtual enumXFStyle GetStyleFamily()
219 : : {
220 : 420 : return enumXFStyleList;
221 : : }
222 : : virtual void ToXml(IXFStream *pStrm);
223 : :
224 : : private:
225 : : XFListLevel *m_pListLevels[10];
226 : : };
227 : :
228 : :
229 : :
230 : 1285 : inline void XFListLevel::SetListlevelType(enumXFListLevel type)
231 : : {
232 : 1285 : m_eListType = type;
233 : 1285 : }
234 : :
235 : 585 : inline void XFListLevel::SetAlignType(enumXFAlignType align)
236 : : {
237 : 585 : m_eAlign = align;
238 : 585 : }
239 : :
240 : 1285 : inline void XFListLevel::SetLevel(sal_Int16 level)
241 : : {
242 : 1285 : m_nLevel = level;
243 : 1285 : }
244 : :
245 : 320 : inline void XFListLevel::SetDisplayLevel(sal_Int16 nDisplayLevel)
246 : : {
247 : 320 : m_nDisplayLevel = nDisplayLevel;
248 : 320 : }
249 : :
250 : 1870 : inline void XFListLevel::SetIndent(double indent)
251 : : {
252 : 1870 : m_fIndent = indent;
253 : 1870 : }
254 : :
255 : 1870 : inline void XFListLevel::SetMinLabelWidth(double labelWidth)
256 : : {
257 : 1870 : m_fMinLabelWidth = labelWidth;
258 : 1870 : }
259 : :
260 : 585 : inline void XFListLevel::SetMinLabelDistance(double distance)
261 : : {
262 : 585 : m_fMinLabelDistance = distance;
263 : 585 : }
264 : :
265 : : #endif
266 : :
267 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|