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

Generated by: LCOV version 1.10