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 _LINGU2_THESIMP_HXX_
21 : #define _LINGU2_THESIMP_HXX_
22 :
23 : #include <cppuhelper/implbase1.hxx>
24 : #include <cppuhelper/implbase5.hxx>
25 : #include <com/sun/star/uno/Reference.h>
26 : #include <com/sun/star/uno/Sequence.h>
27 : #include <com/sun/star/lang/XComponent.hpp>
28 : #include <com/sun/star/lang/XInitialization.hpp>
29 : #include <com/sun/star/lang/XServiceDisplayName.hpp>
30 : #include <com/sun/star/beans/XPropertySet.hpp>
31 : #include <com/sun/star/beans/PropertyValues.hpp>
32 :
33 : #include <com/sun/star/lang/XServiceInfo.hpp>
34 : #include <com/sun/star/linguistic2/XMeaning.hpp>
35 : #include <com/sun/star/linguistic2/XThesaurus.hpp>
36 :
37 : #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
38 : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
39 :
40 : #include <unotools/charclass.hxx>
41 :
42 : #include <lingutil.hxx>
43 : #include <linguistic/misc.hxx>
44 : #include <linguistic/lngprophelp.hxx>
45 :
46 : #include <osl/file.hxx>
47 : #include "mythes.hxx"
48 :
49 : using namespace ::rtl;
50 : using namespace ::com::sun::star::uno;
51 : using namespace ::com::sun::star::beans;
52 : using namespace ::com::sun::star::lang;
53 : using namespace ::com::sun::star::linguistic2;
54 :
55 : namespace com { namespace sun { namespace star { namespace beans {
56 : class XPropertySet;
57 : }}}}
58 :
59 : class Thesaurus :
60 : public cppu::WeakImplHelper5
61 : <
62 : XThesaurus,
63 : XInitialization,
64 : XComponent,
65 : XServiceInfo,
66 : XServiceDisplayName
67 : >
68 : {
69 : Sequence< Locale > aSuppLocales;
70 :
71 : ::cppu::OInterfaceContainerHelper aEvtListeners;
72 : linguistic::PropertyHelper_Thesaurus* pPropHelper;
73 : bool bDisposing;
74 : CharClass ** aCharSetInfo;
75 : MyThes ** aThes;
76 : rtl_TextEncoding * aTEncs;
77 : Locale * aTLocs;
78 : OUString * aTNames;
79 : sal_Int32 numthes;
80 :
81 : // cache for the Thesaurus dialog
82 : Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > prevMeanings;
83 : OUString prevTerm;
84 : sal_Int16 prevLocale;
85 :
86 : // disallow copy-constructor and assignment-operator for now
87 : Thesaurus(const Thesaurus &);
88 : Thesaurus & operator = (const Thesaurus &);
89 :
90 : linguistic::PropertyHelper_Thesaurus& GetPropHelper_Impl();
91 0 : linguistic::PropertyHelper_Thesaurus& GetPropHelper()
92 : {
93 0 : return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
94 : }
95 :
96 : public:
97 : Thesaurus();
98 : virtual ~Thesaurus();
99 :
100 : // XSupportedLocales (for XThesaurus)
101 : virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException, std::exception) SAL_OVERRIDE;
102 : virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
103 :
104 : // XThesaurus
105 : virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException, std::exception) SAL_OVERRIDE;
106 :
107 : // XServiceDisplayName
108 : virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
109 :
110 : // XInitialization
111 : virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException, std::exception) SAL_OVERRIDE;
112 :
113 : // XComponent
114 : virtual void SAL_CALL dispose() throw(RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
116 : virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
117 :
118 : // XServiceInfo
119 : virtual OUString SAL_CALL getImplementationName() throw(RuntimeException, std::exception) SAL_OVERRIDE;
120 : virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException, std::exception) SAL_OVERRIDE;
122 :
123 : static inline OUString
124 : getImplementationName_Static() throw();
125 : static Sequence< OUString >
126 : getSupportedServiceNames_Static() throw();
127 :
128 : private:
129 : OUString SAL_CALL makeLowerCase(const OUString&, CharClass *);
130 : OUString SAL_CALL makeUpperCase(const OUString&, CharClass *);
131 : OUString SAL_CALL makeInitCap(const OUString&, CharClass *);
132 :
133 : /* static ::com::sun::star::uno::Reference<
134 : ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
135 : static ::com::sun::star::uno::Reference<
136 : ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
137 : */
138 : static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
139 :
140 : };
141 :
142 0 : inline OUString Thesaurus::getImplementationName_Static() throw()
143 : {
144 0 : return OUString( "org.openoffice.lingu.new.Thesaurus" );
145 : }
146 :
147 : #endif
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|