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

Generated by: LCOV version 1.10