LCOV - code coverage report
Current view: top level - linguistic/source - lngsvcmgr.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 1 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             : #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 <boost/ptr_container/ptr_vector.hpp>
      35             : 
      36             : #include "linguistic/misc.hxx"
      37             : #include "defs.hxx"
      38             : 
      39             : class SpellCheckerDispatcher;
      40             : class HyphenatorDispatcher;
      41             : class ThesaurusDispatcher;
      42             : class GrammarCheckingIterator;
      43             : class LngSvcMgrListenerHelper;
      44             : struct SvcInfo;
      45             : 
      46             : namespace com { namespace sun { namespace star { namespace linguistic2 {
      47             :     class XLinguServiceEventBroadcaster;
      48             :     class XSpellChecker;
      49             :     class XProofreadingIterator;
      50             :     class XHyphenator;
      51             :     class XThesaurus;
      52             : } } } }
      53             : 
      54             : 
      55             : 
      56             : class LngSvcMgr :
      57             :     public cppu::WeakImplHelper3
      58             :     <
      59             :         com::sun::star::linguistic2::XLinguServiceManager2,
      60             :         com::sun::star::lang::XServiceInfo,
      61             :         com::sun::star::util::XModifyListener
      62             :     >,
      63             :     private utl::ConfigItem
      64             : {
      65             :     friend class LngSvcMgrListenerHelper;
      66             : 
      67             :     ::cppu::OInterfaceContainerHelper                   aEvtListeners;
      68             : 
      69             :     com::sun::star::uno::Reference<
      70             :         ::com::sun::star::linguistic2::XSpellChecker >              xSpellDsp;
      71             :     com::sun::star::uno::Reference<
      72             :         ::com::sun::star::linguistic2::XProofreadingIterator >      xGrammarDsp;
      73             :     com::sun::star::uno::Reference<
      74             :         ::com::sun::star::linguistic2::XHyphenator >                xHyphDsp;
      75             :     com::sun::star::uno::Reference<
      76             :         ::com::sun::star::linguistic2::XThesaurus >                 xThesDsp;
      77             : 
      78             :     com::sun::star::uno::Reference<
      79             :         ::com::sun::star::lang::XEventListener >        xListenerHelper;
      80             : 
      81             :     com::sun::star::uno::Reference<
      82             :         ::com::sun::star::util::XModifyBroadcaster>     xMB;
      83             : 
      84             :     Timer                                               aUpdateTimer;
      85             : 
      86             : 
      87             :     com::sun::star::uno::Sequence<
      88             :         com::sun::star::lang::Locale >                  aAvailSpellLocales;
      89             :     com::sun::star::uno::Sequence<
      90             :         com::sun::star::lang::Locale >                  aAvailGrammarLocales;
      91             :     com::sun::star::uno::Sequence<
      92             :         com::sun::star::lang::Locale >                  aAvailHyphLocales;
      93             :     com::sun::star::uno::Sequence<
      94             :         com::sun::star::lang::Locale >                  aAvailThesLocales;
      95             : 
      96             :     SpellCheckerDispatcher *                            pSpellDsp;
      97             :     GrammarCheckingIterator *                           pGrammarDsp;
      98             :     HyphenatorDispatcher *                              pHyphDsp;
      99             :     ThesaurusDispatcher *                               pThesDsp;
     100             : 
     101             :     LngSvcMgrListenerHelper *                           pListenerHelper;
     102             : 
     103             :     typedef boost::ptr_vector< SvcInfo >    SvcInfoArray;
     104             :     SvcInfoArray *                                      pAvailSpellSvcs;
     105             :     SvcInfoArray *                                      pAvailGrammarSvcs;
     106             :     SvcInfoArray *                                      pAvailHyphSvcs;
     107             :     SvcInfoArray *                                      pAvailThesSvcs;
     108             : 
     109             :     sal_Bool bDisposing;
     110             : 
     111             :     // disallow copy-constructor and assignment-operator for now
     112             :     LngSvcMgr(const LngSvcMgr &);
     113             :     LngSvcMgr & operator = (const LngSvcMgr &);
     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( sal_Bool bSetSvcList = sal_True );
     122             :     void    GetGrammarCheckerDsp_Impl( sal_Bool bSetSvcList = sal_True );
     123             :     void    GetHyphenatorDsp_Impl( sal_Bool bSetSvcList = sal_True );
     124             :     void    GetThesaurusDsp_Impl( sal_Bool bSetSvcList = sal_True );
     125             : 
     126             :     void    SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp );
     127             :     void    SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp );
     128             :     void    SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp );
     129             :     void    SetCfgServiceLists( ThesaurusDispatcher &rThesDsp );
     130             : 
     131             :     sal_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    Commit() SAL_OVERRIDE;
     138             : 
     139             :     void UpdateAll();
     140             :     void stopListening();
     141             :     DECL_LINK( updateAndBroadcast, 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             :     sal_Bool    AddLngSvcEvtBroadcaster(
     182             :                 const ::com::sun::star::uno::Reference<
     183             :                     ::com::sun::star::linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster );
     184             : };
     185             : 
     186             : 
     187           0 : inline OUString LngSvcMgr::getImplementationName_Static()
     188             : {
     189           0 :     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.10