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 .
22 #include <com/sun/star/awt/XWindow.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/lang/XInitialization.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <comphelper/interfacecontainer2.hxx>
31 namespace textconversiondlgs
35 /** This class provides the chinese translation dialog as a uno component.
37 It can be created via lang::XMultiComponentFactory::createInstanceWithContext
38 with servicename "com.sun.star.linguistic2.ChineseTranslationDialog"
39 or implementation name "com.sun.star.comp.linguistic2.ChineseTranslationDialog"
41 It can be initialized via the XInitialization interface with the following single parameter:
42 PropertyValue-Parameter: Name="ParentWindow" Type="awt::XWindow".
44 It can be executed via the ui::dialogs::XExecutableDialog interface.
46 Made settings can be retrieved via beans::XPropertySet interface.
47 Following properties are available (read only and not bound):
48 1) Name="IsDirectionToSimplified" Type="sal_Bool"
49 2) Name="IsUseCharacterVariants" Type="sal_Bool"
50 3) Name="IsTranslateCommonTerms" Type="sal_Bool"
52 The dialog gets this information from the registry on execute and writes it back to the registry if ended with OK.
55 class ChineseTranslationDialog
;
57 class ChineseTranslation_UnoDialog
: public ::cppu::WeakImplHelper
<
58 css::ui::dialogs::XExecutableDialog
59 , css::lang::XInitialization
60 , css::beans::XPropertySet
61 , css::lang::XComponent
62 , css::lang::XServiceInfo
66 ChineseTranslation_UnoDialog();
67 virtual ~ChineseTranslation_UnoDialog() override
;
70 virtual OUString SAL_CALL
getImplementationName() override
;
71 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
72 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
74 // lang::XInitialization
75 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
77 // ui::dialogs::XExecutableDialog
78 virtual void SAL_CALL
setTitle( const OUString
& aTitle
) override
;
79 virtual sal_Int16 SAL_CALL
execute( ) override
;
81 // beans::XPropertySet
82 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
83 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
84 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
85 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
86 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
87 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
88 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
91 virtual void SAL_CALL
dispose() override
;
92 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
93 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
97 void impl_DeleteDialog();
101 css::awt::XWindow
> m_xParentWindow
;
103 std::unique_ptr
<ChineseTranslationDialog
> m_xDialog
;
105 bool m_bDisposed
; ///Dispose call ready.
106 bool m_bInDispose
;///In dispose call
107 osl::Mutex m_aContainerMutex
;
108 comphelper::OInterfaceContainerHelper2 m_aDisposeEventListeners
;
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */