LCOV - code coverage report
Current view: top level - linguistic/source - hyphdsp.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 6 100.0 %
Date: 2014-11-03 Functions: 2 2 100.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             : #ifndef INCLUDED_LINGUISTIC_SOURCE_HYPHDSP_HXX
      21             : #define INCLUDED_LINGUISTIC_SOURCE_HYPHDSP_HXX
      22             : 
      23             : 
      24             : #include <com/sun/star/lang/XComponent.hpp>
      25             : #include <com/sun/star/lang/XInitialization.hpp>
      26             : #include <com/sun/star/lang/XServiceDisplayName.hpp>
      27             : #include <com/sun/star/linguistic2/XHyphenator.hpp>
      28             : #include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
      29             : #include <com/sun/star/lang/XServiceInfo.hpp>
      30             : #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
      31             : #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
      32             : 
      33             : #include <cppuhelper/implbase1.hxx>
      34             : 
      35             : #include <boost/shared_ptr.hpp>
      36             : #include <map>
      37             : 
      38             : #include "lngopt.hxx"
      39             : #include "linguistic/misc.hxx"
      40             : #include "defs.hxx"
      41             : 
      42             : class LngSvcMgr;
      43             : 
      44             : 
      45             : class HyphenatorDispatcher :
      46             :     public cppu::WeakImplHelper1
      47             :     <
      48             :         ::com::sun::star::linguistic2::XHyphenator
      49             :     >,
      50             :     public LinguDispatcher
      51             : {
      52             :     typedef boost::shared_ptr< LangSvcEntries_Hyph >                LangSvcEntries_Hyph_Ptr_t;
      53             :     typedef std::map< LanguageType, LangSvcEntries_Hyph_Ptr_t >     HyphSvcByLangMap_t;
      54             :     HyphSvcByLangMap_t      aSvcMap;
      55             : 
      56             :     ::com::sun::star::uno::Reference<
      57             :         ::com::sun::star::linguistic2::XLinguProperties >          xPropSet;
      58             :     ::com::sun::star::uno::Reference<
      59             :         ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
      60             : 
      61             :     LngSvcMgr      &rMgr;
      62             : 
      63             :     // disallow copy-constructor and assignment-operator for now
      64             :     HyphenatorDispatcher(const HyphenatorDispatcher &);
      65             :     HyphenatorDispatcher & operator = (const HyphenatorDispatcher &);
      66             : 
      67             :     inline ::com::sun::star::uno::Reference<
      68             :         ::com::sun::star::linguistic2::XLinguProperties >
      69             :             GetPropSet();
      70             :     inline ::com::sun::star::uno::Reference<
      71             :         ::com::sun::star::linguistic2::XSearchableDictionaryList >
      72             :             GetDicList();
      73             : 
      74             :     void    ClearSvcList();
      75             : 
      76             :     com::sun::star::uno::Reference<
      77             :         ::com::sun::star::linguistic2::XHyphenatedWord>
      78             :             buildHyphWord( const OUString& rOrigWord,
      79             :                 const ::com::sun::star::uno::Reference<
      80             :                     ::com::sun::star::linguistic2::XDictionaryEntry> &xEntry,
      81             :                 sal_Int16 nLang, sal_Int16 nMaxLeading );
      82             : 
      83             :     com::sun::star::uno::Reference<
      84             :         ::com::sun::star::linguistic2::XPossibleHyphens >
      85             :             buildPossHyphens( const ::com::sun::star::uno::Reference<
      86             :                     ::com::sun::star::linguistic2::XDictionaryEntry > &xEntry,
      87             :                     sal_Int16 nLanguage );
      88             : 
      89             : public:
      90             :     HyphenatorDispatcher( LngSvcMgr &rLngSvcMgr );
      91             :     virtual ~HyphenatorDispatcher();
      92             : 
      93             :     // XSupportedLocales
      94             :     virtual ::com::sun::star::uno::Sequence<
      95             :             ::com::sun::star::lang::Locale > SAL_CALL
      96             :         getLocales()
      97             :             throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             :     virtual sal_Bool SAL_CALL
      99             :         hasLocale( const ::com::sun::star::lang::Locale& aLocale )
     100             :             throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             : 
     102             :     // XHyphenator
     103             :     virtual ::com::sun::star::uno::Reference<
     104             :             ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
     105             :         hyphenate( const OUString& aWord,
     106             :                 const ::com::sun::star::lang::Locale& aLocale,
     107             :                 sal_Int16 nMaxLeading,
     108             :                 const ::com::sun::star::beans::PropertyValues& aProperties )
     109             :             throw(::com::sun::star::lang::IllegalArgumentException,
     110             :                   ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             :     virtual ::com::sun::star::uno::Reference<
     112             :             ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
     113             :         queryAlternativeSpelling( const OUString& aWord,
     114             :                 const ::com::sun::star::lang::Locale& aLocale,
     115             :                 sal_Int16 nIndex,
     116             :                 const ::com::sun::star::beans::PropertyValues& aProperties )
     117             :             throw(::com::sun::star::lang::IllegalArgumentException,
     118             :                   ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             :     virtual ::com::sun::star::uno::Reference<
     120             :             ::com::sun::star::linguistic2::XPossibleHyphens > SAL_CALL
     121             :         createPossibleHyphens(
     122             :                 const OUString& aWord,
     123             :                 const ::com::sun::star::lang::Locale& aLocale,
     124             :                 const ::com::sun::star::beans::PropertyValues& aProperties )
     125             :             throw(::com::sun::star::lang::IllegalArgumentException,
     126             :                   ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             : 
     128             :     // LinguDispatcher
     129             :     virtual void
     130             :         SetServiceList( const ::com::sun::star::lang::Locale &rLocale,
     131             :                 const ::com::sun::star::uno::Sequence<
     132             :                     OUString > &rSvcImplNames ) SAL_OVERRIDE;
     133             :     virtual ::com::sun::star::uno::Sequence< OUString >
     134             :         GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const SAL_OVERRIDE;
     135             :     virtual DspType
     136             :         GetDspType() const SAL_OVERRIDE;
     137             : };
     138             : 
     139             : 
     140             : inline ::com::sun::star::uno::Reference<
     141             :     ::com::sun::star::linguistic2::XLinguProperties >
     142       43214 :         HyphenatorDispatcher::GetPropSet()
     143             : {
     144       43214 :     return xPropSet.is() ?
     145       43214 :                 xPropSet : xPropSet = ::linguistic::GetLinguProperties();
     146             : }
     147             : 
     148             : 
     149             : inline ::com::sun::star::uno::Reference<
     150             :     ::com::sun::star::linguistic2::XSearchableDictionaryList >
     151       43204 :         HyphenatorDispatcher::GetDicList()
     152             : {
     153       43204 :     return xDicList.is() ?
     154       43204 :                 xDicList : xDicList = ::linguistic::GetDictionaryList();
     155             : }
     156             : 
     157             : 
     158             : 
     159             : 
     160             : #endif
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10