diff --git a/include/svtools/wizdlg.hxx b/include/svtools/wizdlg.hxx index 765d2fac6dd7..82212b3208c7 100644 --- a/include/svtools/wizdlg.hxx +++ b/include/svtools/wizdlg.hxx @@ -210,6 +210,7 @@ IMPL_LINK( MyWizardDlg, ImplNextHdl, PushButton*, pBtn ) class SVT_DLLPUBLIC WizardDialog : public ModalDialog { private: + Timer maWizardLayoutTimer; Size maPageSize; ImplWizPageData* mpFirstPage; ImplWizButtonData* mpFirstBtn; @@ -225,6 +226,9 @@ private: sal_Int16 mnLeftAlignCount; bool mbEmptyViewMargin; + DECL_DLLPRIVATE_LINK( ImplHandleWizardLayoutTimerHdl, void* ); + bool hasWizardPendingLayout() const; + protected: long LogicalCoordinateToPixel(int iCoordinate); /**sets the number of buttons which should be left-aligned. Normally, buttons are right-aligned. @@ -248,9 +252,9 @@ private: SVT_DLLPRIVATE TabPage* ImplGetPage( sal_uInt16 nLevel ) const; public: - WizardDialog( Window* pParent, WinBits nStyle = WB_STDTABDIALOG ); - WizardDialog( Window* pParent, const ResId& rResId ); - ~WizardDialog(); + WizardDialog( Window* pParent, WinBits nStyle = WB_STDTABDIALOG ); + WizardDialog( Window* pParent, const ResId& rResId ); + ~WizardDialog(); virtual void Resize(); virtual void StateChanged( StateChangedType nStateChange ); @@ -259,11 +263,13 @@ public: virtual void ActivatePage(); virtual long DeactivatePage(); - sal_Bool ShowPrevPage(); - sal_Bool ShowNextPage(); - sal_Bool ShowPage( sal_uInt16 nLevel ); - sal_Bool Finnish( long nResult = 0 ); - sal_uInt16 GetCurLevel() const { return mnCurLevel; } + virtual void queue_layout(); + + sal_Bool ShowPrevPage(); + sal_Bool ShowNextPage(); + sal_Bool ShowPage( sal_uInt16 nLevel ); + sal_Bool Finnish( long nResult = 0 ); + sal_uInt16 GetCurLevel() const { return mnCurLevel; } void AddPage( TabPage* pPage ); void RemovePage( TabPage* pPage ); diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx index 1a9191af5855..df05a6239cc1 100644 --- a/svtools/source/dialogs/wizdlg.cxx +++ b/svtools/source/dialogs/wizdlg.cxx @@ -61,6 +61,9 @@ void WizardDialog::ImplInitData() meViewAlign = WINDOWALIGN_LEFT; mbEmptyViewMargin = false; mnLeftAlignCount = 0; + + maWizardLayoutTimer.SetTimeout(50); + maWizardLayoutTimer.SetTimeoutHdl( LINK( this, WizardDialog, ImplHandleWizardLayoutTimerHdl ) ); } // ----------------------------------------------------------------------- @@ -111,7 +114,26 @@ void WizardDialog::ImplCalcSize( Size& rSize ) } } -// ----------------------------------------------------------------------- +bool WizardDialog::hasWizardPendingLayout() const +{ + return maWizardLayoutTimer.IsActive(); +} + +void WizardDialog::queue_layout() +{ + if (hasWizardPendingLayout()) + return; + if (IsInClose()) + return; + maWizardLayoutTimer.Start(); +} + +IMPL_LINK( WizardDialog, ImplHandleWizardLayoutTimerHdl, void*, EMPTYARG ) +{ + ImplPosCtrls(); + ImplPosTabPage(); + return 0; +} void WizardDialog::ImplPosCtrls() { @@ -357,8 +379,9 @@ WizardDialog::WizardDialog( Window* pParent, const ResId& rResId ) : WizardDialog::~WizardDialog() { - if ( mpFixedLine ) - delete mpFixedLine; + maWizardLayoutTimer.Stop(); + + delete mpFixedLine; // Remove all buttons while ( mpFirstBtn )