1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: iprcache.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LINGUISTIC_IPRCACHE_HXX_
32 #define _LINGUISTIC_IPRCACHE_HXX_
35 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
36 #include <cppuhelper/implbase2.hxx> // helper for implementations
38 #include <com/sun/star/uno/Reference.h>
39 #include <com/sun/star/document/XEventListener.hpp>
40 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 #include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp>
43 #include <com/sun/star/linguistic2/XDictionaryList.hpp>
45 #include <rtl/string.hxx>
46 #include <i18npool/lang.h>
54 ///////////////////////////////////////////////////////////////////////////
59 virtual void Flush() = 0;
62 ///////////////////////////////////////////////////////////////////////////
65 public cppu::WeakImplHelper2
67 ::com::sun::star::linguistic2::XDictionaryListEventListener
,
68 ::com::sun::star::beans::XPropertyChangeListener
71 ::com::sun::star::uno::Reference
<
72 ::com::sun::star::linguistic2::XDictionaryList
> xDicList
;
73 ::com::sun::star::uno::Reference
<
74 ::com::sun::star::beans::XPropertySet
> xPropSet
;
77 // don't allow to use copy-constructor and assignment-operator
78 FlushListener(const FlushListener
&);
79 FlushListener
& operator = (const FlushListener
&);
82 FlushListener( Flushable
*pFO
);
83 virtual ~FlushListener();
85 inline void SetFlushObj( Flushable
*pFO
) { pFlushObj
= pFO
; }
87 void SetDicList( ::com::sun::star::uno::Reference
< ::com::sun::star::linguistic2::XDictionaryList
> &rDL
);
88 void SetPropSet( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> &rPS
);
91 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& rSource
) throw(::com::sun::star::uno::RuntimeException
);
93 // XDictionaryListEventListener
94 virtual void SAL_CALL
processDictionaryListEvent( const ::com::sun::star::linguistic2::DictionaryListEvent
& rDicListEvent
) throw(::com::sun::star::uno::RuntimeException
);
96 // XPropertyChangeListener
97 virtual void SAL_CALL
propertyChange( const ::com::sun::star::beans::PropertyChangeEvent
& rEvt
) throw(::com::sun::star::uno::RuntimeException
);
100 ///////////////////////////////////////////////////////////////////////////
105 ::com::sun::star::uno::Reference
<
106 ::com::sun::star::linguistic2::XDictionaryListEventListener
>
108 FlushListener
*pFlushLstnr
;
110 typedef std::set
< ::rtl::OUString
> WordList_t
;
111 typedef std::map
< LanguageType
, WordList_t
> LangWordList_t
;
112 LangWordList_t aWordLists
;
114 // don't allow to use copy-constructor and assignment-operator
115 SpellCache(const SpellCache
&);
116 SpellCache
& operator = (const SpellCache
&);
120 virtual ~SpellCache();
123 virtual void Flush();
125 void AddWord( const ::rtl::OUString
& rWord
, LanguageType nLang
);
126 bool CheckWord( const ::rtl::OUString
& rWord
, LanguageType nLang
);
129 ///////////////////////////////////////////////////////////////////////////
131 } // namespace linguistic