LCOV - code coverage report
Current view: top level - xmloff/source/style - adjushdl.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 32 0.0 %
Date: 2014-04-14 Functions: 0 8 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             : #include <adjushdl.hxx>
      21             : #include <xmloff/xmltoken.hxx>
      22             : #include <xmloff/xmluconv.hxx>
      23             : #include <rtl/ustrbuf.hxx>
      24             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      25             : #include <com/sun/star/uno/Any.hxx>
      26             : 
      27             : using namespace ::com::sun::star;
      28             : 
      29             : using namespace ::xmloff::token;
      30             : 
      31             : SvXMLEnumMapEntry const pXML_Para_Adjust_Enum[] =
      32             : {
      33             :     { XML_START,        style::ParagraphAdjust_LEFT },
      34             :     { XML_END,          style::ParagraphAdjust_RIGHT },
      35             :     { XML_CENTER,       style::ParagraphAdjust_CENTER },
      36             :     { XML_JUSTIFY,      style::ParagraphAdjust_BLOCK },
      37             :     { XML_JUSTIFIED,    style::ParagraphAdjust_BLOCK }, // obsolete
      38             :     { XML_LEFT,         style::ParagraphAdjust_LEFT },
      39             :     { XML_RIGHT,        style::ParagraphAdjust_RIGHT },
      40             :     { XML_TOKEN_INVALID, 0 }
      41             : };
      42             : 
      43             : SvXMLEnumMapEntry const pXML_Para_Align_Last_Enum[] =
      44             : {
      45             :     { XML_START,        style::ParagraphAdjust_LEFT },
      46             :     { XML_CENTER,       style::ParagraphAdjust_CENTER },
      47             :     { XML_JUSTIFY,      style::ParagraphAdjust_BLOCK },
      48             :     { XML_JUSTIFIED,    style::ParagraphAdjust_BLOCK }, // obsolete
      49             :     { XML_TOKEN_INVALID, 0 }
      50             : };
      51             : 
      52             : 
      53             : // class XMLParaAdjustPropHdl
      54             : 
      55             : 
      56           0 : XMLParaAdjustPropHdl::~XMLParaAdjustPropHdl()
      57             : {
      58             :     // nothing to do
      59           0 : }
      60             : 
      61           0 : bool XMLParaAdjustPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
      62             : {
      63             :     sal_uInt16 eAdjust;
      64           0 :     bool bRet = SvXMLUnitConverter::convertEnum( eAdjust, rStrImpValue, pXML_Para_Adjust_Enum );
      65           0 :     if( bRet )
      66           0 :         rValue <<= (sal_Int16)eAdjust;
      67             : 
      68           0 :     return bRet;
      69             : }
      70             : 
      71           0 : bool XMLParaAdjustPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
      72             : {
      73           0 :     if(!rValue.hasValue())
      74           0 :         return false;
      75           0 :     OUStringBuffer aOut;
      76           0 :     sal_Int16 nVal = 0;
      77             : 
      78           0 :     rValue >>= nVal;
      79             : 
      80           0 :     bool bRet = SvXMLUnitConverter::convertEnum( aOut, nVal, pXML_Para_Adjust_Enum, XML_START );
      81             : 
      82           0 :     rStrExpValue = aOut.makeStringAndClear();
      83             : 
      84           0 :     return bRet;
      85             : }
      86             : 
      87             : 
      88             : // class XMLLastLineAdjustPropHdl
      89             : 
      90             : 
      91           0 : XMLLastLineAdjustPropHdl::~XMLLastLineAdjustPropHdl()
      92             : {
      93             :     // nothing to do
      94           0 : }
      95             : 
      96           0 : bool XMLLastLineAdjustPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
      97             : {
      98             :     sal_uInt16 eAdjust;
      99           0 :     bool bRet = SvXMLUnitConverter::convertEnum( eAdjust, rStrImpValue, pXML_Para_Align_Last_Enum );
     100           0 :     if( bRet )
     101           0 :         rValue <<= (sal_Int16)eAdjust;
     102             : 
     103           0 :     return bRet;
     104             : }
     105             : 
     106           0 : bool XMLLastLineAdjustPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
     107             : {
     108           0 :     OUStringBuffer aOut;
     109           0 :     sal_Int16 nVal = 0;
     110           0 :     bool bRet = false;
     111             : 
     112           0 :     rValue >>= nVal;
     113             : 
     114           0 :     if( nVal != style::ParagraphAdjust_LEFT )
     115           0 :         bRet = SvXMLUnitConverter::convertEnum( aOut, nVal, pXML_Para_Align_Last_Enum, XML_START );
     116             : 
     117           0 :     rStrExpValue = aOut.makeStringAndClear();
     118             : 
     119           0 :     return bRet;
     120             : }
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10