1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_xmloff.hxx" 30 #include <com/sun/star/uno/Any.hxx> 31 #include <rtl/ustrbuf.hxx> 32 #include <xmloff/xmluconv.hxx> 33 #include <xmloff/xmltoken.hxx> 34 #include "DrawAspectHdl.hxx" 35 36 using ::rtl::OUString; 37 using ::rtl::OUStringBuffer; 38 39 using namespace ::com::sun::star; 40 using namespace ::xmloff::token; 41 42 /////////////////////////////////////////////////////////////////////////////// 43 // 44 // class XMLMeasurePropHdl 45 // 46 47 SvXMLEnumMapEntry __READONLY_DATA pXML_DrawAspect_Enum[] = 48 { 49 { XML_CONTENT, 1 }, 50 { XML_THUMBNAIL, 2 }, 51 { XML_ICON, 4 }, 52 { XML_PRINT, 8 }, 53 { XML_TOKEN_INVALID, 0 } 54 }; 55 56 DrawAspectHdl::~DrawAspectHdl() 57 { 58 // nothing to do 59 } 60 61 sal_Bool DrawAspectHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const 62 { 63 sal_Int64 nAspect = 0; 64 65 SvXMLUnitConverter::convertNumber64( nAspect, rStrImpValue ); 66 rValue <<= nAspect; 67 68 return nAspect > 0; 69 } 70 71 sal_Bool DrawAspectHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const 72 { 73 sal_Bool bRet = sal_False; 74 OUStringBuffer aOut; 75 76 sal_Int64 nAspect = 0; 77 if( ( rValue >>= nAspect ) && nAspect > 0 ) 78 { 79 // store the aspect as an integer value 80 aOut.append( nAspect ); 81 82 rStrExpValue = aOut.makeStringAndClear(); 83 84 bRet = sal_True; 85 } 86 87 return bRet; 88 } 89 90