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 INCLUDED_LINGUISTIC_SOURCE_CONVDICLIST_HXX
21 : #define INCLUDED_LINGUISTIC_SOURCE_CONVDICLIST_HXX
22 :
23 : #include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
24 : #include <com/sun/star/lang/XComponent.hpp>
25 : #include <com/sun/star/lang/XServiceInfo.hpp>
26 : #include <cppuhelper/implbase3.hxx>
27 : #include <cppuhelper/interfacecontainer.h>
28 :
29 : #include "linguistic/misc.hxx"
30 : #include "lngopt.hxx"
31 :
32 :
33 : class ConvDicNameContainer;
34 :
35 :
36 : class ConvDicList :
37 : public cppu::WeakImplHelper3
38 : <
39 : ::com::sun::star::linguistic2::XConversionDictionaryList,
40 : ::com::sun::star::lang::XComponent,
41 : ::com::sun::star::lang::XServiceInfo
42 : >
43 : {
44 :
45 4 : class MyAppExitListener : public linguistic::AppExitListener
46 : {
47 : ConvDicList & rMyDicList;
48 :
49 : public:
50 2 : explicit MyAppExitListener( ConvDicList &rDicList ) : rMyDicList( rDicList ) {}
51 : virtual void AtExit() SAL_OVERRIDE;
52 : };
53 :
54 :
55 : ::cppu::OInterfaceContainerHelper aEvtListeners;
56 :
57 : ConvDicNameContainer *pNameContainer;
58 : ::com::sun::star::uno::Reference<
59 : ::com::sun::star::container::XNameContainer > xNameContainer;
60 :
61 : MyAppExitListener *pExitListener;
62 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::
63 : XTerminateListener > xExitListener;
64 :
65 : bool bDisposing;
66 :
67 : ConvDicList( const ConvDicList & ) SAL_DELETED_FUNCTION;
68 : ConvDicList & operator = (const ConvDicList &) SAL_DELETED_FUNCTION;
69 :
70 : ConvDicNameContainer & GetNameContainer();
71 :
72 : public:
73 : ConvDicList();
74 : virtual ~ConvDicList();
75 :
76 : // XConversionDictionaryList
77 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getDictionaryContainer( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
78 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary > SAL_CALL addNewDictionary( const 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, std::exception) SAL_OVERRIDE;
79 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL queryConversions( const 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, std::exception) SAL_OVERRIDE;
80 : 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, std::exception) SAL_OVERRIDE;
81 :
82 : // XComponent
83 : virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 :
87 : // XServiceInfo
88 : virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 :
93 : static inline OUString
94 : getImplementationName_Static() throw();
95 : static com::sun::star::uno::Sequence< OUString >
96 : getSupportedServiceNames_Static() throw();
97 :
98 : // non UNO-specific
99 : void FlushDics();
100 : };
101 :
102 6 : inline OUString ConvDicList::getImplementationName_Static() throw()
103 : {
104 6 : return OUString( "com.sun.star.lingu2.ConvDicList" );
105 : }
106 :
107 :
108 : #endif
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|