1*46dbaceeSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*46dbaceeSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*46dbaceeSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*46dbaceeSAndrew Rist * distributed with this work for additional information 6*46dbaceeSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*46dbaceeSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*46dbaceeSAndrew Rist * "License"); you may not use this file except in compliance 9*46dbaceeSAndrew Rist * with the License. You may obtain a copy of the License at 10*46dbaceeSAndrew Rist * 11*46dbaceeSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*46dbaceeSAndrew Rist * 13*46dbaceeSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*46dbaceeSAndrew Rist * software distributed under the License is distributed on an 15*46dbaceeSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*46dbaceeSAndrew Rist * KIND, either express or implied. See the License for the 17*46dbaceeSAndrew Rist * specific language governing permissions and limitations 18*46dbaceeSAndrew Rist * under the License. 19*46dbaceeSAndrew Rist * 20*46dbaceeSAndrew Rist *************************************************************/ 21*46dbaceeSAndrew Rist 22*46dbaceeSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_ 25cdf0e10cSrcweir #define _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "controlwizard.hxx" 28cdf0e10cSrcweir #include "commonpagesdbp.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir //......................................................................... 31cdf0e10cSrcweir namespace dbp 32cdf0e10cSrcweir { 33cdf0e10cSrcweir //......................................................................... 34cdf0e10cSrcweir 35cdf0e10cSrcweir #define LCW_STATE_DATASOURCE_SELECTION 0 36cdf0e10cSrcweir #define LCW_STATE_TABLESELECTION 1 37cdf0e10cSrcweir #define LCW_STATE_FIELDSELECTION 2 38cdf0e10cSrcweir #define LCW_STATE_FIELDLINK 3 39cdf0e10cSrcweir #define LCW_STATE_COMBODBFIELD 4 40cdf0e10cSrcweir 41cdf0e10cSrcweir //===================================================================== 42cdf0e10cSrcweir //= OListComboSettings 43cdf0e10cSrcweir //===================================================================== 44cdf0e10cSrcweir struct OListComboSettings : public OControlWizardSettings 45cdf0e10cSrcweir { 46cdf0e10cSrcweir String sListContentTable; 47cdf0e10cSrcweir String sListContentField; 48cdf0e10cSrcweir String sLinkedFormField; 49cdf0e10cSrcweir String sLinkedListField; 50cdf0e10cSrcweir }; 51cdf0e10cSrcweir 52cdf0e10cSrcweir //===================================================================== 53cdf0e10cSrcweir //= OListComboWizard 54cdf0e10cSrcweir //===================================================================== 55cdf0e10cSrcweir class OListComboWizard : public OControlWizard 56cdf0e10cSrcweir { 57cdf0e10cSrcweir protected: 58cdf0e10cSrcweir OListComboSettings m_aSettings; 59cdf0e10cSrcweir sal_Bool m_bListBox : 1; 60cdf0e10cSrcweir sal_Bool m_bHadDataSelection : 1; 61cdf0e10cSrcweir 62cdf0e10cSrcweir public: 63cdf0e10cSrcweir OListComboWizard( 64cdf0e10cSrcweir Window* _pParent, 65cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, 66cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB 67cdf0e10cSrcweir ); 68cdf0e10cSrcweir getSettings()69cdf0e10cSrcweir OListComboSettings& getSettings() { return m_aSettings; } 70cdf0e10cSrcweir isListBox() const71cdf0e10cSrcweir sal_Bool isListBox() const { return m_bListBox; } 72cdf0e10cSrcweir 73cdf0e10cSrcweir protected: 74cdf0e10cSrcweir // OWizardMachine overridables 75cdf0e10cSrcweir virtual ::svt::OWizardPage* createPage( WizardState _nState ); 76cdf0e10cSrcweir virtual WizardState determineNextState( WizardState _nCurrentState ) const; 77cdf0e10cSrcweir virtual void enterState( WizardState _nState ); 78cdf0e10cSrcweir virtual sal_Bool leaveState( WizardState _nState ); 79cdf0e10cSrcweir virtual sal_Bool onFinish(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir virtual sal_Bool approveControl(sal_Int16 _nClassId); 82cdf0e10cSrcweir getFinalState() const83cdf0e10cSrcweir WizardState getFinalState() const { return isListBox() ? LCW_STATE_FIELDLINK : LCW_STATE_COMBODBFIELD; } 84cdf0e10cSrcweir 85cdf0e10cSrcweir private: 86cdf0e10cSrcweir void implApplySettings(); 87cdf0e10cSrcweir }; 88cdf0e10cSrcweir 89cdf0e10cSrcweir //===================================================================== 90cdf0e10cSrcweir //= OLCPage 91cdf0e10cSrcweir //===================================================================== 92cdf0e10cSrcweir class OLCPage : public OControlWizardPage 93cdf0e10cSrcweir { 94cdf0e10cSrcweir public: OLCPage(OListComboWizard * _pParent,const ResId & _rId)95cdf0e10cSrcweir OLCPage( OListComboWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { } 96cdf0e10cSrcweir 97cdf0e10cSrcweir protected: getSettings()98cdf0e10cSrcweir OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); } isListBox()99cdf0e10cSrcweir sal_Bool isListBox() { return static_cast<OListComboWizard*>(getDialog())->isListBox(); } 100cdf0e10cSrcweir 101cdf0e10cSrcweir protected: 102cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > 103cdf0e10cSrcweir getTables(sal_Bool _bNeedIt); 104cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > 105cdf0e10cSrcweir getTableFields(sal_Bool _bNeedIt); 106cdf0e10cSrcweir }; 107cdf0e10cSrcweir 108cdf0e10cSrcweir //===================================================================== 109cdf0e10cSrcweir //= OContentTableSelection 110cdf0e10cSrcweir //===================================================================== 111cdf0e10cSrcweir class OContentTableSelection : public OLCPage 112cdf0e10cSrcweir { 113cdf0e10cSrcweir protected: 114cdf0e10cSrcweir FixedLine m_aFrame; 115cdf0e10cSrcweir FixedText m_aSelectTableLabel; 116cdf0e10cSrcweir ListBox m_aSelectTable; 117cdf0e10cSrcweir 118cdf0e10cSrcweir public: 119cdf0e10cSrcweir OContentTableSelection( OListComboWizard* _pParent ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir protected: 122cdf0e10cSrcweir // TabPage overridables 123cdf0e10cSrcweir virtual void ActivatePage(); 124cdf0e10cSrcweir 125cdf0e10cSrcweir // OWizardPage overridables 126cdf0e10cSrcweir virtual void initializePage(); 127cdf0e10cSrcweir virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); 128cdf0e10cSrcweir virtual bool canAdvance() const; 129cdf0e10cSrcweir 130cdf0e10cSrcweir protected: 131cdf0e10cSrcweir DECL_LINK( OnTableDoubleClicked, ListBox* ); 132cdf0e10cSrcweir DECL_LINK( OnTableSelected, ListBox* ); 133cdf0e10cSrcweir }; 134cdf0e10cSrcweir 135cdf0e10cSrcweir //===================================================================== 136cdf0e10cSrcweir //= OContentFieldSelection 137cdf0e10cSrcweir //===================================================================== 138cdf0e10cSrcweir class OContentFieldSelection : public OLCPage 139cdf0e10cSrcweir { 140cdf0e10cSrcweir protected: 141cdf0e10cSrcweir FixedLine m_aFrame; 142cdf0e10cSrcweir FixedText m_aTableFields; 143cdf0e10cSrcweir ListBox m_aSelectTableField; 144cdf0e10cSrcweir FixedText m_aDisplayedFieldLabel; 145cdf0e10cSrcweir Edit m_aDisplayedField; 146cdf0e10cSrcweir FixedText m_aInfo; 147cdf0e10cSrcweir 148cdf0e10cSrcweir 149cdf0e10cSrcweir public: 150cdf0e10cSrcweir OContentFieldSelection( OListComboWizard* _pParent ); 151cdf0e10cSrcweir 152cdf0e10cSrcweir protected: 153cdf0e10cSrcweir DECL_LINK( OnFieldSelected, ListBox* ); 154cdf0e10cSrcweir DECL_LINK( OnTableDoubleClicked, ListBox* ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir // TabPage overridables 157cdf0e10cSrcweir virtual void ActivatePage(); 158cdf0e10cSrcweir 159cdf0e10cSrcweir // OWizardPage overridables 160cdf0e10cSrcweir virtual void initializePage(); 161cdf0e10cSrcweir virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); 162cdf0e10cSrcweir virtual bool canAdvance() const; 163cdf0e10cSrcweir }; 164cdf0e10cSrcweir 165cdf0e10cSrcweir //===================================================================== 166cdf0e10cSrcweir //= OLinkFieldsPage 167cdf0e10cSrcweir //===================================================================== 168cdf0e10cSrcweir class OLinkFieldsPage : public OLCPage 169cdf0e10cSrcweir { 170cdf0e10cSrcweir protected: 171cdf0e10cSrcweir FixedText m_aDescription; 172cdf0e10cSrcweir FixedLine m_aFrame; 173cdf0e10cSrcweir FixedText m_aValueListFieldLabel; 174cdf0e10cSrcweir ComboBox m_aValueListField; 175cdf0e10cSrcweir FixedText m_aTableFieldLabel; 176cdf0e10cSrcweir ComboBox m_aTableField; 177cdf0e10cSrcweir 178cdf0e10cSrcweir 179cdf0e10cSrcweir public: 180cdf0e10cSrcweir OLinkFieldsPage( OListComboWizard* _pParent ); 181cdf0e10cSrcweir 182cdf0e10cSrcweir protected: 183cdf0e10cSrcweir // TabPage overridables 184cdf0e10cSrcweir virtual void ActivatePage(); 185cdf0e10cSrcweir 186cdf0e10cSrcweir // OWizardPage overridables 187cdf0e10cSrcweir virtual void initializePage(); 188cdf0e10cSrcweir virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); 189cdf0e10cSrcweir virtual bool canAdvance() const; 190cdf0e10cSrcweir 191cdf0e10cSrcweir private: 192cdf0e10cSrcweir void implCheckFinish(); 193cdf0e10cSrcweir 194cdf0e10cSrcweir DECL_LINK(OnSelectionModified, void*); 195cdf0e10cSrcweir }; 196cdf0e10cSrcweir 197cdf0e10cSrcweir //===================================================================== 198cdf0e10cSrcweir //= OComboDBFieldPage 199cdf0e10cSrcweir //===================================================================== 200cdf0e10cSrcweir class OComboDBFieldPage : public ODBFieldPage 201cdf0e10cSrcweir { 202cdf0e10cSrcweir public: 203cdf0e10cSrcweir OComboDBFieldPage( OControlWizard* _pParent ); 204cdf0e10cSrcweir 205cdf0e10cSrcweir protected: getSettings()206cdf0e10cSrcweir OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); } 207cdf0e10cSrcweir 208cdf0e10cSrcweir // TabPage overridables 209cdf0e10cSrcweir virtual void ActivatePage(); 210cdf0e10cSrcweir 211cdf0e10cSrcweir // OWizardPage overridables 212cdf0e10cSrcweir virtual bool canAdvance() const; 213cdf0e10cSrcweir 214cdf0e10cSrcweir // ODBFieldPage overridables 215cdf0e10cSrcweir virtual String& getDBFieldSetting(); 216cdf0e10cSrcweir }; 217cdf0e10cSrcweir 218cdf0e10cSrcweir //......................................................................... 219cdf0e10cSrcweir } // namespace dbp 220cdf0e10cSrcweir //......................................................................... 221cdf0e10cSrcweir 222cdf0e10cSrcweir #endif // _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_ 223cdf0e10cSrcweir 224