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_SVX_SOURCE_UNODIALOGS_TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
21 : #define INCLUDED_SVX_SOURCE_UNODIALOGS_TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
22 :
23 : #include <cppuhelper/component.hxx>
24 : #include <com/sun/star/awt/XWindow.hpp>
25 : #include <com/sun/star/beans/XPropertySet.hpp>
26 : #include <com/sun/star/frame/XModel.hpp>
27 : #include <com/sun/star/lang/XInitialization.hpp>
28 : #include <com/sun/star/lang/XServiceInfo.hpp>
29 : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
30 : #include <com/sun/star/uno/XComponentContext.hpp>
31 : #include <cppuhelper/implbase5.hxx>
32 :
33 :
34 : namespace textconversiondlgs
35 : {
36 :
37 :
38 :
39 : /** This class provides the chinese translation dialog as an uno component.
40 :
41 : It can be created via lang::XMultiComponentFactory::createInstanceWithContext
42 : with servicename "com.sun.star.linguistic2.ChineseTranslationDialog"
43 : or implemenation name "com.sun.star.comp.linguistic2.ChineseTranslationDialog"
44 :
45 : It can be initialized via the XInitialization interface with the following single parameter:
46 : PropertyValue-Parameter: Name="ParentWindow" Type="awt::XWindow".
47 :
48 : It can be executed via the ui::dialogs::XExecutableDialog interface.
49 :
50 : Made settings can be retrieved via beans::XPropertySet interface.
51 : Following properties are available (read only and not bound):
52 : 1) Name="IsDirectionToSimplified" Type="sal_Bool"
53 : 2) Name="IsUseCharacterVariants" Type="sal_Bool"
54 : 3) Name="IsTranslateCommonTerms" Type="sal_Bool"
55 :
56 : The dialog gets this information from the registry on execute and writes it back to the registry if ended with OK.
57 : */
58 :
59 : class ChineseTranslationDialog;
60 :
61 : class ChineseTranslation_UnoDialog : public ::cppu::WeakImplHelper5 <
62 : ::com::sun::star::ui::dialogs::XExecutableDialog
63 : , ::com::sun::star::lang::XInitialization
64 : , ::com::sun::star::beans::XPropertySet
65 : , ::com::sun::star::lang::XComponent
66 : , ::com::sun::star::lang::XServiceInfo
67 : >
68 : // ,public ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
69 : // ,public ::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
70 : // ,public ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
71 : {
72 : public:
73 : ChineseTranslation_UnoDialog( const ::com::sun::star::uno::Reference<
74 : ::com::sun::star::uno::XComponentContext >& xContext );
75 : virtual ~ChineseTranslation_UnoDialog();
76 :
77 : // lang::XServiceInfo
78 : virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
79 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
80 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
81 :
82 : static OUString getImplementationName_Static();
83 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static();
84 :
85 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
86 0 : create( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext) throw(::com::sun::star::uno::Exception)
87 : {
88 0 : return (::cppu::OWeakObject *)new ChineseTranslation_UnoDialog( xContext );
89 : }
90 :
91 : // lang::XInitialization
92 : virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 :
94 : // ui::dialogs::XExecutableDialog
95 : virtual void SAL_CALL setTitle( const OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 : virtual sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 :
98 : // beans::XPropertySet
99 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 :
107 : // lang::XComponent
108 : virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 : 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;
110 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 :
112 : private:
113 : //no default constructor
114 : ChineseTranslation_UnoDialog();
115 :
116 : void impl_DeleteDialog();
117 :
118 : private:
119 : ::com::sun::star::uno::Reference<
120 : ::com::sun::star::uno::XComponentContext> m_xCC;
121 : com::sun::star::uno::Reference<
122 : com::sun::star::awt::XWindow > m_xParentWindow;
123 :
124 : ChineseTranslationDialog* m_pDialog;
125 :
126 : bool m_bDisposed; ///Dispose call ready.
127 : bool m_bInDispose;///In dispose call
128 : osl::Mutex m_aContainerMutex;
129 : cppu::OInterfaceContainerHelper m_aDisposeEventListeners;
130 : };
131 :
132 :
133 : } //end namespace
134 :
135 : #endif
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|