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 INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFLISTSTYLE_HXX
61 : #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_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 257 : 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 514 : class XFListlevelNumber : public XFListLevel
118 : {
119 : public:
120 257 : XFListlevelNumber()
121 257 : {
122 257 : m_eListType = enumXFListLevelNumber;
123 257 : }
124 : public:
125 257 : void SetNumFmt(XFNumFmt& fmt)
126 : {
127 257 : m_aNumFmt = fmt;
128 257 : }
129 :
130 117 : void SetStartValue(sal_Int16 start)
131 : {
132 117 : m_aNumFmt.SetStartValue(start);
133 117 : }
134 :
135 : virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
136 : private:
137 : XFNumFmt m_aNumFmt;
138 : };
139 :
140 0 : class XFListLevelBullet : public XFListLevel
141 : {
142 : public:
143 0 : XFListLevelBullet()
144 0 : : m_chBullet(0)
145 : {
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(const OUString& prefix)
154 : {
155 0 : m_aNumFmt.SetPrefix(prefix);
156 0 : }
157 0 : void SetSuffix(const OUString& suffix)
158 : {
159 0 : m_aNumFmt.SetSuffix(suffix);
160 0 : }
161 0 : void SetFontName(const OUString& name)
162 : {
163 0 : m_strFontName = name;
164 0 : }
165 :
166 : virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
167 : private:
168 : XFNumFmt m_aNumFmt;
169 : int32_t m_chBullet;
170 : OUString m_strFontName;
171 : };
172 :
173 : //not complete.
174 : class XFListLevelImage : public XFListLevel
175 : {
176 : public:
177 : virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
178 : private:
179 : sal_Int16 m_nWidth;
180 : sal_Int16 m_nHeight;
181 : OUString m_strBinaryData;
182 : };
183 :
184 : class XFListStyle : public XFStyle
185 : {
186 : public:
187 : XFListStyle();
188 :
189 : XFListStyle(const XFListStyle& other);
190 :
191 : XFListStyle& operator=(const XFListStyle& other);
192 :
193 : virtual ~XFListStyle();
194 :
195 : public:
196 : void SetDisplayLevel(sal_Int32 level, sal_Int16 nShowLevel);
197 :
198 : void SetListPosition(sal_Int32 level,
199 : double indent,
200 : double minLabelWidth,
201 : double minLabelDistance,
202 : enumXFAlignType align=enumXFAlignStart
203 : );
204 :
205 : void SetListBullet(sal_Int32 level,
206 : UChar32 bullet_char,
207 : const OUString& fontname = "",
208 : const OUString& prefix = "",
209 : const OUString& suffix = ""
210 : );
211 :
212 : void SetListNumber( sal_Int32 level, XFNumFmt& numFmt, sal_Int16 nStartValue = 1 );
213 :
214 84 : virtual enumXFStyle GetStyleFamily() SAL_OVERRIDE
215 : {
216 84 : return enumXFStyleList;
217 : }
218 : virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
219 :
220 : private:
221 : XFListLevel *m_pListLevels[10];
222 : };
223 :
224 257 : inline void XFListLevel::SetListlevelType(enumXFListLevel type)
225 : {
226 257 : m_eListType = type;
227 257 : }
228 :
229 117 : inline void XFListLevel::SetAlignType(enumXFAlignType align)
230 : {
231 117 : m_eAlign = align;
232 117 : }
233 :
234 257 : inline void XFListLevel::SetLevel(sal_Int16 level)
235 : {
236 257 : m_nLevel = level;
237 257 : }
238 :
239 64 : inline void XFListLevel::SetDisplayLevel(sal_Int16 nDisplayLevel)
240 : {
241 64 : m_nDisplayLevel = nDisplayLevel;
242 64 : }
243 :
244 374 : inline void XFListLevel::SetIndent(double indent)
245 : {
246 374 : m_fIndent = indent;
247 374 : }
248 :
249 374 : inline void XFListLevel::SetMinLabelWidth(double labelWidth)
250 : {
251 374 : m_fMinLabelWidth = labelWidth;
252 374 : }
253 :
254 117 : inline void XFListLevel::SetMinLabelDistance(double distance)
255 : {
256 117 : m_fMinLabelDistance = distance;
257 117 : }
258 :
259 : #endif
260 :
261 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|