LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/style - chrlohdl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 30 46 65.2 %
Date: 2012-12-27 Functions: 8 10 80.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 <chrlohdl.hxx>
      21             : #include <xmloff/xmltoken.hxx>
      22             : #include <xmloff/xmluconv.hxx>
      23             : #include <rtl/ustrbuf.hxx>
      24             : #include <com/sun/star/uno/Any.hxx>
      25             : #include <com/sun/star/lang/Locale.hpp>
      26             : 
      27             : using ::rtl::OUString;
      28             : using ::rtl::OUStringBuffer;
      29             : 
      30             : using namespace ::com::sun::star;
      31             : using namespace ::xmloff::token;
      32             : 
      33             : // this is a copy of defines in svx/inc/escpitem.hxx
      34             : #define DFLT_ESC_PROP    58
      35             : #define DFLT_ESC_AUTO_SUPER 101
      36             : #define DFLT_ESC_AUTO_SUB  -101
      37             : 
      38             : ///////////////////////////////////////////////////////////////////////////////
      39             : //
      40             : // class XMLEscapementPropHdl
      41             : //
      42             : 
      43         962 : XMLCharLanguageHdl::~XMLCharLanguageHdl()
      44             : {
      45             :     // nothing to do
      46         962 : }
      47             : 
      48           0 : bool XMLCharLanguageHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
      49             : {
      50           0 :     sal_Bool bRet = sal_False;
      51           0 :     lang::Locale aLocale1, aLocale2;
      52             : 
      53           0 :     if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
      54           0 :         bRet = ( aLocale1.Language == aLocale2.Language );
      55             : 
      56           0 :     return bRet;
      57             : }
      58             : 
      59         188 : sal_Bool XMLCharLanguageHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
      60             : {
      61         188 :     lang::Locale aLocale;
      62             : 
      63         188 :     rValue >>= aLocale;
      64             : 
      65         188 :     if( !IsXMLToken(rStrImpValue, XML_NONE) )
      66         188 :         aLocale.Language = rStrImpValue;
      67             : 
      68         188 :     rValue <<= aLocale;
      69         188 :     return sal_True;
      70             : }
      71             : 
      72          18 : sal_Bool XMLCharLanguageHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
      73             : {
      74          18 :     lang::Locale aLocale;
      75          18 :     if(!(rValue >>= aLocale))
      76           0 :         return sal_False;
      77             : 
      78          18 :     rStrExpValue = aLocale.Language;
      79             : 
      80          18 :     if( rStrExpValue.isEmpty() )
      81           0 :         rStrExpValue = GetXMLToken( XML_NONE );
      82             : 
      83          18 :     return sal_True;
      84             : }
      85             : 
      86             : ///////////////////////////////////////////////////////////////////////////////
      87             : //
      88             : // class XMLEscapementHeightPropHdl
      89             : //
      90             : 
      91         962 : XMLCharCountryHdl::~XMLCharCountryHdl()
      92             : {
      93             :     // nothing to do
      94         962 : }
      95             : 
      96           0 : bool XMLCharCountryHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
      97             : {
      98           0 :     sal_Bool bRet = sal_False;
      99           0 :     lang::Locale aLocale1, aLocale2;
     100             : 
     101           0 :     if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
     102           0 :         bRet = ( aLocale1.Country == aLocale2.Country );
     103             : 
     104           0 :     return bRet;
     105             : }
     106             : 
     107         188 : sal_Bool XMLCharCountryHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
     108             : {
     109         188 :     lang::Locale aLocale;
     110             : 
     111         188 :     rValue >>= aLocale;
     112             : 
     113         188 :     if( !IsXMLToken( rStrImpValue, XML_NONE ) )
     114         182 :         aLocale.Country = rStrImpValue;
     115             : 
     116         188 :     rValue <<= aLocale;
     117         188 :     return sal_True;
     118             : }
     119             : 
     120          18 : sal_Bool XMLCharCountryHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
     121             : {
     122          18 :     lang::Locale aLocale;
     123          18 :     if(!(rValue >>= aLocale))
     124           0 :         return sal_False;
     125             : 
     126          18 :     rStrExpValue = aLocale.Country;
     127             : 
     128          18 :     if( rStrExpValue.isEmpty() )
     129           0 :         rStrExpValue = GetXMLToken( XML_NONE );
     130             : 
     131          18 :     return sal_True;
     132             : }
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10