LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/style - DrawAspectHdl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 16 43.8 %
Date: 2012-12-27 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          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             : using ::rtl::OUString;
      36             : using ::rtl::OUStringBuffer;
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using namespace ::xmloff::token;
      40             : 
      41             : ///////////////////////////////////////////////////////////////////////////////
      42             : //
      43             : // class XMLMeasurePropHdl
      44             : //
      45             : 
      46             : SvXMLEnumMapEntry const pXML_DrawAspect_Enum[] =
      47             : {
      48             :     { XML_CONTENT,          1   },
      49             :     { XML_THUMBNAIL,        2   },
      50             :     { XML_ICON,             4   },
      51             :     { XML_PRINT,            8   },
      52             :     { XML_TOKEN_INVALID, 0 }
      53             : };
      54             : 
      55         556 : DrawAspectHdl::~DrawAspectHdl()
      56             : {
      57             :     // nothing to do
      58         556 : }
      59             : 
      60           3 : sal_Bool DrawAspectHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
      61             : {
      62           3 :     sal_Int64 nAspect = 0;
      63             : 
      64           3 :     ::sax::Converter::convertNumber64( nAspect, rStrImpValue );
      65           3 :     rValue <<= nAspect;
      66             : 
      67           3 :     return nAspect > 0;
      68             : }
      69             : 
      70           0 : sal_Bool DrawAspectHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
      71             : {
      72           0 :     sal_Bool bRet = sal_False;
      73           0 :       OUStringBuffer aOut;
      74             : 
      75           0 :     sal_Int64 nAspect = 0;
      76           0 :     if( ( rValue >>= nAspect ) && nAspect > 0 )
      77             :     {
      78             :         // store the aspect as an integer value
      79           0 :         aOut.append( nAspect );
      80             : 
      81           0 :         rStrExpValue = aOut.makeStringAndClear();
      82             : 
      83           0 :         bRet = sal_True;
      84             :     }
      85             : 
      86           0 :     return bRet;
      87             : }
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10