1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
21 #define _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
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>
33 //.............................................................................
34 namespace textconversiondlgs
36 //.............................................................................
38 //-------------------------------------------------------------------------
39 /** This class provides the chinese translation dialog as an uno component.
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"
45 It can be initialized via the XInitialization interface with the following single parameter:
46 PropertyValue-Parameter: Name="ParentWindow" Type="awt::XWindow".
48 It can be executed via the ui::dialogs::XExecutableDialog interface.
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"
56 The dialog gets this information from the registry on execute and writes it back to the registry if ended with OK.
59 class ChineseTranslationDialog
;
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
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
73 ChineseTranslation_UnoDialog( const ::com::sun::star::uno::Reference
<
74 ::com::sun::star::uno::XComponentContext
>& xContext
);
75 virtual ~ChineseTranslation_UnoDialog();
78 virtual OUString SAL_CALL
getImplementationName() throw( ::com::sun::star::uno::RuntimeException
);
79 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
80 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException
);
82 static OUString
getImplementationName_Static();
83 static ::com::sun::star::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
85 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
86 create( ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> const & xContext
) throw(::com::sun::star::uno::Exception
)
88 return (::cppu::OWeakObject
*)new ChineseTranslation_UnoDialog( xContext
);
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
);
94 // ui::dialogs::XExecutableDialog
95 virtual void SAL_CALL
setTitle( const OUString
& aTitle
) throw (::com::sun::star::uno::RuntimeException
);
96 virtual sal_Int16 SAL_CALL
execute( ) throw (::com::sun::star::uno::RuntimeException
);
98 // beans::XPropertySet
99 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
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
);
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
);
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
);
108 virtual void SAL_CALL
dispose() throw (::com::sun::star::uno::RuntimeException
);
109 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & xListener
) throw (::com::sun::star::uno::RuntimeException
);
110 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & xListener
) throw (::com::sun::star::uno::RuntimeException
);
113 //no default constructor
114 ChineseTranslation_UnoDialog();
116 void impl_DeleteDialog();
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
;
124 ChineseTranslationDialog
* m_pDialog
;
126 bool m_bDisposed
; ///Dispose call ready.
127 bool m_bInDispose
;///In dispose call
128 osl::Mutex m_aContainerMutex
;
129 cppu::OInterfaceContainerHelper m_aDisposeEventListeners
;
132 //.............................................................................
134 //.............................................................................
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */