fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / linguistic / inc / iprcache.hxx
blob0d3b8a5895a5fac2c21604e9ce1fbe5167fdc856
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _LINGUISTIC_IPRCACHE_HXX_
21 #define _LINGUISTIC_IPRCACHE_HXX_
24 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
25 #include <cppuhelper/implbase2.hxx> // helper for implementations
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>
35 #include <rtl/string.hxx>
36 #include <i18nlangtag/lang.h>
38 #include <set>
39 #include <map>
41 namespace linguistic
45 class Flushable
47 public:
48 virtual void Flush() = 0;
50 protected:
51 ~Flushable() {}
55 class FlushListener :
56 public cppu::WeakImplHelper2
58 ::com::sun::star::linguistic2::XDictionaryListEventListener,
59 ::com::sun::star::beans::XPropertyChangeListener
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;
68 // don't allow to use copy-constructor and assignment-operator
69 FlushListener(const FlushListener &);
70 FlushListener & operator = (const FlushListener &);
72 public:
73 FlushListener( Flushable *pFO );
74 virtual ~FlushListener();
76 inline void SetFlushObj( Flushable *pFO) { pFlushObj = pFO; }
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 );
81 //XEventListener
82 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource ) throw(::com::sun::star::uno::RuntimeException);
84 // XDictionaryListEventListener
85 virtual void SAL_CALL processDictionaryListEvent( const ::com::sun::star::linguistic2::DictionaryListEvent& rDicListEvent ) throw(::com::sun::star::uno::RuntimeException);
87 // XPropertyChangeListener
88 virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ) throw(::com::sun::star::uno::RuntimeException);
92 class SpellCache :
93 public Flushable
95 ::com::sun::star::uno::Reference<
96 ::com::sun::star::linguistic2::XDictionaryListEventListener >
97 xFlushLstnr;
98 FlushListener *pFlushLstnr;
100 typedef std::set< OUString > WordList_t;
101 typedef std::map< LanguageType, WordList_t > LangWordList_t;
102 LangWordList_t aWordLists;
104 // don't allow to use copy-constructor and assignment-operator
105 SpellCache(const SpellCache &);
106 SpellCache & operator = (const SpellCache &);
108 public:
109 SpellCache();
110 virtual ~SpellCache();
112 // Flushable
113 virtual void Flush();
115 void AddWord( const OUString& rWord, LanguageType nLang );
116 bool CheckWord( const OUString& rWord, LanguageType nLang );
120 } // namespace linguistic
122 #endif
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */