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