1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SOURCE_DLISTIMP_HXX
21 #define INCLUDED_LINGUISTIC_SOURCE_DLISTIMP_HXX
23 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <rtl/ref.hxx>
32 #include <linguistic/misc.hxx>
35 class DicEvtListenerHelper
;
39 public cppu::WeakImplHelper
41 css::linguistic2::XSearchableDictionaryList
,
42 css::lang::XComponent
,
43 css::lang::XServiceInfo
46 class MyAppExitListener
: public linguistic::AppExitListener
51 explicit MyAppExitListener( DicList
&rDicList
) : rMyDicList( rDicList
) {}
52 virtual void AtExit() override
;
57 ::comphelper::OInterfaceContainerHelper2 aEvtListeners
;
59 typedef std::vector
< css::uno::Reference
< css::linguistic2::XDictionary
> > DictionaryVec_t
;
60 DictionaryVec_t aDicList
;
62 rtl::Reference
<DicEvtListenerHelper
> mxDicEvtLstnrHelper
;
63 rtl::Reference
<MyAppExitListener
> mxExitListener
;
68 DicList( const DicList
& ) = delete;
69 DicList
& operator = (const DicList
&) = delete;
72 DictionaryVec_t
& GetOrCreateDicList()
74 if ( !bInCreation
&& aDicList
.empty() )
79 void SearchForDictionaries( DictionaryVec_t
&rDicList
,
80 const OUString
&rDicDir
, bool bIsWritePath
);
81 sal_Int32
GetDicPos(const css::uno::Reference
<
82 css::linguistic2::XDictionary
> &xDic
);
86 virtual ~DicList() override
;
89 virtual ::sal_Int16 SAL_CALL
getCount( ) override
;
90 virtual css::uno::Sequence
< css::uno::Reference
< css::linguistic2::XDictionary
> > SAL_CALL
getDictionaries( ) override
;
91 virtual css::uno::Reference
< css::linguistic2::XDictionary
> SAL_CALL
getDictionaryByName( const OUString
& aDictionaryName
) override
;
92 virtual sal_Bool SAL_CALL
addDictionary( const css::uno::Reference
< css::linguistic2::XDictionary
>& xDictionary
) override
;
93 virtual sal_Bool SAL_CALL
removeDictionary( const css::uno::Reference
< css::linguistic2::XDictionary
>& xDictionary
) override
;
94 virtual sal_Bool SAL_CALL
addDictionaryListEventListener( const css::uno::Reference
< css::linguistic2::XDictionaryListEventListener
>& xListener
, sal_Bool bReceiveVerbose
) override
;
95 virtual sal_Bool SAL_CALL
removeDictionaryListEventListener( const css::uno::Reference
< css::linguistic2::XDictionaryListEventListener
>& xListener
) override
;
96 virtual ::sal_Int16 SAL_CALL
beginCollectEvents( ) override
;
97 virtual ::sal_Int16 SAL_CALL
endCollectEvents( ) override
;
98 virtual ::sal_Int16 SAL_CALL
flushEvents( ) override
;
99 virtual css::uno::Reference
< css::linguistic2::XDictionary
> SAL_CALL
createDictionary( const OUString
& aName
, const css::lang::Locale
& aLocale
, css::linguistic2::DictionaryType eDicType
, const OUString
& aURL
) override
;
101 // XSearchableDictionaryList
102 virtual css::uno::Reference
< css::linguistic2::XDictionaryEntry
> SAL_CALL
queryDictionaryEntry( const OUString
& aWord
, const css::lang::Locale
& aLocale
, sal_Bool bSearchPosDics
, sal_Bool bSpellEntry
) override
;
105 virtual void SAL_CALL
dispose() override
;
106 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
107 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
110 virtual OUString SAL_CALL
getImplementationName() override
;
111 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
112 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
115 static inline OUString
getImplementationName_Static() throw();
116 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static() throw();
122 inline OUString
DicList::getImplementationName_Static() throw()
124 return "com.sun.star.lingu2.DicList";
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */