xref: /AOO41X/main/xmloff/source/style/xmlnume.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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/style/XStyleFamiliesSupplier.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/style/NumberingType.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/container/XIndexReplace.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/awt/XBitmap.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/text/VertOrientation.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/text/XChapterNumberingSupplier.hpp>
41*cdf0e10cSrcweir // --> OD 2008-01-16 #newlistlevelattrs#
42*cdf0e10cSrcweir #include <com/sun/star/text/PositionAndSpaceMode.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/text/LabelFollow.hpp>
44*cdf0e10cSrcweir // <--
45*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #include <tools/debug.hxx>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
53*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
54*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
55*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
56*cdf0e10cSrcweir #include "fonthdl.hxx"
57*cdf0e10cSrcweir #include "xmloff/XMLTextListAutoStylePool.hxx"
58*cdf0e10cSrcweir #include <xmloff/xmlnume.hxx>
59*cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
60*cdf0e10cSrcweir #include <tools/fontenum.hxx>
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir using ::rtl::OUString;
64*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir using namespace ::com::sun::star;
67*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
68*cdf0e10cSrcweir using namespace ::com::sun::star::style;
69*cdf0e10cSrcweir using namespace ::com::sun::star::text;
70*cdf0e10cSrcweir using namespace ::com::sun::star::container;
71*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
72*cdf0e10cSrcweir using namespace ::xmloff::token;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] = "SymbolTextDistance";
75*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PARENT_NUMBERING[] = "ParentNumbering";
76*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] = "CharStyleName";
77*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_CHAR[] = "BulletChar";
78*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_RELSIZE[] = "BulletRelSize";
79*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_COLOR[] = "BulletColor";
80*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHIC_BITMAP[] = "GraphicBitmap";
81*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] = "GraphicSize";
82*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_VERT_ORIENT[] = "VertOrient";
83*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType";
84*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_HEADING_STYLE_NAME[] = "HeadingStyleName";
85*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PREFIX[] = "Prefix";
86*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix";
87*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_ADJUST[] = "Adjust";
88*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin";
89*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] = "FirstLineOffset";
90*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont";
91*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL";
92*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_START_WITH[] = "StartWith";
93*cdf0e10cSrcweir // --> OD 2008-01-15 #newlistlevelattrs#
94*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
95*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
96*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION[] = "ListtabStopPosition";
97*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_FIRST_LINE_INDENT[] = "FirstLineIndent";
98*cdf0e10cSrcweir static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_INDENT_AT[] = "IndentAt";
99*cdf0e10cSrcweir // <--
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir void SvxXMLNumRuleExport::exportLevelStyles( const uno::Reference< ::com::sun::star::container::XIndexReplace > & xNumRule,
102*cdf0e10cSrcweir 											 sal_Bool bOutline )
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir 	sal_Int32 nCount = xNumRule ->getCount();
105*cdf0e10cSrcweir 	for( sal_Int32 i=0; i<nCount; i++ )
106*cdf0e10cSrcweir 	{
107*cdf0e10cSrcweir 		uno::Any aEntry( xNumRule->getByIndex( i ) );
108*cdf0e10cSrcweir 		uno::Sequence<beans::PropertyValue> aSeq;
109*cdf0e10cSrcweir 		if( aEntry >>= aSeq )
110*cdf0e10cSrcweir 		{
111*cdf0e10cSrcweir 			exportLevelStyle( i, aSeq, bOutline );
112*cdf0e10cSrcweir 		}
113*cdf0e10cSrcweir 	}
114*cdf0e10cSrcweir }
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
117*cdf0e10cSrcweir 									const uno::Sequence<beans::PropertyValue>& rProps,
118*cdf0e10cSrcweir 									sal_Bool bOutline )
119*cdf0e10cSrcweir {
120*cdf0e10cSrcweir 	sal_Int16 eType = NumberingType::CHAR_SPECIAL;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 	sal_Int16 eAdjust = HoriOrientation::LEFT;
123*cdf0e10cSrcweir 	OUString sPrefix, sSuffix;
124*cdf0e10cSrcweir 	OUString sTextStyleName;
125*cdf0e10cSrcweir 	sal_Bool bHasColor = sal_False;
126*cdf0e10cSrcweir 	sal_Int32 nColor = 0;
127*cdf0e10cSrcweir 	sal_Int32 nSpaceBefore = 0, nMinLabelWidth = 0, nMinLabelDist = 0;
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 	sal_Int16 nStartValue = 1, nDisplayLevels = 1, nBullRelSize = 0;
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 	sal_Unicode cBullet = 0xf095;
132*cdf0e10cSrcweir 	OUString sBulletFontName, sBulletFontStyleName ;
133*cdf0e10cSrcweir 	sal_Int16 eBulletFontFamily = FAMILY_DONTKNOW;
134*cdf0e10cSrcweir 	sal_Int16 eBulletFontPitch = PITCH_DONTKNOW;
135*cdf0e10cSrcweir 	rtl_TextEncoding eBulletFontEncoding = RTL_TEXTENCODING_DONTKNOW;
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 	OUString sImageURL;
138*cdf0e10cSrcweir 	uno::Reference< ::com::sun::star::awt::XBitmap >  xBitmap;
139*cdf0e10cSrcweir 	sal_Int32 nImageWidth = 0, nImageHeight = 0;
140*cdf0e10cSrcweir 	sal_Int16 eImageVertOrient = VertOrientation::LINE_CENTER;
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir     // --> OD 2008-01-15 #newlistlevelattrs#
143*cdf0e10cSrcweir     sal_Int16 ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
144*cdf0e10cSrcweir     sal_Int16 eLabelFollowedBy = LabelFollow::LISTTAB;
145*cdf0e10cSrcweir     sal_Int32 nListtabStopPosition( 0 );
146*cdf0e10cSrcweir     sal_Int32 nFirstLineIndent( 0 );
147*cdf0e10cSrcweir     sal_Int32 nIndentAt( 0 );
148*cdf0e10cSrcweir     // <--
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir     const sal_Int32 nCount = rProps.getLength();
151*cdf0e10cSrcweir 	const beans::PropertyValue* pPropArray = rProps.getConstArray();
152*cdf0e10cSrcweir 	for( sal_Int32 i=0; i<nCount; i++ )
153*cdf0e10cSrcweir 	{
154*cdf0e10cSrcweir 		const beans::PropertyValue& rProp = pPropArray[i];
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 		if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_NUMBERINGTYPE, sizeof(XML_UNO_NAME_NRULE_NUMBERINGTYPE)-1 ) )
157*cdf0e10cSrcweir 		{
158*cdf0e10cSrcweir 			rProp.Value >>= eType;
159*cdf0e10cSrcweir 		}
160*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PREFIX, sizeof(XML_UNO_NAME_NRULE_PREFIX)-1 ) )
161*cdf0e10cSrcweir 		{
162*cdf0e10cSrcweir 			rProp.Value >>= sPrefix;
163*cdf0e10cSrcweir 		}
164*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SUFFIX, sizeof(XML_UNO_NAME_NRULE_SUFFIX)-1 ) )
165*cdf0e10cSrcweir 		{
166*cdf0e10cSrcweir 			rProp.Value >>= sSuffix;
167*cdf0e10cSrcweir 		}
168*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_CHAR, sizeof(XML_UNO_NAME_NRULE_BULLET_CHAR)-1 ) )
169*cdf0e10cSrcweir 		{
170*cdf0e10cSrcweir 			OUString sValue;
171*cdf0e10cSrcweir 			rProp.Value >>= sValue;
172*cdf0e10cSrcweir 			if( sValue.getLength() > 0 )
173*cdf0e10cSrcweir 			{
174*cdf0e10cSrcweir 				cBullet = (sal_Unicode)sValue[0];
175*cdf0e10cSrcweir 			}
176*cdf0e10cSrcweir 		}
177*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_RELSIZE, sizeof(XML_UNO_NAME_NRULE_BULLET_RELSIZE)-1 ) )
178*cdf0e10cSrcweir 		{
179*cdf0e10cSrcweir 			rProp.Value >>= nBullRelSize;
180*cdf0e10cSrcweir 		}
181*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_ADJUST, sizeof(XML_UNO_NAME_NRULE_ADJUST)-1 ) )
182*cdf0e10cSrcweir 		{
183*cdf0e10cSrcweir 			sal_Int16 nValue = 0;
184*cdf0e10cSrcweir 			rProp.Value >>= nValue;
185*cdf0e10cSrcweir 			eAdjust = nValue;
186*cdf0e10cSrcweir 		}
187*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_FONT, sizeof(XML_UNO_NAME_NRULE_BULLET_FONT)-1 ) )
188*cdf0e10cSrcweir 		{
189*cdf0e10cSrcweir 			awt::FontDescriptor rFDesc;
190*cdf0e10cSrcweir 			if( rProp.Value >>= rFDesc )
191*cdf0e10cSrcweir 			{
192*cdf0e10cSrcweir 				sBulletFontName = rFDesc.Name;
193*cdf0e10cSrcweir 				sBulletFontStyleName = rFDesc.StyleName;
194*cdf0e10cSrcweir 				eBulletFontFamily = (sal_Int16)rFDesc.Family;
195*cdf0e10cSrcweir 				eBulletFontPitch = (sal_Int16)rFDesc.Pitch;
196*cdf0e10cSrcweir 				eBulletFontEncoding = (rtl_TextEncoding)rFDesc.CharSet;
197*cdf0e10cSrcweir 			}
198*cdf0e10cSrcweir 		}
199*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHICURL, sizeof(XML_UNO_NAME_NRULE_GRAPHICURL)-1 ) )
200*cdf0e10cSrcweir 		{
201*cdf0e10cSrcweir 			rProp.Value >>= sImageURL;
202*cdf0e10cSrcweir 		}
203*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_BITMAP, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_BITMAP)-1 ) )
204*cdf0e10cSrcweir 		{
205*cdf0e10cSrcweir 			rProp.Value >>= xBitmap;
206*cdf0e10cSrcweir 		}
207*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_COLOR, sizeof(XML_UNO_NAME_NRULE_BULLET_COLOR)-1 ) )
208*cdf0e10cSrcweir 		{
209*cdf0e10cSrcweir 			rProp.Value >>= nColor;
210*cdf0e10cSrcweir 			bHasColor = sal_True;
211*cdf0e10cSrcweir 		}
212*cdf0e10cSrcweir 		else  if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_START_WITH, sizeof(XML_UNO_NAME_NRULE_START_WITH)-1 ) )
213*cdf0e10cSrcweir 		{
214*cdf0e10cSrcweir 			rProp.Value >>= nStartValue;
215*cdf0e10cSrcweir 		}
216*cdf0e10cSrcweir 		else  if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LEFT_MARGIN, sizeof(XML_UNO_NAME_NRULE_LEFT_MARGIN)-1 ) )
217*cdf0e10cSrcweir 		{
218*cdf0e10cSrcweir 			rProp.Value >>= nSpaceBefore;
219*cdf0e10cSrcweir 		}
220*cdf0e10cSrcweir 		else  if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET, sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET)-1 ) )
221*cdf0e10cSrcweir 		{
222*cdf0e10cSrcweir 			rProp.Value >>= nMinLabelWidth;
223*cdf0e10cSrcweir 		}
224*cdf0e10cSrcweir 		else  if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE, sizeof(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE)-1 ) )
225*cdf0e10cSrcweir 		{
226*cdf0e10cSrcweir 			rProp.Value >>= nMinLabelDist;
227*cdf0e10cSrcweir 		}
228*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PARENT_NUMBERING, sizeof(XML_UNO_NAME_NRULE_PARENT_NUMBERING)-1 ) )
229*cdf0e10cSrcweir 		{
230*cdf0e10cSrcweir 			rProp.Value >>= nDisplayLevels;
231*cdf0e10cSrcweir 			if( nDisplayLevels > nLevel+1 )
232*cdf0e10cSrcweir 				nDisplayLevels = static_cast<sal_Int16>( nLevel )+1;
233*cdf0e10cSrcweir 		}
234*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME, sizeof(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME)-1 ) )
235*cdf0e10cSrcweir 		{
236*cdf0e10cSrcweir 			rProp.Value >>= sTextStyleName;
237*cdf0e10cSrcweir 		}
238*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_SIZE, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_SIZE)-1 ) )
239*cdf0e10cSrcweir 		{
240*cdf0e10cSrcweir 			awt::Size aSize;
241*cdf0e10cSrcweir 			if( rProp.Value >>= aSize )
242*cdf0e10cSrcweir 			{
243*cdf0e10cSrcweir 				nImageWidth = aSize.Width;
244*cdf0e10cSrcweir 				nImageHeight = aSize.Height;
245*cdf0e10cSrcweir 			}
246*cdf0e10cSrcweir 		}
247*cdf0e10cSrcweir 		else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_VERT_ORIENT, sizeof(XML_UNO_NAME_NRULE_VERT_ORIENT)-1 ) )
248*cdf0e10cSrcweir 		{
249*cdf0e10cSrcweir 			sal_Int16 nValue = 0;
250*cdf0e10cSrcweir 			rProp.Value >>= nValue;
251*cdf0e10cSrcweir 			eImageVertOrient = nValue;
252*cdf0e10cSrcweir 		}
253*cdf0e10cSrcweir         // --> OD 2008-01-16 #newlistlevelattrs#
254*cdf0e10cSrcweir         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE,
255*cdf0e10cSrcweir                                           sizeof(XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE)-1 ) )
256*cdf0e10cSrcweir         {
257*cdf0e10cSrcweir             sal_Int16 nValue = 0;
258*cdf0e10cSrcweir             rProp.Value >>= nValue;
259*cdf0e10cSrcweir             ePosAndSpaceMode = nValue;
260*cdf0e10cSrcweir         }
261*cdf0e10cSrcweir         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY,
262*cdf0e10cSrcweir                                           sizeof(XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY)-1 ) )
263*cdf0e10cSrcweir         {
264*cdf0e10cSrcweir             sal_Int16 nValue = 0;
265*cdf0e10cSrcweir             rProp.Value >>= nValue;
266*cdf0e10cSrcweir             eLabelFollowedBy = nValue;
267*cdf0e10cSrcweir         }
268*cdf0e10cSrcweir         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION,
269*cdf0e10cSrcweir                                           sizeof(XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION)-1 ) )
270*cdf0e10cSrcweir         {
271*cdf0e10cSrcweir             rProp.Value >>= nListtabStopPosition;
272*cdf0e10cSrcweir         }
273*cdf0e10cSrcweir         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_FIRST_LINE_INDENT,
274*cdf0e10cSrcweir                                           sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_INDENT)-1 ) )
275*cdf0e10cSrcweir         {
276*cdf0e10cSrcweir             rProp.Value >>= nFirstLineIndent;
277*cdf0e10cSrcweir         }
278*cdf0e10cSrcweir         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_INDENT_AT,
279*cdf0e10cSrcweir                                           sizeof(XML_UNO_NAME_NRULE_INDENT_AT)-1 ) )
280*cdf0e10cSrcweir         {
281*cdf0e10cSrcweir             rProp.Value >>= nIndentAt;
282*cdf0e10cSrcweir         }
283*cdf0e10cSrcweir         // <--
284*cdf0e10cSrcweir 	}
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 	if( bOutline && (NumberingType::CHAR_SPECIAL == eType ||
287*cdf0e10cSrcweir 					 NumberingType::BITMAP == eType) )
288*cdf0e10cSrcweir 	{
289*cdf0e10cSrcweir 		DBG_ASSERT( !bOutline,
290*cdf0e10cSrcweir 		   "SvxXMLNumRuleExport::exportLevelStyle: invalid style for outline" );
291*cdf0e10cSrcweir 		return;
292*cdf0e10cSrcweir 	}
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 	GetExport().CheckAttrList();
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir 	// text:level
297*cdf0e10cSrcweir 	OUStringBuffer sTmp;
298*cdf0e10cSrcweir 	sTmp.append( nLevel + 1 );
299*cdf0e10cSrcweir 	GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, sTmp.makeStringAndClear() );
300*cdf0e10cSrcweir     // #i110694#: no style-name on list-level-style-image
301*cdf0e10cSrcweir     // #i116149#: neither prefix/suffix
302*cdf0e10cSrcweir     if (NumberingType::BITMAP != eType)
303*cdf0e10cSrcweir     {
304*cdf0e10cSrcweir         if (sTextStyleName.getLength() > 0)
305*cdf0e10cSrcweir         {
306*cdf0e10cSrcweir             GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
307*cdf0e10cSrcweir                     GetExport().EncodeStyleName( sTextStyleName ) );
308*cdf0e10cSrcweir         }
309*cdf0e10cSrcweir         if (sPrefix.getLength() > 0)
310*cdf0e10cSrcweir         {
311*cdf0e10cSrcweir             GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_PREFIX,
312*cdf0e10cSrcweir                     sPrefix );
313*cdf0e10cSrcweir         }
314*cdf0e10cSrcweir         if (sSuffix.getLength() > 0)
315*cdf0e10cSrcweir         {
316*cdf0e10cSrcweir             GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_SUFFIX,
317*cdf0e10cSrcweir                     sSuffix );
318*cdf0e10cSrcweir         }
319*cdf0e10cSrcweir     }
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 	enum XMLTokenEnum eElem = XML_LIST_LEVEL_STYLE_NUMBER;
322*cdf0e10cSrcweir 	if( NumberingType::CHAR_SPECIAL == eType )
323*cdf0e10cSrcweir 	{
324*cdf0e10cSrcweir 		// <text:list-level-style-bullet>
325*cdf0e10cSrcweir 		eElem = XML_LIST_LEVEL_STYLE_BULLET;
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 		if( cBullet )
328*cdf0e10cSrcweir 		{
329*cdf0e10cSrcweir 			if( cBullet < ' ' )
330*cdf0e10cSrcweir 			{
331*cdf0e10cSrcweir 				cBullet = 0xF000 + 149;
332*cdf0e10cSrcweir 			}
333*cdf0e10cSrcweir 			// text:bullet-char="..."
334*cdf0e10cSrcweir 			sTmp.append( cBullet );
335*cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_BULLET_CHAR,
336*cdf0e10cSrcweir 						  sTmp.makeStringAndClear() );
337*cdf0e10cSrcweir 		}
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 	}
340*cdf0e10cSrcweir 	else if( NumberingType::BITMAP == eType )
341*cdf0e10cSrcweir 	{
342*cdf0e10cSrcweir 		// <text:list-level-style-image>
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir 		eElem = XML_LIST_LEVEL_STYLE_IMAGE;
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 		if( sImageURL.getLength() )
348*cdf0e10cSrcweir 		{
349*cdf0e10cSrcweir 			OUString sURL( GetExport().AddEmbeddedGraphicObject( sImageURL ) );
350*cdf0e10cSrcweir 			if( sURL.getLength() )
351*cdf0e10cSrcweir 			{
352*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
355*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
356*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
357*cdf0e10cSrcweir 			}
358*cdf0e10cSrcweir 		}
359*cdf0e10cSrcweir 		else
360*cdf0e10cSrcweir 		{
361*cdf0e10cSrcweir 			DBG_ASSERT( !xBitmap.is(),
362*cdf0e10cSrcweir 						"embedded images are not supported by now" );
363*cdf0e10cSrcweir 		}
364*cdf0e10cSrcweir 	}
365*cdf0e10cSrcweir 	else
366*cdf0e10cSrcweir 	{
367*cdf0e10cSrcweir 		// <text:list-level-style-number> or <text:outline-level-style>
368*cdf0e10cSrcweir 		if( bOutline )
369*cdf0e10cSrcweir 			eElem = XML_OUTLINE_LEVEL_STYLE;
370*cdf0e10cSrcweir 		else
371*cdf0e10cSrcweir 			eElem = XML_LIST_LEVEL_STYLE_NUMBER;
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 		GetExport().GetMM100UnitConverter().convertNumFormat( sTmp, eType );
374*cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
375*cdf0e10cSrcweir 						  	   	  sTmp.makeStringAndClear() );
376*cdf0e10cSrcweir 		GetExport().GetMM100UnitConverter().convertNumLetterSync( sTmp, eType );
377*cdf0e10cSrcweir 		if( sTmp.getLength() )
378*cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_STYLE,
379*cdf0e10cSrcweir 									  XML_NUM_LETTER_SYNC,
380*cdf0e10cSrcweir 						  	   		  sTmp.makeStringAndClear() );
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir 		if( nStartValue != 1 )
383*cdf0e10cSrcweir 		{
384*cdf0e10cSrcweir 			sTmp.append( (sal_Int32)nStartValue );
385*cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
386*cdf0e10cSrcweir 						  sTmp.makeStringAndClear() );
387*cdf0e10cSrcweir 		}
388*cdf0e10cSrcweir 		if( nDisplayLevels > 1 && NumberingType::NUMBER_NONE != eType )
389*cdf0e10cSrcweir 		{
390*cdf0e10cSrcweir 			sTmp.append( (sal_Int32)nDisplayLevels );
391*cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_DISPLAY_LEVELS,
392*cdf0e10cSrcweir 						  sTmp.makeStringAndClear() );
393*cdf0e10cSrcweir 		}
394*cdf0e10cSrcweir 	}
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir 	{
397*cdf0e10cSrcweir 		SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem,
398*cdf0e10cSrcweir 								  sal_True, sal_True );
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir         // --> OD 2008-01-16 #newlistlevelattrs#
401*cdf0e10cSrcweir         OUStringBuffer sBuffer;
402*cdf0e10cSrcweir         if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
403*cdf0e10cSrcweir         {
404*cdf0e10cSrcweir             // --> OD 2008-06-05 #i89178#
405*cdf0e10cSrcweir             // optimization of XML stream size:
406*cdf0e10cSrcweir             // suppress export of property list-level-position-and-space-mode,
407*cdf0e10cSrcweir             // if its value is "label-width-and-position" - its the default value
408*cdf0e10cSrcweir //            GetExport().AddAttribute( XML_NAMESPACE_TEXT,
409*cdf0e10cSrcweir //                                      XML_LIST_LEVEL_POSITION_AND_SPACE_MODE,
410*cdf0e10cSrcweir //                                      XML_LABEL_WIDTH_AND_POSITION );
411*cdf0e10cSrcweir             // <--
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir             nSpaceBefore += nMinLabelWidth;
414*cdf0e10cSrcweir             nMinLabelWidth = -nMinLabelWidth;
415*cdf0e10cSrcweir             if( nSpaceBefore != 0 )
416*cdf0e10cSrcweir             {
417*cdf0e10cSrcweir                 GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nSpaceBefore );
418*cdf0e10cSrcweir                 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_SPACE_BEFORE,
419*cdf0e10cSrcweir                               sBuffer.makeStringAndClear() );
420*cdf0e10cSrcweir             }
421*cdf0e10cSrcweir             if( nMinLabelWidth != 0 )
422*cdf0e10cSrcweir             {
423*cdf0e10cSrcweir                 GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelWidth );
424*cdf0e10cSrcweir                 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH,
425*cdf0e10cSrcweir                               sBuffer.makeStringAndClear() );
426*cdf0e10cSrcweir             }
427*cdf0e10cSrcweir             if( nMinLabelDist > 0 )
428*cdf0e10cSrcweir             {
429*cdf0e10cSrcweir                 GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelDist );
430*cdf0e10cSrcweir                 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE,
431*cdf0e10cSrcweir                               sBuffer.makeStringAndClear() );
432*cdf0e10cSrcweir             }
433*cdf0e10cSrcweir         }
434*cdf0e10cSrcweir         // --> OD 2008-06-06 #i89178#
435*cdf0e10cSrcweir         // check, if properties for position-and-space-mode LABEL_ALIGNMENT
436*cdf0e10cSrcweir         // are allowed to be exported.
437*cdf0e10cSrcweir         else if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
438*cdf0e10cSrcweir                   mbExportPositionAndSpaceModeLabelAlignment )
439*cdf0e10cSrcweir         // <--
440*cdf0e10cSrcweir         {
441*cdf0e10cSrcweir             GetExport().AddAttribute( XML_NAMESPACE_TEXT,
442*cdf0e10cSrcweir                                       XML_LIST_LEVEL_POSITION_AND_SPACE_MODE,
443*cdf0e10cSrcweir                                       XML_LABEL_ALIGNMENT );
444*cdf0e10cSrcweir         }
445*cdf0e10cSrcweir         // <--
446*cdf0e10cSrcweir 		if( HoriOrientation::LEFT != eAdjust )
447*cdf0e10cSrcweir 		{
448*cdf0e10cSrcweir             enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
449*cdf0e10cSrcweir 			switch( eAdjust )
450*cdf0e10cSrcweir 			{
451*cdf0e10cSrcweir 			case HoriOrientation::RIGHT:	eValue = XML_END;	break;
452*cdf0e10cSrcweir 			case HoriOrientation::CENTER:	eValue = XML_CENTER;	break;
453*cdf0e10cSrcweir 			}
454*cdf0e10cSrcweir 			if( eValue != XML_TOKEN_INVALID )
455*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_FO, XML_TEXT_ALIGN, eValue );
456*cdf0e10cSrcweir 		}
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir 		if( NumberingType::BITMAP == eType )
459*cdf0e10cSrcweir 		{
460*cdf0e10cSrcweir             enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
461*cdf0e10cSrcweir 			switch( eImageVertOrient )
462*cdf0e10cSrcweir 			{
463*cdf0e10cSrcweir 			case VertOrientation::BOTTOM:	// yes, its OK: BOTTOM means that the baseline
464*cdf0e10cSrcweir 									// hits the frame at its topmost position
465*cdf0e10cSrcweir 			case VertOrientation::LINE_TOP:
466*cdf0e10cSrcweir 			case VertOrientation::CHAR_TOP:
467*cdf0e10cSrcweir 				eValue = XML_TOP;
468*cdf0e10cSrcweir 				break;
469*cdf0e10cSrcweir 			case VertOrientation::CENTER:
470*cdf0e10cSrcweir 			case VertOrientation::LINE_CENTER:
471*cdf0e10cSrcweir 			case VertOrientation::CHAR_CENTER:
472*cdf0e10cSrcweir 				eValue = XML_MIDDLE;
473*cdf0e10cSrcweir 				break;
474*cdf0e10cSrcweir 			case VertOrientation::TOP:		// yes, its OK: TOP means that the baseline
475*cdf0e10cSrcweir 									// hits the frame at its bottommost position
476*cdf0e10cSrcweir 			case VertOrientation::LINE_BOTTOM:
477*cdf0e10cSrcweir 			case VertOrientation::CHAR_BOTTOM:
478*cdf0e10cSrcweir 				eValue = XML_BOTTOM;
479*cdf0e10cSrcweir 				break;
480*cdf0e10cSrcweir 			}
481*cdf0e10cSrcweir 			if( eValue != XML_TOKEN_INVALID )
482*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_VERTICAL_POS, eValue );
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir 			eValue = XML_TOKEN_INVALID;
485*cdf0e10cSrcweir 			switch( eImageVertOrient )
486*cdf0e10cSrcweir 			{
487*cdf0e10cSrcweir 			case VertOrientation::TOP:
488*cdf0e10cSrcweir 			case VertOrientation::CENTER:
489*cdf0e10cSrcweir 			case VertOrientation::BOTTOM:
490*cdf0e10cSrcweir 				eValue = XML_BASELINE;
491*cdf0e10cSrcweir 				break;
492*cdf0e10cSrcweir 			case VertOrientation::LINE_TOP:
493*cdf0e10cSrcweir 			case VertOrientation::LINE_CENTER:
494*cdf0e10cSrcweir 			case VertOrientation::LINE_BOTTOM:
495*cdf0e10cSrcweir 				eValue = XML_LINE;
496*cdf0e10cSrcweir 				break;
497*cdf0e10cSrcweir 			case VertOrientation::CHAR_TOP:
498*cdf0e10cSrcweir 			case VertOrientation::CHAR_CENTER:
499*cdf0e10cSrcweir 			case VertOrientation::CHAR_BOTTOM:
500*cdf0e10cSrcweir 				eValue = XML_CHAR;
501*cdf0e10cSrcweir 				break;
502*cdf0e10cSrcweir 			}
503*cdf0e10cSrcweir 			if( eValue != XML_TOKEN_INVALID )
504*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_VERTICAL_REL, eValue );
505*cdf0e10cSrcweir 
506*cdf0e10cSrcweir 			if( nImageWidth > 0 )
507*cdf0e10cSrcweir 			{
508*cdf0e10cSrcweir 				GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageWidth );
509*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_FO, XML_WIDTH,
510*cdf0e10cSrcweir 							  sBuffer.makeStringAndClear() );
511*cdf0e10cSrcweir 			}
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir 			if( nImageHeight > 0 )
514*cdf0e10cSrcweir 			{
515*cdf0e10cSrcweir 				GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageHeight );
516*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_FO, XML_HEIGHT,
517*cdf0e10cSrcweir 							  sBuffer.makeStringAndClear() );
518*cdf0e10cSrcweir 			}
519*cdf0e10cSrcweir 		}
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir         // --> OD 2008-01-16 #newlistlevelattrs#
522*cdf0e10cSrcweir //        if( GetExport().GetAttrList().getLength() > 0 )
523*cdf0e10cSrcweir 		{
524*cdf0e10cSrcweir 			SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE,
525*cdf0e10cSrcweir 									  XML_LIST_LEVEL_PROPERTIES, sal_True, sal_True );
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir             // --> OD 2008-06-06 #i89178#
528*cdf0e10cSrcweir             // check, if properties for position-and-space-mode LABEL_ALIGNMENT
529*cdf0e10cSrcweir             // are allowed to be exported.
530*cdf0e10cSrcweir             if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
531*cdf0e10cSrcweir                  mbExportPositionAndSpaceModeLabelAlignment )
532*cdf0e10cSrcweir             // <--
533*cdf0e10cSrcweir             {
534*cdf0e10cSrcweir                 enum XMLTokenEnum eValue = XML_LISTTAB;
535*cdf0e10cSrcweir                 if ( eLabelFollowedBy == LabelFollow::SPACE )
536*cdf0e10cSrcweir                 {
537*cdf0e10cSrcweir                     eValue = XML_SPACE;
538*cdf0e10cSrcweir                 }
539*cdf0e10cSrcweir                 else if ( eLabelFollowedBy == LabelFollow::NOTHING )
540*cdf0e10cSrcweir                 {
541*cdf0e10cSrcweir                     eValue = XML_NOTHING;
542*cdf0e10cSrcweir                 }
543*cdf0e10cSrcweir                 GetExport().AddAttribute( XML_NAMESPACE_TEXT,
544*cdf0e10cSrcweir                                           XML_LABEL_FOLLOWED_BY, eValue );
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir                 if ( eLabelFollowedBy == LabelFollow::LISTTAB &&
547*cdf0e10cSrcweir                      nListtabStopPosition > 0 )
548*cdf0e10cSrcweir                 {
549*cdf0e10cSrcweir                     GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nListtabStopPosition );
550*cdf0e10cSrcweir                     GetExport().AddAttribute( XML_NAMESPACE_TEXT,
551*cdf0e10cSrcweir                                               XML_LIST_TAB_STOP_POSITION,
552*cdf0e10cSrcweir                                               sBuffer.makeStringAndClear() );
553*cdf0e10cSrcweir                 }
554*cdf0e10cSrcweir 
555*cdf0e10cSrcweir                 if ( nFirstLineIndent != 0 )
556*cdf0e10cSrcweir                 {
557*cdf0e10cSrcweir                     GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nFirstLineIndent );
558*cdf0e10cSrcweir                     GetExport().AddAttribute( XML_NAMESPACE_FO,
559*cdf0e10cSrcweir                                               XML_TEXT_INDENT,
560*cdf0e10cSrcweir                                               sBuffer.makeStringAndClear() );
561*cdf0e10cSrcweir                 }
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir                 if ( nIndentAt != 0 )
564*cdf0e10cSrcweir                 {
565*cdf0e10cSrcweir                     GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nIndentAt );
566*cdf0e10cSrcweir                     GetExport().AddAttribute( XML_NAMESPACE_FO,
567*cdf0e10cSrcweir                                               XML_MARGIN_LEFT,
568*cdf0e10cSrcweir                                               sBuffer.makeStringAndClear() );
569*cdf0e10cSrcweir                 }
570*cdf0e10cSrcweir 
571*cdf0e10cSrcweir                 SvXMLElementExport aLabelAlignmentElement( GetExport(), XML_NAMESPACE_STYLE,
572*cdf0e10cSrcweir                                              XML_LIST_LEVEL_LABEL_ALIGNMENT,
573*cdf0e10cSrcweir                                              sal_True, sal_True );
574*cdf0e10cSrcweir             }
575*cdf0e10cSrcweir         }
576*cdf0e10cSrcweir         // <--
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir 		if( NumberingType::CHAR_SPECIAL == eType )
579*cdf0e10cSrcweir 		{
580*cdf0e10cSrcweir 			if( sBulletFontName.getLength() )
581*cdf0e10cSrcweir 			{
582*cdf0e10cSrcweir 				OUString sStyleName =
583*cdf0e10cSrcweir 					GetExport().GetFontAutoStylePool()->Find(
584*cdf0e10cSrcweir 						sBulletFontName, sBulletFontStyleName,
585*cdf0e10cSrcweir 						eBulletFontFamily, eBulletFontPitch,
586*cdf0e10cSrcweir 						eBulletFontEncoding );
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir 				if( sStyleName.getLength() )
589*cdf0e10cSrcweir 				{
590*cdf0e10cSrcweir 						GetExport().AddAttribute( XML_NAMESPACE_STYLE,
591*cdf0e10cSrcweir 												  XML_FONT_NAME,
592*cdf0e10cSrcweir 												  sStyleName );
593*cdf0e10cSrcweir 				}
594*cdf0e10cSrcweir 				else
595*cdf0e10cSrcweir 				{
596*cdf0e10cSrcweir 					Any aAny;
597*cdf0e10cSrcweir 					OUString sTemp;
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir 					const SvXMLUnitConverter& rUnitConv =
600*cdf0e10cSrcweir 						GetExport().GetMM100UnitConverter();
601*cdf0e10cSrcweir 					XMLFontFamilyNamePropHdl aFamilyNameHdl;
602*cdf0e10cSrcweir 					aAny <<= sBulletFontName;
603*cdf0e10cSrcweir 					if( aFamilyNameHdl.exportXML( sTemp, aAny, rUnitConv ) )
604*cdf0e10cSrcweir 						GetExport().AddAttribute( XML_NAMESPACE_FO,
605*cdf0e10cSrcweir 												  XML_FONT_FAMILY, sTemp );
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir 					if( sBulletFontStyleName.getLength() )
608*cdf0e10cSrcweir 						GetExport().AddAttribute( XML_NAMESPACE_STYLE,
609*cdf0e10cSrcweir 												  XML_FONT_STYLE_NAME,
610*cdf0e10cSrcweir 												  sBulletFontStyleName );
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir 					XMLFontFamilyPropHdl aFamilyHdl;
613*cdf0e10cSrcweir 					aAny <<= (sal_Int16)eBulletFontFamily;
614*cdf0e10cSrcweir 					if( aFamilyHdl.exportXML( sTemp, aAny, rUnitConv  ) )
615*cdf0e10cSrcweir 						GetExport().AddAttribute( XML_NAMESPACE_STYLE,
616*cdf0e10cSrcweir 												  XML_FONT_FAMILY_GENERIC,
617*cdf0e10cSrcweir 												  sTemp );
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir 					XMLFontPitchPropHdl aPitchHdl;
620*cdf0e10cSrcweir 					aAny <<= (sal_Int16)eBulletFontPitch;
621*cdf0e10cSrcweir 					if( aPitchHdl.exportXML( sTemp, aAny, rUnitConv  ) )
622*cdf0e10cSrcweir 						GetExport().AddAttribute( XML_NAMESPACE_STYLE,
623*cdf0e10cSrcweir 												  XML_FONT_PITCH, sTemp );
624*cdf0e10cSrcweir 
625*cdf0e10cSrcweir 					XMLFontEncodingPropHdl aEncHdl;
626*cdf0e10cSrcweir 					aAny <<= (sal_Int16)eBulletFontEncoding;
627*cdf0e10cSrcweir 					if( aEncHdl.exportXML( sTemp, aAny, rUnitConv  ) )
628*cdf0e10cSrcweir 						GetExport().AddAttribute( XML_NAMESPACE_STYLE,
629*cdf0e10cSrcweir 												  XML_FONT_CHARSET, sTemp );
630*cdf0e10cSrcweir 				}
631*cdf0e10cSrcweir 			}
632*cdf0e10cSrcweir 		}
633*cdf0e10cSrcweir 		if( NumberingType::BITMAP != eType )
634*cdf0e10cSrcweir 		{
635*cdf0e10cSrcweir 			// fo:color = "#..."
636*cdf0e10cSrcweir 			if( bHasColor )
637*cdf0e10cSrcweir 			{
638*cdf0e10cSrcweir 				const Color aColor( nColor );
639*cdf0e10cSrcweir 				if( aColor.GetColor() == 0xffffffff )
640*cdf0e10cSrcweir 				{
641*cdf0e10cSrcweir 					GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_USE_WINDOW_FONT_COLOR, XML_TRUE );
642*cdf0e10cSrcweir 				}
643*cdf0e10cSrcweir 				else
644*cdf0e10cSrcweir 				{
645*cdf0e10cSrcweir 					SvXMLUnitConverter::convertColor( sBuffer, aColor );
646*cdf0e10cSrcweir 					GetExport().AddAttribute( XML_NAMESPACE_FO, XML_COLOR,
647*cdf0e10cSrcweir 								  sBuffer.makeStringAndClear() );
648*cdf0e10cSrcweir 				}
649*cdf0e10cSrcweir 			}
650*cdf0e10cSrcweir 			// fo:height="...%"
651*cdf0e10cSrcweir 			if( nBullRelSize )
652*cdf0e10cSrcweir 			{
653*cdf0e10cSrcweir 				GetExport().GetMM100UnitConverter().convertPercent( sTmp, nBullRelSize );
654*cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_FO, XML_FONT_SIZE,
655*cdf0e10cSrcweir 							  sTmp.makeStringAndClear() );
656*cdf0e10cSrcweir 			}
657*cdf0e10cSrcweir 		}
658*cdf0e10cSrcweir 		if( GetExport().GetAttrList().getLength() > 0 )
659*cdf0e10cSrcweir 		{
660*cdf0e10cSrcweir 			SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE,
661*cdf0e10cSrcweir 									  XML_TEXT_PROPERTIES, sal_True, sal_True );
662*cdf0e10cSrcweir 		}
663*cdf0e10cSrcweir 		if( NumberingType::BITMAP == eType && sImageURL.getLength() )
664*cdf0e10cSrcweir 		{
665*cdf0e10cSrcweir 			// optional office:binary-data
666*cdf0e10cSrcweir 			GetExport().AddEmbeddedGraphicObjectAsBase64( sImageURL );
667*cdf0e10cSrcweir 		}
668*cdf0e10cSrcweir 	}
669*cdf0e10cSrcweir }
670*cdf0e10cSrcweir 
671*cdf0e10cSrcweir 
672*cdf0e10cSrcweir uno::Reference< ::com::sun::star::container::XIndexReplace >  SvxXMLNumRuleExport::GetUNONumRule() const
673*cdf0e10cSrcweir {
674*cdf0e10cSrcweir 	return uno::Reference< ::com::sun::star::container::XIndexReplace > ();
675*cdf0e10cSrcweir }
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir void SvxXMLNumRuleExport::AddListStyleAttributes()
678*cdf0e10cSrcweir {
679*cdf0e10cSrcweir }
680*cdf0e10cSrcweir 
681*cdf0e10cSrcweir 
682*cdf0e10cSrcweir SvxXMLNumRuleExport::SvxXMLNumRuleExport( SvXMLExport& rExp ) :
683*cdf0e10cSrcweir 	rExport( rExp ),
684*cdf0e10cSrcweir 	sNumberingRules( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ),
685*cdf0e10cSrcweir 	sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
686*cdf0e10cSrcweir     sIsContinuousNumbering( RTL_CONSTASCII_USTRINGPARAM( "IsContinuousNumbering" ) ),
687*cdf0e10cSrcweir     // --> OD 2008-06-06 #i89178#
688*cdf0e10cSrcweir     mbExportPositionAndSpaceModeLabelAlignment( true )
689*cdf0e10cSrcweir     // <--
690*cdf0e10cSrcweir {
691*cdf0e10cSrcweir     switch ( GetExport().getDefaultVersion() )
692*cdf0e10cSrcweir     {
693*cdf0e10cSrcweir         case SvtSaveOptions::ODFVER_010:
694*cdf0e10cSrcweir         case SvtSaveOptions::ODFVER_011:
695*cdf0e10cSrcweir         {
696*cdf0e10cSrcweir             mbExportPositionAndSpaceModeLabelAlignment = false;
697*cdf0e10cSrcweir         }
698*cdf0e10cSrcweir         break;
699*cdf0e10cSrcweir         default: // ODFVER_UNKNOWN or ODFVER_012
700*cdf0e10cSrcweir         {
701*cdf0e10cSrcweir             mbExportPositionAndSpaceModeLabelAlignment = true;
702*cdf0e10cSrcweir         }
703*cdf0e10cSrcweir     }
704*cdf0e10cSrcweir }
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir SvxXMLNumRuleExport::~SvxXMLNumRuleExport()
707*cdf0e10cSrcweir {
708*cdf0e10cSrcweir }
709*cdf0e10cSrcweir 
710*cdf0e10cSrcweir // --> OD 2008-06-17 #i90780#
711*cdf0e10cSrcweir // refactoring: removing unused methods
712*cdf0e10cSrcweir //void SvxXMLNumRuleExport::Export( const OUString& rName,
713*cdf0e10cSrcweir //                                sal_Bool bContNumbering )
714*cdf0e10cSrcweir //{
715*cdf0e10cSrcweir //  GetExport().CheckAttrList();
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir //  // style:name="..."
718*cdf0e10cSrcweir //  if( rName.getLength() )
719*cdf0e10cSrcweir //  {
720*cdf0e10cSrcweir //      sal_Bool bEncoded = sal_False;
721*cdf0e10cSrcweir //      GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
722*cdf0e10cSrcweir //                        GetExport().EncodeStyleName( rName, &bEncoded ) );
723*cdf0e10cSrcweir //      if( bEncoded )
724*cdf0e10cSrcweir //          GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
725*cdf0e10cSrcweir //                                   rName);
726*cdf0e10cSrcweir //  }
727*cdf0e10cSrcweir 
728*cdf0e10cSrcweir //  // text:consecutive-numbering="..."
729*cdf0e10cSrcweir //  if( bContNumbering )
730*cdf0e10cSrcweir //      GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_CONSECUTIVE_NUMBERING,
731*cdf0e10cSrcweir //                         XML_TRUE );
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir //  // other application specific attributes
734*cdf0e10cSrcweir //  AddListStyleAttributes();
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir //  OUString sElem = GetExport().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TEXT,
737*cdf0e10cSrcweir //                                 GetXMLToken(XML_LIST_STYLE) );
738*cdf0e10cSrcweir //  GetExport().IgnorableWhitespace();
739*cdf0e10cSrcweir //  GetExport().StartElement( XML_NAMESPACE_TEXT, XML_LIST_STYLE, sal_False );
740*cdf0e10cSrcweir 
741*cdf0e10cSrcweir //  uno::Reference< ::com::sun::star::container::XIndexReplace >  xNumRule = GetUNONumRule();
742*cdf0e10cSrcweir //  if( xNumRule.is() )
743*cdf0e10cSrcweir //      exportLevelStyles( xNumRule );
744*cdf0e10cSrcweir 
745*cdf0e10cSrcweir //  GetExport().EndElement( XML_NAMESPACE_TEXT, XML_LIST_STYLE, sal_True );
746*cdf0e10cSrcweir //}
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir //void SvxXMLNumRuleExport::ExportOutline()
749*cdf0e10cSrcweir //{
750*cdf0e10cSrcweir //  GetExport().IgnorableWhitespace( );
751*cdf0e10cSrcweir //  GetExport().StartElement( XML_NAMESPACE_TEXT, XML_OUTLINE_STYLE, sal_False );
752*cdf0e10cSrcweir 
753*cdf0e10cSrcweir //  uno::Reference< ::com::sun::star::container::XIndexReplace >  xNumRule = GetUNONumRule();
754*cdf0e10cSrcweir //  if( xNumRule.is() )
755*cdf0e10cSrcweir //      exportLevelStyles( xNumRule, sal_True );
756*cdf0e10cSrcweir 
757*cdf0e10cSrcweir //  GetExport().EndElement( XML_NAMESPACE_TEXT, XML_OUTLINE_STYLE, sal_True );
758*cdf0e10cSrcweir //}
759*cdf0e10cSrcweir // <--
760*cdf0e10cSrcweir 
761*cdf0e10cSrcweir void SvxXMLNumRuleExport::exportNumberingRule(
762*cdf0e10cSrcweir 		const OUString& rName,
763*cdf0e10cSrcweir 		const Reference< XIndexReplace >& rNumRule )
764*cdf0e10cSrcweir {
765*cdf0e10cSrcweir 	Reference< XPropertySet > xPropSet( rNumRule, UNO_QUERY );
766*cdf0e10cSrcweir 	Reference< XPropertySetInfo > xPropSetInfo;
767*cdf0e10cSrcweir 	if( xPropSet.is() )
768*cdf0e10cSrcweir    		xPropSetInfo = xPropSet->getPropertySetInfo();
769*cdf0e10cSrcweir 
770*cdf0e10cSrcweir 	GetExport().CheckAttrList();
771*cdf0e10cSrcweir 
772*cdf0e10cSrcweir 	// style:name="..."
773*cdf0e10cSrcweir 	if( rName.getLength() )
774*cdf0e10cSrcweir 	{
775*cdf0e10cSrcweir 		sal_Bool bEncoded = sal_False;
776*cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
777*cdf0e10cSrcweir 						  GetExport().EncodeStyleName( rName, &bEncoded ) );
778*cdf0e10cSrcweir 		if( bEncoded )
779*cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
780*cdf0e10cSrcweir 								 rName);
781*cdf0e10cSrcweir 	}
782*cdf0e10cSrcweir 
783*cdf0e10cSrcweir 	// text:consecutive-numbering="..."
784*cdf0e10cSrcweir 	sal_Bool bContNumbering = sal_False;
785*cdf0e10cSrcweir 	if( xPropSetInfo.is() &&
786*cdf0e10cSrcweir 		xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) )
787*cdf0e10cSrcweir 	{
788*cdf0e10cSrcweir 		Any aAny( xPropSet->getPropertyValue( sIsContinuousNumbering ) );
789*cdf0e10cSrcweir 		bContNumbering = *(sal_Bool *)aAny.getValue();
790*cdf0e10cSrcweir 	}
791*cdf0e10cSrcweir 	if( bContNumbering )
792*cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_TEXT,
793*cdf0e10cSrcweir                                   XML_CONSECUTIVE_NUMBERING, XML_TRUE );
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir 	// other application specific attributes
796*cdf0e10cSrcweir 	AddListStyleAttributes();
797*cdf0e10cSrcweir 
798*cdf0e10cSrcweir 	{
799*cdf0e10cSrcweir 		SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, XML_LIST_STYLE ,
800*cdf0e10cSrcweir 								  sal_True, sal_True );
801*cdf0e10cSrcweir 		exportLevelStyles( rNumRule );
802*cdf0e10cSrcweir 	}
803*cdf0e10cSrcweir }
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir sal_Bool SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle )
806*cdf0e10cSrcweir {
807*cdf0e10cSrcweir 	Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
808*cdf0e10cSrcweir 	Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir 	Any aAny;
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir 	// Don't export styles that aren't existing really. This may be the
813*cdf0e10cSrcweir 	// case for StarOffice Writer's pool styles.
814*cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
815*cdf0e10cSrcweir 	{
816*cdf0e10cSrcweir 		aAny = xPropSet->getPropertyValue( sIsPhysical );
817*cdf0e10cSrcweir 		if( !*(sal_Bool *)aAny.getValue() )
818*cdf0e10cSrcweir 			return sal_False;
819*cdf0e10cSrcweir 	}
820*cdf0e10cSrcweir 
821*cdf0e10cSrcweir 	aAny = xPropSet->getPropertyValue( sNumberingRules );
822*cdf0e10cSrcweir 	Reference<XIndexReplace> xNumRule;
823*cdf0e10cSrcweir 	aAny >>= xNumRule;
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir 	OUString sName = rStyle->getName();
826*cdf0e10cSrcweir 
827*cdf0e10cSrcweir 	exportNumberingRule( sName, xNumRule );
828*cdf0e10cSrcweir 
829*cdf0e10cSrcweir 	return sal_True;
830*cdf0e10cSrcweir }
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir void SvxXMLNumRuleExport::exportOutline()
833*cdf0e10cSrcweir {
834*cdf0e10cSrcweir 	Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(),
835*cdf0e10cSrcweir 														UNO_QUERY );
836*cdf0e10cSrcweir 	DBG_ASSERT( xCNSupplier.is(), "no chapter numbering supplier" );
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir 	if( xCNSupplier.is() )
839*cdf0e10cSrcweir 	{
840*cdf0e10cSrcweir 		Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
841*cdf0e10cSrcweir 		DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir 		if( xNumRule.is() )
844*cdf0e10cSrcweir 		{
845*cdf0e10cSrcweir             // --> OD 2008-06-17 #i90780#
846*cdf0e10cSrcweir             // Outline style has property style:name since ODF 1.2
847*cdf0e10cSrcweir             // Thus, export this property and adjust fix for issue #i69627#
848*cdf0e10cSrcweir             OUString sOutlineStyleName;
849*cdf0e10cSrcweir             {
850*cdf0e10cSrcweir                 Reference<XPropertySet> xNumRulePropSet(
851*cdf0e10cSrcweir                     xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
852*cdf0e10cSrcweir                 if (xNumRulePropSet.is())
853*cdf0e10cSrcweir                 {
854*cdf0e10cSrcweir                     const OUString sName( RTL_CONSTASCII_USTRINGPARAM("Name") );
855*cdf0e10cSrcweir                     xNumRulePropSet->getPropertyValue( sName ) >>= sOutlineStyleName;
856*cdf0e10cSrcweir                 }
857*cdf0e10cSrcweir             }
858*cdf0e10cSrcweir             const SvtSaveOptions::ODFDefaultVersion nODFVersion =
859*cdf0e10cSrcweir                                                 GetExport().getDefaultVersion();
860*cdf0e10cSrcweir             if ( ( nODFVersion == SvtSaveOptions::ODFVER_010 ||
861*cdf0e10cSrcweir                    nODFVersion == SvtSaveOptions::ODFVER_011 ) &&
862*cdf0e10cSrcweir                  GetExport().writeOutlineStyleAsNormalListStyle() )
863*cdf0e10cSrcweir             {
864*cdf0e10cSrcweir                 exportNumberingRule( sOutlineStyleName, xNumRule );
865*cdf0e10cSrcweir             }
866*cdf0e10cSrcweir             else
867*cdf0e10cSrcweir             {
868*cdf0e10cSrcweir                 if ( nODFVersion != SvtSaveOptions::ODFVER_010 &&
869*cdf0e10cSrcweir                      nODFVersion != SvtSaveOptions::ODFVER_011 )
870*cdf0e10cSrcweir                 {
871*cdf0e10cSrcweir                     // style:name="..."
872*cdf0e10cSrcweir                     GetExport().CheckAttrList();
873*cdf0e10cSrcweir                     if ( sOutlineStyleName.getLength() > 0 )
874*cdf0e10cSrcweir                      {
875*cdf0e10cSrcweir                         sal_Bool bEncoded = sal_False;
876*cdf0e10cSrcweir                         GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
877*cdf0e10cSrcweir                                         GetExport().EncodeStyleName( sOutlineStyleName,
878*cdf0e10cSrcweir                                                                      &bEncoded ) );
879*cdf0e10cSrcweir                         if( bEncoded )
880*cdf0e10cSrcweir                             GetExport().AddAttribute( XML_NAMESPACE_STYLE,
881*cdf0e10cSrcweir                                                       XML_DISPLAY_NAME,
882*cdf0e10cSrcweir                                                       sOutlineStyleName );
883*cdf0e10cSrcweir                     }
884*cdf0e10cSrcweir                 }
885*cdf0e10cSrcweir                 SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
886*cdf0e10cSrcweir                                           XML_OUTLINE_STYLE, sal_True, sal_True );
887*cdf0e10cSrcweir                 exportLevelStyles( xNumRule, sal_True );
888*cdf0e10cSrcweir             }
889*cdf0e10cSrcweir 		}
890*cdf0e10cSrcweir 	}
891*cdf0e10cSrcweir }
892*cdf0e10cSrcweir 
893*cdf0e10cSrcweir void SvxXMLNumRuleExport::exportStyles( sal_Bool bUsed,
894*cdf0e10cSrcweir 									 	XMLTextListAutoStylePool *pPool,
895*cdf0e10cSrcweir 									 	sal_Bool bExportChapterNumbering )
896*cdf0e10cSrcweir {
897*cdf0e10cSrcweir 	if( bExportChapterNumbering )
898*cdf0e10cSrcweir 		exportOutline();
899*cdf0e10cSrcweir 
900*cdf0e10cSrcweir 	Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
901*cdf0e10cSrcweir 	DBG_ASSERT( xFamiliesSupp.is(), "No XStyleFamiliesSupplier from XModel for export!" );
902*cdf0e10cSrcweir 	if( xFamiliesSupp.is() )
903*cdf0e10cSrcweir 	{
904*cdf0e10cSrcweir 		Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
905*cdf0e10cSrcweir 		DBG_ASSERT( xFamiliesSupp.is(), "getStyleFamilies() from XModel failed for export!" );
906*cdf0e10cSrcweir 
907*cdf0e10cSrcweir 		if( xFamilies.is() )
908*cdf0e10cSrcweir 		{
909*cdf0e10cSrcweir 			const OUString aNumberStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyles" ));
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir 			Reference< XIndexAccess > xStyles;
912*cdf0e10cSrcweir 			if( xFamilies->hasByName( aNumberStyleName ) )
913*cdf0e10cSrcweir 			{
914*cdf0e10cSrcweir 				xFamilies->getByName( aNumberStyleName ) >>= xStyles;
915*cdf0e10cSrcweir 
916*cdf0e10cSrcweir 				DBG_ASSERT( xStyles.is(), "Style not found for export!" );
917*cdf0e10cSrcweir 
918*cdf0e10cSrcweir 				if( xStyles.is() )
919*cdf0e10cSrcweir 				{
920*cdf0e10cSrcweir 					const sal_Int32 nStyles = xStyles->getCount();
921*cdf0e10cSrcweir 
922*cdf0e10cSrcweir 					for( sal_Int32 i=0; i < nStyles; i++ )
923*cdf0e10cSrcweir 					{
924*cdf0e10cSrcweir 						Reference< XStyle > xStyle;
925*cdf0e10cSrcweir 						xStyles->getByIndex( i ) >>= xStyle;
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir 						if( !bUsed || xStyle->isInUse() )
928*cdf0e10cSrcweir 						{
929*cdf0e10cSrcweir 							exportStyle( xStyle );
930*cdf0e10cSrcweir 							if( pPool )
931*cdf0e10cSrcweir 								pPool->RegisterName( xStyle->getName() );
932*cdf0e10cSrcweir 						}
933*cdf0e10cSrcweir 					}
934*cdf0e10cSrcweir 				}
935*cdf0e10cSrcweir 			}
936*cdf0e10cSrcweir 		}
937*cdf0e10cSrcweir 	}
938*cdf0e10cSrcweir }
939*cdf0e10cSrcweir 
940*cdf0e10cSrcweir sal_Bool SvxXMLNumRuleExport::GetOutlineStyles( XMLStringVector& rStyleNames,
941*cdf0e10cSrcweir    const ::com::sun::star::uno::Reference<
942*cdf0e10cSrcweir    				::com::sun::star::frame::XModel > & rModel	)
943*cdf0e10cSrcweir {
944*cdf0e10cSrcweir 	Reference< XChapterNumberingSupplier > xCNSupplier( rModel,
945*cdf0e10cSrcweir 														UNO_QUERY );
946*cdf0e10cSrcweir 	sal_Int32 nLevels = 0;
947*cdf0e10cSrcweir 	Reference< XIndexReplace > xNumRule;
948*cdf0e10cSrcweir 	if( xCNSupplier.is() )
949*cdf0e10cSrcweir 	{
950*cdf0e10cSrcweir 		xNumRule = xCNSupplier->getChapterNumberingRules();
951*cdf0e10cSrcweir 		if( xNumRule.is() )
952*cdf0e10cSrcweir 			nLevels = xNumRule->getCount();
953*cdf0e10cSrcweir 	}
954*cdf0e10cSrcweir 
955*cdf0e10cSrcweir 	rStyleNames.resize( nLevels );
956*cdf0e10cSrcweir 	for( sal_Int32 i=0; i<nLevels; i++ )
957*cdf0e10cSrcweir 	{
958*cdf0e10cSrcweir 		uno::Any aEntry( xNumRule->getByIndex( i ) );
959*cdf0e10cSrcweir 		uno::Sequence<beans::PropertyValue> aSeq;
960*cdf0e10cSrcweir 		if( aEntry >>= aSeq )
961*cdf0e10cSrcweir 		{
962*cdf0e10cSrcweir             const sal_Int32 nCount = aSeq.getLength();
963*cdf0e10cSrcweir 			const beans::PropertyValue* pPropArray = aSeq.getConstArray();
964*cdf0e10cSrcweir 			for( sal_Int32 j=0; j<nCount; j++ )
965*cdf0e10cSrcweir 			{
966*cdf0e10cSrcweir 				const beans::PropertyValue& rProp = pPropArray[j];
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir 				if( rProp.Name.equalsAsciiL(
969*cdf0e10cSrcweir 							XML_UNO_NAME_NRULE_HEADING_STYLE_NAME,
970*cdf0e10cSrcweir 							sizeof(XML_UNO_NAME_NRULE_HEADING_STYLE_NAME)-1 ) )
971*cdf0e10cSrcweir 				{
972*cdf0e10cSrcweir 					rProp.Value >>= rStyleNames[i];
973*cdf0e10cSrcweir 					break;
974*cdf0e10cSrcweir 				}
975*cdf0e10cSrcweir 			}
976*cdf0e10cSrcweir 		}
977*cdf0e10cSrcweir 	}
978*cdf0e10cSrcweir 
979*cdf0e10cSrcweir 	return nLevels != 0;
980*cdf0e10cSrcweir }
981