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 <sal/config.h>
26 #include <com/sun/star/awt/XWindow.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/lang/XInitialization.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
31 #include <cppuhelper/implbase.hxx>
32 #include <comphelper/interfacecontainer4.hxx>
36 namespace textconversiondlgs
40 /** This class provides the chinese translation dialog as a uno component.
42 It can be created via lang::XMultiComponentFactory::createInstanceWithContext
43 with servicename "com.sun.star.linguistic2.ChineseTranslationDialog"
44 or implementation name "com.sun.star.comp.linguistic2.ChineseTranslationDialog"
46 It can be initialized via the XInitialization interface with the following single parameter:
47 PropertyValue-Parameter: Name="ParentWindow" Type="awt::XWindow".
49 It can be executed via the ui::dialogs::XExecutableDialog interface.
51 Made settings can be retrieved via beans::XPropertySet interface.
52 Following properties are available (read only and not bound):
53 1) Name="IsDirectionToSimplified" Type="sal_Bool"
54 2) Name="IsUseCharacterVariants" Type="sal_Bool"
55 3) Name="IsTranslateCommonTerms" Type="sal_Bool"
57 The dialog gets this information from the registry on execute and writes it back to the registry if ended with OK.
60 class ChineseTranslationDialog
;
62 class ChineseTranslation_UnoDialog
: public ::cppu::WeakImplHelper
<
63 css::ui::dialogs::XExecutableDialog
64 , css::lang::XInitialization
65 , css::beans::XPropertySet
66 , css::lang::XComponent
67 , css::lang::XServiceInfo
71 ChineseTranslation_UnoDialog();
72 virtual ~ChineseTranslation_UnoDialog() override
;
75 virtual OUString SAL_CALL
getImplementationName() override
;
76 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
77 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
79 // lang::XInitialization
80 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
82 // ui::dialogs::XExecutableDialog
83 virtual void SAL_CALL
setTitle( const OUString
& aTitle
) override
;
84 virtual sal_Int16 SAL_CALL
execute( ) override
;
86 // beans::XPropertySet
87 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
88 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
89 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
90 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
91 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
92 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
93 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
96 virtual void SAL_CALL
dispose() override
;
97 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
98 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
102 void impl_DeleteDialog();
106 css::awt::XWindow
> m_xParentWindow
;
108 std::unique_ptr
<ChineseTranslationDialog
> m_xDialog
;
110 bool m_bDisposed
; ///Dispose call ready.
111 bool m_bInDispose
;///In dispose call
112 std::mutex m_aContainerMutex
;
113 comphelper::OInterfaceContainerHelper4
<css::lang::XEventListener
> m_aDisposeEventListeners
;
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */