xref: /AOO41X/main/xmloff/source/style/undlihdl.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 #include <undlihdl.hxx>
31*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
32*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
33*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
37*cdf0e10cSrcweir #include <com/sun/star/awt/FontUnderline.hpp>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir using ::rtl::OUString;
40*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir using namespace ::com::sun::star;
43*cdf0e10cSrcweir using namespace ::com::sun::star::awt;
44*cdf0e10cSrcweir using namespace ::xmloff::token;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir SvXMLEnumMapEntry __READONLY_DATA pXML_UnderlineType_Enum[] =
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir 	{ XML_NONE,							FontUnderline::NONE },
49*cdf0e10cSrcweir 	{ XML_SINGLE,		        FontUnderline::SINGLE },
50*cdf0e10cSrcweir 	{ XML_DOUBLE,				        FontUnderline::DOUBLE },
51*cdf0e10cSrcweir 	{ XML_SINGLE,		        FontUnderline::DOTTED },
52*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::DASH },
53*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::LONGDASH },
54*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::DASHDOT },
55*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::DASHDOTDOT },
56*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::WAVE },
57*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLD },
58*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLDDOTTED },
59*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLDDASH },
60*cdf0e10cSrcweir 	{ XML_SINGLE,	    		FontUnderline::BOLDLONGDASH },
61*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLDDASHDOT },
62*cdf0e10cSrcweir 	{ XML_SINGLE,  			FontUnderline::BOLDDASHDOTDOT },
63*cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLDWAVE },
64*cdf0e10cSrcweir 	{ XML_DOUBLE, 						FontUnderline::DOUBLEWAVE },
65*cdf0e10cSrcweir 	{ XML_SINGLE,			    FontUnderline::SMALLWAVE },
66*cdf0e10cSrcweir 	{ XML_TOKEN_INVALID,				0 }
67*cdf0e10cSrcweir };
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir SvXMLEnumMapEntry __READONLY_DATA pXML_UnderlineStyle_Enum[] =
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir 	{ XML_NONE,							FontUnderline::NONE },
72*cdf0e10cSrcweir 	{ XML_SOLID,		        		FontUnderline::SINGLE },
73*cdf0e10cSrcweir 	{ XML_SOLID,		        		FontUnderline::DOUBLE },
74*cdf0e10cSrcweir 	{ XML_DOTTED,		        FontUnderline::DOTTED },
75*cdf0e10cSrcweir 	{ XML_DASH,				FontUnderline::DASH },
76*cdf0e10cSrcweir 	{ XML_LONG_DASH,			FontUnderline::LONGDASH },
77*cdf0e10cSrcweir 	{ XML_DOT_DASH,			FontUnderline::DASHDOT },
78*cdf0e10cSrcweir 	{ XML_DOT_DOT_DASH,		FontUnderline::DASHDOTDOT },
79*cdf0e10cSrcweir 	{ XML_WAVE,				FontUnderline::WAVE },
80*cdf0e10cSrcweir 	{ XML_SOLID,						FontUnderline::BOLD },
81*cdf0e10cSrcweir 	{ XML_DOTTED,				FontUnderline::BOLDDOTTED },
82*cdf0e10cSrcweir 	{ XML_DASH,				FontUnderline::BOLDDASH },
83*cdf0e10cSrcweir 	{ XML_LONG_DASH,	   	 	FontUnderline::BOLDLONGDASH },
84*cdf0e10cSrcweir 	{ XML_DOT_DASH,			FontUnderline::BOLDDASHDOT },
85*cdf0e10cSrcweir 	{ XML_DOT_DOT_DASH,  		FontUnderline::BOLDDASHDOTDOT },
86*cdf0e10cSrcweir 	{ XML_WAVE,				FontUnderline::BOLDWAVE },
87*cdf0e10cSrcweir 	{ XML_WAVE, 				FontUnderline::DOUBLEWAVE },
88*cdf0e10cSrcweir 	{ XML_SMALL_WAVE,		    FontUnderline::SMALLWAVE },
89*cdf0e10cSrcweir 	{ XML_TOKEN_INVALID,				0 }
90*cdf0e10cSrcweir };
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir SvXMLEnumMapEntry __READONLY_DATA pXML_UnderlineWidth_Enum[] =
93*cdf0e10cSrcweir {
94*cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::NONE },
95*cdf0e10cSrcweir 	{ XML_AUTO,		     			   	FontUnderline::SINGLE },
96*cdf0e10cSrcweir 	{ XML_AUTO,		   			     	FontUnderline::DOUBLE },
97*cdf0e10cSrcweir 	{ XML_AUTO,		   			     	FontUnderline::DOTTED },
98*cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::DASH },
99*cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::LONGDASH },
100*cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::DASHDOT },
101*cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::DASHDOTDOT },
102*cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::WAVE },
103*cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLD },
104*cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLDDOTTED },
105*cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLDDASH },
106*cdf0e10cSrcweir 	{ XML_BOLD,	   	 		FontUnderline::BOLDLONGDASH },
107*cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLDDASHDOT },
108*cdf0e10cSrcweir 	{ XML_BOLD,  				FontUnderline::BOLDDASHDOTDOT },
109*cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLDWAVE },
110*cdf0e10cSrcweir 	{ XML_AUTO, 						FontUnderline::DOUBLEWAVE },
111*cdf0e10cSrcweir 	{ XML_THIN,		    				FontUnderline::NONE },
112*cdf0e10cSrcweir 	{ XML_MEDIUM,		    			FontUnderline::NONE },
113*cdf0e10cSrcweir 	{ XML_THICK,		    			FontUnderline::BOLD},
114*cdf0e10cSrcweir 	{ XML_TOKEN_INVALID,				0 }
115*cdf0e10cSrcweir };
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////////
120*cdf0e10cSrcweir //
121*cdf0e10cSrcweir // class XMLUnderlineTypePropHdl
122*cdf0e10cSrcweir //
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir XMLUnderlineTypePropHdl::~XMLUnderlineTypePropHdl()
125*cdf0e10cSrcweir {
126*cdf0e10cSrcweir 	// nothing to do
127*cdf0e10cSrcweir }
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir sal_Bool XMLUnderlineTypePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
130*cdf0e10cSrcweir {
131*cdf0e10cSrcweir 	sal_uInt16 eNewUnderline;
132*cdf0e10cSrcweir 	sal_Bool bRet = SvXMLUnitConverter::convertEnum(
133*cdf0e10cSrcweir         eNewUnderline, rStrImpValue, pXML_UnderlineType_Enum );
134*cdf0e10cSrcweir 	if( bRet )
135*cdf0e10cSrcweir 	{
136*cdf0e10cSrcweir 		// multi property: style and width might be set already.
137*cdf0e10cSrcweir 		// If the old value is NONE, the new is used unchanged.
138*cdf0e10cSrcweir 		sal_Int16 eUnderline = sal_Int16();
139*cdf0e10cSrcweir 		if( (rValue >>= eUnderline) && FontUnderline::NONE!=eUnderline )
140*cdf0e10cSrcweir 		{
141*cdf0e10cSrcweir 			switch( eNewUnderline )
142*cdf0e10cSrcweir 			{
143*cdf0e10cSrcweir 			case FontUnderline::NONE:
144*cdf0e10cSrcweir 			case FontUnderline::SINGLE:
145*cdf0e10cSrcweir 				// keep existing line style
146*cdf0e10cSrcweir 				eNewUnderline = eUnderline;
147*cdf0e10cSrcweir 				break;
148*cdf0e10cSrcweir 			case FontUnderline::DOUBLE:
149*cdf0e10cSrcweir 				// A double line style has priority over a bold line style,
150*cdf0e10cSrcweir 				// but not over the line style itself.
151*cdf0e10cSrcweir 				switch( eUnderline )
152*cdf0e10cSrcweir 				{
153*cdf0e10cSrcweir 				case FontUnderline::SINGLE:
154*cdf0e10cSrcweir 				case FontUnderline::BOLD:
155*cdf0e10cSrcweir 					break;
156*cdf0e10cSrcweir 				case FontUnderline::WAVE:
157*cdf0e10cSrcweir 				case FontUnderline::BOLDWAVE:
158*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::DOUBLEWAVE;
159*cdf0e10cSrcweir 					break;
160*cdf0e10cSrcweir 				default:
161*cdf0e10cSrcweir 					// If a double line style is not supported for the existing
162*cdf0e10cSrcweir 					// value, keep the new one
163*cdf0e10cSrcweir 					eNewUnderline = eUnderline;
164*cdf0e10cSrcweir 					break;
165*cdf0e10cSrcweir 				}
166*cdf0e10cSrcweir 				break;
167*cdf0e10cSrcweir 			default:
168*cdf0e10cSrcweir 				OSL_ENSURE( bRet, "unexpected line type value" );
169*cdf0e10cSrcweir 				break;
170*cdf0e10cSrcweir 			}
171*cdf0e10cSrcweir 			if( eNewUnderline != eUnderline )
172*cdf0e10cSrcweir 				rValue <<= (sal_Int16)eNewUnderline;
173*cdf0e10cSrcweir 		}
174*cdf0e10cSrcweir 		else
175*cdf0e10cSrcweir 		{
176*cdf0e10cSrcweir 			rValue <<= (sal_Int16)eNewUnderline;
177*cdf0e10cSrcweir 		}
178*cdf0e10cSrcweir 	}
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	return bRet;
181*cdf0e10cSrcweir }
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir sal_Bool XMLUnderlineTypePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
186*cdf0e10cSrcweir 	sal_Int16 nValue = sal_Int16();
187*cdf0e10cSrcweir 	OUStringBuffer aOut;
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir 	if( (rValue >>= nValue) &&
190*cdf0e10cSrcweir 		(FontUnderline::DOUBLE == nValue ||
191*cdf0e10cSrcweir 		 FontUnderline::DOUBLEWAVE == nValue) )
192*cdf0e10cSrcweir 	{
193*cdf0e10cSrcweir         bRet = SvXMLUnitConverter::convertEnum(
194*cdf0e10cSrcweir             aOut, (sal_uInt16)nValue, pXML_UnderlineType_Enum );
195*cdf0e10cSrcweir 		if( bRet )
196*cdf0e10cSrcweir 			rStrExpValue = aOut.makeStringAndClear();
197*cdf0e10cSrcweir 	}
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 	return bRet;
200*cdf0e10cSrcweir }
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////////
203*cdf0e10cSrcweir //
204*cdf0e10cSrcweir // class XMLUnderlineStylePropHdl
205*cdf0e10cSrcweir //
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir XMLUnderlineStylePropHdl::~XMLUnderlineStylePropHdl()
208*cdf0e10cSrcweir {
209*cdf0e10cSrcweir 	// nothing to do
210*cdf0e10cSrcweir }
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir sal_Bool XMLUnderlineStylePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
213*cdf0e10cSrcweir {
214*cdf0e10cSrcweir 	sal_uInt16 eNewUnderline;
215*cdf0e10cSrcweir 	sal_Bool bRet = SvXMLUnitConverter::convertEnum(
216*cdf0e10cSrcweir         eNewUnderline, rStrImpValue, pXML_UnderlineStyle_Enum );
217*cdf0e10cSrcweir 	if( bRet )
218*cdf0e10cSrcweir 	{
219*cdf0e10cSrcweir 		// multi property: style and width might be set already.
220*cdf0e10cSrcweir 		// If the old value is NONE, the new is used unchanged.
221*cdf0e10cSrcweir 		sal_Int16 eUnderline = sal_Int16();
222*cdf0e10cSrcweir 		if( (rValue >>= eUnderline) && FontUnderline::NONE!=eUnderline )
223*cdf0e10cSrcweir 		{
224*cdf0e10cSrcweir 			switch( eNewUnderline )
225*cdf0e10cSrcweir 			{
226*cdf0e10cSrcweir 			case FontUnderline::NONE:
227*cdf0e10cSrcweir 			case FontUnderline::SINGLE:
228*cdf0e10cSrcweir 				// keep double or bold line style
229*cdf0e10cSrcweir 				eNewUnderline = eUnderline;
230*cdf0e10cSrcweir 			case FontUnderline::DOTTED:
231*cdf0e10cSrcweir 				// The line style has priority over a double type.
232*cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
233*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDOTTED;
234*cdf0e10cSrcweir 				break;
235*cdf0e10cSrcweir 			case FontUnderline::DASH:
236*cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
237*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASH;
238*cdf0e10cSrcweir 				break;
239*cdf0e10cSrcweir 			case FontUnderline::LONGDASH:
240*cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
241*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDLONGDASH;
242*cdf0e10cSrcweir 				break;
243*cdf0e10cSrcweir 			case FontUnderline::DASHDOT:
244*cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
245*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASHDOT;
246*cdf0e10cSrcweir 				break;
247*cdf0e10cSrcweir 			case FontUnderline::DASHDOTDOT:
248*cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
249*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASHDOTDOT;
250*cdf0e10cSrcweir 				break;
251*cdf0e10cSrcweir 			case FontUnderline::WAVE:
252*cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
253*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDWAVE;
254*cdf0e10cSrcweir 				break;
255*cdf0e10cSrcweir 			case FontUnderline::SMALLWAVE:
256*cdf0e10cSrcweir 				// SMALLWAVE is not used
257*cdf0e10cSrcweir 			default:
258*cdf0e10cSrcweir 				OSL_ENSURE( bRet, "unexpected line style value" );
259*cdf0e10cSrcweir 				break;
260*cdf0e10cSrcweir 			}
261*cdf0e10cSrcweir 			if( eNewUnderline != eUnderline )
262*cdf0e10cSrcweir 				rValue <<= (sal_Int16)eNewUnderline;
263*cdf0e10cSrcweir 		}
264*cdf0e10cSrcweir 		else
265*cdf0e10cSrcweir 		{
266*cdf0e10cSrcweir 			rValue <<= (sal_Int16)eNewUnderline;
267*cdf0e10cSrcweir 		}
268*cdf0e10cSrcweir 	}
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 	return bRet;
271*cdf0e10cSrcweir }
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir sal_Bool XMLUnderlineStylePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
274*cdf0e10cSrcweir {
275*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
276*cdf0e10cSrcweir 	sal_Int16 nValue = sal_Int16();
277*cdf0e10cSrcweir 	OUStringBuffer aOut;
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 	if( rValue >>= nValue )
280*cdf0e10cSrcweir 	{
281*cdf0e10cSrcweir         bRet = SvXMLUnitConverter::convertEnum(
282*cdf0e10cSrcweir             aOut, (sal_uInt16)nValue, pXML_UnderlineStyle_Enum );
283*cdf0e10cSrcweir 		if( bRet )
284*cdf0e10cSrcweir 			rStrExpValue = aOut.makeStringAndClear();
285*cdf0e10cSrcweir 	}
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir 	return bRet;
288*cdf0e10cSrcweir }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////////
291*cdf0e10cSrcweir //
292*cdf0e10cSrcweir // class XMLUnderlineWidthPropHdl
293*cdf0e10cSrcweir //
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir XMLUnderlineWidthPropHdl::~XMLUnderlineWidthPropHdl()
296*cdf0e10cSrcweir {
297*cdf0e10cSrcweir 	// nothing to do
298*cdf0e10cSrcweir }
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir sal_Bool XMLUnderlineWidthPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
301*cdf0e10cSrcweir {
302*cdf0e10cSrcweir 	sal_uInt16 eNewUnderline;
303*cdf0e10cSrcweir 	sal_Bool bRet = SvXMLUnitConverter::convertEnum(
304*cdf0e10cSrcweir         eNewUnderline, rStrImpValue, pXML_UnderlineWidth_Enum );
305*cdf0e10cSrcweir 	if( bRet )
306*cdf0e10cSrcweir 	{
307*cdf0e10cSrcweir 		// multi property: style and width might be set already.
308*cdf0e10cSrcweir 		// If the old value is NONE, the new is used unchanged.
309*cdf0e10cSrcweir 		sal_Int16 eUnderline = sal_Int16();
310*cdf0e10cSrcweir 		if( (rValue >>= eUnderline) && FontUnderline::NONE!=eUnderline )
311*cdf0e10cSrcweir 		{
312*cdf0e10cSrcweir 			switch( eNewUnderline )
313*cdf0e10cSrcweir 			{
314*cdf0e10cSrcweir 			case FontUnderline::NONE:
315*cdf0e10cSrcweir 				// keep existing line style
316*cdf0e10cSrcweir 				eNewUnderline = eUnderline;
317*cdf0e10cSrcweir 				break;
318*cdf0e10cSrcweir 			case FontUnderline::BOLD:
319*cdf0e10cSrcweir 				// A double line style has priority over a bold line style,
320*cdf0e10cSrcweir 				// but not over the line style itself.
321*cdf0e10cSrcweir 				switch( eUnderline )
322*cdf0e10cSrcweir 				{
323*cdf0e10cSrcweir 				case FontUnderline::SINGLE:
324*cdf0e10cSrcweir 					break;
325*cdf0e10cSrcweir 				case FontUnderline::DOTTED:
326*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDOTTED;
327*cdf0e10cSrcweir 					break;
328*cdf0e10cSrcweir 				case FontUnderline::DASH:
329*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASH;
330*cdf0e10cSrcweir 					break;
331*cdf0e10cSrcweir 				case FontUnderline::LONGDASH:
332*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDLONGDASH;
333*cdf0e10cSrcweir 					break;
334*cdf0e10cSrcweir 				case FontUnderline::DASHDOT:
335*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASHDOT;
336*cdf0e10cSrcweir 					break;
337*cdf0e10cSrcweir 				case FontUnderline::DASHDOTDOT:
338*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASHDOTDOT;
339*cdf0e10cSrcweir 					break;
340*cdf0e10cSrcweir 				case FontUnderline::WAVE:
341*cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDWAVE;
342*cdf0e10cSrcweir 					break;
343*cdf0e10cSrcweir 				default:
344*cdf0e10cSrcweir 					// a doube line style overwrites a bold one
345*cdf0e10cSrcweir 					eNewUnderline = eUnderline;
346*cdf0e10cSrcweir 					break;
347*cdf0e10cSrcweir 				}
348*cdf0e10cSrcweir 				break;
349*cdf0e10cSrcweir 			default:
350*cdf0e10cSrcweir 				OSL_ENSURE( bRet, "unexpected line width value" );
351*cdf0e10cSrcweir 				break;
352*cdf0e10cSrcweir 			}
353*cdf0e10cSrcweir 			if( eNewUnderline != eUnderline )
354*cdf0e10cSrcweir 				rValue <<= (sal_Int16)eNewUnderline;
355*cdf0e10cSrcweir 		}
356*cdf0e10cSrcweir 		else
357*cdf0e10cSrcweir 		{
358*cdf0e10cSrcweir 			rValue <<= (sal_Int16)eNewUnderline;
359*cdf0e10cSrcweir 		}
360*cdf0e10cSrcweir 	}
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 	return bRet;
363*cdf0e10cSrcweir }
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir sal_Bool XMLUnderlineWidthPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
366*cdf0e10cSrcweir {
367*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
368*cdf0e10cSrcweir 	sal_Int16 nValue = sal_Int16();
369*cdf0e10cSrcweir 	OUStringBuffer aOut;
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir 	if( (rValue >>= nValue) && (FontUnderline::NONE != nValue) )
372*cdf0e10cSrcweir 	{
373*cdf0e10cSrcweir         bRet = SvXMLUnitConverter::convertEnum(
374*cdf0e10cSrcweir             aOut, (sal_uInt16)nValue, pXML_UnderlineWidth_Enum );
375*cdf0e10cSrcweir 		if( bRet )
376*cdf0e10cSrcweir 			rStrExpValue = aOut.makeStringAndClear();
377*cdf0e10cSrcweir 	}
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 	return bRet;
380*cdf0e10cSrcweir }
381*cdf0e10cSrcweir 
382