xref: /AOO41X/main/xmloff/source/forms/controlpropertyhdl.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 <xmloff/controlpropertyhdl.hxx>
31*cdf0e10cSrcweir #include <com/sun/star/awt/TextAlign.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/awt/FontWidth.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/awt/FontEmphasisMark.hpp>
34*cdf0e10cSrcweir #include <xmloff/xmltypes.hxx>
35*cdf0e10cSrcweir #include "xmloff/NamedBoolPropertyHdl.hxx"
36*cdf0e10cSrcweir #include "formenums.hxx"
37*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
38*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
39*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
40*cdf0e10cSrcweir #include <osl/diagnose.h>
41*cdf0e10cSrcweir #include "callbacks.hxx"
42*cdf0e10cSrcweir #include <xmloff/XMLConstantsPropertyHandler.hxx>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir //.........................................................................
45*cdf0e10cSrcweir namespace xmloff
46*cdf0e10cSrcweir {
47*cdf0e10cSrcweir //.........................................................................
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
50*cdf0e10cSrcweir 	using namespace ::com::sun::star::awt;
51*cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
52*cdf0e10cSrcweir 	using namespace ::xmloff::token;
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir 	//=====================================================================
55*cdf0e10cSrcweir 	//= OControlPropertyHandlerFactory
56*cdf0e10cSrcweir 	//=====================================================================
57*cdf0e10cSrcweir 	//---------------------------------------------------------------------
58*cdf0e10cSrcweir 	OControlPropertyHandlerFactory::OControlPropertyHandlerFactory()
59*cdf0e10cSrcweir 		:m_pTextAlignHandler(NULL)
60*cdf0e10cSrcweir 		,m_pControlBorderStyleHandler(NULL)
61*cdf0e10cSrcweir         ,m_pControlBorderColorHandler(NULL)
62*cdf0e10cSrcweir 		,m_pRotationAngleHandler(NULL)
63*cdf0e10cSrcweir 		,m_pFontWidthHandler(NULL)
64*cdf0e10cSrcweir 		,m_pFontEmphasisHandler(NULL)
65*cdf0e10cSrcweir 		,m_pFontReliefHandler(NULL)
66*cdf0e10cSrcweir 	{
67*cdf0e10cSrcweir 	}
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 	//---------------------------------------------------------------------
70*cdf0e10cSrcweir 	OControlPropertyHandlerFactory::~OControlPropertyHandlerFactory()
71*cdf0e10cSrcweir 	{
72*cdf0e10cSrcweir 		delete m_pTextAlignHandler;
73*cdf0e10cSrcweir 		delete m_pControlBorderStyleHandler;
74*cdf0e10cSrcweir         delete m_pControlBorderColorHandler;
75*cdf0e10cSrcweir 		delete m_pRotationAngleHandler;
76*cdf0e10cSrcweir 		delete m_pFontWidthHandler;
77*cdf0e10cSrcweir 		delete m_pFontEmphasisHandler;
78*cdf0e10cSrcweir 		delete m_pFontReliefHandler;
79*cdf0e10cSrcweir 	}
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 	//---------------------------------------------------------------------
82*cdf0e10cSrcweir 	const XMLPropertyHandler* OControlPropertyHandlerFactory::GetPropertyHandler(sal_Int32 _nType) const
83*cdf0e10cSrcweir 	{
84*cdf0e10cSrcweir 		const XMLPropertyHandler* pHandler = NULL;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 		switch (_nType)
87*cdf0e10cSrcweir 		{
88*cdf0e10cSrcweir 			case XML_TYPE_TEXT_ALIGN:
89*cdf0e10cSrcweir 				if (!m_pTextAlignHandler)
90*cdf0e10cSrcweir 					m_pTextAlignHandler = new XMLConstantsPropertyHandler(OEnumMapper::getEnumMap(OEnumMapper::epTextAlign), XML_TOKEN_INVALID );
91*cdf0e10cSrcweir 				pHandler = m_pTextAlignHandler;
92*cdf0e10cSrcweir 				break;
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 			case XML_TYPE_CONTROL_BORDER:
95*cdf0e10cSrcweir 				if (!m_pControlBorderStyleHandler)
96*cdf0e10cSrcweir                     m_pControlBorderStyleHandler = new OControlBorderHandler( OControlBorderHandler::STYLE );
97*cdf0e10cSrcweir 				pHandler = m_pControlBorderStyleHandler;
98*cdf0e10cSrcweir 				break;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 			case XML_TYPE_CONTROL_BORDER_COLOR:
101*cdf0e10cSrcweir 				if ( !m_pControlBorderColorHandler )
102*cdf0e10cSrcweir 					m_pControlBorderColorHandler = new OControlBorderHandler( OControlBorderHandler::COLOR );
103*cdf0e10cSrcweir 				pHandler = m_pControlBorderColorHandler;
104*cdf0e10cSrcweir 				break;
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 			case XML_TYPE_ROTATION_ANGLE:
107*cdf0e10cSrcweir 				if (!m_pRotationAngleHandler)
108*cdf0e10cSrcweir 					m_pRotationAngleHandler = new ORotationAngleHandler;
109*cdf0e10cSrcweir 				pHandler = m_pRotationAngleHandler;
110*cdf0e10cSrcweir 				break;
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 			case XML_TYPE_FONT_WIDTH:
113*cdf0e10cSrcweir 				if (!m_pFontWidthHandler)
114*cdf0e10cSrcweir 					m_pFontWidthHandler = new OFontWidthHandler;
115*cdf0e10cSrcweir 				pHandler = m_pFontWidthHandler;
116*cdf0e10cSrcweir 				break;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 			case XML_TYPE_CONTROL_TEXT_EMPHASIZE:
119*cdf0e10cSrcweir 				if (!m_pFontEmphasisHandler)
120*cdf0e10cSrcweir 					m_pFontEmphasisHandler = new XMLConstantsPropertyHandler( OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis), XML_NONE );
121*cdf0e10cSrcweir 				pHandler = m_pFontEmphasisHandler;
122*cdf0e10cSrcweir 				break;
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 			case XML_TYPE_TEXT_FONT_RELIEF:
125*cdf0e10cSrcweir 				if (!m_pFontReliefHandler)
126*cdf0e10cSrcweir 					m_pFontReliefHandler = new XMLConstantsPropertyHandler( OEnumMapper::getEnumMap(OEnumMapper::epFontRelief), XML_NONE );
127*cdf0e10cSrcweir 				pHandler = m_pFontReliefHandler;
128*cdf0e10cSrcweir 				break;
129*cdf0e10cSrcweir             case XML_TYPE_TEXT_LINE_MODE:
130*cdf0e10cSrcweir 		        pHandler = new XMLNamedBoolPropertyHdl(
131*cdf0e10cSrcweir 									        ::xmloff::token::XML_SKIP_WHITE_SPACE,
132*cdf0e10cSrcweir                                             ::xmloff::token::XML_CONTINUOUS);
133*cdf0e10cSrcweir 		        break;
134*cdf0e10cSrcweir 		}
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir 		if (!pHandler)
137*cdf0e10cSrcweir 			pHandler = XMLPropertyHandlerFactory::GetPropertyHandler(_nType);
138*cdf0e10cSrcweir 		return pHandler;
139*cdf0e10cSrcweir 	}
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	//=====================================================================
142*cdf0e10cSrcweir 	//= OControlTextEmphasisHandler
143*cdf0e10cSrcweir 	//=====================================================================
144*cdf0e10cSrcweir 	OControlTextEmphasisHandler::OControlTextEmphasisHandler()
145*cdf0e10cSrcweir 	{
146*cdf0e10cSrcweir 	}
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 	//---------------------------------------------------------------------
149*cdf0e10cSrcweir 	sal_Bool OControlTextEmphasisHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
150*cdf0e10cSrcweir 	{
151*cdf0e10cSrcweir 		::rtl::OUStringBuffer aReturn;
152*cdf0e10cSrcweir 		sal_Bool bSuccess = sal_False;
153*cdf0e10cSrcweir 		sal_Int16 nFontEmphasis = sal_Int16();
154*cdf0e10cSrcweir 		if (_rValue >>= nFontEmphasis)
155*cdf0e10cSrcweir 		{
156*cdf0e10cSrcweir 			// the type
157*cdf0e10cSrcweir 			sal_Int16 nType = nFontEmphasis & ~(FontEmphasisMark::ABOVE | FontEmphasisMark::BELOW);
158*cdf0e10cSrcweir 			// the position of the mark
159*cdf0e10cSrcweir 			sal_Bool bBelow = 0 != (nFontEmphasis & FontEmphasisMark::BELOW);
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 			// convert
162*cdf0e10cSrcweir             bSuccess = SvXMLUnitConverter::convertEnum(aReturn, nType, OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis), XML_NONE);
163*cdf0e10cSrcweir 			if (bSuccess)
164*cdf0e10cSrcweir 			{
165*cdf0e10cSrcweir 				aReturn.append( (sal_Unicode)' ' );
166*cdf0e10cSrcweir 				aReturn.append( GetXMLToken(bBelow ? XML_BELOW : XML_ABOVE) );
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 				_rStrExpValue = aReturn.makeStringAndClear();
169*cdf0e10cSrcweir 			}
170*cdf0e10cSrcweir 		}
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 		return bSuccess;
173*cdf0e10cSrcweir 	}
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 	//---------------------------------------------------------------------
176*cdf0e10cSrcweir 	sal_Bool OControlTextEmphasisHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
177*cdf0e10cSrcweir 	{
178*cdf0e10cSrcweir 		sal_Bool bSuccess = sal_True;
179*cdf0e10cSrcweir 		sal_uInt16 nEmphasis = FontEmphasisMark::NONE;
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 		sal_Bool bBelow = sal_False;
182*cdf0e10cSrcweir 		sal_Bool bHasPos = sal_False, bHasType = sal_False;
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 		::rtl::OUString sToken;
185*cdf0e10cSrcweir 		SvXMLTokenEnumerator aTokenEnum(_rStrImpValue);
186*cdf0e10cSrcweir 		while (aTokenEnum.getNextToken(sToken))
187*cdf0e10cSrcweir 		{
188*cdf0e10cSrcweir 			if (!bHasPos)
189*cdf0e10cSrcweir 			{
190*cdf0e10cSrcweir 				if (IsXMLToken(sToken, XML_ABOVE))
191*cdf0e10cSrcweir 				{
192*cdf0e10cSrcweir 					bBelow = sal_False;
193*cdf0e10cSrcweir 					bHasPos = sal_True;
194*cdf0e10cSrcweir 				}
195*cdf0e10cSrcweir 				else if (IsXMLToken(sToken, XML_BELOW))
196*cdf0e10cSrcweir 				{
197*cdf0e10cSrcweir 					bBelow = sal_True;
198*cdf0e10cSrcweir 					bHasPos = sal_True;
199*cdf0e10cSrcweir 				}
200*cdf0e10cSrcweir 			}
201*cdf0e10cSrcweir 			if (!bHasType)
202*cdf0e10cSrcweir 			{
203*cdf0e10cSrcweir 				if (SvXMLUnitConverter::convertEnum(nEmphasis, sToken, OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis)))
204*cdf0e10cSrcweir 				{
205*cdf0e10cSrcweir 					bHasType = sal_True;
206*cdf0e10cSrcweir 				}
207*cdf0e10cSrcweir 				else
208*cdf0e10cSrcweir 				{
209*cdf0e10cSrcweir 					bSuccess = sal_False;
210*cdf0e10cSrcweir 					break;
211*cdf0e10cSrcweir 				}
212*cdf0e10cSrcweir 			}
213*cdf0e10cSrcweir 		}
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 		if (bSuccess)
216*cdf0e10cSrcweir 		{
217*cdf0e10cSrcweir 			nEmphasis |= bBelow ? FontEmphasisMark::BELOW : FontEmphasisMark::ABOVE;
218*cdf0e10cSrcweir 			_rValue <<= (sal_Int16)nEmphasis;
219*cdf0e10cSrcweir 		}
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 		return bSuccess;
222*cdf0e10cSrcweir 	}
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 	//=====================================================================
225*cdf0e10cSrcweir 	//= OControlBorderHandlerBase
226*cdf0e10cSrcweir 	//=====================================================================
227*cdf0e10cSrcweir 	//---------------------------------------------------------------------
228*cdf0e10cSrcweir 	OControlBorderHandler::OControlBorderHandler( const OControlBorderHandler::BorderFacet _eFacet )
229*cdf0e10cSrcweir         :m_eFacet( _eFacet )
230*cdf0e10cSrcweir 	{
231*cdf0e10cSrcweir 	}
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 	//---------------------------------------------------------------------
234*cdf0e10cSrcweir 	sal_Bool OControlBorderHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
235*cdf0e10cSrcweir 	{
236*cdf0e10cSrcweir 		::rtl::OUString sToken;
237*cdf0e10cSrcweir 		SvXMLTokenEnumerator aTokens(_rStrImpValue);
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 		sal_uInt16 nStyle = 1;
240*cdf0e10cSrcweir         Color aColor;
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 		while	(	aTokens.getNextToken(sToken)	// have a new token
243*cdf0e10cSrcweir 				&&	(0 != sToken.getLength())		// really have a new token
244*cdf0e10cSrcweir 				)
245*cdf0e10cSrcweir 		{
246*cdf0e10cSrcweir             // try interpreting the token as border style
247*cdf0e10cSrcweir             if ( m_eFacet == STYLE )
248*cdf0e10cSrcweir             {
249*cdf0e10cSrcweir                 // is it a valid enum value?
250*cdf0e10cSrcweir 			    if ( SvXMLUnitConverter::convertEnum( nStyle, sToken, OEnumMapper::getEnumMap( OEnumMapper::epBorderWidth ) ) )
251*cdf0e10cSrcweir                 {
252*cdf0e10cSrcweir                     _rValue <<= nStyle;
253*cdf0e10cSrcweir                     return sal_True;
254*cdf0e10cSrcweir                 }
255*cdf0e10cSrcweir             }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir             // try interpreting it as color value
258*cdf0e10cSrcweir             if ( m_eFacet == COLOR )
259*cdf0e10cSrcweir             {
260*cdf0e10cSrcweir                 if ( SvXMLUnitConverter::convertColor( aColor, sToken ) )
261*cdf0e10cSrcweir                 {
262*cdf0e10cSrcweir                     _rValue <<= (sal_Int32)aColor.GetColor();
263*cdf0e10cSrcweir                     return sal_True;
264*cdf0e10cSrcweir                 }
265*cdf0e10cSrcweir             }
266*cdf0e10cSrcweir 		}
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 		return sal_False;
269*cdf0e10cSrcweir 	}
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 	//---------------------------------------------------------------------
272*cdf0e10cSrcweir 	sal_Bool OControlBorderHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
273*cdf0e10cSrcweir 	{
274*cdf0e10cSrcweir 		sal_Bool bSuccess = sal_False;
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 	    ::rtl::OUStringBuffer aOut;
277*cdf0e10cSrcweir         switch ( m_eFacet )
278*cdf0e10cSrcweir         {
279*cdf0e10cSrcweir         case STYLE:
280*cdf0e10cSrcweir         {
281*cdf0e10cSrcweir 		    sal_Int16 nBorder = 0;
282*cdf0e10cSrcweir 		    bSuccess =	(_rValue >>= nBorder)
283*cdf0e10cSrcweir 			    	&&	SvXMLUnitConverter::convertEnum( aOut, nBorder, OEnumMapper::getEnumMap( OEnumMapper::epBorderWidth ) );
284*cdf0e10cSrcweir         }
285*cdf0e10cSrcweir         break;
286*cdf0e10cSrcweir         case COLOR:
287*cdf0e10cSrcweir         {
288*cdf0e10cSrcweir 		    sal_Int32 nBorderColor = 0;
289*cdf0e10cSrcweir 		    if ( _rValue >>= nBorderColor )
290*cdf0e10cSrcweir             {
291*cdf0e10cSrcweir                 SvXMLUnitConverter::convertColor( aOut, Color( nBorderColor ) );
292*cdf0e10cSrcweir                 bSuccess = sal_True;
293*cdf0e10cSrcweir             }
294*cdf0e10cSrcweir         }
295*cdf0e10cSrcweir         break;
296*cdf0e10cSrcweir         }   // switch ( m_eFacet )
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir         if ( !bSuccess )
299*cdf0e10cSrcweir             return sal_False;
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir         if ( _rStrExpValue.getLength() )
302*cdf0e10cSrcweir             _rStrExpValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
303*cdf0e10cSrcweir 		_rStrExpValue += aOut.makeStringAndClear();
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 		return sal_True;
306*cdf0e10cSrcweir     }
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir 	//=====================================================================
309*cdf0e10cSrcweir 	//= OFontWidthHandler
310*cdf0e10cSrcweir 	//=====================================================================
311*cdf0e10cSrcweir 	//---------------------------------------------------------------------
312*cdf0e10cSrcweir 	OFontWidthHandler::OFontWidthHandler()
313*cdf0e10cSrcweir 	{
314*cdf0e10cSrcweir 	}
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir 	//---------------------------------------------------------------------
317*cdf0e10cSrcweir 	sal_Bool OFontWidthHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
318*cdf0e10cSrcweir 	{
319*cdf0e10cSrcweir 		sal_Int32 nWidth = 0;
320*cdf0e10cSrcweir 		sal_Bool bSuccess = SvXMLUnitConverter::convertMeasure(nWidth, _rStrImpValue, MAP_POINT);
321*cdf0e10cSrcweir 		if (bSuccess)
322*cdf0e10cSrcweir 			_rValue <<= (sal_Int16)nWidth;
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 		return bSuccess;
325*cdf0e10cSrcweir 	}
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 	//---------------------------------------------------------------------
328*cdf0e10cSrcweir 	sal_Bool OFontWidthHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
329*cdf0e10cSrcweir 	{
330*cdf0e10cSrcweir 		sal_Int16 nWidth = 0;
331*cdf0e10cSrcweir 		::rtl::OUStringBuffer aResult;
332*cdf0e10cSrcweir 		if (_rValue >>= nWidth)
333*cdf0e10cSrcweir 			SvXMLUnitConverter::convertMeasure(aResult, nWidth, MAP_POINT, MAP_POINT);
334*cdf0e10cSrcweir 		_rStrExpValue = aResult.makeStringAndClear();
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir 		return _rStrExpValue.getLength() != 0;
337*cdf0e10cSrcweir 	}
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 	//=====================================================================
340*cdf0e10cSrcweir 	//= ORotationAngleHandler
341*cdf0e10cSrcweir 	//=====================================================================
342*cdf0e10cSrcweir 	//---------------------------------------------------------------------
343*cdf0e10cSrcweir 	ORotationAngleHandler::ORotationAngleHandler()
344*cdf0e10cSrcweir 	{
345*cdf0e10cSrcweir 	}
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 	//---------------------------------------------------------------------
348*cdf0e10cSrcweir 	sal_Bool ORotationAngleHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
349*cdf0e10cSrcweir 	{
350*cdf0e10cSrcweir 		double fValue;
351*cdf0e10cSrcweir 		sal_Bool bSucces =
352*cdf0e10cSrcweir             SvXMLUnitConverter::convertDouble(fValue, _rStrImpValue);
353*cdf0e10cSrcweir 		if (bSucces)
354*cdf0e10cSrcweir 		{
355*cdf0e10cSrcweir 			fValue *= 10;
356*cdf0e10cSrcweir 			_rValue <<= (float)fValue;
357*cdf0e10cSrcweir 		}
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 		return bSucces;
360*cdf0e10cSrcweir 	}
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 	//---------------------------------------------------------------------
363*cdf0e10cSrcweir 	sal_Bool ORotationAngleHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
364*cdf0e10cSrcweir 	{
365*cdf0e10cSrcweir 		float fAngle = 0;
366*cdf0e10cSrcweir 		sal_Bool bSuccess = (_rValue >>= fAngle);
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 		if (bSuccess)
369*cdf0e10cSrcweir 		{
370*cdf0e10cSrcweir 			rtl::OUStringBuffer sValue;
371*cdf0e10cSrcweir 			SvXMLUnitConverter::convertDouble(sValue, ((double)fAngle) / 10);
372*cdf0e10cSrcweir 			_rStrExpValue = sValue.makeStringAndClear();
373*cdf0e10cSrcweir 		}
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 		return bSuccess;
376*cdf0e10cSrcweir 	}
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir 	//=====================================================================
379*cdf0e10cSrcweir 	//= ImageScaleModeHandler
380*cdf0e10cSrcweir 	//=====================================================================
381*cdf0e10cSrcweir 	//---------------------------------------------------------------------
382*cdf0e10cSrcweir     ImageScaleModeHandler::ImageScaleModeHandler()
383*cdf0e10cSrcweir         :XMLConstantsPropertyHandler( OEnumMapper::getEnumMap( OEnumMapper::epImageScaleMode ), XML_STRETCH )
384*cdf0e10cSrcweir     {
385*cdf0e10cSrcweir     }
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir //.........................................................................
388*cdf0e10cSrcweir }	// namespace xmloff
389*cdf0e10cSrcweir //.........................................................................
390*cdf0e10cSrcweir 
391