1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _EXTENSIONS_DBP_CONTROLWIZARD_HXX 29*cdf0e10cSrcweir #define _EXTENSIONS_DBP_CONTROLWIZARD_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <svtools/wizardmachine.hxx> 32*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/form/FormComponentType.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp> 36*cdf0e10cSrcweir #include <vcl/fixed.hxx> 37*cdf0e10cSrcweir #include <vcl/edit.hxx> 38*cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX 39*cdf0e10cSrcweir #include <vcl/button.hxx> 40*cdf0e10cSrcweir #endif 41*cdf0e10cSrcweir #include <vcl/lstbox.hxx> 42*cdf0e10cSrcweir #include <vcl/combobox.hxx> 43*cdf0e10cSrcweir #include "dbptypes.hxx" 44*cdf0e10cSrcweir #ifndef _EXTENSIONS_DBP_DBPRESID_HRC_ 45*cdf0e10cSrcweir #include "dbpresid.hrc" 46*cdf0e10cSrcweir #endif 47*cdf0e10cSrcweir #include "componentmodule.hxx" 48*cdf0e10cSrcweir #include "wizardcontext.hxx" 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir class ResId; 51*cdf0e10cSrcweir //......................................................................... 52*cdf0e10cSrcweir namespace dbp 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir //......................................................................... 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir //===================================================================== 57*cdf0e10cSrcweir //= OControlWizardSettings 58*cdf0e10cSrcweir //===================================================================== 59*cdf0e10cSrcweir struct OControlWizardSettings 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir String sControlLabel; 62*cdf0e10cSrcweir }; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir //===================================================================== 65*cdf0e10cSrcweir //= OControlWizardPage 66*cdf0e10cSrcweir //===================================================================== 67*cdf0e10cSrcweir class OControlWizard; 68*cdf0e10cSrcweir typedef ::svt::OWizardPage OControlWizardPage_Base; 69*cdf0e10cSrcweir class OControlWizardPage : public OControlWizardPage_Base 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir protected: 72*cdf0e10cSrcweir FixedLine* m_pFormSettingsSeparator; 73*cdf0e10cSrcweir FixedText* m_pFormDatasourceLabel; 74*cdf0e10cSrcweir FixedText* m_pFormDatasource; 75*cdf0e10cSrcweir FixedText* m_pFormContentTypeLabel; 76*cdf0e10cSrcweir FixedText* m_pFormContentType; 77*cdf0e10cSrcweir FixedText* m_pFormTableLabel; 78*cdf0e10cSrcweir FixedText* m_pFormTable; 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir protected: 81*cdf0e10cSrcweir OControlWizard* getDialog(); 82*cdf0e10cSrcweir const OControlWizard* getDialog() const; 83*cdf0e10cSrcweir const OControlWizardContext& getContext(); 84*cdf0e10cSrcweir sal_Bool updateContext(); 85*cdf0e10cSrcweir void setFormConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, sal_Bool _bAutoDispose = sal_True ); 86*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > 87*cdf0e10cSrcweir getFormConnection() const; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir public: 90*cdf0e10cSrcweir OControlWizardPage( OControlWizard* _pParent, const ResId& _rResId ); 91*cdf0e10cSrcweir ~OControlWizardPage(); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir protected: 94*cdf0e10cSrcweir void fillListBox( 95*cdf0e10cSrcweir ListBox& _rList, 96*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rItems, 97*cdf0e10cSrcweir sal_Bool _bClear = sal_True); 98*cdf0e10cSrcweir void fillListBox( 99*cdf0e10cSrcweir ComboBox& _rList, 100*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rItems, 101*cdf0e10cSrcweir sal_Bool _bClear = sal_True); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir protected: 104*cdf0e10cSrcweir void enableFormDatasourceDisplay(); 105*cdf0e10cSrcweir void adjustControlForNoDSDisplay(Control* _pControl, sal_Bool bConstLowerDistance = sal_False); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir protected: 108*cdf0e10cSrcweir // OWizardPage overridables 109*cdf0e10cSrcweir virtual void initializePage(); 110*cdf0e10cSrcweir }; 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir struct OAccessRegulator; 113*cdf0e10cSrcweir //===================================================================== 114*cdf0e10cSrcweir //= OControlWizard 115*cdf0e10cSrcweir //===================================================================== 116*cdf0e10cSrcweir typedef ::svt::OWizardMachine OControlWizard_Base; 117*cdf0e10cSrcweir class OControlWizard : public OControlWizard_Base 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir private: 120*cdf0e10cSrcweir OControlWizardContext m_aContext; 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir protected: 123*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 124*cdf0e10cSrcweir m_xORB; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir public: 127*cdf0e10cSrcweir OControlWizard( 128*cdf0e10cSrcweir Window* _pParent, 129*cdf0e10cSrcweir const ResId& _rId, 130*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, 131*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB 132*cdf0e10cSrcweir ); 133*cdf0e10cSrcweir ~OControlWizard(); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir // make the some base class methods public 136*cdf0e10cSrcweir sal_Bool travelNext() { return OControlWizard_Base::travelNext(); } 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir public: 139*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 140*cdf0e10cSrcweir getServiceFactory() const { return m_xORB; } 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir const OControlWizardContext& getContext() const { return m_aContext; } 143*cdf0e10cSrcweir sal_Bool updateContext(const OAccessRegulator&); 144*cdf0e10cSrcweir void setFormConnection(const OAccessRegulator&, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, sal_Bool _bAutoDispose = sal_True ); 145*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > 146*cdf0e10cSrcweir getFormConnection(const OAccessRegulator&) const; 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir /** returns the com.sun.star.task.InteractionHandler 149*cdf0e10cSrcweir @param _pWindow The window will be used when an error message has to be shown. 150*cdf0e10cSrcweir */ 151*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler(Window* _pWindow) const; 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir protected: 154*cdf0e10cSrcweir // initialize the derivees settings (which have to be derived from OControlWizardSettings) 155*cdf0e10cSrcweir // with some common data extracted from the control model 156*cdf0e10cSrcweir void initControlSettings(OControlWizardSettings* _pSettings); 157*cdf0e10cSrcweir // commit the control-relevant settings 158*cdf0e10cSrcweir void commitControlSettings(OControlWizardSettings* _pSettings); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir sal_Bool needDatasourceSelection(); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > 163*cdf0e10cSrcweir getFormConnection() const; 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir virtual sal_Bool approveControl(sal_Int16 _nClassId) = 0; 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir // ModalDialog overridables 168*cdf0e10cSrcweir virtual short Execute(); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir private: 171*cdf0e10cSrcweir sal_Bool initContext(); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir void implGetDSContext(); 174*cdf0e10cSrcweir void implDetermineForm(); 175*cdf0e10cSrcweir void implDeterminePage(); 176*cdf0e10cSrcweir void implDetermineShape(); 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir // made private. Not to be used by derived (or external) classes 179*cdf0e10cSrcweir virtual void ActivatePage(); 180*cdf0e10cSrcweir }; 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir //......................................................................... 183*cdf0e10cSrcweir } // namespace dbp 184*cdf0e10cSrcweir //......................................................................... 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir #endif // _EXTENSIONS_DBP_CONTROLWIZARD_HXX 187*cdf0e10cSrcweir 188