LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/chart - XMLAxisPositionPropertyHdl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 47 0.0 %
Date: 2012-12-27 Functions: 0 5 0.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 "XMLAxisPositionPropertyHdl.hxx"
      22             : 
      23             : #include <rtl/ustrbuf.hxx>
      24             : 
      25             : #include <com/sun/star/uno/Any.hxx>
      26             : #include <com/sun/star/chart/ChartAxisPosition.hpp>
      27             : 
      28             : #include <sax/tools/converter.hxx>
      29             : 
      30             : #include <xmloff/xmltoken.hxx>
      31             : 
      32             : 
      33             : using namespace ::xmloff::token;
      34             : using ::rtl::OUString;
      35             : using ::rtl::OUStringBuffer;
      36             : 
      37             : using namespace com::sun::star;
      38             : 
      39           0 : XMLAxisPositionPropertyHdl::XMLAxisPositionPropertyHdl( bool bCrossingValue )
      40           0 :         : m_bCrossingValue( bCrossingValue )
      41           0 : {}
      42             : 
      43           0 : XMLAxisPositionPropertyHdl::~XMLAxisPositionPropertyHdl()
      44           0 : {}
      45             : 
      46           0 : sal_Bool XMLAxisPositionPropertyHdl::importXML( const OUString& rStrImpValue,
      47             :                                                   uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
      48             : {
      49           0 :     sal_Bool bResult = false;
      50             : 
      51           0 :     if( rStrImpValue.equals( GetXMLToken(XML_START) ) )
      52             :     {
      53           0 :         if( !m_bCrossingValue )
      54             :         {
      55           0 :             rValue <<= ::com::sun::star::chart::ChartAxisPosition_START;
      56           0 :             bResult = true;
      57             :         }
      58             :     }
      59           0 :     else if( rStrImpValue.equals( GetXMLToken(XML_END) ) )
      60             :     {
      61           0 :         if( !m_bCrossingValue )
      62             :         {
      63           0 :             rValue <<= ::com::sun::star::chart::ChartAxisPosition_END;
      64           0 :             bResult = true;
      65             :         }
      66             :     }
      67             :     else
      68             :     {
      69           0 :         if( !m_bCrossingValue )
      70             :         {
      71           0 :             rValue <<= ::com::sun::star::chart::ChartAxisPosition_VALUE;
      72           0 :             bResult = true;
      73             :         }
      74             :         else
      75             :         {
      76           0 :             double fDblValue=0.0;
      77           0 :             bResult = ::sax::Converter::convertDouble(fDblValue, rStrImpValue);
      78           0 :             rValue <<= fDblValue;
      79             :         }
      80             :     }
      81             : 
      82           0 :     return bResult;
      83             : }
      84             : 
      85           0 : sal_Bool XMLAxisPositionPropertyHdl::exportXML( OUString& rStrExpValue,
      86             :                                               const uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
      87             : {
      88           0 :     sal_Bool bResult = sal_False;
      89             : 
      90           0 :     rtl::OUStringBuffer sValueBuffer;
      91           0 :     if( m_bCrossingValue )
      92             :     {
      93           0 :         if(rStrExpValue.isEmpty())
      94             :         {
      95           0 :             double fValue = 0.0;
      96           0 :             rValue >>= fValue;
      97           0 :             ::sax::Converter::convertDouble( sValueBuffer, fValue );
      98           0 :             rStrExpValue = sValueBuffer.makeStringAndClear();
      99           0 :             bResult = true;
     100             :         }
     101             :     }
     102             :     else
     103             :     {
     104           0 :         ::com::sun::star::chart::ChartAxisPosition ePosition( ::com::sun::star::chart::ChartAxisPosition_ZERO );
     105           0 :         rValue >>= ePosition;
     106           0 :         switch(ePosition)
     107             :         {
     108             :             case ::com::sun::star::chart::ChartAxisPosition_START:
     109           0 :                 rStrExpValue = GetXMLToken( XML_START );
     110           0 :                 bResult = true;
     111           0 :                 break;
     112             :             case ::com::sun::star::chart::ChartAxisPosition_END:
     113           0 :                 rStrExpValue = GetXMLToken( XML_END );
     114           0 :                 bResult = true;
     115           0 :                 break;
     116             :             case ::com::sun::star::chart::ChartAxisPosition_ZERO:
     117           0 :                 ::sax::Converter::convertDouble( sValueBuffer, 0.0 );
     118           0 :                 rStrExpValue = sValueBuffer.makeStringAndClear();
     119           0 :                 bResult = true;
     120           0 :                 break;
     121             :             default:
     122           0 :                 break;
     123             :         }
     124             :     }
     125           0 :     return bResult;
     126             : }
     127             : 
     128             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10