LCOV - code coverage report
Current view: top level - sw/source/core/tox - toxhlp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 40 55.0 %
Date: 2012-08-25 Functions: 4 7 57.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 18 80 22.5 %

           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 <com/sun/star/lang/XMultiServiceFactory.hpp>
      30                 :            : #include <comphelper/processfactory.hxx>
      31                 :            : #include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
      32                 :            : #include <rtl/strbuf.hxx>
      33                 :            : #include <tools/string.hxx>
      34                 :            : #include <toxwrap.hxx>
      35                 :            : 
      36                 :            : using namespace ::com::sun::star;
      37                 :            : 
      38                 :            : 
      39                 :          4 : IndexEntrySupplierWrapper::IndexEntrySupplierWrapper()
      40                 :            : {
      41                 :            :     uno::Reference<
      42                 :            :             lang::XMultiServiceFactory > rxMSF =
      43         [ +  - ]:          4 :                                     ::comphelper::getProcessServiceFactory();
      44                 :            : 
      45                 :            :     try {
      46                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xI =
      47         [ +  - ]:          4 :             rxMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
      48 [ +  - ][ +  - ]:          4 :                                 "com.sun.star.i18n.IndexEntrySupplier")) );
      49         [ +  - ]:          4 :         if( xI.is() )
      50                 :            :         {
      51         [ +  - ]:          4 :             ::com::sun::star::uno::Any x = xI->queryInterface( ::getCppuType(
      52 [ +  - ][ +  - ]:          4 :                     (const uno::Reference< i18n::XExtendedIndexEntrySupplier>*)0) );
      53         [ +  - ]:          4 :             x >>= xIES;
      54         [ #  # ]:          4 :         }
      55                 :            :     }
      56         [ #  # ]:          0 :     catch (const ::com::sun::star::uno::Exception&
      57                 :            : #if OSL_DEBUG_LEVEL > 0
      58                 :            :         e
      59                 :            : #endif
      60                 :            :         )
      61                 :            :     {
      62                 :            : #if OSL_DEBUG_LEVEL > 0
      63                 :            :         rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("IndexEntrySupplierWrapper: Caught exception\n"));
      64                 :            :         aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
      65                 :            :         OSL_FAIL( aMsg.getStr() );
      66                 :            : #endif
      67                 :          4 :     }
      68                 :          4 : }
      69                 :            : 
      70                 :          4 : IndexEntrySupplierWrapper::~IndexEntrySupplierWrapper()
      71                 :            : {
      72                 :          4 : }
      73                 :            : 
      74                 :          2 : String IndexEntrySupplierWrapper::GetIndexKey( const String& rTxt,
      75                 :            :                                                const String& rTxtReading,
      76                 :            :                                                const ::com::sun::star::lang::Locale& rLocale ) const
      77                 :            : {
      78                 :          2 :     String sRet;
      79                 :            :     try {
      80 [ +  - ][ +  - ]:          2 :         sRet = xIES->getIndexKey( rTxt, rTxtReading, rLocale );
         [ -  + ][ #  # ]
         [ -  + ][ +  - ]
      81                 :            :     }
      82         [ +  - ]:          2 :     catch (const ::com::sun::star::uno::Exception&
      83                 :            : #if OSL_DEBUG_LEVEL > 0
      84                 :            :         e
      85                 :            : #endif
      86                 :            :         )
      87                 :            :     {
      88                 :            : #if OSL_DEBUG_LEVEL > 0
      89                 :            :         rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("getIndexKey: Caught exception\n"));
      90                 :            :         aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
      91                 :            :         OSL_FAIL( aMsg.getStr() );
      92                 :            : #endif
      93                 :            :     }
      94                 :          2 :     return sRet;
      95                 :            : }
      96                 :            : 
      97                 :          0 : String IndexEntrySupplierWrapper::GetFollowingText( sal_Bool bMorePages ) const
      98                 :            : {
      99                 :          0 :     String sRet;
     100                 :            :     try {
     101 [ #  # ][ #  # ]:          0 :         sRet = xIES->getIndexFollowPageWord( bMorePages, aLcl );
         [ #  # ][ #  # ]
     102                 :            :     }
     103         [ #  # ]:          0 :     catch (const ::com::sun::star::uno::Exception&
     104                 :            : #if OSL_DEBUG_LEVEL > 0
     105                 :            :         e
     106                 :            : #endif
     107                 :            :         )
     108                 :            :     {
     109                 :            : #if OSL_DEBUG_LEVEL > 0
     110                 :            :         rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("getIndexFollowPageWord: Caught exception\n"));
     111                 :            :         aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
     112                 :            :         OSL_FAIL( aMsg.getStr() );
     113                 :            : #endif
     114                 :            :     }
     115                 :          0 :     return sRet;
     116                 :            : }
     117                 :            : 
     118                 :            : ::com::sun::star::uno::Sequence< ::rtl::OUString >
     119                 :          0 : IndexEntrySupplierWrapper::GetAlgorithmList( const ::com::sun::star::lang::Locale& rLcl ) const
     120                 :            : {
     121                 :          0 :     uno::Sequence< ::rtl::OUString > sRet;
     122                 :            : 
     123                 :            :     try {
     124 [ #  # ][ #  # ]:          0 :         sRet = xIES->getAlgorithmList( rLcl );
         [ #  # ][ #  # ]
                 [ #  # ]
     125                 :            :     }
     126         [ #  # ]:          0 :     catch (const ::com::sun::star::uno::Exception&
     127                 :            : #if OSL_DEBUG_LEVEL > 0
     128                 :            :         e
     129                 :            : #endif
     130                 :            :         )
     131                 :            :     {
     132                 :            : #if OSL_DEBUG_LEVEL > 0
     133                 :            :         rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("getAlgorithmList: Caught exception\n"));
     134                 :            :         aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
     135                 :            :         OSL_FAIL( aMsg.getStr() );
     136                 :            : #endif
     137                 :            :     }
     138                 :          0 :     return sRet;
     139                 :            : }
     140                 :            : 
     141                 :          4 : sal_Bool IndexEntrySupplierWrapper::LoadAlgorithm(
     142                 :            :         const ::com::sun::star::lang::Locale& rLcl,
     143                 :            :         const String& sSortAlgorithm, long nOptions ) const
     144                 :            : {
     145                 :          4 :     sal_Bool bRet = sal_False;
     146                 :            :     try {
     147 [ +  - ][ +  - ]:          4 :         bRet = xIES->loadAlgorithm( rLcl, sSortAlgorithm, nOptions );
         [ +  - ][ #  # ]
     148                 :            :     }
     149                 :          0 :     catch (const ::com::sun::star::uno::Exception&
     150                 :            : #if OSL_DEBUG_LEVEL > 0
     151                 :            :         e
     152                 :            : #endif
     153                 :            :         )
     154                 :            :     {
     155                 :            : #if OSL_DEBUG_LEVEL > 0
     156                 :            :         rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("loadAlgorithm: Caught exception\n"));
     157                 :            :         aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
     158                 :            :         OSL_FAIL( aMsg.getStr() );
     159                 :            : #endif
     160                 :            :     }
     161                 :          4 :     return bRet;
     162                 :            : }
     163                 :            : 
     164                 :          0 : sal_Int16 IndexEntrySupplierWrapper::CompareIndexEntry(
     165                 :            :             const String& rTxt1, const String& rTxtReading1,
     166                 :            :             const ::com::sun::star::lang::Locale& rLocale1,
     167                 :            :             const String& rTxt2, const String& rTxtReading2,
     168                 :            :             const ::com::sun::star::lang::Locale& rLocale2 ) const
     169                 :            : {
     170                 :          0 :     sal_Int16 nRet = 0;
     171                 :            :     try {
     172         [ #  # ]:          0 :         nRet = xIES->compareIndexEntry( rTxt1, rTxtReading1, rLocale1,
     173 [ #  # ][ #  # ]:          0 :                                         rTxt2, rTxtReading2, rLocale2 );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     174                 :            :     }
     175                 :          0 :     catch (const ::com::sun::star::uno::Exception&
     176                 :            : #if OSL_DEBUG_LEVEL > 0
     177                 :            :         e
     178                 :            : #endif
     179                 :            :         )
     180                 :            :     {
     181                 :            : #if OSL_DEBUG_LEVEL > 0
     182                 :            :         rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("compareIndexEntry: Caught exception\n"));
     183                 :            :         aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
     184                 :            :         OSL_FAIL( aMsg.getStr() );
     185                 :            : #endif
     186                 :            :     }
     187                 :          0 :     return nRet;
     188                 :            : }
     189                 :            : 
     190                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10