LCOV - code coverage report
Current view: top level - xmloff/source/style - chrlohdl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 31 46 67.4 %
Date: 2012-08-25 Functions: 8 10 80.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 20 56 35.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <chrlohdl.hxx>
      30                 :            : #include <xmloff/xmltoken.hxx>
      31                 :            : #include <xmloff/xmluconv.hxx>
      32                 :            : #include <rtl/ustrbuf.hxx>
      33                 :            : #include <com/sun/star/uno/Any.hxx>
      34                 :            : #include <com/sun/star/lang/Locale.hpp>
      35                 :            : 
      36                 :            : using ::rtl::OUString;
      37                 :            : using ::rtl::OUStringBuffer;
      38                 :            : 
      39                 :            : using namespace ::com::sun::star;
      40                 :            : using namespace ::xmloff::token;
      41                 :            : 
      42                 :            : // this is a copy of defines in svx/inc/escpitem.hxx
      43                 :            : #define DFLT_ESC_PROP    58
      44                 :            : #define DFLT_ESC_AUTO_SUPER 101
      45                 :            : #define DFLT_ESC_AUTO_SUB  -101
      46                 :            : 
      47                 :            : ///////////////////////////////////////////////////////////////////////////////
      48                 :            : //
      49                 :            : // class XMLEscapementPropHdl
      50                 :            : //
      51                 :            : 
      52                 :       2285 : XMLCharLanguageHdl::~XMLCharLanguageHdl()
      53                 :            : {
      54                 :            :     // nothing to do
      55         [ -  + ]:       4570 : }
      56                 :            : 
      57                 :          0 : bool XMLCharLanguageHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
      58                 :            : {
      59                 :          0 :     sal_Bool bRet = sal_False;
      60                 :          0 :     lang::Locale aLocale1, aLocale2;
      61                 :            : 
      62 [ #  # ][ #  # ]:          0 :     if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
         [ #  # ][ #  # ]
                 [ #  # ]
      63                 :          0 :         bRet = ( aLocale1.Language == aLocale2.Language );
      64                 :            : 
      65                 :          0 :     return bRet;
      66                 :            : }
      67                 :            : 
      68                 :        762 : sal_Bool XMLCharLanguageHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
      69                 :            : {
      70                 :        762 :     lang::Locale aLocale;
      71                 :            : 
      72         [ +  - ]:        762 :     rValue >>= aLocale;
      73                 :            : 
      74 [ +  - ][ +  + ]:        762 :     if( !IsXMLToken(rStrImpValue, XML_NONE) )
      75                 :        738 :         aLocale.Language = rStrImpValue;
      76                 :            : 
      77         [ +  - ]:        762 :     rValue <<= aLocale;
      78                 :        762 :     return sal_True;
      79                 :            : }
      80                 :            : 
      81                 :        174 : sal_Bool XMLCharLanguageHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
      82                 :            : {
      83                 :        174 :     lang::Locale aLocale;
      84 [ -  + ][ +  - ]:        174 :     if(!(rValue >>= aLocale))
      85                 :          0 :         return sal_False;
      86                 :            : 
      87                 :        174 :     rStrExpValue = aLocale.Language;
      88                 :            : 
      89         [ -  + ]:        174 :     if( rStrExpValue.isEmpty() )
      90         [ #  # ]:          0 :         rStrExpValue = GetXMLToken( XML_NONE );
      91                 :            : 
      92                 :        174 :     return sal_True;
      93                 :            : }
      94                 :            : 
      95                 :            : ///////////////////////////////////////////////////////////////////////////////
      96                 :            : //
      97                 :            : // class XMLEscapementHeightPropHdl
      98                 :            : //
      99                 :            : 
     100                 :       2285 : XMLCharCountryHdl::~XMLCharCountryHdl()
     101                 :            : {
     102                 :            :     // nothing to do
     103         [ -  + ]:       4570 : }
     104                 :            : 
     105                 :          0 : bool XMLCharCountryHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
     106                 :            : {
     107                 :          0 :     sal_Bool bRet = sal_False;
     108                 :          0 :     lang::Locale aLocale1, aLocale2;
     109                 :            : 
     110 [ #  # ][ #  # ]:          0 :     if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     111                 :          0 :         bRet = ( aLocale1.Country == aLocale2.Country );
     112                 :            : 
     113                 :          0 :     return bRet;
     114                 :            : }
     115                 :            : 
     116                 :        762 : sal_Bool XMLCharCountryHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
     117                 :            : {
     118                 :        762 :     lang::Locale aLocale;
     119                 :            : 
     120         [ +  - ]:        762 :     rValue >>= aLocale;
     121                 :            : 
     122 [ +  - ][ +  + ]:        762 :     if( !IsXMLToken( rStrImpValue, XML_NONE ) )
     123                 :        647 :         aLocale.Country = rStrImpValue;
     124                 :            : 
     125         [ +  - ]:        762 :     rValue <<= aLocale;
     126                 :        762 :     return sal_True;
     127                 :            : }
     128                 :            : 
     129                 :        174 : sal_Bool XMLCharCountryHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
     130                 :            : {
     131                 :        174 :     lang::Locale aLocale;
     132 [ -  + ][ +  - ]:        174 :     if(!(rValue >>= aLocale))
     133                 :          0 :         return sal_False;
     134                 :            : 
     135                 :        174 :     rStrExpValue = aLocale.Country;
     136                 :            : 
     137         [ +  + ]:        174 :     if( rStrExpValue.isEmpty() )
     138         [ +  - ]:         16 :         rStrExpValue = GetXMLToken( XML_NONE );
     139                 :            : 
     140                 :        174 :     return sal_True;
     141                 :            : }
     142                 :            : 
     143                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10