Line data Source code
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_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
21 : #define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
22 :
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"
37 :
38 : class ResId;
39 :
40 : namespace dbp
41 : {
42 0 : struct OControlWizardSettings
43 : {
44 : OUString sControlLabel;
45 : };
46 :
47 : class OControlWizard;
48 : typedef ::svt::OWizardPage OControlWizardPage_Base;
49 : class OControlWizardPage : public OControlWizardPage_Base
50 : {
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;
58 :
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;
71 :
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);
81 :
82 : protected:
83 : void enableFormDatasourceDisplay();
84 :
85 : protected:
86 : // OWizardPage overridables
87 : virtual void initializePage() SAL_OVERRIDE;
88 : };
89 :
90 : struct OAccessRegulator;
91 :
92 : typedef ::svt::OWizardMachine OControlWizard_Base;
93 : class OControlWizard : public OControlWizard_Base
94 : {
95 : private:
96 : OControlWizardContext m_aContext;
97 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
98 : m_xContext;
99 :
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
105 : );
106 : virtual ~OControlWizard();
107 :
108 : // make the some base class methods public
109 0 : bool travelNext() { return OControlWizard_Base::travelNext(); }
110 :
111 : public:
112 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
113 0 : getComponentContext() const { return m_xContext; }
114 :
115 0 : 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;
120 :
121 : /** returns the com.sun.star.task.InteractionHandler
122 : @param _pWindow The window will be used when an error message has to be shown.
123 : */
124 : ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler(vcl::Window* _pWindow) const;
125 :
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);
132 :
133 : bool needDatasourceSelection();
134 :
135 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
136 : getFormConnection() const;
137 :
138 : virtual bool approveControl(sal_Int16 _nClassId) = 0;
139 :
140 : // ModalDialog overridables
141 : virtual short Execute() SAL_OVERRIDE;
142 :
143 : private:
144 : bool initContext();
145 :
146 : void implGetDSContext();
147 : void implDetermineForm();
148 : void implDeterminePage();
149 : void implDetermineShape();
150 :
151 : // made private. Not to be used by derived (or external) classes
152 : virtual void ActivatePage() SAL_OVERRIDE;
153 : };
154 :
155 :
156 : } // namespace dbp
157 :
158 :
159 : #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
160 :
161 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|