1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_UNO_HXX
21 #define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_UNO_HXX
22 
23 #include <MutexContainer.hxx>
24 #include <cppuhelper/component.hxx>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/frame/XTerminateListener.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 
31 #include <tools/link.hxx>
32 #include <vcl/vclptr.hxx>
33 #include "dlg_CreationWizard.hxx"
34 
35 namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } }
36 namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
37 namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
38 
39 class VclWindowEvent;
40 
41 namespace chart
42 {
43 
44 class CreationWizardUnoDlg : public MutexContainer
45                             , public ::cppu::OComponentHelper
46                             , public css::ui::dialogs::XExecutableDialog
47                             , public css::lang::XServiceInfo
48                             , public css::lang::XInitialization
49                             , public css::frame::XTerminateListener
50                             , public css::beans::XPropertySet
51 {
52 public:
53     CreationWizardUnoDlg() = delete;
54 
55     CreationWizardUnoDlg( const css::uno::Reference< css::uno::XComponentContext >& xContext );
56     virtual ~CreationWizardUnoDlg() override;
57 
58     // XInterface
59     virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
60     virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) override;
61     virtual void SAL_CALL acquire() throw () override;
62     virtual void SAL_CALL release() throw () override;
63 
64     // XTypeProvider
65     virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  ) override;
66     virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) override;
67 
68     // XServiceInfo
69     virtual OUString SAL_CALL getImplementationName() override;
70     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
71     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
72 
73     // XExecutableDialog
74     virtual void SAL_CALL setTitle( const OUString& aTitle ) override;
75     virtual sal_Int16 SAL_CALL execute(  ) override;
76 
77     // XInitialization
78     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
79 
80     // XTerminateListener
81     virtual void SAL_CALL queryTermination( const css::lang::EventObject& Event ) override;
82     virtual void SAL_CALL notifyTermination( const css::lang::EventObject& Event ) override;
83 
84     virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
85 
86     //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;
94 
95 protected:
96     // ____ OComponentHelper ____
97     /// Called in dispose method after the listeners were notified.
98     virtual void SAL_CALL disposing() override;
99 
100 private:
101     void createDialogOnDemand();
102 
103 private:
104     css::uno::Reference< css::frame::XModel >            m_xChartModel;
105     css::uno::Reference< css::uno::XComponentContext>    m_xCC;
106     css::uno::Reference< css::awt::XWindow >             m_xParentWindow;
107 
108     std::unique_ptr<CreationWizard> m_xDialog;
109     bool            m_bUnlockControllersOnExecute;
110 };
111 
112 } //namespace chart
113 #endif
114 
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
116