LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/linguistic/inc - iprcache.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2013-07-09 Functions: 3 3 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 _LINGUISTIC_IPRCACHE_HXX_
      21             : #define _LINGUISTIC_IPRCACHE_HXX_
      22             : 
      23             : 
      24             : #include <uno/lbnames.h>            // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
      25             : #include <cppuhelper/implbase2.hxx> // helper for implementations
      26             : 
      27             : #include <com/sun/star/uno/Reference.h>
      28             : #include <com/sun/star/document/XEventListener.hpp>
      29             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      30             : #include <com/sun/star/beans/XPropertySet.hpp>
      31             : #include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp>
      32             : #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
      33             : #include <com/sun/star/linguistic2/XLinguProperties.hpp>
      34             : 
      35             : #include <rtl/string.hxx>
      36             : #include <i18nlangtag/lang.h>
      37             : 
      38             : #include <set>
      39             : #include <map>
      40             : 
      41             : namespace linguistic
      42             : {
      43             : 
      44             : 
      45          19 : class Flushable
      46             : {
      47             : public:
      48             :     virtual void    Flush() = 0;
      49             : 
      50             : protected:
      51          19 :     ~Flushable() {}
      52             : };
      53             : 
      54             : 
      55             : class FlushListener :
      56             :     public cppu::WeakImplHelper2
      57             :     <
      58             :         ::com::sun::star::linguistic2::XDictionaryListEventListener,
      59             :         ::com::sun::star::beans::XPropertyChangeListener
      60             :     >
      61             : {
      62             :     ::com::sun::star::uno::Reference<
      63             :         ::com::sun::star::linguistic2::XSearchableDictionaryList >    xDicList;
      64             :     ::com::sun::star::uno::Reference<
      65             :         ::com::sun::star::linguistic2::XLinguProperties >             xPropSet;
      66             :     Flushable                                              *pFlushObj;
      67             : 
      68             :     // don't allow to use copy-constructor and assignment-operator
      69             :     FlushListener(const FlushListener &);
      70             :     FlushListener & operator = (const FlushListener &);
      71             : 
      72             : public:
      73             :     FlushListener( Flushable *pFO );
      74             :     virtual ~FlushListener();
      75             : 
      76          19 :     inline void SetFlushObj( Flushable *pFO)    { pFlushObj = pFO; }
      77             : 
      78             :     void        SetDicList( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &rDL );
      79             :     void        SetPropSet( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguProperties > &rPS );
      80             : 
      81             :     //XEventListener
      82             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource ) throw(::com::sun::star::uno::RuntimeException);
      83             : 
      84             :     // XDictionaryListEventListener
      85             :     virtual void SAL_CALL processDictionaryListEvent( const ::com::sun::star::linguistic2::DictionaryListEvent& rDicListEvent ) throw(::com::sun::star::uno::RuntimeException);
      86             : 
      87             :     // XPropertyChangeListener
      88             :     virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ) throw(::com::sun::star::uno::RuntimeException);
      89             : };
      90             : 
      91             : 
      92             : class SpellCache :
      93             :     public Flushable
      94             : {
      95             :     ::com::sun::star::uno::Reference<
      96             :         ::com::sun::star::linguistic2::XDictionaryListEventListener >
      97             :                         xFlushLstnr;
      98             :     FlushListener      *pFlushLstnr;
      99             : 
     100             :     typedef std::set< OUString >             WordList_t;
     101             :     typedef std::map< LanguageType, WordList_t >    LangWordList_t;
     102             :     LangWordList_t  aWordLists;
     103             : 
     104             :     // don't allow to use copy-constructor and assignment-operator
     105             :     SpellCache(const SpellCache &);
     106             :     SpellCache & operator = (const SpellCache &);
     107             : 
     108             : public:
     109             :     SpellCache();
     110             :     virtual ~SpellCache();
     111             : 
     112             :     // Flushable
     113             :     virtual void    Flush();
     114             : 
     115             :     void    AddWord( const OUString& rWord, LanguageType nLang );
     116             :     bool    CheckWord( const OUString& rWord, LanguageType nLang );
     117             : };
     118             : 
     119             : 
     120             : }   // namespace linguistic
     121             : 
     122             : #endif
     123             : 
     124             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10