LCOV - code coverage report
Current view: top level - linguistic/source - hyphdta.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 24 53 45.3 %
Date: 2012-08-25 Functions: 7 18 38.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 17 92 18.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                 :            : 
      30                 :            : #include "linguistic/hyphdta.hxx"
      31                 :            : #include "linguistic/lngprops.hxx"
      32                 :            : #include "linguistic/misc.hxx"
      33                 :            : #include <osl/mutex.hxx>
      34                 :            : 
      35                 :            : 
      36                 :            : #include <rtl/ustrbuf.hxx>
      37                 :            : #include <tools/debug.hxx>
      38                 :            : #include <svl/lngmisc.hxx>
      39                 :            : #include <unotools/localedatawrapper.hxx>
      40                 :            : 
      41                 :            : using namespace osl;
      42                 :            : using namespace com::sun::star;
      43                 :            : using namespace com::sun::star::lang;
      44                 :            : using namespace com::sun::star::uno;
      45                 :            : using namespace com::sun::star::linguistic2;
      46                 :            : 
      47                 :            : using ::rtl::OUString;
      48                 :            : 
      49                 :            : namespace linguistic
      50                 :            : {
      51                 :            : 
      52                 :            : 
      53                 :        282 : HyphenatedWord::HyphenatedWord(const OUString &rWord, sal_Int16 nLang, sal_Int16 nHPos,
      54                 :            :                                const OUString &rHyphWord, sal_Int16 nPos ) :
      55                 :            :     aWord           (rWord),
      56                 :            :     aHyphenatedWord (rHyphWord),
      57                 :            :     nHyphPos        (nPos),
      58                 :            :     nHyphenationPos (nHPos),
      59                 :        282 :     nLanguage       (nLang)
      60                 :            : {
      61 [ +  - ][ +  - ]:        282 :     String aSingleQuote( GetLocaleDataWrapper( nLanguage ).getQuotationMarkEnd() );
                 [ +  - ]
      62                 :            :     DBG_ASSERT( 1 == aSingleQuote.Len(), "unexpectend length of quotation mark" );
      63         [ +  - ]:        282 :     if (aSingleQuote.Len())
      64                 :            :     {
      65                 :            :         // ignore typographical apostrophes (which got replaced in original
      66                 :            :         // word when being checked for hyphenation) in results.
      67                 :        282 :         OUString aTmpWord( rWord );
      68                 :        282 :         OUString aTmpHyphWord( rHyphWord );
      69                 :        282 :         aTmpWord        = aTmpWord    .replace( aSingleQuote.GetChar(0), '\'' );
      70                 :        282 :         aTmpHyphWord    = aTmpHyphWord.replace( aSingleQuote.GetChar(0), '\'' );
      71                 :        282 :         bIsAltSpelling  = aTmpWord != aTmpHyphWord;
      72                 :            :     }
      73                 :            :     else
      74         [ +  - ]:        282 :         bIsAltSpelling = rWord != rHyphWord;
      75                 :        282 : }
      76                 :            : 
      77                 :            : 
      78                 :        282 : HyphenatedWord::~HyphenatedWord()
      79                 :            : {
      80         [ -  + ]:        564 : }
      81                 :            : 
      82                 :            : 
      83                 :        282 : OUString SAL_CALL HyphenatedWord::getWord()
      84                 :            :         throw(RuntimeException)
      85                 :            : {
      86 [ +  - ][ +  - ]:        282 :     MutexGuard  aGuard( GetLinguMutex() );
      87         [ +  - ]:        282 :     return aWord;
      88                 :            : }
      89                 :            : 
      90                 :            : 
      91                 :          0 : Locale SAL_CALL HyphenatedWord::getLocale()
      92                 :            :         throw(RuntimeException)
      93                 :            : {
      94 [ #  # ][ #  # ]:          0 :     MutexGuard  aGuard( GetLinguMutex() );
      95                 :            : 
      96                 :          0 :     Locale aRes;
      97 [ #  # ][ #  # ]:          0 :     return LanguageToLocale( aRes, nLanguage );
      98                 :            : }
      99                 :            : 
     100                 :            : 
     101                 :          0 : sal_Int16 SAL_CALL HyphenatedWord::getHyphenationPos()
     102                 :            :         throw(RuntimeException)
     103                 :            : {
     104 [ #  # ][ #  # ]:          0 :     MutexGuard  aGuard( GetLinguMutex() );
     105         [ #  # ]:          0 :     return nHyphenationPos;
     106                 :            : }
     107                 :            : 
     108                 :            : 
     109                 :          0 : OUString SAL_CALL HyphenatedWord::getHyphenatedWord()
     110                 :            :         throw(RuntimeException)
     111                 :            : {
     112 [ #  # ][ #  # ]:          0 :     MutexGuard  aGuard( GetLinguMutex() );
     113         [ #  # ]:          0 :     return aHyphenatedWord;
     114                 :            : }
     115                 :            : 
     116                 :            : 
     117                 :        282 : sal_Int16 SAL_CALL HyphenatedWord::getHyphenPos()
     118                 :            :         throw(RuntimeException)
     119                 :            : {
     120 [ +  - ][ +  - ]:        282 :     MutexGuard  aGuard( GetLinguMutex() );
     121         [ +  - ]:        282 :     return nHyphPos;
     122                 :            : }
     123                 :            : 
     124                 :            : 
     125                 :        282 : sal_Bool SAL_CALL HyphenatedWord::isAlternativeSpelling()
     126                 :            :         throw(RuntimeException)
     127                 :            : {
     128 [ +  - ][ +  - ]:        282 :     MutexGuard  aGuard( GetLinguMutex() );
     129         [ +  - ]:        282 :     return bIsAltSpelling;
     130                 :            : }
     131                 :            : 
     132                 :            : 
     133                 :            : 
     134                 :            : 
     135                 :          0 : PossibleHyphens::PossibleHyphens(const OUString &rWord, sal_Int16 nLang,
     136                 :            :             const OUString &rHyphWord,
     137                 :            :             const Sequence< sal_Int16 > &rPositions) :
     138                 :            :     aWord           (rWord),
     139                 :            :     aWordWithHyphens(rHyphWord),
     140                 :            :     aOrigHyphenPos  (rPositions),
     141         [ #  # ]:          0 :     nLanguage       (nLang)
     142                 :            : {
     143                 :          0 : }
     144                 :            : 
     145                 :            : 
     146         [ #  # ]:          0 : PossibleHyphens::~PossibleHyphens()
     147                 :            : {
     148         [ #  # ]:          0 : }
     149                 :            : 
     150                 :            : 
     151                 :          0 : OUString SAL_CALL PossibleHyphens::getWord()
     152                 :            :         throw(RuntimeException)
     153                 :            : {
     154 [ #  # ][ #  # ]:          0 :     MutexGuard  aGuard( GetLinguMutex() );
     155         [ #  # ]:          0 :     return aWord;
     156                 :            : }
     157                 :            : 
     158                 :            : 
     159                 :          0 : Locale SAL_CALL PossibleHyphens::getLocale()
     160                 :            :         throw(RuntimeException)
     161                 :            : {
     162 [ #  # ][ #  # ]:          0 :     MutexGuard  aGuard( GetLinguMutex() );
     163 [ #  # ][ #  # ]:          0 :     return CreateLocale( nLanguage );
     164                 :            : }
     165                 :            : 
     166                 :            : 
     167                 :          0 : OUString SAL_CALL PossibleHyphens::getPossibleHyphens()
     168                 :            :         throw(RuntimeException)
     169                 :            : {
     170 [ #  # ][ #  # ]:          0 :     MutexGuard  aGuard( GetLinguMutex() );
     171         [ #  # ]:          0 :     return aWordWithHyphens;
     172                 :            : }
     173                 :            : 
     174                 :            : 
     175                 :          0 : Sequence< sal_Int16 > SAL_CALL PossibleHyphens::getHyphenationPositions()
     176                 :            :         throw(RuntimeException)
     177                 :            : {
     178 [ #  # ][ #  # ]:          0 :     MutexGuard  aGuard( GetLinguMutex() );
     179 [ #  # ][ #  # ]:          0 :     return aOrigHyphenPos;
     180                 :            : }
     181                 :            : 
     182                 :        282 : com::sun::star::uno::Reference <com::sun::star::linguistic2::XHyphenatedWord> HyphenatedWord::CreateHyphenatedWord(
     183                 :            :         const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos,
     184                 :            :         const ::rtl::OUString &rHyphenatedWord, sal_Int16 nHyphenPos )
     185                 :            : {
     186 [ +  - ][ +  - ]:        282 :     return new HyphenatedWord( rWord, nLang, nHyphenationPos, rHyphenatedWord, nHyphenPos );
     187                 :            : }
     188                 :            : 
     189                 :          0 : com::sun::star::uno::Reference < com::sun::star::linguistic2::XPossibleHyphens > PossibleHyphens::CreatePossibleHyphens
     190                 :            :         (const ::rtl::OUString &rWord, sal_Int16 nLang,
     191                 :            :          const ::rtl::OUString &rHyphWord,
     192                 :            :          const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions)
     193                 :            : {
     194 [ #  # ][ #  # ]:          0 :     return new PossibleHyphens( rWord, nLang, rHyphWord, rPositions );
     195                 :            : }
     196                 :            : 
     197                 :            : 
     198                 :            : 
     199                 :            : }   // namespace linguistic
     200                 :            : 
     201                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10