update emoji autocorrect entries from po-files
[LibreOffice.git] / linguistic / inc / iprcache.hxx
blob855fde7998dde4527a3f948005ac609604b5be14
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 INCLUDED_LINGUISTIC_INC_IPRCACHE_HXX
21 #define INCLUDED_LINGUISTIC_INC_IPRCACHE_HXX
23 #include <cppuhelper/implbase2.hxx>
25 #include <com/sun/star/uno/Reference.h>
26 #include <com/sun/star/document/XEventListener.hpp>
27 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp>
30 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
31 #include <com/sun/star/linguistic2/XLinguProperties.hpp>
33 #include <rtl/string.hxx>
34 #include <i18nlangtag/lang.h>
36 #include <set>
37 #include <map>
39 namespace linguistic
43 class Flushable
45 public:
46 virtual void Flush() = 0;
48 protected:
49 ~Flushable() {}
53 class FlushListener :
54 public cppu::WeakImplHelper2
56 ::com::sun::star::linguistic2::XDictionaryListEventListener,
57 ::com::sun::star::beans::XPropertyChangeListener
60 ::com::sun::star::uno::Reference<
61 ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
62 ::com::sun::star::uno::Reference<
63 ::com::sun::star::linguistic2::XLinguProperties > xPropSet;
64 Flushable *pFlushObj;
66 FlushListener(const FlushListener &) SAL_DELETED_FUNCTION;
67 FlushListener & operator = (const FlushListener &) SAL_DELETED_FUNCTION;
69 public:
70 FlushListener( Flushable *pFO );
71 virtual ~FlushListener();
73 inline void SetFlushObj( Flushable *pFO) { pFlushObj = pFO; }
75 void SetDicList( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &rDL );
76 void SetPropSet( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguProperties > &rPS );
78 //XEventListener
79 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
81 // XDictionaryListEventListener
82 virtual void SAL_CALL processDictionaryListEvent( const ::com::sun::star::linguistic2::DictionaryListEvent& rDicListEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 // XPropertyChangeListener
85 virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 class SpellCache :
90 public Flushable
92 ::com::sun::star::uno::Reference<
93 ::com::sun::star::linguistic2::XDictionaryListEventListener >
94 xFlushLstnr;
95 FlushListener *pFlushLstnr;
97 typedef std::set< OUString > WordList_t;
98 typedef std::map< LanguageType, WordList_t > LangWordList_t;
99 LangWordList_t aWordLists;
101 SpellCache(const SpellCache &) SAL_DELETED_FUNCTION;
102 SpellCache & operator = (const SpellCache &) SAL_DELETED_FUNCTION;
104 public:
105 SpellCache();
106 virtual ~SpellCache();
108 // Flushable
109 virtual void Flush() SAL_OVERRIDE;
111 void AddWord( const OUString& rWord, LanguageType nLang );
112 bool CheckWord( const OUString& rWord, LanguageType nLang );
116 } // namespace linguistic
118 #endif
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */