From 46d0d1ebfa4623291b55d95f97e150e7a445b107 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 25 May 2010 10:17:24 +0200 Subject: unoawt: completely separated the controller functionality of a wizard page from the wizard page itself, by moving the canAdvance method from OWizardPage to the IWizardPage interface, which in this course has been renamed to IWizardPageController. This will later on allow to have implementations where the TabPage is provided by an external component (e.g. as UNO Service), but the controlling of those pages is still intercepted and handled internally. --- dbaccess/source/ext/macromigration/macromigrationpages.cxx | 4 ++-- dbaccess/source/ext/macromigration/macromigrationpages.hxx | 9 ++++----- dbaccess/source/ui/dlg/ConnectionPageSetup.cxx | 2 +- dbaccess/source/ui/dlg/ConnectionPageSetup.hxx | 2 +- dbaccess/source/ui/dlg/adminpages.cxx | 7 ++++++- dbaccess/source/ui/dlg/adminpages.hxx | 8 +++++--- dbaccess/source/ui/dlg/dbwiz.cxx | 2 +- dbaccess/source/ui/dlg/dbwizsetup.cxx | 2 +- dbaccess/source/ui/inc/dbwiz.hxx | 5 +++-- dbaccess/source/ui/inc/dbwizsetup.hxx | 2 +- 10 files changed, 25 insertions(+), 18 deletions(-) diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.cxx b/dbaccess/source/ext/macromigration/macromigrationpages.cxx index 251fa3df5..653070683 100644 --- a/dbaccess/source/ext/macromigration/macromigrationpages.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationpages.cxx @@ -188,12 +188,12 @@ namespace dbmm } //-------------------------------------------------------------------- - sal_Bool SaveDBDocPage::commitPage( CommitPageReason _eReason ) + sal_Bool SaveDBDocPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if ( !MacroMigrationPage::commitPage( _eReason ) ) return sal_False; - if ( eTravelBackward == _eReason ) + if ( ::svt::WizardTypes::eTravelBackward == _eReason ) return sal_True; if ( !m_aLocationController.prepareCommit() ) diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.hxx b/dbaccess/source/ext/macromigration/macromigrationpages.hxx index 8836a595b..321c2c76a 100644 --- a/dbaccess/source/ext/macromigration/macromigrationpages.hxx +++ b/dbaccess/source/ext/macromigration/macromigrationpages.hxx @@ -109,11 +109,10 @@ namespace dbmm m_aLocationController; protected: - // OWizardPage overridables - virtual void initializePage(); - virtual bool canAdvance() const; - // IWizardPage overridables - virtual sal_Bool commitPage( CommitPageReason _eReason ); + // IWizardPageController overridables + virtual void initializePage(); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); + virtual bool canAdvance() const; private: DECL_LINK( OnLocationModified, Edit* ); diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx index 4561371ae..632ffa2f6 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx @@ -289,7 +289,7 @@ namespace dbaui callModifiedHdl(); } // ----------------------------------------------------------------------- - sal_Bool OConnectionTabPageSetup::commitPage( CommitPageReason /*_eReason*/ ) + sal_Bool OConnectionTabPageSetup::commitPage( ::svt::WizardTypes::CommitPageReason /*_eReason*/ ) { return commitURL(); } diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx index 874c4dc61..487015ade 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx @@ -89,7 +89,7 @@ namespace dbaui virtual BOOL FillItemSet (SfxItemSet& _rCoreAttrs); virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); inline void enableConnectionURL() { m_aConnectionURL.SetReadOnly(sal_False); } diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx index f884f1450..21689d2d7 100644 --- a/dbaccess/source/ui/dlg/adminpages.cxx +++ b/dbaccess/source/ui/dlg/adminpages.cxx @@ -201,11 +201,16 @@ namespace dbaui Reset(*m_pItemSetHelper->getOutputSet()); } // ----------------------------------------------------------------------- - sal_Bool OGenericAdministrationPage::commitPage( CommitPageReason ) + sal_Bool OGenericAdministrationPage::commitPage( ::svt::WizardTypes::CommitPageReason ) { return sal_True; } // ----------------------------------------------------------------------- + bool OGenericAdministrationPage::canAdvance() const + { + return true; + } + // ----------------------------------------------------------------------- void OGenericAdministrationPage::fillBool( SfxItemSet& _rSet, CheckBox* _pCheckBox, USHORT _nID, sal_Bool& _bChangedSomething, bool _bRevertValue ) { if ( (_pCheckBox != NULL ) && ( _pCheckBox->GetState() != _pCheckBox->GetSavedValue() ) ) diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx index 716deabe6..4b38685ac 100644 --- a/dbaccess/source/ui/dlg/adminpages.hxx +++ b/dbaccess/source/ui/dlg/adminpages.hxx @@ -113,7 +113,8 @@ namespace dbaui //========================================================================= class IDatabaseSettingsDialog; class IItemSetHelper; - class OGenericAdministrationPage : public SfxTabPage, public svt::IWizardPage + class OGenericAdministrationPage :public SfxTabPage + ,public ::svt::IWizardPageController { private: Link m_aModifiedHandler; /// to be called if something on the page has been modified @@ -165,9 +166,10 @@ namespace dbaui */ sal_Bool getSelectedDataSource(::rtl::OUString& _sReturn,::rtl::OUString& _sCurr); - // svt::IWizardPage + // svt::IWizardPageController virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); + virtual bool canAdvance() const; void SetRoadmapStateValue( sal_Bool _bDoEnable ) { m_abEnableRoadmap = _bDoEnable; } bool GetRoadmapStateValue() const { return m_abEnableRoadmap; } diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx index 31c71ed5f..cc07cfd9f 100644 --- a/dbaccess/source/ui/dlg/dbwiz.cxx +++ b/dbaccess/source/ui/dlg/dbwiz.cxx @@ -405,7 +405,7 @@ sal_Bool ODbTypeWizDialog::saveDatasource() return sal_True; } // ----------------------------------------------------------------------------- -IWizardPage* ODbTypeWizDialog::getWizardPage(TabPage* _pCurrentPage) const +IWizardPageController* ODbTypeWizDialog::getPageController( TabPage* _pCurrentPage ) const { OGenericAdministrationPage* pPage = static_cast(_pCurrentPage); return pPage; diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 8aa20d6ad..3338e9406 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -1078,7 +1078,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() return aExistenceCheck.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); } // ----------------------------------------------------------------------------- - IWizardPage* ODbTypeWizDialogSetup::getWizardPage(TabPage* _pCurrentPage) const + IWizardPageController* ODbTypeWizDialogSetup::getPageController( TabPage* _pCurrentPage ) const { OGenericAdministrationPage* pPage = static_cast(_pCurrentPage); return pPage; diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx index 515396cc1..8c1839e28 100644 --- a/dbaccess/source/ui/inc/dbwiz.hxx +++ b/dbaccess/source/ui/inc/dbwiz.hxx @@ -111,8 +111,9 @@ protected: virtual TabPage* createPage(WizardState _nState); virtual WizardState determineNextState(WizardState _nCurrentState) const; virtual sal_Bool leaveState(WizardState _nState); - virtual ::svt::IWizardPage* getWizardPage(TabPage* _pCurrentPage) const; - virtual sal_Bool onFinish(sal_Int32 _nResult); + virtual ::svt::IWizardPageController* + getPageController( TabPage* _pCurrentPage ) const; + virtual sal_Bool onFinish(sal_Int32 _nResult); protected: inline sal_Bool isUIEnabled() const { return m_bUIEnabled; } diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx index b387a0be8..45b38e952 100644 --- a/dbaccess/source/ui/inc/dbwizsetup.hxx +++ b/dbaccess/source/ui/inc/dbwizsetup.hxx @@ -149,7 +149,7 @@ protected: virtual TabPage* createPage(WizardState _nState); virtual sal_Bool leaveState(WizardState _nState); virtual void enterState(WizardState _nState); - virtual ::svt::IWizardPage* getWizardPage(TabPage* _pCurrentPage) const; + virtual ::svt::IWizardPageController* getPageController( TabPage* _pCurrentPage ) const; virtual sal_Bool onFinish(sal_Int32 _nResult); protected: -- cgit v1.2.3 From ec4d6cbcbb8f4c4c6c0120b72fd43ec62c6798ae Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 25 May 2010 11:43:39 +0200 Subject: unoawt: onFinish does not need this parameter, it's always called with RET_OK --- dbaccess/source/ext/macromigration/macromigrationdialog.cxx | 4 ++-- dbaccess/source/ext/macromigration/macromigrationdialog.hxx | 2 +- dbaccess/source/ui/dlg/dbwiz.cxx | 4 ++-- dbaccess/source/ui/dlg/dbwizsetup.cxx | 8 ++++---- dbaccess/source/ui/inc/dbwiz.hxx | 2 +- dbaccess/source/ui/inc/dbwizsetup.hxx | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx index ecdce4bab..ec1b5c2f1 100644 --- a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx @@ -314,9 +314,9 @@ namespace dbmm } //-------------------------------------------------------------------- - sal_Bool MacroMigrationDialog::onFinish( sal_Int32 _nResult ) + sal_Bool MacroMigrationDialog::onFinish() { - return MacroMigrationDialog_Base::onFinish( _nResult ); + return MacroMigrationDialog_Base::onFinish(); } //-------------------------------------------------------------------- diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.hxx b/dbaccess/source/ext/macromigration/macromigrationdialog.hxx index 5e042a3f5..947f9d1ae 100644 --- a/dbaccess/source/ext/macromigration/macromigrationdialog.hxx +++ b/dbaccess/source/ext/macromigration/macromigrationdialog.hxx @@ -68,7 +68,7 @@ namespace dbmm virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason ); virtual sal_Bool leaveState( WizardState _nState ); virtual WizardState determineNextState( WizardState _nCurrentState ) const; - virtual sal_Bool onFinish( sal_Int32 _nResult ); + virtual sal_Bool onFinish(); // Dialog overridables virtual BOOL Close(); diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx index cc07cfd9f..53e3f928d 100644 --- a/dbaccess/source/ui/dlg/dbwiz.cxx +++ b/dbaccess/source/ui/dlg/dbwiz.cxx @@ -411,10 +411,10 @@ IWizardPageController* ODbTypeWizDialog::getPageController( TabPage* _pCurrentPa return pPage; } // ----------------------------------------------------------------------------- -sal_Bool ODbTypeWizDialog::onFinish(sal_Int32 _nResult) +sal_Bool ODbTypeWizDialog::onFinish() { saveDatasource(); - return m_pImpl->saveChanges(*m_pOutSet) ? OWizardMachine::onFinish(_nResult) : sal_False; + return m_pImpl->saveChanges(*m_pOutSet) ? OWizardMachine::onFinish() : sal_False; } //......................................................................... } // namespace dbaui diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 3338e9406..b43f6b7ab 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -789,7 +789,7 @@ IMPL_LINK(ODbTypeWizDialogSetup, OnRecentDocumentSelected, OGeneralPage*, /*_pGe IMPL_LINK(ODbTypeWizDialogSetup, OnSingleDocumentChosen, OGeneralPage*, /*_pGeneralPage*/) { if ( prepareLeaveCurrentState( eFinish ) ) - onFinish( RET_OK ); + onFinish(); return 0L; } @@ -1206,7 +1206,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() } // ----------------------------------------------------------------------------- - sal_Bool ODbTypeWizDialogSetup::onFinish(sal_Int32 _nResult) + sal_Bool ODbTypeWizDialogSetup::onFinish() { if ( m_pGeneralPage->GetDatabaseCreationMode() == OGeneralPage::eOpenExisting ) { @@ -1214,7 +1214,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() // wants us to load could be a non-database document. Instead, we asynchronously // open the selected document. Thus, the wizard's return value is RET_CANCEL, // which means to not continue loading the database document - if ( !OWizardMachine::onFinish( RET_CANCEL ) ) + if ( !OWizardMachine::Finnish( RET_CANCEL ) ) return sal_False; Reference< XComponentLoader > xFrameLoader; @@ -1237,7 +1237,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() skipUntil(PAGE_DBSETUPWIZARD_FINAL); } if (getCurrentState() == PAGE_DBSETUPWIZARD_FINAL) - return SaveDatabaseDocument() ? OWizardMachine::onFinish( _nResult ) : sal_False; + return SaveDatabaseDocument() ? OWizardMachine::onFinish() : sal_False; else { enableButtons( WZB_FINISH, sal_False ); diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx index 8c1839e28..3bd8fc666 100644 --- a/dbaccess/source/ui/inc/dbwiz.hxx +++ b/dbaccess/source/ui/inc/dbwiz.hxx @@ -113,7 +113,7 @@ protected: virtual sal_Bool leaveState(WizardState _nState); virtual ::svt::IWizardPageController* getPageController( TabPage* _pCurrentPage ) const; - virtual sal_Bool onFinish(sal_Int32 _nResult); + virtual sal_Bool onFinish(); protected: inline sal_Bool isUIEnabled() const { return m_bUIEnabled; } diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx index 45b38e952..25899e158 100644 --- a/dbaccess/source/ui/inc/dbwizsetup.hxx +++ b/dbaccess/source/ui/inc/dbwizsetup.hxx @@ -150,7 +150,7 @@ protected: virtual sal_Bool leaveState(WizardState _nState); virtual void enterState(WizardState _nState); virtual ::svt::IWizardPageController* getPageController( TabPage* _pCurrentPage ) const; - virtual sal_Bool onFinish(sal_Int32 _nResult); + virtual sal_Bool onFinish(); protected: inline sal_Bool isUIEnabled() const { return m_bUIEnabled; } -- cgit v1.2.3