1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26 #include <com/sun/star/uno/Any.hxx>
27 #include <rtl/ustrbuf.hxx>
28 #include <xmloff/xmluconv.hxx>
29 #include <xmloff/xmltoken.hxx>
30 #include "DrawAspectHdl.hxx"
31 
32 using ::rtl::OUString;
33 using ::rtl::OUStringBuffer;
34 
35 using namespace ::com::sun::star;
36 using namespace ::xmloff::token;
37 
38 ///////////////////////////////////////////////////////////////////////////////
39 //
40 // class XMLMeasurePropHdl
41 //
42 
43 SvXMLEnumMapEntry __READONLY_DATA pXML_DrawAspect_Enum[] =
44 {
45 	{ XML_CONTENT,			1	},
46 	{ XML_THUMBNAIL,		2	},
47 	{ XML_ICON,			    4	},
48 	{ XML_PRINT,			8	},
49 	{ XML_TOKEN_INVALID, 0 }
50 };
51 
~DrawAspectHdl()52 DrawAspectHdl::~DrawAspectHdl()
53 {
54 	// nothing to do
55 }
56 
importXML(const OUString & rStrImpValue,uno::Any & rValue,const SvXMLUnitConverter &) const57 sal_Bool DrawAspectHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
58 {
59 	sal_Int64 nAspect = 0;
60 
61 	SvXMLUnitConverter::convertNumber64( nAspect, rStrImpValue );
62 	rValue <<= nAspect;
63 
64 	return nAspect > 0;
65 }
66 
exportXML(OUString & rStrExpValue,const uno::Any & rValue,const SvXMLUnitConverter &) const67 sal_Bool DrawAspectHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
68 {
69 	sal_Bool bRet = sal_False;
70   	OUStringBuffer aOut;
71 
72 	sal_Int64 nAspect = 0;
73 	if( ( rValue >>= nAspect ) && nAspect > 0 )
74 	{
75 		// store the aspect as an integer value
76 		aOut.append( nAspect );
77 
78 		rStrExpValue = aOut.makeStringAndClear();
79 
80 		bRet = sal_True;
81 	}
82 
83 	return bRet;
84 }
85 
86