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