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