LCOV - code coverage report
Current view: top level - linguistic/source - lngsvcmgr.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 Functions: 1 1 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_LNGSVCMGR_HXX
      21             : #define INCLUDED_LINGUISTIC_SOURCE_LNGSVCMGR_HXX
      22             : 
      23             : #include <cppuhelper/implbase3.hxx>
      24             : #include <cppuhelper/interfacecontainer.h>
      25             : 
      26             : 
      27             : #include <com/sun/star/uno/Reference.h>
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/linguistic2/XLinguServiceManager2.hpp>
      30             : #include <com/sun/star/util/XModifyBroadcaster.hpp>
      31             : #include <com/sun/star/util/XModifyListener.hpp>
      32             : #include <unotools/configitem.hxx>
      33             : #include <vcl/timer.hxx>
      34             : #include <vcl/idle.hxx>
      35             : #include <boost/ptr_container/ptr_vector.hpp>
      36             : 
      37             : #include "linguistic/misc.hxx"
      38             : #include "defs.hxx"
      39             : 
      40             : class SpellCheckerDispatcher;
      41             : class HyphenatorDispatcher;
      42             : class ThesaurusDispatcher;
      43             : class GrammarCheckingIterator;
      44             : class LngSvcMgrListenerHelper;
      45             : struct SvcInfo;
      46             : 
      47             : namespace com { namespace sun { namespace star { namespace linguistic2 {
      48             :     class XLinguServiceEventBroadcaster;
      49             :     class XSpellChecker;
      50             :     class XProofreadingIterator;
      51             :     class XHyphenator;
      52             :     class XThesaurus;
      53             : } } } }
      54             : 
      55             : 
      56             : 
      57             : class LngSvcMgr :
      58             :     public cppu::WeakImplHelper3
      59             :     <
      60             :         com::sun::star::linguistic2::XLinguServiceManager2,
      61             :         com::sun::star::lang::XServiceInfo,
      62             :         com::sun::star::util::XModifyListener
      63             :     >,
      64             :     private utl::ConfigItem
      65             : {
      66             :     friend class LngSvcMgrListenerHelper;
      67             : 
      68             :     ::cppu::OInterfaceContainerHelper                   aEvtListeners;
      69             : 
      70             :     com::sun::star::uno::Reference<
      71             :         ::com::sun::star::linguistic2::XSpellChecker >              xSpellDsp;
      72             :     com::sun::star::uno::Reference<
      73             :         ::com::sun::star::linguistic2::XProofreadingIterator >      xGrammarDsp;
      74             :     com::sun::star::uno::Reference<
      75             :         ::com::sun::star::linguistic2::XHyphenator >                xHyphDsp;
      76             :     com::sun::star::uno::Reference<
      77             :         ::com::sun::star::linguistic2::XThesaurus >                 xThesDsp;
      78             : 
      79             :     com::sun::star::uno::Reference<
      80             :         ::com::sun::star::lang::XEventListener >        xListenerHelper;
      81             : 
      82             :     com::sun::star::uno::Reference<
      83             :         ::com::sun::star::util::XModifyBroadcaster>     xMB;
      84             : 
      85             :     Idle                                                aUpdateIdle;
      86             : 
      87             : 
      88             :     com::sun::star::uno::Sequence<
      89             :         com::sun::star::lang::Locale >                  aAvailSpellLocales;
      90             :     com::sun::star::uno::Sequence<
      91             :         com::sun::star::lang::Locale >                  aAvailGrammarLocales;
      92             :     com::sun::star::uno::Sequence<
      93             :         com::sun::star::lang::Locale >                  aAvailHyphLocales;
      94             :     com::sun::star::uno::Sequence<
      95             :         com::sun::star::lang::Locale >                  aAvailThesLocales;
      96             : 
      97             :     SpellCheckerDispatcher *                            pSpellDsp;
      98             :     GrammarCheckingIterator *                           pGrammarDsp;
      99             :     HyphenatorDispatcher *                              pHyphDsp;
     100             :     ThesaurusDispatcher *                               pThesDsp;
     101             : 
     102             :     LngSvcMgrListenerHelper *                           pListenerHelper;
     103             : 
     104             :     typedef boost::ptr_vector< SvcInfo >    SvcInfoArray;
     105             :     SvcInfoArray *                                      pAvailSpellSvcs;
     106             :     SvcInfoArray *                                      pAvailGrammarSvcs;
     107             :     SvcInfoArray *                                      pAvailHyphSvcs;
     108             :     SvcInfoArray *                                      pAvailThesSvcs;
     109             : 
     110             :     bool bDisposing;
     111             : 
     112             :     LngSvcMgr(const LngSvcMgr &) SAL_DELETED_FUNCTION;
     113             :     LngSvcMgr & operator = (const LngSvcMgr &) SAL_DELETED_FUNCTION;
     114             : 
     115             :     void    GetAvailableSpellSvcs_Impl();
     116             :     void    GetAvailableGrammarSvcs_Impl();
     117             :     void    GetAvailableHyphSvcs_Impl();
     118             :     void    GetAvailableThesSvcs_Impl();
     119             :     void    GetListenerHelper_Impl();
     120             : 
     121             :     void    GetSpellCheckerDsp_Impl( bool bSetSvcList = true );
     122             :     void    GetGrammarCheckerDsp_Impl( bool bSetSvcList = true );
     123             :     void    GetHyphenatorDsp_Impl( bool bSetSvcList = true );
     124             :     void    GetThesaurusDsp_Impl( bool bSetSvcList = true );
     125             : 
     126             :     void    SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp );
     127             :     void    SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp );
     128             :     void    SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp );
     129             :     void    SetCfgServiceLists( ThesaurusDispatcher &rThesDsp );
     130             : 
     131             :     bool    SaveCfgSvcs( const OUString &rServiceName );
     132             : 
     133             :     static void clearSvcInfoArray(SvcInfoArray *&rpInfo);
     134             : 
     135             :     // utl::ConfigItem (to allow for listening of changes of relevant properties)
     136             :     virtual void    Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames ) SAL_OVERRIDE;
     137             :     virtual void    ImplCommit() SAL_OVERRIDE;
     138             : 
     139             :     void UpdateAll();
     140             :     void stopListening();
     141             :     DECL_LINK_TYPED( updateAndBroadcast, Idle*, void );
     142             : 
     143             : public:
     144             :     LngSvcMgr();
     145             :     virtual ~LngSvcMgr();
     146             : 
     147             :     // XLinguServiceManager
     148             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker > SAL_CALL getSpellChecker(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > SAL_CALL getHyphenator(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     150             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > SAL_CALL getThesaurus(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     151             :     virtual sal_Bool SAL_CALL addLinguServiceManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             :     virtual sal_Bool SAL_CALL removeLinguServiceManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServices( const OUString& aServiceName, const ::com::sun::star::lang::Locale& aLocale )
     154             :         throw (::com::sun::star::uno::RuntimeException,
     155             :                std::exception) SAL_OVERRIDE;
     156             :     virtual void SAL_CALL setConfiguredServices( const OUString& aServiceName, const ::com::sun::star::lang::Locale& aLocale, const ::com::sun::star::uno::Sequence< OUString >& aServiceImplNames ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     157             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getConfiguredServices( const OUString& aServiceName, const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     158             : 
     159             :     // XAvailableLocales
     160             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getAvailableLocales( const OUString& aServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     161             : 
     162             :     // XComponent
     163             :     virtual void SAL_CALL dispose(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             :     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     165             :     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     166             : 
     167             :     // XServiceInfo
     168             :     virtual OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     169             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     170             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     171             : 
     172             :     // XEventListener
     173             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     174             : 
     175             :     // XModifyListener
     176             :     virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     177             : 
     178             :     static inline OUString   getImplementationName_Static();
     179             :     static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static() throw();
     180             : 
     181             :     bool    AddLngSvcEvtBroadcaster(
     182             :                 const ::com::sun::star::uno::Reference<
     183             :                     ::com::sun::star::linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster );
     184             : };
     185             : 
     186             : 
     187         268 : inline OUString LngSvcMgr::getImplementationName_Static()
     188             : {
     189         268 :     return OUString( "com.sun.star.lingu2.LngSvcMgr" );
     190             : }
     191             : 
     192             : 
     193             : 
     194             : #endif
     195             : 
     196             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11