1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski #ifndef _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
25*b1cdbd2cSJim Jagielski #define _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski #include <cppuhelper/component.hxx>
28*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/XWindow.hpp>
29*b1cdbd2cSJim Jagielski #include <com/sun/star/beans/XPropertySet.hpp>
30*b1cdbd2cSJim Jagielski #include <com/sun/star/frame/XModel.hpp>
31*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XInitialization.hpp>
32*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XServiceInfo.hpp>
33*b1cdbd2cSJim Jagielski #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
34*b1cdbd2cSJim Jagielski #include <com/sun/star/uno/XComponentContext.hpp>
35*b1cdbd2cSJim Jagielski #include <cppuhelper/implbase5.hxx>
36*b1cdbd2cSJim Jagielski 
37*b1cdbd2cSJim Jagielski //.............................................................................
38*b1cdbd2cSJim Jagielski namespace textconversiondlgs
39*b1cdbd2cSJim Jagielski {
40*b1cdbd2cSJim Jagielski //.............................................................................
41*b1cdbd2cSJim Jagielski 
42*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
43*b1cdbd2cSJim Jagielski /** This class provides the chinese translation dialog as an uno component.
44*b1cdbd2cSJim Jagielski 
45*b1cdbd2cSJim Jagielski It can be created via lang::XMultiComponentFactory::createInstanceWithContext
46*b1cdbd2cSJim Jagielski with servicename "com.sun.star.linguistic2.ChineseTranslationDialog"
47*b1cdbd2cSJim Jagielski or implemenation name "com.sun.star.comp.linguistic2.ChineseTranslationDialog"
48*b1cdbd2cSJim Jagielski 
49*b1cdbd2cSJim Jagielski It can be initialized via the XInitialization interface with the following single parameter:
50*b1cdbd2cSJim Jagielski PropertyValue-Parameter: Name="ParentWindow" Type="awt::XWindow".
51*b1cdbd2cSJim Jagielski 
52*b1cdbd2cSJim Jagielski It can be executed via the ui::dialogs::XExecutableDialog interface.
53*b1cdbd2cSJim Jagielski 
54*b1cdbd2cSJim Jagielski Made settings can be retrieved via beans::XPropertySet interface.
55*b1cdbd2cSJim Jagielski Following properties are available (read only and not bound):
56*b1cdbd2cSJim Jagielski 1) Name="IsDirectionToSimplified" Type="sal_Bool"
57*b1cdbd2cSJim Jagielski 2) Name="IsUseCharacterVariants" Type="sal_Bool"
58*b1cdbd2cSJim Jagielski 3) Name="IsTranslateCommonTerms" Type="sal_Bool"
59*b1cdbd2cSJim Jagielski 
60*b1cdbd2cSJim Jagielski The dialog gets this information from the registry on execute and writes it back to the registry if ended with OK.
61*b1cdbd2cSJim Jagielski */
62*b1cdbd2cSJim Jagielski 
63*b1cdbd2cSJim Jagielski class ChineseTranslationDialog;
64*b1cdbd2cSJim Jagielski 
65*b1cdbd2cSJim Jagielski class ChineseTranslation_UnoDialog : public ::cppu::WeakImplHelper5 <
66*b1cdbd2cSJim Jagielski 						      ::com::sun::star::ui::dialogs::XExecutableDialog
67*b1cdbd2cSJim Jagielski                             , ::com::sun::star::lang::XInitialization
68*b1cdbd2cSJim Jagielski                             , ::com::sun::star::beans::XPropertySet
69*b1cdbd2cSJim Jagielski                             , ::com::sun::star::lang::XComponent
70*b1cdbd2cSJim Jagielski                             , ::com::sun::star::lang::XServiceInfo
71*b1cdbd2cSJim Jagielski                             >
72*b1cdbd2cSJim Jagielski                             //	,public ::com::sun::star::uno::XWeak			// implemented by WeakImplHelper(optional interface)
73*b1cdbd2cSJim Jagielski 	                        //	,public ::com::sun::star::uno::XInterface		// implemented by WeakImplHelper(optional interface)
74*b1cdbd2cSJim Jagielski 	                        //	,public ::com::sun::star::lang::XTypeProvider	// implemented by WeakImplHelper
75*b1cdbd2cSJim Jagielski {
76*b1cdbd2cSJim Jagielski public:
77*b1cdbd2cSJim Jagielski     ChineseTranslation_UnoDialog( const ::com::sun::star::uno::Reference<
78*b1cdbd2cSJim Jagielski         ::com::sun::star::uno::XComponentContext >& xContext );
79*b1cdbd2cSJim Jagielski     virtual ~ChineseTranslation_UnoDialog();
80*b1cdbd2cSJim Jagielski 
81*b1cdbd2cSJim Jagielski 	// lang::XServiceInfo
82*b1cdbd2cSJim Jagielski     virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
83*b1cdbd2cSJim Jagielski     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
84*b1cdbd2cSJim Jagielski 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
85*b1cdbd2cSJim Jagielski 
86*b1cdbd2cSJim Jagielski 	static ::rtl::OUString getImplementationName_Static();
87*b1cdbd2cSJim Jagielski     static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static();
88*b1cdbd2cSJim Jagielski 
89*b1cdbd2cSJim Jagielski     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
create(::com::sun::star::uno::Reference<::com::sun::star::uno::XComponentContext> const & xContext)90*b1cdbd2cSJim Jagielski 	        create( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext) throw(::com::sun::star::uno::Exception)
91*b1cdbd2cSJim Jagielski     {
92*b1cdbd2cSJim Jagielski 	    return (::cppu::OWeakObject *)new ChineseTranslation_UnoDialog( xContext );
93*b1cdbd2cSJim Jagielski     }
94*b1cdbd2cSJim Jagielski 
95*b1cdbd2cSJim Jagielski     // lang::XInitialization
96*b1cdbd2cSJim Jagielski 	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);
97*b1cdbd2cSJim Jagielski 
98*b1cdbd2cSJim Jagielski     // ui::dialogs::XExecutableDialog
99*b1cdbd2cSJim Jagielski 	virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException);
100*b1cdbd2cSJim Jagielski     virtual sal_Int16 SAL_CALL execute(  ) throw (::com::sun::star::uno::RuntimeException);
101*b1cdbd2cSJim Jagielski 
102*b1cdbd2cSJim Jagielski     // beans::XPropertySet
103*b1cdbd2cSJim Jagielski     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw (::com::sun::star::uno::RuntimeException);
104*b1cdbd2cSJim Jagielski     virtual void SAL_CALL setPropertyValue( const ::rtl::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);
105*b1cdbd2cSJim Jagielski     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
106*b1cdbd2cSJim Jagielski     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::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);
107*b1cdbd2cSJim Jagielski     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::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);
108*b1cdbd2cSJim Jagielski     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::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);
109*b1cdbd2cSJim Jagielski     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::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);
110*b1cdbd2cSJim Jagielski 
111*b1cdbd2cSJim Jagielski     // lang::XComponent
112*b1cdbd2cSJim Jagielski 	virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
113*b1cdbd2cSJim Jagielski 	virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw (::com::sun::star::uno::RuntimeException);
114*b1cdbd2cSJim Jagielski 	virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw (::com::sun::star::uno::RuntimeException);
115*b1cdbd2cSJim Jagielski 
116*b1cdbd2cSJim Jagielski private:
117*b1cdbd2cSJim Jagielski     //no default constructor
118*b1cdbd2cSJim Jagielski     ChineseTranslation_UnoDialog();
119*b1cdbd2cSJim Jagielski 
120*b1cdbd2cSJim Jagielski     void impl_DeleteDialog();
121*b1cdbd2cSJim Jagielski 
122*b1cdbd2cSJim Jagielski private:
123*b1cdbd2cSJim Jagielski     ::com::sun::star::uno::Reference<
124*b1cdbd2cSJim Jagielski         ::com::sun::star::uno::XComponentContext>    m_xCC;
125*b1cdbd2cSJim Jagielski     com::sun::star::uno::Reference<
126*b1cdbd2cSJim Jagielski         com::sun::star::awt::XWindow >               m_xParentWindow;
127*b1cdbd2cSJim Jagielski 
128*b1cdbd2cSJim Jagielski 	ChineseTranslationDialog*     m_pDialog;
129*b1cdbd2cSJim Jagielski 
130*b1cdbd2cSJim Jagielski 	sal_Bool m_bDisposed; ///Dispose call ready.
131*b1cdbd2cSJim Jagielski 	sal_Bool m_bInDispose;///In dispose call
132*b1cdbd2cSJim Jagielski     osl::Mutex				        m_aContainerMutex;
133*b1cdbd2cSJim Jagielski     cppu::OInterfaceContainerHelper m_aDisposeEventListeners;
134*b1cdbd2cSJim Jagielski };
135*b1cdbd2cSJim Jagielski 
136*b1cdbd2cSJim Jagielski //.............................................................................
137*b1cdbd2cSJim Jagielski } //end namespace
138*b1cdbd2cSJim Jagielski //.............................................................................
139*b1cdbd2cSJim Jagielski #endif
140