LCOV - code coverage report
Current view: top level - i18npool/source/indexentry - indexentrysupplier_common.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 45 0.0 %
Date: 2012-08-25 Functions: 0 16 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 36 0.0 %

           Branch data     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 <indexentrysupplier_common.hxx>
      22                 :            : #include <com/sun/star/i18n/CollatorOptions.hpp>
      23                 :            : #include <localedata.hxx>
      24                 :            : 
      25                 :            : using namespace ::com::sun::star::uno;
      26                 :            : using namespace ::com::sun::star;
      27                 :            : using namespace ::rtl;
      28                 :            : 
      29                 :            : namespace com { namespace sun { namespace star { namespace i18n {
      30                 :            : 
      31                 :          0 : IndexEntrySupplier_Common::IndexEntrySupplier_Common(const Reference < lang::XMultiServiceFactory >& rxMSF)
      32                 :            : {
      33                 :          0 :     implementationName = "com.sun.star.i18n.IndexEntrySupplier_Common";
      34         [ #  # ]:          0 :     collator = new CollatorImpl(rxMSF);
      35                 :          0 :     usePhonetic = sal_False;
      36                 :          0 : }
      37                 :            : 
      38                 :          0 : IndexEntrySupplier_Common::~IndexEntrySupplier_Common()
      39                 :            : {
      40 [ #  # ][ #  # ]:          0 :     delete collator;
      41         [ #  # ]:          0 : }
      42                 :            : 
      43                 :          0 : Sequence < lang::Locale > SAL_CALL IndexEntrySupplier_Common::getLocaleList() throw (RuntimeException)
      44                 :            : {
      45         [ #  # ]:          0 :     throw RuntimeException();
      46                 :            : }
      47                 :            : 
      48                 :          0 : Sequence < OUString > SAL_CALL IndexEntrySupplier_Common::getAlgorithmList( const lang::Locale& ) throw (RuntimeException)
      49                 :            : {
      50         [ #  # ]:          0 :     throw RuntimeException();
      51                 :            : }
      52                 :            : 
      53                 :          0 : OUString SAL_CALL IndexEntrySupplier_Common::getPhoneticCandidate( const OUString&,
      54                 :            :     const lang::Locale& ) throw (RuntimeException)
      55                 :            : {
      56                 :          0 :     return OUString();
      57                 :            : }
      58                 :            : 
      59                 :          0 : sal_Bool SAL_CALL IndexEntrySupplier_Common::usePhoneticEntry( const lang::Locale& ) throw (RuntimeException)
      60                 :            : {
      61         [ #  # ]:          0 :     throw RuntimeException();
      62                 :            : }
      63                 :            : 
      64                 :          0 : sal_Bool SAL_CALL IndexEntrySupplier_Common::loadAlgorithm( const lang::Locale& rLocale,
      65                 :            :     const OUString& rAlgorithm, sal_Int32 collatorOptions ) throw (RuntimeException)
      66                 :            : {
      67         [ #  # ]:          0 :     usePhonetic = LocaleData().isPhonetic(rLocale, rAlgorithm);
      68                 :          0 :     collator->loadCollatorAlgorithm(rAlgorithm, rLocale, collatorOptions);
      69                 :          0 :     aLocale = rLocale;
      70                 :          0 :     aAlgorithm = rAlgorithm;
      71                 :          0 :     return sal_True;
      72                 :            : }
      73                 :            : 
      74                 :          0 : OUString SAL_CALL IndexEntrySupplier_Common::getIndexKey( const OUString& rIndexEntry,
      75                 :            :     const OUString&, const lang::Locale& ) throw (RuntimeException)
      76                 :            : {
      77                 :          0 :     sal_Int32 nPos=0;
      78         [ #  # ]:          0 :     sal_uInt32 indexChar=rIndexEntry.iterateCodePoints(&nPos, 0);
      79         [ #  # ]:          0 :     return OUString(&indexChar, 1);
      80                 :            : }
      81                 :            : 
      82                 :          0 : sal_Int16 SAL_CALL IndexEntrySupplier_Common::compareIndexEntry(
      83                 :            :     const OUString& rIndexEntry1, const OUString&, const lang::Locale&,
      84                 :            :     const OUString& rIndexEntry2, const OUString&, const lang::Locale& )
      85                 :            :     throw (RuntimeException)
      86                 :            : {
      87                 :            :     return sal::static_int_cast< sal_Int16 >(
      88                 :          0 :         collator->compareString(rIndexEntry1, rIndexEntry2));
      89                 :            :         // return value of compareString in { -1, 0, 1 }
      90                 :            : }
      91                 :            : 
      92                 :          0 : OUString SAL_CALL IndexEntrySupplier_Common::getIndexCharacter( const OUString& rIndexEntry,
      93                 :            :     const lang::Locale& rLocale, const OUString& ) throw (RuntimeException)
      94                 :            : {
      95                 :          0 :     return getIndexKey(rIndexEntry, rIndexEntry, rLocale);
      96                 :            : }
      97                 :            : 
      98                 :          0 : OUString SAL_CALL IndexEntrySupplier_Common::getIndexFollowPageWord( sal_Bool,
      99                 :            :     const lang::Locale& ) throw (RuntimeException)
     100                 :            : {
     101         [ #  # ]:          0 :     throw RuntimeException();
     102                 :            : }
     103                 :            : 
     104                 :            : const OUString& SAL_CALL
     105                 :          0 : IndexEntrySupplier_Common::getEntry( const OUString& IndexEntry,
     106                 :            :     const OUString& PhoneticEntry, const lang::Locale& rLocale ) throw (RuntimeException)
     107                 :            : {
     108                 :            :     // The condition for using phonetic entry is:
     109                 :            :     // usePhonetic is set for the algorithm;
     110                 :            :     // rLocale for phonetic entry is same as aLocale for algorithm,
     111                 :            :     // which means Chinese phonetic will not be used for Japanese algorithm;
     112                 :            :     // phonetic entry is not blank.
     113 [ #  # ][ #  # ]:          0 :     if (usePhonetic && !PhoneticEntry.isEmpty() && rLocale.Language == aLocale.Language &&
           [ #  #  #  #  
           #  # ][ #  # ]
     114                 :          0 :             rLocale.Country == aLocale.Country && rLocale.Variant == aLocale.Variant)
     115                 :          0 :         return PhoneticEntry;
     116                 :            :     else
     117                 :          0 :         return IndexEntry;
     118                 :            : }
     119                 :            : 
     120                 :            : OUString SAL_CALL
     121                 :          0 : IndexEntrySupplier_Common::getImplementationName() throw( RuntimeException )
     122                 :            : {
     123                 :          0 :     return OUString::createFromAscii( implementationName );
     124                 :            : }
     125                 :            : 
     126                 :            : sal_Bool SAL_CALL
     127                 :          0 : IndexEntrySupplier_Common::supportsService(const OUString& rServiceName) throw( RuntimeException )
     128                 :            : {
     129                 :          0 :     return rServiceName.compareToAscii(implementationName) == 0;
     130                 :            : }
     131                 :            : 
     132                 :            : Sequence< OUString > SAL_CALL
     133                 :          0 : IndexEntrySupplier_Common::getSupportedServiceNames() throw( RuntimeException )
     134                 :            : {
     135                 :          0 :     Sequence< OUString > aRet(1);
     136         [ #  # ]:          0 :     aRet[0] = OUString::createFromAscii( implementationName );
     137                 :          0 :     return aRet;
     138                 :            : }
     139                 :            : 
     140                 :            : } } } }
     141                 :            : 
     142                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10