xref: /aoo41x/main/xmloff/source/style/xmlnumi.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/text/VertOrientation.hpp>
37*cdf0e10cSrcweir // --> OD 2008-01-16 #newlistlevelattrs#
38*cdf0e10cSrcweir #include <com/sun/star/text/PositionAndSpaceMode.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/text/LabelFollow.hpp>
40*cdf0e10cSrcweir // <--
41*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <tools/urlobj.hxx>
49*cdf0e10cSrcweir #include <tools/debug.hxx>
50*cdf0e10cSrcweir #include <tools/fontenum.hxx>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #include <xmloff/xmltkmap.hxx>
53*cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
54*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
55*cdf0e10cSrcweir #include <xmloff/xmlimp.hxx>
56*cdf0e10cSrcweir #include <xmloff/XMLBase64ImportContext.hxx>
57*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir #include <xmloff/i18nmap.hxx>
60*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
61*cdf0e10cSrcweir #include "fonthdl.hxx"
62*cdf0e10cSrcweir #include <xmloff/XMLFontStylesContext.hxx>
63*cdf0e10cSrcweir #include <xmloff/families.hxx>
64*cdf0e10cSrcweir #include <xmloff/maptype.hxx>
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir #include <xmloff/xmlnumi.hxx>
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir #define _SVSTDARR_USHORTS
69*cdf0e10cSrcweir #include <svl/svstdarr.hxx>
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir using ::rtl::OUString;
73*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir using namespace ::com::sun::star;
76*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
77*cdf0e10cSrcweir using namespace ::com::sun::star::style;
78*cdf0e10cSrcweir using namespace ::com::sun::star::text;
79*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
80*cdf0e10cSrcweir using namespace ::com::sun::star::container;
81*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
82*cdf0e10cSrcweir using namespace ::com::sun::star::frame;
83*cdf0e10cSrcweir using namespace ::xmloff::token;
84*cdf0e10cSrcweir using namespace ::com::sun::star::io;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] =
87*cdf0e10cSrcweir 		"SymbolTextDistance";
88*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PARENT_NUMBERING[] =
89*cdf0e10cSrcweir 		"ParentNumbering";
90*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] =
91*cdf0e10cSrcweir 		"CharStyleName";
92*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_CHAR[] ="BulletChar";
93*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_RELSIZE[] = "BulletRelSize";
94*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] =
95*cdf0e10cSrcweir 		"GraphicSize";
96*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_VERT_ORIENT[] ="VertOrient";
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType";
99*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PREFIX[] = "Prefix";
100*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix";
101*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_ADJUST[] = "Adjust";
102*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin";
103*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] =
104*cdf0e10cSrcweir 	"FirstLineOffset";
105*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont";
106*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL";
107*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_START_WITH[] = "StartWith";
108*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_COLOR[] = "BulletColor";
109*cdf0e10cSrcweir // --> OD 2008-01-15 #newlistlevelattrs#
110*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
111*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
112*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION[] = "ListtabStopPosition";
113*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_FIRST_LINE_INDENT[] = "FirstLineIndent";
114*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_INDENT_AT[] = "IndentAt";
115*cdf0e10cSrcweir // <--
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir // ---------------------------------------------------------------------
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir class SvxXMLListLevelStyleContext_Impl;
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir class SvxXMLListLevelStyleAttrContext_Impl : public SvXMLImportContext
122*cdf0e10cSrcweir {
123*cdf0e10cSrcweir 	SvxXMLListLevelStyleContext_Impl&	rListLevel;
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir public:
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 	SvxXMLListLevelStyleAttrContext_Impl(
128*cdf0e10cSrcweir 			SvXMLImport& rImport, sal_uInt16 nPrfx,
129*cdf0e10cSrcweir 		 	const OUString& rLName,
130*cdf0e10cSrcweir 		  	const Reference< xml::sax::XAttributeList >& xAttrList,
131*cdf0e10cSrcweir 			SvxXMLListLevelStyleContext_Impl& rLLevel	);
132*cdf0e10cSrcweir 	virtual ~SvxXMLListLevelStyleAttrContext_Impl();
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir     // --> OD 2008-01-16 #newlistlevelattrs#
135*cdf0e10cSrcweir     virtual SvXMLImportContext *CreateChildContext(
136*cdf0e10cSrcweir             sal_uInt16 nPrefix, const OUString& rLocalName,
137*cdf0e10cSrcweir             const Reference< xml::sax::XAttributeList > & xAttrList );
138*cdf0e10cSrcweir     // <--
139*cdf0e10cSrcweir };
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir // ---------------------------------------------------------------------
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir // --> OD 2008-01-16 #newlistlevelattrs#
144*cdf0e10cSrcweir class SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl : public SvXMLImportContext
145*cdf0e10cSrcweir {
146*cdf0e10cSrcweir     SvxXMLListLevelStyleContext_Impl&   rListLevel;
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir public:
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir     SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl(
151*cdf0e10cSrcweir             SvXMLImport& rImport, sal_uInt16 nPrfx,
152*cdf0e10cSrcweir             const OUString& rLName,
153*cdf0e10cSrcweir             const Reference< xml::sax::XAttributeList >& xAttrList,
154*cdf0e10cSrcweir             SvxXMLListLevelStyleContext_Impl& rLLevel   );
155*cdf0e10cSrcweir     virtual ~SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl();
156*cdf0e10cSrcweir };
157*cdf0e10cSrcweir // <--
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir // ---------------------------------------------------------------------
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir enum SvxXMLTextListLevelStyleAttrTokens
162*cdf0e10cSrcweir {
163*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_LEVEL,
164*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME,
165*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR,
166*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_HREF,
167*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_TYPE,
168*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_SHOW,
169*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_ACTUATE,
170*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT,
171*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX,
172*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX,
173*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC,
174*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_START_VALUE,
175*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS,
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir     XML_TOK_TEXT_LEVEL_ATTR_END=XML_TOK_UNKNOWN
178*cdf0e10cSrcweir };
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir const SvXMLTokenMapEntry* lcl_getLevelAttrTokenMap()
181*cdf0e10cSrcweir {
182*cdf0e10cSrcweir     static __FAR_DATA SvXMLTokenMapEntry aLevelAttrTokenMap[] =
183*cdf0e10cSrcweir     {
184*cdf0e10cSrcweir 	    { XML_NAMESPACE_TEXT, XML_LEVEL, XML_TOK_TEXT_LEVEL_ATTR_LEVEL },
185*cdf0e10cSrcweir 	    { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME },
186*cdf0e10cSrcweir 	    { XML_NAMESPACE_TEXT, XML_BULLET_CHAR, XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR },
187*cdf0e10cSrcweir 	    { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXT_LEVEL_ATTR_HREF },
188*cdf0e10cSrcweir 	    { XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_TEXT_LEVEL_ATTR_TYPE },
189*cdf0e10cSrcweir 	    { XML_NAMESPACE_XLINK, XML_SHOW, XML_TOK_TEXT_LEVEL_ATTR_SHOW },
190*cdf0e10cSrcweir 	    { XML_NAMESPACE_XLINK, XML_ACTUATE, XML_TOK_TEXT_LEVEL_ATTR_ACTUATE },
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT },
193*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_NUM_PREFIX, XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX },
194*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX },
195*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC },
196*cdf0e10cSrcweir 	    { XML_NAMESPACE_TEXT, XML_START_VALUE, XML_TOK_TEXT_LEVEL_ATTR_START_VALUE },
197*cdf0e10cSrcweir 	    { XML_NAMESPACE_TEXT, XML_DISPLAY_LEVELS, XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS },
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 	    XML_TOKEN_MAP_END
200*cdf0e10cSrcweir     };
201*cdf0e10cSrcweir     return aLevelAttrTokenMap;
202*cdf0e10cSrcweir }
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext
205*cdf0e10cSrcweir {
206*cdf0e10cSrcweir     friend class SvxXMLListLevelStyleAttrContext_Impl;
207*cdf0e10cSrcweir 	const OUString 		sStarBats;
208*cdf0e10cSrcweir 	const OUString 		sStarMath;
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 	OUString 			sPrefix;
211*cdf0e10cSrcweir 	OUString			sSuffix;
212*cdf0e10cSrcweir 	OUString			sTextStyleName;
213*cdf0e10cSrcweir 	OUString			sNumFormat;
214*cdf0e10cSrcweir 	OUString			sNumLetterSync;
215*cdf0e10cSrcweir 	OUString			sBulletFontName;
216*cdf0e10cSrcweir 	OUString			sBulletFontStyleName;
217*cdf0e10cSrcweir 	OUString			sImageURL;
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 	Reference < XOutputStream > xBase64Stream;
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 	sal_Int32			nLevel;
222*cdf0e10cSrcweir 	sal_Int32			nSpaceBefore;
223*cdf0e10cSrcweir 	sal_Int32			nMinLabelWidth;
224*cdf0e10cSrcweir 	sal_Int32			nMinLabelDist;
225*cdf0e10cSrcweir 	sal_Int32			nImageWidth;
226*cdf0e10cSrcweir 	sal_Int32			nImageHeight;
227*cdf0e10cSrcweir 	sal_Int16			nNumStartValue;
228*cdf0e10cSrcweir 	sal_Int16			nNumDisplayLevels;
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 	sal_Int16 			eAdjust;
231*cdf0e10cSrcweir 	sal_Int16			eBulletFontFamily;
232*cdf0e10cSrcweir 	sal_Int16			eBulletFontPitch;
233*cdf0e10cSrcweir 	rtl_TextEncoding	eBulletFontEncoding;
234*cdf0e10cSrcweir 	sal_Int16			eImageVertOrient;
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 	sal_Unicode			cBullet;
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 	sal_Int16			nRelSize;
239*cdf0e10cSrcweir 	Color				aColor;
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir     // --> OD 2008-01-16 #newlistlevelattrs#
242*cdf0e10cSrcweir     sal_Int16           ePosAndSpaceMode;
243*cdf0e10cSrcweir     sal_Int16           eLabelFollowedBy;
244*cdf0e10cSrcweir     sal_Int32           nListtabStopPosition;
245*cdf0e10cSrcweir     sal_Int32           nFirstLineIndent;
246*cdf0e10cSrcweir     sal_Int32           nIndentAt;
247*cdf0e10cSrcweir     // <--
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 	sal_Bool			bBullet : 1;
250*cdf0e10cSrcweir 	sal_Bool			bImage : 1;
251*cdf0e10cSrcweir 	sal_Bool			bNum : 1;
252*cdf0e10cSrcweir 	sal_Bool			bHasColor : 1;
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 	void SetRelSize( sal_Int16 nRel ) { nRelSize = nRel; }
255*cdf0e10cSrcweir 	void SetColor( sal_Int32 _aColor ) { aColor = _aColor; bHasColor = sal_True; }
256*cdf0e10cSrcweir 	void SetSpaceBefore( sal_Int32 nSet ) { nSpaceBefore = nSet; }
257*cdf0e10cSrcweir 	void SetMinLabelWidth( sal_Int32 nSet ) { nMinLabelWidth = nSet; }
258*cdf0e10cSrcweir 	void SetMinLabelDist( sal_Int32 nSet ) { nMinLabelDist = nSet; }
259*cdf0e10cSrcweir 	void SetAdjust( sal_Int16 eSet ) { eAdjust = eSet; }
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 	void SetBulletFontName( const OUString& rSet ) { sBulletFontName = rSet; }
262*cdf0e10cSrcweir 	void SetBulletFontStyleName( const OUString& rSet )
263*cdf0e10cSrcweir 		 { sBulletFontStyleName = rSet; }
264*cdf0e10cSrcweir 	void SetBulletFontFamily( sal_Int16 eSet ) { eBulletFontFamily = eSet; }
265*cdf0e10cSrcweir 	void SetBulletFontPitch( sal_Int16 eSet ) { eBulletFontPitch = eSet; }
266*cdf0e10cSrcweir 	void SetBulletFontEncoding( rtl_TextEncoding eSet )
267*cdf0e10cSrcweir 		 { eBulletFontEncoding = eSet; }
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir 	void SetImageWidth( sal_Int32 nSet ) { nImageWidth = nSet; }
270*cdf0e10cSrcweir 	void SetImageHeight( sal_Int32 nSet ) { nImageHeight = nSet; }
271*cdf0e10cSrcweir 	void SetImageVertOrient( sal_Int16 eSet )
272*cdf0e10cSrcweir 		 { eImageVertOrient = eSet; }
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir public:
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 	SvxXMLListLevelStyleContext_Impl(
277*cdf0e10cSrcweir 			SvXMLImport& rImport, sal_uInt16 nPrfx,
278*cdf0e10cSrcweir 			const OUString& rLName,
279*cdf0e10cSrcweir 			const Reference< xml::sax::XAttributeList > & xAttrList );
280*cdf0e10cSrcweir 	virtual ~SvxXMLListLevelStyleContext_Impl();
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir 	virtual SvXMLImportContext *CreateChildContext(
283*cdf0e10cSrcweir 			sal_uInt16 nPrefix, const OUString& rLocalName,
284*cdf0e10cSrcweir 			const Reference< xml::sax::XAttributeList > & xAttrList );
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 	sal_Int32 GetLevel() const { return nLevel; }
287*cdf0e10cSrcweir 	Sequence<beans::PropertyValue> GetProperties(
288*cdf0e10cSrcweir 			const SvI18NMap *pI18NMap=0 );
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir     // --> OD 2008-01-16 #newlistlevelattrs#
291*cdf0e10cSrcweir     inline void SetPosAndSpaceMode( sal_Int16 eValue )
292*cdf0e10cSrcweir     {
293*cdf0e10cSrcweir         ePosAndSpaceMode = eValue;
294*cdf0e10cSrcweir     }
295*cdf0e10cSrcweir     inline void SetLabelFollowedBy( sal_Int16 eValue )
296*cdf0e10cSrcweir     {
297*cdf0e10cSrcweir         eLabelFollowedBy = eValue;
298*cdf0e10cSrcweir     }
299*cdf0e10cSrcweir     inline void SetListtabStopPosition( sal_Int32 nValue )
300*cdf0e10cSrcweir     {
301*cdf0e10cSrcweir         nListtabStopPosition = nValue;
302*cdf0e10cSrcweir     }
303*cdf0e10cSrcweir     inline void SetFirstLineIndent( sal_Int32 nValue )
304*cdf0e10cSrcweir     {
305*cdf0e10cSrcweir         nFirstLineIndent = nValue;
306*cdf0e10cSrcweir     }
307*cdf0e10cSrcweir     inline void SetIndentAt( sal_Int32 nValue )
308*cdf0e10cSrcweir     {
309*cdf0e10cSrcweir         nIndentAt = nValue;
310*cdf0e10cSrcweir     }
311*cdf0e10cSrcweir     // <--
312*cdf0e10cSrcweir };
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir SvxXMLListLevelStyleContext_Impl::SvxXMLListLevelStyleContext_Impl(
315*cdf0e10cSrcweir 		SvXMLImport& rImport, sal_uInt16 nPrfx,
316*cdf0e10cSrcweir 		const OUString& rLName,
317*cdf0e10cSrcweir 		const Reference< xml::sax::XAttributeList > & xAttrList )
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir :	SvXMLImportContext( rImport, nPrfx, rLName )
320*cdf0e10cSrcweir ,	sStarBats( RTL_CONSTASCII_USTRINGPARAM( "StarBats" ) )
321*cdf0e10cSrcweir ,	sStarMath( RTL_CONSTASCII_USTRINGPARAM( "StarMath" ) )
322*cdf0e10cSrcweir ,	sNumFormat( OUString::createFromAscii( "1" ) )
323*cdf0e10cSrcweir ,	nLevel( -1L )
324*cdf0e10cSrcweir ,	nSpaceBefore( 0L )
325*cdf0e10cSrcweir ,	nMinLabelWidth( 0L )
326*cdf0e10cSrcweir ,	nMinLabelDist( 0L )
327*cdf0e10cSrcweir ,	nImageWidth( 0L )
328*cdf0e10cSrcweir ,	nImageHeight( 0L )
329*cdf0e10cSrcweir ,	nNumStartValue( 1 )
330*cdf0e10cSrcweir ,	nNumDisplayLevels( 1 )
331*cdf0e10cSrcweir ,	eAdjust( HoriOrientation::LEFT )
332*cdf0e10cSrcweir ,	eBulletFontFamily( FAMILY_DONTKNOW )
333*cdf0e10cSrcweir ,	eBulletFontPitch( PITCH_DONTKNOW )
334*cdf0e10cSrcweir ,	eBulletFontEncoding( RTL_TEXTENCODING_DONTKNOW )
335*cdf0e10cSrcweir ,	eImageVertOrient(0)
336*cdf0e10cSrcweir ,	cBullet( 0 )
337*cdf0e10cSrcweir ,	nRelSize(0)
338*cdf0e10cSrcweir ,	aColor( 0 )
339*cdf0e10cSrcweir // --> OD 2008-01-16 #newlistelevelattrs#
340*cdf0e10cSrcweir ,   ePosAndSpaceMode( PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
341*cdf0e10cSrcweir ,   eLabelFollowedBy( LabelFollow::LISTTAB )
342*cdf0e10cSrcweir ,   nListtabStopPosition( 0 )
343*cdf0e10cSrcweir ,   nFirstLineIndent( 0 )
344*cdf0e10cSrcweir ,   nIndentAt( 0 )
345*cdf0e10cSrcweir // <--
346*cdf0e10cSrcweir ,	bBullet( sal_False )
347*cdf0e10cSrcweir ,	bImage( sal_False )
348*cdf0e10cSrcweir ,	bNum( sal_False )
349*cdf0e10cSrcweir ,	bHasColor( sal_False )
350*cdf0e10cSrcweir {
351*cdf0e10cSrcweir 	if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_NUMBER ) ||
352*cdf0e10cSrcweir 		IsXMLToken( rLName, XML_OUTLINE_LEVEL_STYLE )        )
353*cdf0e10cSrcweir 		bNum = sal_True;
354*cdf0e10cSrcweir 	else if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_BULLET ) )
355*cdf0e10cSrcweir 		bBullet = sal_True;
356*cdf0e10cSrcweir 	else if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_IMAGE ) )
357*cdf0e10cSrcweir 		bImage = sal_True;
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 	SvXMLTokenMap aTokenMap( lcl_getLevelAttrTokenMap() );
360*cdf0e10cSrcweir 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
361*cdf0e10cSrcweir 	for( sal_Int16 i=0; i < nAttrCount; i++ )
362*cdf0e10cSrcweir 	{
363*cdf0e10cSrcweir 		const OUString& rAttrName = xAttrList->getNameByIndex( i );
364*cdf0e10cSrcweir 		OUString aLocalName;
365*cdf0e10cSrcweir 		sal_uInt16 nPrefix =
366*cdf0e10cSrcweir 			GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
367*cdf0e10cSrcweir 															&aLocalName );
368*cdf0e10cSrcweir 		const OUString& rValue = xAttrList->getValueByIndex( i );
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir 		switch( aTokenMap.Get( nPrefix, aLocalName ) )
371*cdf0e10cSrcweir 		{
372*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_LEVEL:
373*cdf0e10cSrcweir 			nLevel = rValue.toInt32();
374*cdf0e10cSrcweir 			if( nLevel >= 1L )
375*cdf0e10cSrcweir 				nLevel--;
376*cdf0e10cSrcweir 			else
377*cdf0e10cSrcweir                 nLevel = 0;
378*cdf0e10cSrcweir 			break;
379*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME:
380*cdf0e10cSrcweir 			sTextStyleName = rValue;
381*cdf0e10cSrcweir 			break;
382*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR:
383*cdf0e10cSrcweir 			cBullet = rValue[0];
384*cdf0e10cSrcweir 			break;
385*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_HREF:
386*cdf0e10cSrcweir 			if( bImage )
387*cdf0e10cSrcweir 				sImageURL = rValue;
388*cdf0e10cSrcweir 			break;
389*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_TYPE:
390*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_SHOW:
391*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_ACTUATE:
392*cdf0e10cSrcweir 			// This properties will be ignored
393*cdf0e10cSrcweir 			break;
394*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT:
395*cdf0e10cSrcweir 			if( bNum )
396*cdf0e10cSrcweir 				sNumFormat = rValue;
397*cdf0e10cSrcweir 			break;
398*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX:
399*cdf0e10cSrcweir 			sPrefix = rValue;
400*cdf0e10cSrcweir 			break;
401*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX:
402*cdf0e10cSrcweir 			sSuffix = rValue;
403*cdf0e10cSrcweir 			break;
404*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC:
405*cdf0e10cSrcweir 			if( bNum )
406*cdf0e10cSrcweir 				sNumLetterSync = rValue;
407*cdf0e10cSrcweir 			break;
408*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_START_VALUE:
409*cdf0e10cSrcweir 			if( bNum )
410*cdf0e10cSrcweir 			{
411*cdf0e10cSrcweir 				sal_Int32 nTmp = rValue.toInt32();
412*cdf0e10cSrcweir 				nNumStartValue =
413*cdf0e10cSrcweir 					(nTmp < 0L) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
414*cdf0e10cSrcweir 														: (sal_Int16)nTmp );
415*cdf0e10cSrcweir 			}
416*cdf0e10cSrcweir 			break;
417*cdf0e10cSrcweir 		case XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS:
418*cdf0e10cSrcweir 			if( bNum )
419*cdf0e10cSrcweir 			{
420*cdf0e10cSrcweir 				sal_Int32 nTmp = rValue.toInt32();
421*cdf0e10cSrcweir 				nNumDisplayLevels =
422*cdf0e10cSrcweir 					(nTmp < 1L) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
423*cdf0e10cSrcweir 														: (sal_Int16)nTmp );
424*cdf0e10cSrcweir 			}
425*cdf0e10cSrcweir 			break;
426*cdf0e10cSrcweir 		}
427*cdf0e10cSrcweir 	}
428*cdf0e10cSrcweir }
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir SvxXMLListLevelStyleContext_Impl::~SvxXMLListLevelStyleContext_Impl()
431*cdf0e10cSrcweir {
432*cdf0e10cSrcweir }
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir SvXMLImportContext *SvxXMLListLevelStyleContext_Impl::CreateChildContext(
435*cdf0e10cSrcweir 		sal_uInt16 nPrefix, const OUString& rLocalName,
436*cdf0e10cSrcweir 		const Reference< xml::sax::XAttributeList > & xAttrList )
437*cdf0e10cSrcweir {
438*cdf0e10cSrcweir 	SvXMLImportContext *pContext = 0;
439*cdf0e10cSrcweir 	if( XML_NAMESPACE_STYLE == nPrefix &&
440*cdf0e10cSrcweir 		( IsXMLToken( rLocalName, XML_LIST_LEVEL_PROPERTIES ) ||
441*cdf0e10cSrcweir 	   	  IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) )
442*cdf0e10cSrcweir 	{
443*cdf0e10cSrcweir 		pContext = new SvxXMLListLevelStyleAttrContext_Impl( GetImport(),
444*cdf0e10cSrcweir 															 nPrefix,
445*cdf0e10cSrcweir 															 rLocalName,
446*cdf0e10cSrcweir 														  	 xAttrList,
447*cdf0e10cSrcweir 														     *this );
448*cdf0e10cSrcweir 	}
449*cdf0e10cSrcweir 	else if( (XML_NAMESPACE_OFFICE == nPrefix) && xmloff::token::IsXMLToken( rLocalName,
450*cdf0e10cSrcweir 										xmloff::token::XML_BINARY_DATA ) )
451*cdf0e10cSrcweir 	{
452*cdf0e10cSrcweir 		if( bImage && !sImageURL.getLength() && !xBase64Stream.is() )
453*cdf0e10cSrcweir 		{
454*cdf0e10cSrcweir 			xBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
455*cdf0e10cSrcweir 			if( xBase64Stream.is() )
456*cdf0e10cSrcweir 				pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
457*cdf0e10cSrcweir 													rLocalName, xAttrList,
458*cdf0e10cSrcweir 													xBase64Stream );
459*cdf0e10cSrcweir 		}
460*cdf0e10cSrcweir 	}
461*cdf0e10cSrcweir 	if( !pContext )
462*cdf0e10cSrcweir 	{
463*cdf0e10cSrcweir 		pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
464*cdf0e10cSrcweir 	}
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 	return pContext;
467*cdf0e10cSrcweir }
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties(
470*cdf0e10cSrcweir 		const SvI18NMap *pI18NMap )
471*cdf0e10cSrcweir {
472*cdf0e10cSrcweir 	sal_Int16 eType;
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir     sal_Int32 nCount = 0;
475*cdf0e10cSrcweir 	if( bBullet )
476*cdf0e10cSrcweir 	{
477*cdf0e10cSrcweir 		eType = NumberingType::CHAR_SPECIAL;
478*cdf0e10cSrcweir         nCount = cBullet ? 15 : 14;
479*cdf0e10cSrcweir 	}
480*cdf0e10cSrcweir 	if( bImage )
481*cdf0e10cSrcweir 	{
482*cdf0e10cSrcweir 		eType = NumberingType::BITMAP;
483*cdf0e10cSrcweir         nCount = 15;
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir 		if( (sImageURL.getLength() > 0L) || xBase64Stream.is() )
486*cdf0e10cSrcweir 			nCount++;
487*cdf0e10cSrcweir 	}
488*cdf0e10cSrcweir 	if( bNum )
489*cdf0e10cSrcweir 	{
490*cdf0e10cSrcweir 		eType = NumberingType::ARABIC;
491*cdf0e10cSrcweir 		GetImport().GetMM100UnitConverter().convertNumFormat(
492*cdf0e10cSrcweir 				eType, sNumFormat, sNumLetterSync, sal_True );
493*cdf0e10cSrcweir         nCount = 15;
494*cdf0e10cSrcweir 	}
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir 	if( ( bBullet || bNum ) && nRelSize )
497*cdf0e10cSrcweir 		nCount++;
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir 	if( !bImage && bHasColor )
500*cdf0e10cSrcweir 	{
501*cdf0e10cSrcweir 		nCount++;
502*cdf0e10cSrcweir 	}
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir     if (bBullet && sSuffix.getLength())
505*cdf0e10cSrcweir     {
506*cdf0e10cSrcweir         sal_uInt16 const nVersion(GetImport().getGeneratorVersion());
507*cdf0e10cSrcweir         sal_Int32 nUPD;
508*cdf0e10cSrcweir         sal_Int32 nBuildId;
509*cdf0e10cSrcweir         if (GetImport().getBuildIds(nUPD, nBuildId)
510*cdf0e10cSrcweir             && (   (SvXMLImport::OOo_1x == nVersion)
511*cdf0e10cSrcweir                 || (SvXMLImport::OOo_2x == nVersion)
512*cdf0e10cSrcweir                 || (310 == nUPD) || (320 == nUPD) || (330 == nUPD)
513*cdf0e10cSrcweir                 || ((300 == nUPD) && (nBuildId <= 9573))))
514*cdf0e10cSrcweir         {
515*cdf0e10cSrcweir             // #i93908# OOo < 3.4 wrote a bogus suffix for bullet chars
516*cdf0e10cSrcweir             sSuffix = ::rtl::OUString(); // clear it
517*cdf0e10cSrcweir         }
518*cdf0e10cSrcweir     }
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 	Sequence<beans::PropertyValue> aPropSeq( nCount );
521*cdf0e10cSrcweir 	if( nCount > 0 )
522*cdf0e10cSrcweir 	{
523*cdf0e10cSrcweir 		beans::PropertyValue *pProps = aPropSeq.getArray();
524*cdf0e10cSrcweir         sal_Int32 nPos = 0;
525*cdf0e10cSrcweir 		pProps[nPos].Name =
526*cdf0e10cSrcweir 				OUString::createFromAscii( XML_UNO_NAME_NRULE_NUMBERINGTYPE );
527*cdf0e10cSrcweir 		pProps[nPos++].Value <<= (sal_Int16)eType ;
528*cdf0e10cSrcweir 
529*cdf0e10cSrcweir 		pProps[nPos].Name = OUString::createFromAscii( XML_UNO_NAME_NRULE_PREFIX );
530*cdf0e10cSrcweir 		pProps[nPos++].Value <<= sPrefix;
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir 		pProps[nPos].Name = OUString::createFromAscii( XML_UNO_NAME_NRULE_SUFFIX );
533*cdf0e10cSrcweir 		pProps[nPos++].Value <<= sSuffix;
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir 		pProps[nPos].Name = OUString::createFromAscii( XML_UNO_NAME_NRULE_ADJUST );
536*cdf0e10cSrcweir 		pProps[nPos++].Value <<= eAdjust;
537*cdf0e10cSrcweir 
538*cdf0e10cSrcweir 		sal_Int32 nLeftMargin = nSpaceBefore + nMinLabelWidth;
539*cdf0e10cSrcweir 		pProps[nPos].Name =
540*cdf0e10cSrcweir 			OUString::createFromAscii( XML_UNO_NAME_NRULE_LEFT_MARGIN );
541*cdf0e10cSrcweir 		pProps[nPos++].Value <<= (sal_Int32)nLeftMargin;
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir 		sal_Int32 nFirstLineOffset = -nMinLabelWidth;
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir 		pProps[nPos].Name =
546*cdf0e10cSrcweir 				OUString::createFromAscii( XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET );
547*cdf0e10cSrcweir 		pProps[nPos++].Value <<= (sal_Int32)nFirstLineOffset;
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir 		pProps[nPos].Name =
550*cdf0e10cSrcweir 			OUString::createFromAscii(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE);
551*cdf0e10cSrcweir 		pProps[nPos++].Value <<= (sal_Int16)nMinLabelDist;
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir         // --> OD 2008-01-16 #newlistlevelattrs#
554*cdf0e10cSrcweir         pProps[nPos].Name =
555*cdf0e10cSrcweir             OUString::createFromAscii(XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE);
556*cdf0e10cSrcweir         pProps[nPos++].Value <<= (sal_Int16)ePosAndSpaceMode;
557*cdf0e10cSrcweir         pProps[nPos].Name =
558*cdf0e10cSrcweir             OUString::createFromAscii(XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY);
559*cdf0e10cSrcweir         pProps[nPos++].Value <<= (sal_Int16)eLabelFollowedBy;
560*cdf0e10cSrcweir         pProps[nPos].Name =
561*cdf0e10cSrcweir             OUString::createFromAscii(XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION);
562*cdf0e10cSrcweir         pProps[nPos++].Value <<= (sal_Int32)nListtabStopPosition;
563*cdf0e10cSrcweir         pProps[nPos].Name =
564*cdf0e10cSrcweir             OUString::createFromAscii(XML_UNO_NAME_NRULE_FIRST_LINE_INDENT);
565*cdf0e10cSrcweir         pProps[nPos++].Value <<= (sal_Int32)nFirstLineIndent;
566*cdf0e10cSrcweir         pProps[nPos].Name =
567*cdf0e10cSrcweir             OUString::createFromAscii(XML_UNO_NAME_NRULE_INDENT_AT);
568*cdf0e10cSrcweir         pProps[nPos++].Value <<= (sal_Int32)nIndentAt;
569*cdf0e10cSrcweir         // <--
570*cdf0e10cSrcweir 
571*cdf0e10cSrcweir 		OUString sDisplayTextStyleName = GetImport().GetStyleDisplayName(
572*cdf0e10cSrcweir 								XML_STYLE_FAMILY_TEXT_TEXT, sTextStyleName	);
573*cdf0e10cSrcweir 		OUString sStyleName = sDisplayTextStyleName;
574*cdf0e10cSrcweir 		if( sStyleName.getLength() && pI18NMap )
575*cdf0e10cSrcweir 			sStyleName = pI18NMap->Get( SFX_STYLE_FAMILY_CHAR, sStyleName );
576*cdf0e10cSrcweir 		pProps[nPos].Name =
577*cdf0e10cSrcweir 				OUString::createFromAscii( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME );
578*cdf0e10cSrcweir 		pProps[nPos++].Value <<= sDisplayTextStyleName;
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir 		if( bBullet )
581*cdf0e10cSrcweir 		{
582*cdf0e10cSrcweir 			awt::FontDescriptor aFDesc;
583*cdf0e10cSrcweir 			aFDesc.Name = sBulletFontName;
584*cdf0e10cSrcweir 			if( sBulletFontName.getLength() )
585*cdf0e10cSrcweir 			{
586*cdf0e10cSrcweir 				aFDesc.StyleName = sBulletFontStyleName;
587*cdf0e10cSrcweir 				aFDesc.Family = eBulletFontFamily;
588*cdf0e10cSrcweir 				aFDesc.Pitch = eBulletFontPitch;
589*cdf0e10cSrcweir 				aFDesc.CharSet = eBulletFontEncoding;
590*cdf0e10cSrcweir 				aFDesc.Weight = WEIGHT_DONTKNOW;
591*cdf0e10cSrcweir 				//aFDesc.Transparant = sal_True;
592*cdf0e10cSrcweir 				sal_Bool bStarSymbol = sal_False;
593*cdf0e10cSrcweir 				if( aFDesc.Name.equalsIgnoreAsciiCase( sStarBats ) )
594*cdf0e10cSrcweir 				{
595*cdf0e10cSrcweir 					cBullet = GetImport().ConvStarBatsCharToStarSymbol( cBullet );
596*cdf0e10cSrcweir 					bStarSymbol = sal_True;
597*cdf0e10cSrcweir 				}
598*cdf0e10cSrcweir 				else if( aFDesc.Name.equalsIgnoreAsciiCase( sStarMath ) )
599*cdf0e10cSrcweir 				{
600*cdf0e10cSrcweir 					cBullet = GetImport().ConvStarMathCharToStarSymbol( cBullet );
601*cdf0e10cSrcweir 					bStarSymbol = sal_True;
602*cdf0e10cSrcweir 				}
603*cdf0e10cSrcweir 				if( bStarSymbol )
604*cdf0e10cSrcweir 					aFDesc.Name =
605*cdf0e10cSrcweir 						OUString( RTL_CONSTASCII_USTRINGPARAM("StarSymbol" ) );
606*cdf0e10cSrcweir 			}
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir 			if( cBullet )
609*cdf0e10cSrcweir 			{
610*cdf0e10cSrcweir 				OUStringBuffer sTmp(1);
611*cdf0e10cSrcweir 				sTmp.append( cBullet );
612*cdf0e10cSrcweir 				pProps[nPos].Name =
613*cdf0e10cSrcweir 						OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_CHAR );
614*cdf0e10cSrcweir 				pProps[nPos++].Value <<= sTmp.makeStringAndClear();
615*cdf0e10cSrcweir 			}
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir 			pProps[nPos].Name =
618*cdf0e10cSrcweir 					OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_FONT );
619*cdf0e10cSrcweir 			pProps[nPos++].Value <<= aFDesc;
620*cdf0e10cSrcweir 
621*cdf0e10cSrcweir 		}
622*cdf0e10cSrcweir 
623*cdf0e10cSrcweir 		if( bImage )
624*cdf0e10cSrcweir 		{
625*cdf0e10cSrcweir 			OUString sStr( sImageURL );
626*cdf0e10cSrcweir 			if( sImageURL.getLength() )
627*cdf0e10cSrcweir 			{
628*cdf0e10cSrcweir 				sStr = GetImport().ResolveGraphicObjectURL( sImageURL,
629*cdf0e10cSrcweir 																 sal_False );
630*cdf0e10cSrcweir 			}
631*cdf0e10cSrcweir 			else if( xBase64Stream.is() )
632*cdf0e10cSrcweir 			{
633*cdf0e10cSrcweir 				sStr = GetImport().ResolveGraphicObjectURLFromBase64( xBase64Stream );
634*cdf0e10cSrcweir //				xBase64Stream = 0;
635*cdf0e10cSrcweir 			}
636*cdf0e10cSrcweir 
637*cdf0e10cSrcweir 			if( sStr.getLength() )
638*cdf0e10cSrcweir 			{
639*cdf0e10cSrcweir 				pProps[nPos].Name =
640*cdf0e10cSrcweir 						OUString::createFromAscii( XML_UNO_NAME_NRULE_GRAPHICURL );
641*cdf0e10cSrcweir 				pProps[nPos++].Value <<= sStr;
642*cdf0e10cSrcweir 			}
643*cdf0e10cSrcweir 
644*cdf0e10cSrcweir 			awt::Size aSize( nImageWidth, nImageHeight );
645*cdf0e10cSrcweir 			pProps[nPos].Name =
646*cdf0e10cSrcweir 				OUString::createFromAscii( XML_UNO_NAME_NRULE_GRAPHIC_SIZE );
647*cdf0e10cSrcweir 			pProps[nPos++].Value <<= aSize;
648*cdf0e10cSrcweir 
649*cdf0e10cSrcweir 			pProps[nPos].Name =
650*cdf0e10cSrcweir 				OUString::createFromAscii( XML_UNO_NAME_NRULE_VERT_ORIENT );
651*cdf0e10cSrcweir 			pProps[nPos++].Value <<= (sal_Int16)eImageVertOrient;
652*cdf0e10cSrcweir 		}
653*cdf0e10cSrcweir 
654*cdf0e10cSrcweir 		if( bNum )
655*cdf0e10cSrcweir 		{
656*cdf0e10cSrcweir 			pProps[nPos].Name =
657*cdf0e10cSrcweir 					OUString::createFromAscii( XML_UNO_NAME_NRULE_START_WITH );
658*cdf0e10cSrcweir 			pProps[nPos++].Value <<= (sal_Int16)nNumStartValue;
659*cdf0e10cSrcweir 
660*cdf0e10cSrcweir 			pProps[nPos].Name =
661*cdf0e10cSrcweir 				OUString::createFromAscii(XML_UNO_NAME_NRULE_PARENT_NUMBERING);
662*cdf0e10cSrcweir 			pProps[nPos++].Value <<= (sal_Int16)nNumDisplayLevels;
663*cdf0e10cSrcweir 		}
664*cdf0e10cSrcweir 
665*cdf0e10cSrcweir 		if( ( bNum || bBullet ) && nRelSize )
666*cdf0e10cSrcweir 		{
667*cdf0e10cSrcweir 			pProps[nPos].Name =
668*cdf0e10cSrcweir 				OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_RELSIZE );
669*cdf0e10cSrcweir 			pProps[nPos++].Value <<= nRelSize;
670*cdf0e10cSrcweir 		}
671*cdf0e10cSrcweir 
672*cdf0e10cSrcweir 		if( !bImage && bHasColor )
673*cdf0e10cSrcweir 		{
674*cdf0e10cSrcweir 			pProps[nPos].Name = OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_COLOR );
675*cdf0e10cSrcweir 			pProps[nPos++].Value <<= (sal_Int32)aColor.GetColor();
676*cdf0e10cSrcweir 		}
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir 		DBG_ASSERT( nPos == nCount, "array under/overflow" );
679*cdf0e10cSrcweir 	}
680*cdf0e10cSrcweir 
681*cdf0e10cSrcweir 	return aPropSeq;
682*cdf0e10cSrcweir }
683*cdf0e10cSrcweir 
684*cdf0e10cSrcweir // ---------------------------------------------------------------------
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir enum SvxXMLStyleAttributesAttrTokens
687*cdf0e10cSrcweir {
688*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE,
689*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH,
690*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST,
691*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN,
692*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME,
693*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY,
694*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC,
695*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME,
696*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH,
697*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET,
698*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS,
699*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL,
700*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH,
701*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT,
702*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR,
703*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR,
704*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE,
705*cdf0e10cSrcweir     // --> OD 2008-01-16 #newlistlevelattrs#
706*cdf0e10cSrcweir     XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE,
707*cdf0e10cSrcweir     // <--
708*cdf0e10cSrcweir 
709*cdf0e10cSrcweir 	XML_TOK_STYLE_ATTRIBUTES_ATTR_END=XML_TOK_UNKNOWN
710*cdf0e10cSrcweir };
711*cdf0e10cSrcweir const SvXMLTokenMapEntry* lcl_getStyleAttributesAttrTokenMap()
712*cdf0e10cSrcweir {
713*cdf0e10cSrcweir     static __FAR_DATA SvXMLTokenMapEntry aStyleAttributesAttrTokenMap[] =
714*cdf0e10cSrcweir     {
715*cdf0e10cSrcweir 	    { XML_NAMESPACE_TEXT, XML_SPACE_BEFORE,
716*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE },
717*cdf0e10cSrcweir 	    { XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH,
718*cdf0e10cSrcweir 	  		    XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH },
719*cdf0e10cSrcweir 	    { XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE,
720*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST },
721*cdf0e10cSrcweir 	    { XML_NAMESPACE_FO, XML_TEXT_ALIGN,
722*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN },
723*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_FONT_NAME,
724*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME },
725*cdf0e10cSrcweir 	    { XML_NAMESPACE_FO, XML_FONT_FAMILY,
726*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY },
727*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC,
728*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC },
729*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME,
730*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME },
731*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_FONT_PITCH,
732*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH },
733*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_FONT_CHARSET,
734*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET },
735*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_VERTICAL_POS,
736*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS },
737*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_VERTICAL_REL,
738*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL },
739*cdf0e10cSrcweir 	    { XML_NAMESPACE_FO, XML_WIDTH,
740*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH },
741*cdf0e10cSrcweir 	    { XML_NAMESPACE_FO, XML_HEIGHT,
742*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT },
743*cdf0e10cSrcweir 	    { XML_NAMESPACE_FO, XML_COLOR,
744*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR },
745*cdf0e10cSrcweir 	    { XML_NAMESPACE_STYLE, XML_USE_WINDOW_FONT_COLOR,
746*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR },
747*cdf0e10cSrcweir 	    { XML_NAMESPACE_FO, XML_FONT_SIZE,
748*cdf0e10cSrcweir 			    XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE },
749*cdf0e10cSrcweir         // --> OD 2008-01-16 #newlistlevelattrs#
750*cdf0e10cSrcweir         { XML_NAMESPACE_TEXT, XML_LIST_LEVEL_POSITION_AND_SPACE_MODE,
751*cdf0e10cSrcweir                 XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE },
752*cdf0e10cSrcweir         // <--
753*cdf0e10cSrcweir 
754*cdf0e10cSrcweir 	    XML_TOKEN_MAP_END
755*cdf0e10cSrcweir     };
756*cdf0e10cSrcweir     return aStyleAttributesAttrTokenMap;
757*cdf0e10cSrcweir }
758*cdf0e10cSrcweir SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
759*cdf0e10cSrcweir 		SvXMLImport& rImport, sal_uInt16 nPrfx,
760*cdf0e10cSrcweir 		const OUString& rLName,
761*cdf0e10cSrcweir 		const Reference< xml::sax::XAttributeList > & xAttrList,
762*cdf0e10cSrcweir 		SvxXMLListLevelStyleContext_Impl& rLLevel ) :
763*cdf0e10cSrcweir 	SvXMLImportContext( rImport, nPrfx, rLName ),
764*cdf0e10cSrcweir 	rListLevel( rLLevel )
765*cdf0e10cSrcweir {
766*cdf0e10cSrcweir 	SvXMLTokenMap aTokenMap( lcl_getStyleAttributesAttrTokenMap() );
767*cdf0e10cSrcweir 	SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir 	OUString sFontName, sFontFamily, sFontStyleName, sFontFamilyGeneric,
770*cdf0e10cSrcweir 			 sFontPitch, sFontCharset;
771*cdf0e10cSrcweir 	OUString sVerticalPos, sVerticalRel;
772*cdf0e10cSrcweir 
773*cdf0e10cSrcweir 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
774*cdf0e10cSrcweir 	for( sal_Int16 i=0; i < nAttrCount; i++ )
775*cdf0e10cSrcweir 	{
776*cdf0e10cSrcweir 		const OUString& rAttrName = xAttrList->getNameByIndex( i );
777*cdf0e10cSrcweir 		OUString aLocalName;
778*cdf0e10cSrcweir 		sal_uInt16 nPrefix =
779*cdf0e10cSrcweir 			GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
780*cdf0e10cSrcweir 															&aLocalName );
781*cdf0e10cSrcweir 		const OUString& rValue = xAttrList->getValueByIndex( i );
782*cdf0e10cSrcweir 
783*cdf0e10cSrcweir 		sal_Int32 nVal;
784*cdf0e10cSrcweir 		switch( aTokenMap.Get( nPrefix, aLocalName ) )
785*cdf0e10cSrcweir 		{
786*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE:
787*cdf0e10cSrcweir 			if( rUnitConv.convertMeasure( nVal, rValue, SHRT_MIN, SHRT_MAX ) )
788*cdf0e10cSrcweir 				rListLevel.SetSpaceBefore( nVal );
789*cdf0e10cSrcweir 			break;
790*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH:
791*cdf0e10cSrcweir 			if( rUnitConv.convertMeasure( nVal, rValue, 0, SHRT_MAX ) )
792*cdf0e10cSrcweir 				rListLevel.SetMinLabelWidth( nVal );
793*cdf0e10cSrcweir 			break;
794*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST:
795*cdf0e10cSrcweir 			if( rUnitConv.convertMeasure( nVal, rValue, 0, USHRT_MAX ) )
796*cdf0e10cSrcweir 				rListLevel.SetMinLabelDist( nVal );
797*cdf0e10cSrcweir 			break;
798*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN:
799*cdf0e10cSrcweir 			if( rValue.getLength() )
800*cdf0e10cSrcweir 			{
801*cdf0e10cSrcweir 				sal_Int16 eAdjust = HoriOrientation::LEFT;
802*cdf0e10cSrcweir 				if( IsXMLToken( rValue, XML_CENTER ) )
803*cdf0e10cSrcweir 					eAdjust = HoriOrientation::CENTER;
804*cdf0e10cSrcweir 				else if( IsXMLToken( rValue, XML_END ) )
805*cdf0e10cSrcweir 					eAdjust = HoriOrientation::RIGHT;
806*cdf0e10cSrcweir 				rListLevel.SetAdjust( eAdjust );
807*cdf0e10cSrcweir 			}
808*cdf0e10cSrcweir 			break;
809*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME:
810*cdf0e10cSrcweir 			sFontName = rValue;
811*cdf0e10cSrcweir 			break;
812*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY:
813*cdf0e10cSrcweir 			sFontFamily = rValue;
814*cdf0e10cSrcweir 			break;
815*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC:
816*cdf0e10cSrcweir 			sFontFamilyGeneric = rValue;
817*cdf0e10cSrcweir 			break;
818*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME:
819*cdf0e10cSrcweir 			sFontStyleName = rValue;
820*cdf0e10cSrcweir 			break;
821*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH:
822*cdf0e10cSrcweir 			sFontPitch = rValue;
823*cdf0e10cSrcweir 			break;
824*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET:
825*cdf0e10cSrcweir 			sFontCharset = rValue;
826*cdf0e10cSrcweir 			break;
827*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS:
828*cdf0e10cSrcweir 			sVerticalPos = rValue;
829*cdf0e10cSrcweir 			break;
830*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL:
831*cdf0e10cSrcweir 			sVerticalRel = rValue;
832*cdf0e10cSrcweir 			break;
833*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH:
834*cdf0e10cSrcweir 			if( rUnitConv.convertMeasure( nVal, rValue, 0, SAL_MAX_INT32) )
835*cdf0e10cSrcweir 				rListLevel.SetImageWidth( nVal );
836*cdf0e10cSrcweir 			break;
837*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT:
838*cdf0e10cSrcweir 			if( rUnitConv.convertMeasure( nVal, rValue, 0, SAL_MAX_INT32) )
839*cdf0e10cSrcweir 				rListLevel.SetImageHeight( nVal );
840*cdf0e10cSrcweir 			break;
841*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR:
842*cdf0e10cSrcweir 			{
843*cdf0e10cSrcweir 				Color aColor;
844*cdf0e10cSrcweir 				if( SvXMLUnitConverter::convertColor( aColor, rValue ) )
845*cdf0e10cSrcweir 					rListLevel.SetColor( (sal_Int32)aColor.GetColor() );
846*cdf0e10cSrcweir 			}
847*cdf0e10cSrcweir 			break;
848*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR:
849*cdf0e10cSrcweir 			{
850*cdf0e10cSrcweir 				if( IsXMLToken( rValue, XML_TRUE ) )
851*cdf0e10cSrcweir 					rListLevel.SetColor( (sal_Int32)0xffffffff );
852*cdf0e10cSrcweir 			}
853*cdf0e10cSrcweir 			break;
854*cdf0e10cSrcweir 		case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE:
855*cdf0e10cSrcweir 			if(SvXMLUnitConverter::convertPercent( nVal, rValue ) )
856*cdf0e10cSrcweir 				rListLevel.SetRelSize( (sal_Int16)nVal );
857*cdf0e10cSrcweir 			break;
858*cdf0e10cSrcweir         // --> OD 2008-01-16 #newlistlevelattrs#
859*cdf0e10cSrcweir         case XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE:
860*cdf0e10cSrcweir             {
861*cdf0e10cSrcweir                 sal_Int16 ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
862*cdf0e10cSrcweir                 if( IsXMLToken( rValue, XML_LABEL_ALIGNMENT ) )
863*cdf0e10cSrcweir                     ePosAndSpaceMode = PositionAndSpaceMode::LABEL_ALIGNMENT;
864*cdf0e10cSrcweir                 rListLevel.SetPosAndSpaceMode( ePosAndSpaceMode );
865*cdf0e10cSrcweir             }
866*cdf0e10cSrcweir             break;
867*cdf0e10cSrcweir         // <--
868*cdf0e10cSrcweir 		}
869*cdf0e10cSrcweir 	}
870*cdf0e10cSrcweir 
871*cdf0e10cSrcweir 	if( sFontName.getLength() )
872*cdf0e10cSrcweir 	{
873*cdf0e10cSrcweir 		const XMLFontStylesContext *pFontDecls =
874*cdf0e10cSrcweir 			GetImport().GetTextImport()->GetFontDecls();
875*cdf0e10cSrcweir 		if( pFontDecls )
876*cdf0e10cSrcweir 		{
877*cdf0e10cSrcweir 			::std::vector < XMLPropertyState > aProps;
878*cdf0e10cSrcweir 			if( pFontDecls->FillProperties( sFontName, aProps, 0, 1, 2, 3, 4 ) )
879*cdf0e10cSrcweir 			{
880*cdf0e10cSrcweir 				OUString sTmp;
881*cdf0e10cSrcweir 				sal_Int16 nTmp = 0;
882*cdf0e10cSrcweir 				::std::vector< XMLPropertyState >::iterator i;
883*cdf0e10cSrcweir 				for( i = aProps.begin(); i != aProps.end(); i++ )
884*cdf0e10cSrcweir 				{
885*cdf0e10cSrcweir 					switch( i->mnIndex )
886*cdf0e10cSrcweir 					{
887*cdf0e10cSrcweir 					case 0:
888*cdf0e10cSrcweir 						i->maValue >>= sTmp;
889*cdf0e10cSrcweir 						rListLevel.SetBulletFontName( sTmp);
890*cdf0e10cSrcweir 						break;
891*cdf0e10cSrcweir 					case 1:
892*cdf0e10cSrcweir 						i->maValue >>= sTmp;
893*cdf0e10cSrcweir 						rListLevel.SetBulletFontStyleName( sTmp );
894*cdf0e10cSrcweir 						break;
895*cdf0e10cSrcweir 					case 2:
896*cdf0e10cSrcweir 						i->maValue >>= nTmp;
897*cdf0e10cSrcweir 						rListLevel.SetBulletFontFamily( nTmp );
898*cdf0e10cSrcweir 						break;
899*cdf0e10cSrcweir 					case 3:
900*cdf0e10cSrcweir 						i->maValue >>= nTmp;
901*cdf0e10cSrcweir 						rListLevel.SetBulletFontPitch( nTmp );
902*cdf0e10cSrcweir 						break;
903*cdf0e10cSrcweir 					case 4:
904*cdf0e10cSrcweir 						i->maValue >>= nTmp;
905*cdf0e10cSrcweir 						rListLevel.SetBulletFontEncoding( nTmp );
906*cdf0e10cSrcweir 						break;
907*cdf0e10cSrcweir 					}
908*cdf0e10cSrcweir 				}
909*cdf0e10cSrcweir 			}
910*cdf0e10cSrcweir 		}
911*cdf0e10cSrcweir 	}
912*cdf0e10cSrcweir 	if( sFontFamily.getLength() )
913*cdf0e10cSrcweir 	{
914*cdf0e10cSrcweir 		String sEmpty;
915*cdf0e10cSrcweir 		Any aAny;
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir 		XMLFontFamilyNamePropHdl aFamilyNameHdl;
918*cdf0e10cSrcweir 		if( aFamilyNameHdl.importXML( sFontFamily, aAny, rUnitConv ) )
919*cdf0e10cSrcweir 		{
920*cdf0e10cSrcweir 			OUString sTmp;
921*cdf0e10cSrcweir 			aAny >>= sTmp;
922*cdf0e10cSrcweir 			rListLevel.SetBulletFontName( sTmp);
923*cdf0e10cSrcweir 		}
924*cdf0e10cSrcweir 
925*cdf0e10cSrcweir 		XMLFontFamilyPropHdl aFamilyHdl;
926*cdf0e10cSrcweir 		if( sFontFamilyGeneric.getLength() &&
927*cdf0e10cSrcweir 			aFamilyHdl.importXML( sFontFamilyGeneric, aAny, rUnitConv  ) )
928*cdf0e10cSrcweir 		{
929*cdf0e10cSrcweir 			sal_Int16 nTmp = 0;
930*cdf0e10cSrcweir 			aAny >>= nTmp;
931*cdf0e10cSrcweir 			rListLevel.SetBulletFontFamily( nTmp );
932*cdf0e10cSrcweir 		}
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir 		if( sFontStyleName.getLength() )
935*cdf0e10cSrcweir 			rListLevel.SetBulletFontStyleName( sFontStyleName );
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir 		XMLFontPitchPropHdl aPitchHdl;
938*cdf0e10cSrcweir 		if( sFontPitch.getLength() &&
939*cdf0e10cSrcweir 			aPitchHdl.importXML( sFontPitch, aAny, rUnitConv  ) )
940*cdf0e10cSrcweir 		{
941*cdf0e10cSrcweir 			sal_Int16 nTmp = 0;
942*cdf0e10cSrcweir 			aAny >>= nTmp;
943*cdf0e10cSrcweir 			rListLevel.SetBulletFontPitch( nTmp );
944*cdf0e10cSrcweir 		}
945*cdf0e10cSrcweir 
946*cdf0e10cSrcweir 		XMLFontEncodingPropHdl aEncHdl;
947*cdf0e10cSrcweir 		if( sFontCharset.getLength() &&
948*cdf0e10cSrcweir 			aEncHdl.importXML( sFontCharset, aAny, rUnitConv  ) )
949*cdf0e10cSrcweir 		{
950*cdf0e10cSrcweir 			sal_Int16 nTmp = 0;
951*cdf0e10cSrcweir 			aAny >>= nTmp;
952*cdf0e10cSrcweir 			rListLevel.SetBulletFontEncoding( nTmp );
953*cdf0e10cSrcweir 		}
954*cdf0e10cSrcweir 	}
955*cdf0e10cSrcweir 
956*cdf0e10cSrcweir 	sal_Int16 eVertOrient = VertOrientation::LINE_CENTER;
957*cdf0e10cSrcweir 	if( sVerticalPos.getLength() )
958*cdf0e10cSrcweir 	{
959*cdf0e10cSrcweir 		if( IsXMLToken( sVerticalPos, XML_TOP ) )
960*cdf0e10cSrcweir 			eVertOrient = VertOrientation::LINE_TOP;
961*cdf0e10cSrcweir 		else if( IsXMLToken( sVerticalPos, XML_BOTTOM ) )
962*cdf0e10cSrcweir 			eVertOrient = VertOrientation::LINE_BOTTOM;
963*cdf0e10cSrcweir 	}
964*cdf0e10cSrcweir 	if( sVerticalRel.getLength() )
965*cdf0e10cSrcweir 	{
966*cdf0e10cSrcweir 		if( IsXMLToken( sVerticalRel, XML_BASELINE ) )
967*cdf0e10cSrcweir 		{
968*cdf0e10cSrcweir 			// TOP and BOTTOM are exchanged for a baseline relation
969*cdf0e10cSrcweir 			switch( eVertOrient  )
970*cdf0e10cSrcweir 			{
971*cdf0e10cSrcweir 			case VertOrientation::LINE_TOP:
972*cdf0e10cSrcweir 				eVertOrient = VertOrientation::BOTTOM;
973*cdf0e10cSrcweir 				break;
974*cdf0e10cSrcweir 			case VertOrientation::LINE_CENTER:
975*cdf0e10cSrcweir 				eVertOrient = VertOrientation::CENTER;
976*cdf0e10cSrcweir 				break;
977*cdf0e10cSrcweir 			case VertOrientation::LINE_BOTTOM:
978*cdf0e10cSrcweir 				eVertOrient = VertOrientation::TOP;
979*cdf0e10cSrcweir 				break;
980*cdf0e10cSrcweir 			}
981*cdf0e10cSrcweir 		}
982*cdf0e10cSrcweir 		else if( IsXMLToken( sVerticalRel, XML_CHAR ) )
983*cdf0e10cSrcweir 		{
984*cdf0e10cSrcweir 			switch( eVertOrient  )
985*cdf0e10cSrcweir 			{
986*cdf0e10cSrcweir 			case VertOrientation::LINE_TOP:
987*cdf0e10cSrcweir 				eVertOrient = VertOrientation::CHAR_TOP;
988*cdf0e10cSrcweir 				break;
989*cdf0e10cSrcweir 			case VertOrientation::LINE_CENTER:
990*cdf0e10cSrcweir 				eVertOrient = VertOrientation::CHAR_CENTER;
991*cdf0e10cSrcweir 				break;
992*cdf0e10cSrcweir 			case VertOrientation::LINE_BOTTOM:
993*cdf0e10cSrcweir 				eVertOrient = VertOrientation::CHAR_BOTTOM;
994*cdf0e10cSrcweir 				break;
995*cdf0e10cSrcweir 			}
996*cdf0e10cSrcweir 		}
997*cdf0e10cSrcweir 	}
998*cdf0e10cSrcweir 	rListLevel.SetImageVertOrient( eVertOrient );
999*cdf0e10cSrcweir }
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir SvxXMLListLevelStyleAttrContext_Impl::~SvxXMLListLevelStyleAttrContext_Impl()
1002*cdf0e10cSrcweir {
1003*cdf0e10cSrcweir }
1004*cdf0e10cSrcweir 
1005*cdf0e10cSrcweir // --> OD 2008-01-16 #newlistlevelattrs#
1006*cdf0e10cSrcweir SvXMLImportContext* SvxXMLListLevelStyleAttrContext_Impl::CreateChildContext(
1007*cdf0e10cSrcweir         sal_uInt16 nPrefix, const OUString& rLocalName,
1008*cdf0e10cSrcweir         const Reference< xml::sax::XAttributeList > & xAttrList )
1009*cdf0e10cSrcweir {
1010*cdf0e10cSrcweir     SvXMLImportContext *pContext = 0;
1011*cdf0e10cSrcweir     if ( XML_NAMESPACE_STYLE == nPrefix &&
1012*cdf0e10cSrcweir          IsXMLToken( rLocalName, XML_LIST_LEVEL_LABEL_ALIGNMENT ) )
1013*cdf0e10cSrcweir     {
1014*cdf0e10cSrcweir         pContext = new SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl( GetImport(),
1015*cdf0e10cSrcweir                                                              nPrefix,
1016*cdf0e10cSrcweir                                                              rLocalName,
1017*cdf0e10cSrcweir                                                              xAttrList,
1018*cdf0e10cSrcweir                                                              rListLevel );
1019*cdf0e10cSrcweir     }
1020*cdf0e10cSrcweir     if( !pContext )
1021*cdf0e10cSrcweir     {
1022*cdf0e10cSrcweir         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1023*cdf0e10cSrcweir     }
1024*cdf0e10cSrcweir 
1025*cdf0e10cSrcweir     return pContext;
1026*cdf0e10cSrcweir }
1027*cdf0e10cSrcweir // <--
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir // ---------------------------------------------------------------------
1030*cdf0e10cSrcweir 
1031*cdf0e10cSrcweir // --> OD 2008-01-16 #newlistlevelattrs#
1032*cdf0e10cSrcweir enum SvxXMLStyleAttributesLabelAlignmentAttrTokens
1033*cdf0e10cSrcweir {
1034*cdf0e10cSrcweir     XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY,
1035*cdf0e10cSrcweir     XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION,
1036*cdf0e10cSrcweir     XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT,
1037*cdf0e10cSrcweir     XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT,
1038*cdf0e10cSrcweir 
1039*cdf0e10cSrcweir     XML_TOK_STYLE_ATTRIBUTES_LABEL_ALIGNMENT_ATTR_END=XML_TOK_UNKNOWN
1040*cdf0e10cSrcweir };
1041*cdf0e10cSrcweir const SvXMLTokenMapEntry* lcl_getStyleAlignmentAttributesAttrTokenMap()
1042*cdf0e10cSrcweir {
1043*cdf0e10cSrcweir     static __FAR_DATA SvXMLTokenMapEntry aStyleAlignmentAttributesAttrTokenMap[] =
1044*cdf0e10cSrcweir     {
1045*cdf0e10cSrcweir         { XML_NAMESPACE_TEXT, XML_LABEL_FOLLOWED_BY,
1046*cdf0e10cSrcweir                 XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY },
1047*cdf0e10cSrcweir         { XML_NAMESPACE_TEXT, XML_LIST_TAB_STOP_POSITION,
1048*cdf0e10cSrcweir                 XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION },
1049*cdf0e10cSrcweir         { XML_NAMESPACE_FO, XML_TEXT_INDENT,
1050*cdf0e10cSrcweir                 XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT },
1051*cdf0e10cSrcweir         { XML_NAMESPACE_FO, XML_MARGIN_LEFT,
1052*cdf0e10cSrcweir                 XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT },
1053*cdf0e10cSrcweir 
1054*cdf0e10cSrcweir         XML_TOKEN_MAP_END
1055*cdf0e10cSrcweir     };
1056*cdf0e10cSrcweir     return aStyleAlignmentAttributesAttrTokenMap;
1057*cdf0e10cSrcweir }
1058*cdf0e10cSrcweir SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl(
1059*cdf0e10cSrcweir         SvXMLImport& rImport, sal_uInt16 nPrfx,
1060*cdf0e10cSrcweir         const OUString& rLName,
1061*cdf0e10cSrcweir         const Reference< xml::sax::XAttributeList > & xAttrList,
1062*cdf0e10cSrcweir         SvxXMLListLevelStyleContext_Impl& rLLevel ) :
1063*cdf0e10cSrcweir     SvXMLImportContext( rImport, nPrfx, rLName ),
1064*cdf0e10cSrcweir     rListLevel( rLLevel )
1065*cdf0e10cSrcweir {
1066*cdf0e10cSrcweir     SvXMLTokenMap aTokenMap( lcl_getStyleAlignmentAttributesAttrTokenMap() );
1067*cdf0e10cSrcweir     SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
1070*cdf0e10cSrcweir     for( sal_Int16 i=0; i < nAttrCount; i++ )
1071*cdf0e10cSrcweir     {
1072*cdf0e10cSrcweir         const OUString& rAttrName = xAttrList->getNameByIndex( i );
1073*cdf0e10cSrcweir         OUString aLocalName;
1074*cdf0e10cSrcweir         sal_uInt16 nPrefix =
1075*cdf0e10cSrcweir             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
1076*cdf0e10cSrcweir                                                             &aLocalName );
1077*cdf0e10cSrcweir         const OUString& rValue = xAttrList->getValueByIndex( i );
1078*cdf0e10cSrcweir 
1079*cdf0e10cSrcweir         sal_Int32 nVal;
1080*cdf0e10cSrcweir         switch( aTokenMap.Get( nPrefix, aLocalName ) )
1081*cdf0e10cSrcweir         {
1082*cdf0e10cSrcweir         case XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY:
1083*cdf0e10cSrcweir             {
1084*cdf0e10cSrcweir                 sal_Int16 eLabelFollowedBy = LabelFollow::LISTTAB;
1085*cdf0e10cSrcweir                 if( IsXMLToken( rValue, XML_SPACE ) )
1086*cdf0e10cSrcweir                     eLabelFollowedBy = LabelFollow::SPACE;
1087*cdf0e10cSrcweir                 else if( IsXMLToken( rValue, XML_NOTHING ) )
1088*cdf0e10cSrcweir                     eLabelFollowedBy = LabelFollow::NOTHING;
1089*cdf0e10cSrcweir                 rListLevel.SetLabelFollowedBy( eLabelFollowedBy );
1090*cdf0e10cSrcweir             }
1091*cdf0e10cSrcweir             break;
1092*cdf0e10cSrcweir         case XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION:
1093*cdf0e10cSrcweir             if( rUnitConv.convertMeasure( nVal, rValue, 0, SHRT_MAX ) )
1094*cdf0e10cSrcweir                 rListLevel.SetListtabStopPosition( nVal );
1095*cdf0e10cSrcweir             break;
1096*cdf0e10cSrcweir         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT:
1097*cdf0e10cSrcweir             if( rUnitConv.convertMeasure( nVal, rValue, SHRT_MIN, SHRT_MAX ) )
1098*cdf0e10cSrcweir                 rListLevel.SetFirstLineIndent( nVal );
1099*cdf0e10cSrcweir             break;
1100*cdf0e10cSrcweir         case XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT:
1101*cdf0e10cSrcweir             if( rUnitConv.convertMeasure( nVal, rValue, SHRT_MIN, SHRT_MAX ) )
1102*cdf0e10cSrcweir                 rListLevel.SetIndentAt( nVal );
1103*cdf0e10cSrcweir             break;
1104*cdf0e10cSrcweir         }
1105*cdf0e10cSrcweir     }
1106*cdf0e10cSrcweir }
1107*cdf0e10cSrcweir 
1108*cdf0e10cSrcweir SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::~SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl()
1109*cdf0e10cSrcweir {
1110*cdf0e10cSrcweir }
1111*cdf0e10cSrcweir // <--
1112*cdf0e10cSrcweir 
1113*cdf0e10cSrcweir // ---------------------------------------------------------------------
1114*cdf0e10cSrcweir 
1115*cdf0e10cSrcweir typedef SvxXMLListLevelStyleContext_Impl *SvxXMLListLevelStyleContext_ImplPtr;
1116*cdf0e10cSrcweir SV_DECL_PTRARR( SvxXMLListStyle_Impl, SvxXMLListLevelStyleContext_ImplPtr,
1117*cdf0e10cSrcweir 				10, 5 )
1118*cdf0e10cSrcweir 
1119*cdf0e10cSrcweir void SvxXMLListStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
1120*cdf0e10cSrcweir 										   const OUString& rLocalName,
1121*cdf0e10cSrcweir 										   const OUString& rValue )
1122*cdf0e10cSrcweir {
1123*cdf0e10cSrcweir 	if( XML_NAMESPACE_TEXT == nPrefixKey &&
1124*cdf0e10cSrcweir 		IsXMLToken( rLocalName, XML_CONSECUTIVE_NUMBERING ) )
1125*cdf0e10cSrcweir 	{
1126*cdf0e10cSrcweir 		bConsecutive = IsXMLToken( rValue, XML_TRUE );
1127*cdf0e10cSrcweir 	}
1128*cdf0e10cSrcweir 	else
1129*cdf0e10cSrcweir 	{
1130*cdf0e10cSrcweir 		SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
1131*cdf0e10cSrcweir 	}
1132*cdf0e10cSrcweir }
1133*cdf0e10cSrcweir 
1134*cdf0e10cSrcweir 
1135*cdf0e10cSrcweir SvxXMLListStyleContext::SvxXMLListStyleContext( SvXMLImport& rImport,
1136*cdf0e10cSrcweir 		sal_uInt16 nPrfx,
1137*cdf0e10cSrcweir 		const OUString& rLName,
1138*cdf0e10cSrcweir 		const Reference< xml::sax::XAttributeList > & xAttrList,
1139*cdf0e10cSrcweir 		sal_Bool bOutl )
1140*cdf0e10cSrcweir :	SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, bOutl ? XML_STYLE_FAMILY_TEXT_OUTLINE : XML_STYLE_FAMILY_TEXT_LIST )
1141*cdf0e10cSrcweir ,	sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) )
1142*cdf0e10cSrcweir ,	sNumberingRules( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) )
1143*cdf0e10cSrcweir ,	sName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) )
1144*cdf0e10cSrcweir ,	sIsContinuousNumbering( RTL_CONSTASCII_USTRINGPARAM( "IsContinuousNumbering" ) )
1145*cdf0e10cSrcweir ,	pLevelStyles( 0 )
1146*cdf0e10cSrcweir ,	nLevels( 0 )
1147*cdf0e10cSrcweir ,	bConsecutive( sal_False )
1148*cdf0e10cSrcweir ,	bOutline( bOutl )
1149*cdf0e10cSrcweir {
1150*cdf0e10cSrcweir }
1151*cdf0e10cSrcweir 
1152*cdf0e10cSrcweir SvxXMLListStyleContext::~SvxXMLListStyleContext()
1153*cdf0e10cSrcweir {
1154*cdf0e10cSrcweir 	if( pLevelStyles )
1155*cdf0e10cSrcweir 	{
1156*cdf0e10cSrcweir 		while( pLevelStyles->Count() )
1157*cdf0e10cSrcweir 		{
1158*cdf0e10cSrcweir 			sal_uInt16 n = pLevelStyles->Count() - 1;
1159*cdf0e10cSrcweir 			SvxXMLListLevelStyleContext_Impl *pStyle = (*pLevelStyles)[n];
1160*cdf0e10cSrcweir 			pLevelStyles->Remove( n, 1 );
1161*cdf0e10cSrcweir 			pStyle->ReleaseRef();
1162*cdf0e10cSrcweir 		}
1163*cdf0e10cSrcweir 	}
1164*cdf0e10cSrcweir 
1165*cdf0e10cSrcweir 	delete pLevelStyles;
1166*cdf0e10cSrcweir }
1167*cdf0e10cSrcweir 
1168*cdf0e10cSrcweir TYPEINIT1( SvxXMLListStyleContext, SvXMLStyleContext );
1169*cdf0e10cSrcweir 
1170*cdf0e10cSrcweir SvXMLImportContext *SvxXMLListStyleContext::CreateChildContext(
1171*cdf0e10cSrcweir 		sal_uInt16 nPrefix,
1172*cdf0e10cSrcweir 		const OUString& rLocalName,
1173*cdf0e10cSrcweir 		const Reference< xml::sax::XAttributeList > & xAttrList )
1174*cdf0e10cSrcweir {
1175*cdf0e10cSrcweir 	SvXMLImportContext *pContext = 0;
1176*cdf0e10cSrcweir 
1177*cdf0e10cSrcweir 	if( XML_NAMESPACE_TEXT == nPrefix &&
1178*cdf0e10cSrcweir 		( bOutline
1179*cdf0e10cSrcweir 		  	? IsXMLToken( rLocalName, XML_OUTLINE_LEVEL_STYLE )
1180*cdf0e10cSrcweir 		  	: ( IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_NUMBER ) ||
1181*cdf0e10cSrcweir 				IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_BULLET ) ||
1182*cdf0e10cSrcweir 			 	IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_IMAGE )    ) ) )
1183*cdf0e10cSrcweir 	{
1184*cdf0e10cSrcweir 		SvxXMLListLevelStyleContext_Impl *pLevelStyle =
1185*cdf0e10cSrcweir 			new SvxXMLListLevelStyleContext_Impl( GetImport(), nPrefix,
1186*cdf0e10cSrcweir 												  rLocalName, xAttrList );
1187*cdf0e10cSrcweir 		if( !pLevelStyles )
1188*cdf0e10cSrcweir 			pLevelStyles = new SvxXMLListStyle_Impl;
1189*cdf0e10cSrcweir 		pLevelStyles->Insert( pLevelStyle, pLevelStyles->Count() );
1190*cdf0e10cSrcweir 		pLevelStyle->AddRef();
1191*cdf0e10cSrcweir 
1192*cdf0e10cSrcweir 		pContext = pLevelStyle;
1193*cdf0e10cSrcweir 	}
1194*cdf0e10cSrcweir 	else
1195*cdf0e10cSrcweir 	{
1196*cdf0e10cSrcweir 		pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1197*cdf0e10cSrcweir 	}
1198*cdf0e10cSrcweir 
1199*cdf0e10cSrcweir 	return pContext;
1200*cdf0e10cSrcweir }
1201*cdf0e10cSrcweir 
1202*cdf0e10cSrcweir void SvxXMLListStyleContext::FillUnoNumRule(
1203*cdf0e10cSrcweir 		const Reference< container::XIndexReplace > & rNumRule,
1204*cdf0e10cSrcweir 		const SvI18NMap *pI18NMap ) const
1205*cdf0e10cSrcweir {
1206*cdf0e10cSrcweir 	try
1207*cdf0e10cSrcweir 	{
1208*cdf0e10cSrcweir 		if( pLevelStyles && rNumRule.is() )
1209*cdf0e10cSrcweir 		{
1210*cdf0e10cSrcweir 			sal_uInt16 nCount = pLevelStyles->Count();
1211*cdf0e10cSrcweir 			sal_Int32 l_nLevels = rNumRule->getCount();
1212*cdf0e10cSrcweir 			for( sal_uInt16 i=0; i < nCount; i++ )
1213*cdf0e10cSrcweir 			{
1214*cdf0e10cSrcweir 				SvxXMLListLevelStyleContext_Impl *pLevelStyle =
1215*cdf0e10cSrcweir 					(*pLevelStyles)[i];
1216*cdf0e10cSrcweir 				sal_Int32 nLevel = pLevelStyle->GetLevel();
1217*cdf0e10cSrcweir 				if( nLevel >= 0 && nLevel < l_nLevels )
1218*cdf0e10cSrcweir 				{
1219*cdf0e10cSrcweir 					Sequence<beans::PropertyValue> aProps =
1220*cdf0e10cSrcweir 						pLevelStyle->GetProperties( pI18NMap );
1221*cdf0e10cSrcweir 					Any aAny;
1222*cdf0e10cSrcweir 					aAny <<= aProps;
1223*cdf0e10cSrcweir 					rNumRule->replaceByIndex( nLevel, aAny );
1224*cdf0e10cSrcweir 				}
1225*cdf0e10cSrcweir 			}
1226*cdf0e10cSrcweir 		}
1227*cdf0e10cSrcweir 
1228*cdf0e10cSrcweir 		Reference < XPropertySet > xPropSet( rNumRule, UNO_QUERY );
1229*cdf0e10cSrcweir 		Reference< XPropertySetInfo > xPropSetInfo;
1230*cdf0e10cSrcweir 		if (xPropSet.is())
1231*cdf0e10cSrcweir 			xPropSetInfo = xPropSet->getPropertySetInfo();
1232*cdf0e10cSrcweir 		if( xPropSetInfo.is() &&
1233*cdf0e10cSrcweir 			xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) )
1234*cdf0e10cSrcweir 		{
1235*cdf0e10cSrcweir 			Any aAny;
1236*cdf0e10cSrcweir 			sal_Bool bTmp = bConsecutive;
1237*cdf0e10cSrcweir 			aAny.setValue( &bTmp, ::getBooleanCppuType() );
1238*cdf0e10cSrcweir 			xPropSet->setPropertyValue( sIsContinuousNumbering, aAny );
1239*cdf0e10cSrcweir 		}
1240*cdf0e10cSrcweir 	}
1241*cdf0e10cSrcweir 	catch( Exception& )
1242*cdf0e10cSrcweir 	{
1243*cdf0e10cSrcweir 		DBG_ERROR( "SvxXMLListStyleContext::FillUnoNumRule - Exception catched" );
1244*cdf0e10cSrcweir 	}
1245*cdf0e10cSrcweir }
1246*cdf0e10cSrcweir 
1247*cdf0e10cSrcweir void SvxXMLListStyleContext::CreateAndInsertLate( sal_Bool bOverwrite )
1248*cdf0e10cSrcweir {
1249*cdf0e10cSrcweir 	if( bOutline )
1250*cdf0e10cSrcweir 	{
1251*cdf0e10cSrcweir 		if( bOverwrite )
1252*cdf0e10cSrcweir 		{
1253*cdf0e10cSrcweir 			const Reference< XIndexReplace >& rNumRule =
1254*cdf0e10cSrcweir 				GetImport().GetTextImport()->GetChapterNumbering();
1255*cdf0e10cSrcweir 			// We don't set xNumberingRules here, to avoid using them
1256*cdf0e10cSrcweir 			// as numbering rules.
1257*cdf0e10cSrcweir 			if( rNumRule.is() )
1258*cdf0e10cSrcweir 				FillUnoNumRule( rNumRule, 0 );
1259*cdf0e10cSrcweir 		}
1260*cdf0e10cSrcweir 	}
1261*cdf0e10cSrcweir 	else
1262*cdf0e10cSrcweir 	{
1263*cdf0e10cSrcweir 		Reference < XStyle > xStyle;
1264*cdf0e10cSrcweir 		const OUString& rName = GetDisplayName();
1265*cdf0e10cSrcweir 		if( 0 == rName.getLength() )
1266*cdf0e10cSrcweir 		{
1267*cdf0e10cSrcweir 			SetValid( sal_False );
1268*cdf0e10cSrcweir 			return;
1269*cdf0e10cSrcweir 		}
1270*cdf0e10cSrcweir 
1271*cdf0e10cSrcweir 		const Reference < XNameContainer >& rNumStyles =
1272*cdf0e10cSrcweir 				GetImport().GetTextImport()->GetNumberingStyles();
1273*cdf0e10cSrcweir 		if( !rNumStyles.is() )
1274*cdf0e10cSrcweir 		{
1275*cdf0e10cSrcweir 			SetValid( sal_False );
1276*cdf0e10cSrcweir 			return;
1277*cdf0e10cSrcweir 		}
1278*cdf0e10cSrcweir 
1279*cdf0e10cSrcweir 		sal_Bool bNew = sal_False;
1280*cdf0e10cSrcweir 		if( rNumStyles->hasByName( rName ) )
1281*cdf0e10cSrcweir 		{
1282*cdf0e10cSrcweir 			Any aAny = rNumStyles->getByName( rName );
1283*cdf0e10cSrcweir 			aAny >>= xStyle;
1284*cdf0e10cSrcweir 		}
1285*cdf0e10cSrcweir 		else
1286*cdf0e10cSrcweir 		{
1287*cdf0e10cSrcweir 			Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
1288*cdf0e10cSrcweir 														UNO_QUERY );
1289*cdf0e10cSrcweir 			DBG_ASSERT( xFactory.is(), "no factory" );
1290*cdf0e10cSrcweir 			if( !xFactory.is() )
1291*cdf0e10cSrcweir 				return;
1292*cdf0e10cSrcweir 
1293*cdf0e10cSrcweir 			Reference < XInterface > xIfc = xFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.NumberingStyle")) );
1294*cdf0e10cSrcweir 			if( !xIfc.is() )
1295*cdf0e10cSrcweir 				return;
1296*cdf0e10cSrcweir 			Reference < XStyle > xTmp( xIfc, UNO_QUERY );
1297*cdf0e10cSrcweir 			xStyle = xTmp;
1298*cdf0e10cSrcweir 			if( !xStyle.is() )
1299*cdf0e10cSrcweir 				return;
1300*cdf0e10cSrcweir 
1301*cdf0e10cSrcweir 			Any aAny;
1302*cdf0e10cSrcweir 			aAny <<= xStyle;
1303*cdf0e10cSrcweir 			rNumStyles->insertByName( rName, aAny );
1304*cdf0e10cSrcweir 			bNew = sal_True;
1305*cdf0e10cSrcweir 		}
1306*cdf0e10cSrcweir 
1307*cdf0e10cSrcweir 		Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
1308*cdf0e10cSrcweir 		Reference< XPropertySetInfo > xPropSetInfo =
1309*cdf0e10cSrcweir 			xPropSet->getPropertySetInfo();
1310*cdf0e10cSrcweir 		if( !bNew && xPropSetInfo->hasPropertyByName( sIsPhysical ) )
1311*cdf0e10cSrcweir 		{
1312*cdf0e10cSrcweir 			Any aAny = xPropSet->getPropertyValue( sIsPhysical );
1313*cdf0e10cSrcweir 			bNew = !*(sal_Bool *)aAny.getValue();
1314*cdf0e10cSrcweir 		}
1315*cdf0e10cSrcweir 		if( rName != GetName() )
1316*cdf0e10cSrcweir 			GetImport().AddStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
1317*cdf0e10cSrcweir 											 GetName(), rName );
1318*cdf0e10cSrcweir 
1319*cdf0e10cSrcweir 		Any aAny = xPropSet->getPropertyValue( sNumberingRules );
1320*cdf0e10cSrcweir 		aAny >>= xNumRules;
1321*cdf0e10cSrcweir 		nLevels = xNumRules->getCount();
1322*cdf0e10cSrcweir 		if( bOverwrite || bNew )
1323*cdf0e10cSrcweir 		{
1324*cdf0e10cSrcweir 			FillUnoNumRule( xNumRules, 0 );
1325*cdf0e10cSrcweir 			aAny <<= xNumRules;
1326*cdf0e10cSrcweir 			xPropSet->setPropertyValue( sNumberingRules, aAny );
1327*cdf0e10cSrcweir 		}
1328*cdf0e10cSrcweir 		else
1329*cdf0e10cSrcweir 		{
1330*cdf0e10cSrcweir 			SetValid( sal_False );
1331*cdf0e10cSrcweir 		}
1332*cdf0e10cSrcweir 
1333*cdf0e10cSrcweir 		SetNew( bNew );
1334*cdf0e10cSrcweir 	}
1335*cdf0e10cSrcweir }
1336*cdf0e10cSrcweir 
1337*cdf0e10cSrcweir void SvxXMLListStyleContext::CreateAndInsertAuto() const
1338*cdf0e10cSrcweir {
1339*cdf0e10cSrcweir 	DBG_ASSERT( !bOutline, "Outlines cannot be inserted here" );
1340*cdf0e10cSrcweir 	DBG_ASSERT( !xNumRules.is(), "Numbering Rule is existing already" );
1341*cdf0e10cSrcweir 
1342*cdf0e10cSrcweir 	const OUString& rName = GetName();
1343*cdf0e10cSrcweir 	if( bOutline || xNumRules.is() || 0 == rName.getLength() )
1344*cdf0e10cSrcweir 	{
1345*cdf0e10cSrcweir 		((SvxXMLListStyleContext *)this)->SetValid( sal_False );
1346*cdf0e10cSrcweir 		return;
1347*cdf0e10cSrcweir 	}
1348*cdf0e10cSrcweir 
1349*cdf0e10cSrcweir 	((SvxXMLListStyleContext *)this)->xNumRules = CreateNumRule(
1350*cdf0e10cSrcweir 		GetImport().GetModel() );
1351*cdf0e10cSrcweir 	((SvxXMLListStyleContext *)this)->nLevels = xNumRules->getCount();
1352*cdf0e10cSrcweir 
1353*cdf0e10cSrcweir 	FillUnoNumRule( xNumRules, 0 );
1354*cdf0e10cSrcweir }
1355*cdf0e10cSrcweir 
1356*cdf0e10cSrcweir Reference < XIndexReplace > SvxXMLListStyleContext::CreateNumRule(
1357*cdf0e10cSrcweir 								const Reference < XModel > & rModel )
1358*cdf0e10cSrcweir {
1359*cdf0e10cSrcweir 	Reference<XIndexReplace> xNumRule;
1360*cdf0e10cSrcweir 
1361*cdf0e10cSrcweir 	Reference< XMultiServiceFactory > xFactory( rModel, UNO_QUERY );
1362*cdf0e10cSrcweir 	DBG_ASSERT( xFactory.is(), "no factory" );
1363*cdf0e10cSrcweir 	if( !xFactory.is() )
1364*cdf0e10cSrcweir 		return xNumRule;
1365*cdf0e10cSrcweir 
1366*cdf0e10cSrcweir 	Reference < XInterface > xIfc = xFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.NumberingRules")) );
1367*cdf0e10cSrcweir 	if( !xIfc.is() )
1368*cdf0e10cSrcweir 		return xNumRule;
1369*cdf0e10cSrcweir 
1370*cdf0e10cSrcweir 	xNumRule = Reference<XIndexReplace>( xIfc, UNO_QUERY );
1371*cdf0e10cSrcweir 	DBG_ASSERT( xNumRule.is(), "go no numbering rule" );
1372*cdf0e10cSrcweir 
1373*cdf0e10cSrcweir 	return xNumRule;
1374*cdf0e10cSrcweir }
1375*cdf0e10cSrcweir 
1376*cdf0e10cSrcweir void SvxXMLListStyleContext::SetDefaultStyle(
1377*cdf0e10cSrcweir 		const Reference < XIndexReplace > & rNumRule,
1378*cdf0e10cSrcweir 		sal_Int16 nLevel,
1379*cdf0e10cSrcweir 		sal_Bool bOrdered )
1380*cdf0e10cSrcweir {
1381*cdf0e10cSrcweir 	Sequence<beans::PropertyValue> aPropSeq( bOrdered ? 1 : 4  );
1382*cdf0e10cSrcweir 	beans::PropertyValue *pProps = aPropSeq.getArray();
1383*cdf0e10cSrcweir 
1384*cdf0e10cSrcweir 	pProps->Name =
1385*cdf0e10cSrcweir 				OUString::createFromAscii( XML_UNO_NAME_NRULE_NUMBERINGTYPE );
1386*cdf0e10cSrcweir 	(pProps++)->Value <<= (sal_Int16)(bOrdered ? NumberingType::ARABIC
1387*cdf0e10cSrcweir 									  		   : NumberingType::CHAR_SPECIAL );
1388*cdf0e10cSrcweir 	if( !bOrdered )
1389*cdf0e10cSrcweir 	{
1390*cdf0e10cSrcweir 		// TODO: Bullet-Font
1391*cdf0e10cSrcweir 		//aNumFmt.SetBulletFont( &SwNumRule::GetDefBulletFont() );
1392*cdf0e10cSrcweir 		awt::FontDescriptor aFDesc;
1393*cdf0e10cSrcweir 		aFDesc.Name = OUString(
1394*cdf0e10cSrcweir #if defined UNX
1395*cdf0e10cSrcweir 						RTL_CONSTASCII_USTRINGPARAM( "starbats" )
1396*cdf0e10cSrcweir #else
1397*cdf0e10cSrcweir 						RTL_CONSTASCII_USTRINGPARAM( "StarBats" )
1398*cdf0e10cSrcweir #endif
1399*cdf0e10cSrcweir 										);
1400*cdf0e10cSrcweir 		aFDesc.Family = FAMILY_DONTKNOW ;
1401*cdf0e10cSrcweir 		aFDesc.Pitch = PITCH_DONTKNOW ;
1402*cdf0e10cSrcweir 		aFDesc.CharSet = RTL_TEXTENCODING_SYMBOL ;
1403*cdf0e10cSrcweir 		aFDesc.Weight = WEIGHT_DONTKNOW;
1404*cdf0e10cSrcweir 		//aFDesc.Transparant = sal_True;
1405*cdf0e10cSrcweir 		pProps->Name =
1406*cdf0e10cSrcweir 					OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_FONT );
1407*cdf0e10cSrcweir 		(pProps++)->Value <<= aFDesc;
1408*cdf0e10cSrcweir 
1409*cdf0e10cSrcweir 		OUStringBuffer sTmp(1);
1410*cdf0e10cSrcweir 		sTmp.append( (sal_Unicode)(0xF000 + 149) );
1411*cdf0e10cSrcweir 		pProps->Name =
1412*cdf0e10cSrcweir 					OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_CHAR );
1413*cdf0e10cSrcweir 		(pProps++)->Value <<= sTmp.makeStringAndClear();
1414*cdf0e10cSrcweir 		pProps->Name =
1415*cdf0e10cSrcweir 				OUString::createFromAscii( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME );
1416*cdf0e10cSrcweir 		(pProps++)->Value <<=
1417*cdf0e10cSrcweir 			OUString( RTL_CONSTASCII_USTRINGPARAM( "Numbering Symbols" ) );
1418*cdf0e10cSrcweir 	}
1419*cdf0e10cSrcweir 
1420*cdf0e10cSrcweir 	Any aAny;
1421*cdf0e10cSrcweir 	aAny <<= aPropSeq;
1422*cdf0e10cSrcweir 	rNumRule->replaceByIndex( nLevel, aAny );
1423*cdf0e10cSrcweir }
1424*cdf0e10cSrcweir 
1425