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_LISTCOMBOWIZARD_HXX_ 29*cdf0e10cSrcweir #define _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "controlwizard.hxx" 32*cdf0e10cSrcweir #include "commonpagesdbp.hxx" 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir //......................................................................... 35*cdf0e10cSrcweir namespace dbp 36*cdf0e10cSrcweir { 37*cdf0e10cSrcweir //......................................................................... 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #define LCW_STATE_DATASOURCE_SELECTION 0 40*cdf0e10cSrcweir #define LCW_STATE_TABLESELECTION 1 41*cdf0e10cSrcweir #define LCW_STATE_FIELDSELECTION 2 42*cdf0e10cSrcweir #define LCW_STATE_FIELDLINK 3 43*cdf0e10cSrcweir #define LCW_STATE_COMBODBFIELD 4 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir //===================================================================== 46*cdf0e10cSrcweir //= OListComboSettings 47*cdf0e10cSrcweir //===================================================================== 48*cdf0e10cSrcweir struct OListComboSettings : public OControlWizardSettings 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir String sListContentTable; 51*cdf0e10cSrcweir String sListContentField; 52*cdf0e10cSrcweir String sLinkedFormField; 53*cdf0e10cSrcweir String sLinkedListField; 54*cdf0e10cSrcweir }; 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir //===================================================================== 57*cdf0e10cSrcweir //= OListComboWizard 58*cdf0e10cSrcweir //===================================================================== 59*cdf0e10cSrcweir class OListComboWizard : public OControlWizard 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir protected: 62*cdf0e10cSrcweir OListComboSettings m_aSettings; 63*cdf0e10cSrcweir sal_Bool m_bListBox : 1; 64*cdf0e10cSrcweir sal_Bool m_bHadDataSelection : 1; 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir public: 67*cdf0e10cSrcweir OListComboWizard( 68*cdf0e10cSrcweir Window* _pParent, 69*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, 70*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB 71*cdf0e10cSrcweir ); 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir OListComboSettings& getSettings() { return m_aSettings; } 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir sal_Bool isListBox() const { return m_bListBox; } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir protected: 78*cdf0e10cSrcweir // OWizardMachine overridables 79*cdf0e10cSrcweir virtual ::svt::OWizardPage* createPage( WizardState _nState ); 80*cdf0e10cSrcweir virtual WizardState determineNextState( WizardState _nCurrentState ) const; 81*cdf0e10cSrcweir virtual void enterState( WizardState _nState ); 82*cdf0e10cSrcweir virtual sal_Bool leaveState( WizardState _nState ); 83*cdf0e10cSrcweir virtual sal_Bool onFinish(); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir virtual sal_Bool approveControl(sal_Int16 _nClassId); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir WizardState getFinalState() const { return isListBox() ? LCW_STATE_FIELDLINK : LCW_STATE_COMBODBFIELD; } 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir private: 90*cdf0e10cSrcweir void implApplySettings(); 91*cdf0e10cSrcweir }; 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir //===================================================================== 94*cdf0e10cSrcweir //= OLCPage 95*cdf0e10cSrcweir //===================================================================== 96*cdf0e10cSrcweir class OLCPage : public OControlWizardPage 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir public: 99*cdf0e10cSrcweir OLCPage( OListComboWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { } 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir protected: 102*cdf0e10cSrcweir OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); } 103*cdf0e10cSrcweir sal_Bool isListBox() { return static_cast<OListComboWizard*>(getDialog())->isListBox(); } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir protected: 106*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > 107*cdf0e10cSrcweir getTables(sal_Bool _bNeedIt); 108*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > 109*cdf0e10cSrcweir getTableFields(sal_Bool _bNeedIt); 110*cdf0e10cSrcweir }; 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir //===================================================================== 113*cdf0e10cSrcweir //= OContentTableSelection 114*cdf0e10cSrcweir //===================================================================== 115*cdf0e10cSrcweir class OContentTableSelection : public OLCPage 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir protected: 118*cdf0e10cSrcweir FixedLine m_aFrame; 119*cdf0e10cSrcweir FixedText m_aSelectTableLabel; 120*cdf0e10cSrcweir ListBox m_aSelectTable; 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir public: 123*cdf0e10cSrcweir OContentTableSelection( OListComboWizard* _pParent ); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir protected: 126*cdf0e10cSrcweir // TabPage overridables 127*cdf0e10cSrcweir virtual void ActivatePage(); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir // OWizardPage overridables 130*cdf0e10cSrcweir virtual void initializePage(); 131*cdf0e10cSrcweir virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); 132*cdf0e10cSrcweir virtual bool canAdvance() const; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir protected: 135*cdf0e10cSrcweir DECL_LINK( OnTableDoubleClicked, ListBox* ); 136*cdf0e10cSrcweir DECL_LINK( OnTableSelected, ListBox* ); 137*cdf0e10cSrcweir }; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir //===================================================================== 140*cdf0e10cSrcweir //= OContentFieldSelection 141*cdf0e10cSrcweir //===================================================================== 142*cdf0e10cSrcweir class OContentFieldSelection : public OLCPage 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir protected: 145*cdf0e10cSrcweir FixedLine m_aFrame; 146*cdf0e10cSrcweir FixedText m_aTableFields; 147*cdf0e10cSrcweir ListBox m_aSelectTableField; 148*cdf0e10cSrcweir FixedText m_aDisplayedFieldLabel; 149*cdf0e10cSrcweir Edit m_aDisplayedField; 150*cdf0e10cSrcweir FixedText m_aInfo; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir public: 154*cdf0e10cSrcweir OContentFieldSelection( OListComboWizard* _pParent ); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir protected: 157*cdf0e10cSrcweir DECL_LINK( OnFieldSelected, ListBox* ); 158*cdf0e10cSrcweir DECL_LINK( OnTableDoubleClicked, ListBox* ); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir // TabPage overridables 161*cdf0e10cSrcweir virtual void ActivatePage(); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir // OWizardPage overridables 164*cdf0e10cSrcweir virtual void initializePage(); 165*cdf0e10cSrcweir virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); 166*cdf0e10cSrcweir virtual bool canAdvance() const; 167*cdf0e10cSrcweir }; 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir //===================================================================== 170*cdf0e10cSrcweir //= OLinkFieldsPage 171*cdf0e10cSrcweir //===================================================================== 172*cdf0e10cSrcweir class OLinkFieldsPage : public OLCPage 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir protected: 175*cdf0e10cSrcweir FixedText m_aDescription; 176*cdf0e10cSrcweir FixedLine m_aFrame; 177*cdf0e10cSrcweir FixedText m_aValueListFieldLabel; 178*cdf0e10cSrcweir ComboBox m_aValueListField; 179*cdf0e10cSrcweir FixedText m_aTableFieldLabel; 180*cdf0e10cSrcweir ComboBox m_aTableField; 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir public: 184*cdf0e10cSrcweir OLinkFieldsPage( OListComboWizard* _pParent ); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir protected: 187*cdf0e10cSrcweir // TabPage overridables 188*cdf0e10cSrcweir virtual void ActivatePage(); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir // OWizardPage overridables 191*cdf0e10cSrcweir virtual void initializePage(); 192*cdf0e10cSrcweir virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); 193*cdf0e10cSrcweir virtual bool canAdvance() const; 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir private: 196*cdf0e10cSrcweir void implCheckFinish(); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir DECL_LINK(OnSelectionModified, void*); 199*cdf0e10cSrcweir }; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir //===================================================================== 202*cdf0e10cSrcweir //= OComboDBFieldPage 203*cdf0e10cSrcweir //===================================================================== 204*cdf0e10cSrcweir class OComboDBFieldPage : public ODBFieldPage 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir public: 207*cdf0e10cSrcweir OComboDBFieldPage( OControlWizard* _pParent ); 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir protected: 210*cdf0e10cSrcweir OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); } 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir // TabPage overridables 213*cdf0e10cSrcweir virtual void ActivatePage(); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir // OWizardPage overridables 216*cdf0e10cSrcweir virtual bool canAdvance() const; 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir // ODBFieldPage overridables 219*cdf0e10cSrcweir virtual String& getDBFieldSetting(); 220*cdf0e10cSrcweir }; 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir //......................................................................... 223*cdf0e10cSrcweir } // namespace dbp 224*cdf0e10cSrcweir //......................................................................... 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir #endif // _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_ 227*cdf0e10cSrcweir 228