bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / dbpilots / controlwizard.hxx
blob413f5f3b6984db75ec2759e23271ba3c72cf9d9a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
23 #include <svtools/wizardmachine.hxx>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/form/FormComponentType.hpp>
26 #include <com/sun/star/sdbc/XConnection.hpp>
27 #include <com/sun/star/task/XInteractionHandler.hpp>
28 #include <vcl/fixed.hxx>
29 #include <vcl/edit.hxx>
30 #include <vcl/button.hxx>
31 #include <vcl/lstbox.hxx>
32 #include <vcl/combobox.hxx>
33 #include "dbptypes.hxx"
34 #include "dbpresid.hrc"
35 #include "componentmodule.hxx"
36 #include "wizardcontext.hxx"
38 class ResId;
40 namespace dbp
42 struct OControlWizardSettings
44 OUString sControlLabel;
47 class OControlWizard;
48 typedef ::svt::OWizardPage OControlWizardPage_Base;
49 class OControlWizardPage : public OControlWizardPage_Base
51 protected:
52 VclPtr<FixedText> m_pFormDatasourceLabel;
53 VclPtr<FixedText> m_pFormDatasource;
54 VclPtr<FixedText> m_pFormContentTypeLabel;
55 VclPtr<FixedText> m_pFormContentType;
56 VclPtr<FixedText> m_pFormTableLabel;
57 VclPtr<FixedText> m_pFormTable;
59 protected:
60 OControlWizard* getDialog();
61 const OControlWizard* getDialog() const;
62 const OControlWizardContext& getContext();
63 bool updateContext();
64 void setFormConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, bool _bAutoDispose = true );
65 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
66 getFormConnection() const;
67 public:
68 OControlWizardPage( OControlWizard* _pParent, const OString& rID, const OUString& rUIXMLDescription );
69 virtual ~OControlWizardPage();
70 virtual void dispose() SAL_OVERRIDE;
72 protected:
73 static void fillListBox(
74 ListBox& _rList,
75 const ::com::sun::star::uno::Sequence< OUString >& _rItems,
76 bool _bClear = true);
77 static void fillListBox(
78 ComboBox& _rList,
79 const ::com::sun::star::uno::Sequence< OUString >& _rItems,
80 bool _bClear = true);
82 protected:
83 void enableFormDatasourceDisplay();
85 protected:
86 // OWizardPage overridables
87 virtual void initializePage() SAL_OVERRIDE;
90 struct OAccessRegulator;
92 typedef ::svt::OWizardMachine OControlWizard_Base;
93 class OControlWizard : public OControlWizard_Base
95 private:
96 OControlWizardContext m_aContext;
97 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
98 m_xContext;
100 public:
101 OControlWizard(
102 vcl::Window* _pParent,
103 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
104 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
106 virtual ~OControlWizard();
108 // make the some base class methods public
109 bool travelNext() { return OControlWizard_Base::travelNext(); }
111 public:
112 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
113 getComponentContext() const { return m_xContext; }
115 const OControlWizardContext& getContext() const { return m_aContext; }
116 bool updateContext(const OAccessRegulator&);
117 void setFormConnection(const OAccessRegulator&, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, bool _bAutoDispose = true );
118 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
119 getFormConnection(const OAccessRegulator&) const;
121 /** returns the com.sun.star.task.InteractionHandler
122 @param _pWindow The window will be used when an error message has to be shown.
124 ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler(vcl::Window* _pWindow) const;
126 protected:
127 // initialize the derivees settings (which have to be derived from OControlWizardSettings)
128 // with some common data extracted from the control model
129 void initControlSettings(OControlWizardSettings* _pSettings);
130 // commit the control-relevant settings
131 void commitControlSettings(OControlWizardSettings* _pSettings);
133 bool needDatasourceSelection();
135 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
136 getFormConnection() const;
138 virtual bool approveControl(sal_Int16 _nClassId) = 0;
140 // ModalDialog overridables
141 virtual short Execute() SAL_OVERRIDE;
143 private:
144 bool initContext();
146 void implGetDSContext();
147 void implDetermineForm();
148 void implDeterminePage();
149 void implDetermineShape();
151 // made private. Not to be used by derived (or external) classes
152 virtual void ActivatePage() SAL_OVERRIDE;
156 } // namespace dbp
159 #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */