xref: /trunk/main/linguistic/source/convdiclist.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*63ce064aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63ce064aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63ce064aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63ce064aSAndrew Rist  * distributed with this work for additional information
6*63ce064aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63ce064aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63ce064aSAndrew Rist  * "License"); you may not use this file except in compliance
9*63ce064aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*63ce064aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*63ce064aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63ce064aSAndrew Rist  * software distributed under the License is distributed on an
15*63ce064aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63ce064aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63ce064aSAndrew Rist  * specific language governing permissions and limitations
18*63ce064aSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*63ce064aSAndrew Rist  *************************************************************/
21*63ce064aSAndrew Rist 
22*63ce064aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _LINGUISTIC_CONVDICLIST_HXX_
25cdf0e10cSrcweir #define _LINGUISTIC_CONVDICLIST_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
28cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
30cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
31cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h>
32cdf0e10cSrcweir #include <svl/svarray.hxx>
33cdf0e10cSrcweir #include <tools/debug.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include "linguistic/misc.hxx"
36cdf0e10cSrcweir #include "lngopt.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class ConvDicNameContainer;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
42cdf0e10cSrcweir 
43cdf0e10cSrcweir class ConvDicList :
44cdf0e10cSrcweir     public cppu::WeakImplHelper3
45cdf0e10cSrcweir     <
46cdf0e10cSrcweir         ::com::sun::star::linguistic2::XConversionDictionaryList,
47cdf0e10cSrcweir         ::com::sun::star::lang::XComponent,
48cdf0e10cSrcweir         ::com::sun::star::lang::XServiceInfo
49cdf0e10cSrcweir     >
50cdf0e10cSrcweir {
51cdf0e10cSrcweir 
52cdf0e10cSrcweir     class MyAppExitListener : public linguistic::AppExitListener
53cdf0e10cSrcweir     {
54cdf0e10cSrcweir         ConvDicList & rMyDicList;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     public:
MyAppExitListener(ConvDicList & rDicList)57cdf0e10cSrcweir         MyAppExitListener( ConvDicList &rDicList ) : rMyDicList( rDicList ) {}
58cdf0e10cSrcweir         virtual void    AtExit();
59cdf0e10cSrcweir     };
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper       aEvtListeners;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     ConvDicNameContainer                   *pNameContainer;
65cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
66cdf0e10cSrcweir         ::com::sun::star::container::XNameContainer >   xNameContainer;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     MyAppExitListener                      *pExitListener;
69cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::frame::
70cdf0e10cSrcweir                 XTerminateListener >        xExitListener;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     sal_Bool                                    bDisposing;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     // disallow copy-constructor and assignment-operator for now
75cdf0e10cSrcweir     ConvDicList( const ConvDicList & );
76cdf0e10cSrcweir     ConvDicList & operator = (const ConvDicList &);
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     ConvDicNameContainer &  GetNameContainer();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir public:
81cdf0e10cSrcweir     ConvDicList();
82cdf0e10cSrcweir     virtual ~ConvDicList();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     // XConversionDictionaryList
85cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getDictionaryContainer(  ) throw (::com::sun::star::uno::RuntimeException);
86cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary > SAL_CALL addNewDictionary( const ::rtl::OUString& aName, const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nConversionDictionaryType ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
87cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL queryConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nConversionDictionaryType, ::com::sun::star::linguistic2::ConversionDirection eDirection, sal_Int32 nTextConversionOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir     virtual sal_Int16 SAL_CALL queryMaxCharCount( const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nConversionDictionaryType, ::com::sun::star::linguistic2::ConversionDirection eDirection ) throw (::com::sun::star::uno::RuntimeException);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     // XComponent
91cdf0e10cSrcweir     virtual void SAL_CALL dispose(  ) throw (::com::sun::star::uno::RuntimeException);
92cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     // XServiceInfo
96cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
97cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     static inline ::rtl::OUString
102cdf0e10cSrcweir         getImplementationName_Static() throw();
103cdf0e10cSrcweir     static com::sun::star::uno::Sequence< ::rtl::OUString >
104cdf0e10cSrcweir         getSupportedServiceNames_Static() throw();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     // non UNO-specific
107cdf0e10cSrcweir     void                    FlushDics();
108cdf0e10cSrcweir };
109cdf0e10cSrcweir 
getImplementationName_Static()110cdf0e10cSrcweir inline ::rtl::OUString ConvDicList::getImplementationName_Static() throw()
111cdf0e10cSrcweir {
112cdf0e10cSrcweir     return A2OU( "com.sun.star.lingu2.ConvDicList" );
113cdf0e10cSrcweir }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
116cdf0e10cSrcweir 
117cdf0e10cSrcweir #endif
118