Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "DrawAspectHdl.hxx"
22 :
23 : #include <com/sun/star/uno/Any.hxx>
24 :
25 : #include <rtl/ustrbuf.hxx>
26 :
27 : #include <tools/solar.h>
28 :
29 : #include <sax/tools/converter.hxx>
30 :
31 : #include <xmloff/xmlement.hxx>
32 : #include <xmloff/xmltoken.hxx>
33 :
34 :
35 :
36 : using namespace ::com::sun::star;
37 : using namespace ::xmloff::token;
38 :
39 : ///////////////////////////////////////////////////////////////////////////////
40 : //
41 : // class XMLMeasurePropHdl
42 : //
43 :
44 : SvXMLEnumMapEntry const pXML_DrawAspect_Enum[] =
45 : {
46 : { XML_CONTENT, 1 },
47 : { XML_THUMBNAIL, 2 },
48 : { XML_ICON, 4 },
49 : { XML_PRINT, 8 },
50 : { XML_TOKEN_INVALID, 0 }
51 : };
52 :
53 2512 : DrawAspectHdl::~DrawAspectHdl()
54 : {
55 : // nothing to do
56 2512 : }
57 :
58 15 : sal_Bool DrawAspectHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
59 : {
60 15 : sal_Int64 nAspect = 0;
61 :
62 15 : ::sax::Converter::convertNumber64( nAspect, rStrImpValue );
63 15 : rValue <<= nAspect;
64 :
65 15 : return nAspect > 0;
66 : }
67 :
68 4 : sal_Bool DrawAspectHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
69 : {
70 4 : sal_Bool bRet = sal_False;
71 4 : OUStringBuffer aOut;
72 :
73 4 : sal_Int64 nAspect = 0;
74 4 : if( ( rValue >>= nAspect ) && nAspect > 0 )
75 : {
76 : // store the aspect as an integer value
77 4 : aOut.append( nAspect );
78 :
79 4 : rStrExpValue = aOut.makeStringAndClear();
80 :
81 4 : bRet = sal_True;
82 : }
83 :
84 4 : return bRet;
85 : }
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|