xref: /aoo42x/main/xmloff/source/style/undlihdl.cxx (revision 63bba73c)
1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63bba73cSAndrew Rist  * distributed with this work for additional information
6*63bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*63bba73cSAndrew Rist  *
11*63bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*63bba73cSAndrew Rist  *
13*63bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist  * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63bba73cSAndrew Rist  * specific language governing permissions and limitations
18*63bba73cSAndrew Rist  * under the License.
19*63bba73cSAndrew Rist  *
20*63bba73cSAndrew Rist  *************************************************************/
21*63bba73cSAndrew Rist 
22*63bba73cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir #include <undlihdl.hxx>
27cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
28cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
29cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
33cdf0e10cSrcweir #include <com/sun/star/awt/FontUnderline.hpp>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir using ::rtl::OUString;
36cdf0e10cSrcweir using ::rtl::OUStringBuffer;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir using namespace ::com::sun::star;
39cdf0e10cSrcweir using namespace ::com::sun::star::awt;
40cdf0e10cSrcweir using namespace ::xmloff::token;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir SvXMLEnumMapEntry __READONLY_DATA pXML_UnderlineType_Enum[] =
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	{ XML_NONE,							FontUnderline::NONE },
45cdf0e10cSrcweir 	{ XML_SINGLE,		        FontUnderline::SINGLE },
46cdf0e10cSrcweir 	{ XML_DOUBLE,				        FontUnderline::DOUBLE },
47cdf0e10cSrcweir 	{ XML_SINGLE,		        FontUnderline::DOTTED },
48cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::DASH },
49cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::LONGDASH },
50cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::DASHDOT },
51cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::DASHDOTDOT },
52cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::WAVE },
53cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLD },
54cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLDDOTTED },
55cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLDDASH },
56cdf0e10cSrcweir 	{ XML_SINGLE,	    		FontUnderline::BOLDLONGDASH },
57cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLDDASHDOT },
58cdf0e10cSrcweir 	{ XML_SINGLE,  			FontUnderline::BOLDDASHDOTDOT },
59cdf0e10cSrcweir 	{ XML_SINGLE,				FontUnderline::BOLDWAVE },
60cdf0e10cSrcweir 	{ XML_DOUBLE, 						FontUnderline::DOUBLEWAVE },
61cdf0e10cSrcweir 	{ XML_SINGLE,			    FontUnderline::SMALLWAVE },
62cdf0e10cSrcweir 	{ XML_TOKEN_INVALID,				0 }
63cdf0e10cSrcweir };
64cdf0e10cSrcweir 
65cdf0e10cSrcweir SvXMLEnumMapEntry __READONLY_DATA pXML_UnderlineStyle_Enum[] =
66cdf0e10cSrcweir {
67cdf0e10cSrcweir 	{ XML_NONE,							FontUnderline::NONE },
68cdf0e10cSrcweir 	{ XML_SOLID,		        		FontUnderline::SINGLE },
69cdf0e10cSrcweir 	{ XML_SOLID,		        		FontUnderline::DOUBLE },
70cdf0e10cSrcweir 	{ XML_DOTTED,		        FontUnderline::DOTTED },
71cdf0e10cSrcweir 	{ XML_DASH,				FontUnderline::DASH },
72cdf0e10cSrcweir 	{ XML_LONG_DASH,			FontUnderline::LONGDASH },
73cdf0e10cSrcweir 	{ XML_DOT_DASH,			FontUnderline::DASHDOT },
74cdf0e10cSrcweir 	{ XML_DOT_DOT_DASH,		FontUnderline::DASHDOTDOT },
75cdf0e10cSrcweir 	{ XML_WAVE,				FontUnderline::WAVE },
76cdf0e10cSrcweir 	{ XML_SOLID,						FontUnderline::BOLD },
77cdf0e10cSrcweir 	{ XML_DOTTED,				FontUnderline::BOLDDOTTED },
78cdf0e10cSrcweir 	{ XML_DASH,				FontUnderline::BOLDDASH },
79cdf0e10cSrcweir 	{ XML_LONG_DASH,	   	 	FontUnderline::BOLDLONGDASH },
80cdf0e10cSrcweir 	{ XML_DOT_DASH,			FontUnderline::BOLDDASHDOT },
81cdf0e10cSrcweir 	{ XML_DOT_DOT_DASH,  		FontUnderline::BOLDDASHDOTDOT },
82cdf0e10cSrcweir 	{ XML_WAVE,				FontUnderline::BOLDWAVE },
83cdf0e10cSrcweir 	{ XML_WAVE, 				FontUnderline::DOUBLEWAVE },
84cdf0e10cSrcweir 	{ XML_SMALL_WAVE,		    FontUnderline::SMALLWAVE },
85cdf0e10cSrcweir 	{ XML_TOKEN_INVALID,				0 }
86cdf0e10cSrcweir };
87cdf0e10cSrcweir 
88cdf0e10cSrcweir SvXMLEnumMapEntry __READONLY_DATA pXML_UnderlineWidth_Enum[] =
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::NONE },
91cdf0e10cSrcweir 	{ XML_AUTO,		     			   	FontUnderline::SINGLE },
92cdf0e10cSrcweir 	{ XML_AUTO,		   			     	FontUnderline::DOUBLE },
93cdf0e10cSrcweir 	{ XML_AUTO,		   			     	FontUnderline::DOTTED },
94cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::DASH },
95cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::LONGDASH },
96cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::DASHDOT },
97cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::DASHDOTDOT },
98cdf0e10cSrcweir 	{ XML_AUTO,							FontUnderline::WAVE },
99cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLD },
100cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLDDOTTED },
101cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLDDASH },
102cdf0e10cSrcweir 	{ XML_BOLD,	   	 		FontUnderline::BOLDLONGDASH },
103cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLDDASHDOT },
104cdf0e10cSrcweir 	{ XML_BOLD,  				FontUnderline::BOLDDASHDOTDOT },
105cdf0e10cSrcweir 	{ XML_BOLD,				FontUnderline::BOLDWAVE },
106cdf0e10cSrcweir 	{ XML_AUTO, 						FontUnderline::DOUBLEWAVE },
107cdf0e10cSrcweir 	{ XML_THIN,		    				FontUnderline::NONE },
108cdf0e10cSrcweir 	{ XML_MEDIUM,		    			FontUnderline::NONE },
109cdf0e10cSrcweir 	{ XML_THICK,		    			FontUnderline::BOLD},
110cdf0e10cSrcweir 	{ XML_TOKEN_INVALID,				0 }
111cdf0e10cSrcweir };
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 
115cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////////
116cdf0e10cSrcweir //
117cdf0e10cSrcweir // class XMLUnderlineTypePropHdl
118cdf0e10cSrcweir //
119cdf0e10cSrcweir 
~XMLUnderlineTypePropHdl()120cdf0e10cSrcweir XMLUnderlineTypePropHdl::~XMLUnderlineTypePropHdl()
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	// nothing to do
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,uno::Any & rValue,const SvXMLUnitConverter &) const125cdf0e10cSrcweir sal_Bool XMLUnderlineTypePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
126cdf0e10cSrcweir {
127cdf0e10cSrcweir 	sal_uInt16 eNewUnderline;
128cdf0e10cSrcweir 	sal_Bool bRet = SvXMLUnitConverter::convertEnum(
129cdf0e10cSrcweir         eNewUnderline, rStrImpValue, pXML_UnderlineType_Enum );
130cdf0e10cSrcweir 	if( bRet )
131cdf0e10cSrcweir 	{
132cdf0e10cSrcweir 		// multi property: style and width might be set already.
133cdf0e10cSrcweir 		// If the old value is NONE, the new is used unchanged.
134cdf0e10cSrcweir 		sal_Int16 eUnderline = sal_Int16();
135cdf0e10cSrcweir 		if( (rValue >>= eUnderline) && FontUnderline::NONE!=eUnderline )
136cdf0e10cSrcweir 		{
137cdf0e10cSrcweir 			switch( eNewUnderline )
138cdf0e10cSrcweir 			{
139cdf0e10cSrcweir 			case FontUnderline::NONE:
140cdf0e10cSrcweir 			case FontUnderline::SINGLE:
141cdf0e10cSrcweir 				// keep existing line style
142cdf0e10cSrcweir 				eNewUnderline = eUnderline;
143cdf0e10cSrcweir 				break;
144cdf0e10cSrcweir 			case FontUnderline::DOUBLE:
145cdf0e10cSrcweir 				// A double line style has priority over a bold line style,
146cdf0e10cSrcweir 				// but not over the line style itself.
147cdf0e10cSrcweir 				switch( eUnderline )
148cdf0e10cSrcweir 				{
149cdf0e10cSrcweir 				case FontUnderline::SINGLE:
150cdf0e10cSrcweir 				case FontUnderline::BOLD:
151cdf0e10cSrcweir 					break;
152cdf0e10cSrcweir 				case FontUnderline::WAVE:
153cdf0e10cSrcweir 				case FontUnderline::BOLDWAVE:
154cdf0e10cSrcweir 					eNewUnderline = FontUnderline::DOUBLEWAVE;
155cdf0e10cSrcweir 					break;
156cdf0e10cSrcweir 				default:
157cdf0e10cSrcweir 					// If a double line style is not supported for the existing
158cdf0e10cSrcweir 					// value, keep the new one
159cdf0e10cSrcweir 					eNewUnderline = eUnderline;
160cdf0e10cSrcweir 					break;
161cdf0e10cSrcweir 				}
162cdf0e10cSrcweir 				break;
163cdf0e10cSrcweir 			default:
164cdf0e10cSrcweir 				OSL_ENSURE( bRet, "unexpected line type value" );
165cdf0e10cSrcweir 				break;
166cdf0e10cSrcweir 			}
167cdf0e10cSrcweir 			if( eNewUnderline != eUnderline )
168cdf0e10cSrcweir 				rValue <<= (sal_Int16)eNewUnderline;
169cdf0e10cSrcweir 		}
170cdf0e10cSrcweir 		else
171cdf0e10cSrcweir 		{
172cdf0e10cSrcweir 			rValue <<= (sal_Int16)eNewUnderline;
173cdf0e10cSrcweir 		}
174cdf0e10cSrcweir 	}
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	return bRet;
177cdf0e10cSrcweir }
178cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const uno::Any & rValue,const SvXMLUnitConverter &) const179cdf0e10cSrcweir sal_Bool XMLUnderlineTypePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
180cdf0e10cSrcweir {
181cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
182cdf0e10cSrcweir 	sal_Int16 nValue = sal_Int16();
183cdf0e10cSrcweir 	OUStringBuffer aOut;
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 	if( (rValue >>= nValue) &&
186cdf0e10cSrcweir 		(FontUnderline::DOUBLE == nValue ||
187cdf0e10cSrcweir 		 FontUnderline::DOUBLEWAVE == nValue) )
188cdf0e10cSrcweir 	{
189cdf0e10cSrcweir         bRet = SvXMLUnitConverter::convertEnum(
190cdf0e10cSrcweir             aOut, (sal_uInt16)nValue, pXML_UnderlineType_Enum );
191cdf0e10cSrcweir 		if( bRet )
192cdf0e10cSrcweir 			rStrExpValue = aOut.makeStringAndClear();
193cdf0e10cSrcweir 	}
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 	return bRet;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir 
198cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////////
199cdf0e10cSrcweir //
200cdf0e10cSrcweir // class XMLUnderlineStylePropHdl
201cdf0e10cSrcweir //
202cdf0e10cSrcweir 
~XMLUnderlineStylePropHdl()203cdf0e10cSrcweir XMLUnderlineStylePropHdl::~XMLUnderlineStylePropHdl()
204cdf0e10cSrcweir {
205cdf0e10cSrcweir 	// nothing to do
206cdf0e10cSrcweir }
207cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,uno::Any & rValue,const SvXMLUnitConverter &) const208cdf0e10cSrcweir sal_Bool XMLUnderlineStylePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
209cdf0e10cSrcweir {
210cdf0e10cSrcweir 	sal_uInt16 eNewUnderline;
211cdf0e10cSrcweir 	sal_Bool bRet = SvXMLUnitConverter::convertEnum(
212cdf0e10cSrcweir         eNewUnderline, rStrImpValue, pXML_UnderlineStyle_Enum );
213cdf0e10cSrcweir 	if( bRet )
214cdf0e10cSrcweir 	{
215cdf0e10cSrcweir 		// multi property: style and width might be set already.
216cdf0e10cSrcweir 		// If the old value is NONE, the new is used unchanged.
217cdf0e10cSrcweir 		sal_Int16 eUnderline = sal_Int16();
218cdf0e10cSrcweir 		if( (rValue >>= eUnderline) && FontUnderline::NONE!=eUnderline )
219cdf0e10cSrcweir 		{
220cdf0e10cSrcweir 			switch( eNewUnderline )
221cdf0e10cSrcweir 			{
222cdf0e10cSrcweir 			case FontUnderline::NONE:
223cdf0e10cSrcweir 			case FontUnderline::SINGLE:
224cdf0e10cSrcweir 				// keep double or bold line style
225cdf0e10cSrcweir 				eNewUnderline = eUnderline;
226cdf0e10cSrcweir 			case FontUnderline::DOTTED:
227cdf0e10cSrcweir 				// The line style has priority over a double type.
228cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
229cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDOTTED;
230cdf0e10cSrcweir 				break;
231cdf0e10cSrcweir 			case FontUnderline::DASH:
232cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
233cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASH;
234cdf0e10cSrcweir 				break;
235cdf0e10cSrcweir 			case FontUnderline::LONGDASH:
236cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
237cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDLONGDASH;
238cdf0e10cSrcweir 				break;
239cdf0e10cSrcweir 			case FontUnderline::DASHDOT:
240cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
241cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASHDOT;
242cdf0e10cSrcweir 				break;
243cdf0e10cSrcweir 			case FontUnderline::DASHDOTDOT:
244cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
245cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASHDOTDOT;
246cdf0e10cSrcweir 				break;
247cdf0e10cSrcweir 			case FontUnderline::WAVE:
248cdf0e10cSrcweir 				if( FontUnderline::BOLD == eUnderline )
249cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDWAVE;
250cdf0e10cSrcweir 				break;
251cdf0e10cSrcweir 			case FontUnderline::SMALLWAVE:
252cdf0e10cSrcweir 				// SMALLWAVE is not used
253cdf0e10cSrcweir 			default:
254cdf0e10cSrcweir 				OSL_ENSURE( bRet, "unexpected line style value" );
255cdf0e10cSrcweir 				break;
256cdf0e10cSrcweir 			}
257cdf0e10cSrcweir 			if( eNewUnderline != eUnderline )
258cdf0e10cSrcweir 				rValue <<= (sal_Int16)eNewUnderline;
259cdf0e10cSrcweir 		}
260cdf0e10cSrcweir 		else
261cdf0e10cSrcweir 		{
262cdf0e10cSrcweir 			rValue <<= (sal_Int16)eNewUnderline;
263cdf0e10cSrcweir 		}
264cdf0e10cSrcweir 	}
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 	return bRet;
267cdf0e10cSrcweir }
268cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const uno::Any & rValue,const SvXMLUnitConverter &) const269cdf0e10cSrcweir sal_Bool XMLUnderlineStylePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
270cdf0e10cSrcweir {
271cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
272cdf0e10cSrcweir 	sal_Int16 nValue = sal_Int16();
273cdf0e10cSrcweir 	OUStringBuffer aOut;
274cdf0e10cSrcweir 
275cdf0e10cSrcweir 	if( rValue >>= nValue )
276cdf0e10cSrcweir 	{
277cdf0e10cSrcweir         bRet = SvXMLUnitConverter::convertEnum(
278cdf0e10cSrcweir             aOut, (sal_uInt16)nValue, pXML_UnderlineStyle_Enum );
279cdf0e10cSrcweir 		if( bRet )
280cdf0e10cSrcweir 			rStrExpValue = aOut.makeStringAndClear();
281cdf0e10cSrcweir 	}
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	return bRet;
284cdf0e10cSrcweir }
285cdf0e10cSrcweir 
286cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////////
287cdf0e10cSrcweir //
288cdf0e10cSrcweir // class XMLUnderlineWidthPropHdl
289cdf0e10cSrcweir //
290cdf0e10cSrcweir 
~XMLUnderlineWidthPropHdl()291cdf0e10cSrcweir XMLUnderlineWidthPropHdl::~XMLUnderlineWidthPropHdl()
292cdf0e10cSrcweir {
293cdf0e10cSrcweir 	// nothing to do
294cdf0e10cSrcweir }
295cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,uno::Any & rValue,const SvXMLUnitConverter &) const296cdf0e10cSrcweir sal_Bool XMLUnderlineWidthPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
297cdf0e10cSrcweir {
298cdf0e10cSrcweir 	sal_uInt16 eNewUnderline;
299cdf0e10cSrcweir 	sal_Bool bRet = SvXMLUnitConverter::convertEnum(
300cdf0e10cSrcweir         eNewUnderline, rStrImpValue, pXML_UnderlineWidth_Enum );
301cdf0e10cSrcweir 	if( bRet )
302cdf0e10cSrcweir 	{
303cdf0e10cSrcweir 		// multi property: style and width might be set already.
304cdf0e10cSrcweir 		// If the old value is NONE, the new is used unchanged.
305cdf0e10cSrcweir 		sal_Int16 eUnderline = sal_Int16();
306cdf0e10cSrcweir 		if( (rValue >>= eUnderline) && FontUnderline::NONE!=eUnderline )
307cdf0e10cSrcweir 		{
308cdf0e10cSrcweir 			switch( eNewUnderline )
309cdf0e10cSrcweir 			{
310cdf0e10cSrcweir 			case FontUnderline::NONE:
311cdf0e10cSrcweir 				// keep existing line style
312cdf0e10cSrcweir 				eNewUnderline = eUnderline;
313cdf0e10cSrcweir 				break;
314cdf0e10cSrcweir 			case FontUnderline::BOLD:
315cdf0e10cSrcweir 				// A double line style has priority over a bold line style,
316cdf0e10cSrcweir 				// but not over the line style itself.
317cdf0e10cSrcweir 				switch( eUnderline )
318cdf0e10cSrcweir 				{
319cdf0e10cSrcweir 				case FontUnderline::SINGLE:
320cdf0e10cSrcweir 					break;
321cdf0e10cSrcweir 				case FontUnderline::DOTTED:
322cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDOTTED;
323cdf0e10cSrcweir 					break;
324cdf0e10cSrcweir 				case FontUnderline::DASH:
325cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASH;
326cdf0e10cSrcweir 					break;
327cdf0e10cSrcweir 				case FontUnderline::LONGDASH:
328cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDLONGDASH;
329cdf0e10cSrcweir 					break;
330cdf0e10cSrcweir 				case FontUnderline::DASHDOT:
331cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASHDOT;
332cdf0e10cSrcweir 					break;
333cdf0e10cSrcweir 				case FontUnderline::DASHDOTDOT:
334cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDDASHDOTDOT;
335cdf0e10cSrcweir 					break;
336cdf0e10cSrcweir 				case FontUnderline::WAVE:
337cdf0e10cSrcweir 					eNewUnderline = FontUnderline::BOLDWAVE;
338cdf0e10cSrcweir 					break;
339cdf0e10cSrcweir 				default:
340cdf0e10cSrcweir 					// a doube line style overwrites a bold one
341cdf0e10cSrcweir 					eNewUnderline = eUnderline;
342cdf0e10cSrcweir 					break;
343cdf0e10cSrcweir 				}
344cdf0e10cSrcweir 				break;
345cdf0e10cSrcweir 			default:
346cdf0e10cSrcweir 				OSL_ENSURE( bRet, "unexpected line width value" );
347cdf0e10cSrcweir 				break;
348cdf0e10cSrcweir 			}
349cdf0e10cSrcweir 			if( eNewUnderline != eUnderline )
350cdf0e10cSrcweir 				rValue <<= (sal_Int16)eNewUnderline;
351cdf0e10cSrcweir 		}
352cdf0e10cSrcweir 		else
353cdf0e10cSrcweir 		{
354cdf0e10cSrcweir 			rValue <<= (sal_Int16)eNewUnderline;
355cdf0e10cSrcweir 		}
356cdf0e10cSrcweir 	}
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 	return bRet;
359cdf0e10cSrcweir }
360cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const uno::Any & rValue,const SvXMLUnitConverter &) const361cdf0e10cSrcweir sal_Bool XMLUnderlineWidthPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
362cdf0e10cSrcweir {
363cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
364cdf0e10cSrcweir 	sal_Int16 nValue = sal_Int16();
365cdf0e10cSrcweir 	OUStringBuffer aOut;
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 	if( (rValue >>= nValue) && (FontUnderline::NONE != nValue) )
368cdf0e10cSrcweir 	{
369cdf0e10cSrcweir         bRet = SvXMLUnitConverter::convertEnum(
370cdf0e10cSrcweir             aOut, (sal_uInt16)nValue, pXML_UnderlineWidth_Enum );
371cdf0e10cSrcweir 		if( bRet )
372cdf0e10cSrcweir 			rStrExpValue = aOut.makeStringAndClear();
373cdf0e10cSrcweir 	}
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 	return bRet;
376cdf0e10cSrcweir }
377cdf0e10cSrcweir 
378