1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: chinese_translation_unodialog.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
32 #define _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
34 #include <cppuhelper/component.hxx>
35 #include <com/sun/star/awt/XWindow.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/frame/XModel.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
41 #include <com/sun/star/uno/XComponentContext.hpp>
42 #include <cppuhelper/implbase5.hxx>
44 //.............................................................................
45 namespace textconversiondlgs
47 //.............................................................................
49 //-------------------------------------------------------------------------
50 /** This class provides the chinese translation dialog as an uno component.
52 It can be created via lang::XMultiComponentFactory::createInstanceWithContext
53 with servicename "com.sun.star.linguistic2.ChineseTranslationDialog"
54 or implemenation name "com.sun.star.comp.linguistic2.ChineseTranslationDialog"
56 It can be initialized via the XInitialization interface with the following single parameter:
57 PropertyValue-Parameter: Name="ParentWindow" Type="awt::XWindow".
59 It can be executed via the ui::dialogs::XExecutableDialog interface.
61 Made settings can be retrieved via beans::XPropertySet interface.
62 Following properties are available (read only and not bound):
63 1) Name="IsDirectionToSimplified" Type="sal_Bool"
64 2) Name="IsUseCharacterVariants" Type="sal_Bool"
65 3) Name="IsTranslateCommonTerms" Type="sal_Bool"
67 The dialog gets this information from the registry on execute and writes it back to the registry if ended with OK.
70 class ChineseTranslationDialog
;
72 class ChineseTranslation_UnoDialog
: public ::cppu::WeakImplHelper5
<
73 ::com::sun::star::ui::dialogs::XExecutableDialog
74 , ::com::sun::star::lang::XInitialization
75 , ::com::sun::star::beans::XPropertySet
76 , ::com::sun::star::lang::XComponent
77 , ::com::sun::star::lang::XServiceInfo
79 // ,public ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
80 // ,public ::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
81 // ,public ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
84 ChineseTranslation_UnoDialog( const ::com::sun::star::uno::Reference
<
85 ::com::sun::star::uno::XComponentContext
>& xContext
);
86 virtual ~ChineseTranslation_UnoDialog();
89 virtual ::rtl::OUString SAL_CALL
getImplementationName() throw( ::com::sun::star::uno::RuntimeException
);
90 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
91 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException
);
93 static ::rtl::OUString
getImplementationName_Static();
94 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> getSupportedServiceNames_Static();
96 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
97 create( ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> const & xContext
) throw(::com::sun::star::uno::Exception
)
99 return (::cppu::OWeakObject
*)new ChineseTranslation_UnoDialog( xContext
);
102 // lang::XInitialization
103 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
);
105 // ui::dialogs::XExecutableDialog
106 virtual void SAL_CALL
setTitle( const ::rtl::OUString
& aTitle
) throw (::com::sun::star::uno::RuntimeException
);
107 virtual sal_Int16 SAL_CALL
execute( ) throw (::com::sun::star::uno::RuntimeException
);
109 // beans::XPropertySet
110 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException
);
111 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
);
112 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
);
113 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
);
114 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
);
115 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
);
116 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
);
119 virtual void SAL_CALL
dispose() throw (::com::sun::star::uno::RuntimeException
);
120 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & xListener
) throw (::com::sun::star::uno::RuntimeException
);
121 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & xListener
) throw (::com::sun::star::uno::RuntimeException
);
124 //no default constructor
125 ChineseTranslation_UnoDialog();
127 void impl_DeleteDialog();
130 ::com::sun::star::uno::Reference
<
131 ::com::sun::star::uno::XComponentContext
> m_xCC
;
132 com::sun::star::uno::Reference
<
133 com::sun::star::awt::XWindow
> m_xParentWindow
;
135 ChineseTranslationDialog
* m_pDialog
;
137 sal_Bool m_bDisposed
; ///Dispose call ready.
138 sal_Bool m_bInDispose
;///In dispose call
139 osl::Mutex m_aContainerMutex
;
140 cppu::OInterfaceContainerHelper m_aDisposeEventListeners
;
143 //.............................................................................
145 //.............................................................................