LCOV - code coverage report
Current view: top level - libreoffice/linguistic/source - dlistimp.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 8 50.0 %
Date: 2012-12-27 Functions: 4 5 80.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 _LINGUISTIC_DLISTIMP_HXX_
      21             : #define _LINGUISTIC_DLISTIMP_HXX_
      22             : 
      23             : #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
      24             : #include <com/sun/star/lang/XComponent.hpp>
      25             : #include <com/sun/star/lang/XServiceInfo.hpp>
      26             : 
      27             : #include <uno/lbnames.h>            // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
      28             : #include <cppuhelper/implbase1.hxx> // helper for implementations
      29             : #include <cppuhelper/implbase3.hxx> // helper for implementations
      30             : #include <cppuhelper/interfacecontainer.h>
      31             : 
      32             : #include <vector>
      33             : #include <memory>
      34             : 
      35             : #include "linguistic/misc.hxx"
      36             : #include "lngopt.hxx"
      37             : 
      38             : class DicEvtListenerHelper;
      39             : 
      40             : 
      41             : class DicList :
      42             :     public cppu::WeakImplHelper3
      43             :     <
      44             :         ::com::sun::star::linguistic2::XSearchableDictionaryList,
      45             :         ::com::sun::star::lang::XComponent,
      46             :         ::com::sun::star::lang::XServiceInfo
      47             :     >
      48             : {
      49          14 :     class MyAppExitListener : public linguistic::AppExitListener
      50             :     {
      51             :         DicList & rMyDicList;
      52             : 
      53             :     public:
      54           7 :         MyAppExitListener( DicList &rDicList ) : rMyDicList( rDicList ) {}
      55             :         virtual void    AtExit();
      56             :     };
      57             : 
      58             :     LinguOptions    aOpt;
      59             : 
      60             :     ::cppu::OInterfaceContainerHelper       aEvtListeners;
      61             : 
      62             :     typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > >   DictionaryVec_t;
      63             :     DictionaryVec_t                          aDicList;
      64             : 
      65             :     ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::
      66             :                 XDictionaryEventListener >  xDicEvtLstnrHelper;
      67             :     DicEvtListenerHelper                    *pDicEvtLstnrHelper;
      68             : 
      69             :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::
      70             :                 XTerminateListener >        xExitListener;
      71             :     MyAppExitListener                       *pExitListener;
      72             : 
      73             :     sal_Bool    bDisposing;
      74             :     sal_Bool    bInCreation;
      75             : 
      76             :     // disallow copy-constructor and assignment-operator for now
      77             :     DicList( const DicList & );
      78             :     DicList & operator = (const DicList &);
      79             : 
      80             :     void                _CreateDicList();
      81           0 :     DictionaryVec_t &   GetOrCreateDicList()
      82             :                         {
      83           0 :                             if ( !bInCreation && aDicList.empty() )
      84           0 :                                 _CreateDicList();
      85           0 :                             return aDicList;
      86             :                         }
      87             : 
      88             :     void            LaunchEvent(sal_Int16 nEvent, com::sun::star::uno::Sequence<
      89             :                             ::com::sun::star::linguistic2::XDictionary > xDic);
      90             :     void            SearchForDictionaries( DictionaryVec_t &rDicList,
      91             :                                             const String &rDicDir, sal_Bool bIsWritePath );
      92             :     sal_Int32           GetDicPos(const com::sun::star::uno::Reference<
      93             :                             ::com::sun::star::linguistic2::XDictionary > &xDic);
      94             : 
      95             : public:
      96             :     DicList();
      97             :     virtual ~DicList();
      98             : 
      99             :     // XDictionaryList
     100             :     virtual ::sal_Int16 SAL_CALL getCount(  ) throw (::com::sun::star::uno::RuntimeException);
     101             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > > SAL_CALL getDictionaries(  ) throw (::com::sun::star::uno::RuntimeException);
     102             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > SAL_CALL getDictionaryByName( const ::rtl::OUString& aDictionaryName ) throw (::com::sun::star::uno::RuntimeException);
     103             :     virtual ::sal_Bool SAL_CALL addDictionary( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary >& xDictionary ) throw (::com::sun::star::uno::RuntimeException);
     104             :     virtual ::sal_Bool SAL_CALL removeDictionary( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary >& xDictionary ) throw (::com::sun::star::uno::RuntimeException);
     105             :     virtual ::sal_Bool SAL_CALL addDictionaryListEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryListEventListener >& xListener, ::sal_Bool bReceiveVerbose ) throw (::com::sun::star::uno::RuntimeException);
     106             :     virtual ::sal_Bool SAL_CALL removeDictionaryListEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryListEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
     107             :     virtual ::sal_Int16 SAL_CALL beginCollectEvents(  ) throw (::com::sun::star::uno::RuntimeException);
     108             :     virtual ::sal_Int16 SAL_CALL endCollectEvents(  ) throw (::com::sun::star::uno::RuntimeException);
     109             :     virtual ::sal_Int16 SAL_CALL flushEvents(  ) throw (::com::sun::star::uno::RuntimeException);
     110             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > SAL_CALL createDictionary( const ::rtl::OUString& aName, const ::com::sun::star::lang::Locale& aLocale, ::com::sun::star::linguistic2::DictionaryType eDicType, const ::rtl::OUString& aURL ) throw (::com::sun::star::uno::RuntimeException);
     111             : 
     112             :     // XSearchableDictionaryList
     113             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryEntry > SAL_CALL queryDictionaryEntry( const ::rtl::OUString& aWord, const ::com::sun::star::lang::Locale& aLocale, sal_Bool bSearchPosDics, sal_Bool bSpellEntry ) throw(::com::sun::star::uno::RuntimeException);
     114             : 
     115             :     // XComponent
     116             :     virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
     117             :     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     118             :     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
     119             : 
     120             :     // XServiceInfo
     121             :     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
     122             :     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
     123             :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
     124             : 
     125             : 
     126             :     static inline ::rtl::OUString getImplementationName_Static() throw();
     127             :     static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
     128             : 
     129             :     // non UNO-specific
     130             :     void    SaveDics();
     131             : };
     132             : 
     133          14 : inline ::rtl::OUString DicList::getImplementationName_Static() throw()
     134             : {
     135          14 :     return A2OU( "com.sun.star.lingu2.DicList" );
     136             : }
     137             : 
     138             : 
     139             : #endif
     140             : 
     141             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10