diff options
5 files changed, 35 insertions, 31 deletions
diff --git a/chart2/source/controller/dialogs/RangeSelectionListener.cxx b/chart2/source/controller/dialogs/RangeSelectionListener.cxx index e4974ab30de0..ec5d5f0ded43 100644 --- a/chart2/source/controller/dialogs/RangeSelectionListener.cxx +++ b/chart2/source/controller/dialogs/RangeSelectionListener.cxx @@ -19,6 +19,7 @@ #include <RangeSelectionListener.hxx> #include <ChartModel.hxx> +#include <vcl/weld.hxx> #include <utility> using namespace ::com::sun::star; @@ -56,6 +57,23 @@ void SAL_CALL RangeSelectionListener::disposing( const lang::EventObject& /*Sour m_rParent.disposingRangeSelection(); } +void RangeSelectionListenerParent::enableRangeChoosing(bool bEnable, weld::DialogController* pDialog) +{ + if (!pDialog) + return; + weld::Dialog* pDlg = pDialog->getDialog(); + // tdf#158753 save the current page when hiding the wizard, + // and restore it on showing the wizard to workaround that + // that GtkAssistant resets to page 0 on hide+show + weld::Assistant* pAss = dynamic_cast<weld::Assistant*>(pDlg); + if (pAss && bEnable) + m_sRestorePageIdent = pAss->get_current_page_ident(); + pDlg->set_modal(!bEnable); + pDlg->set_visible(!bEnable); + if (pAss && !bEnable) + pAss->set_current_page(m_sRestorePageIdent); +} + } // namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx index 82c3f3ab4acc..1b77d23dcefd 100644 --- a/chart2/source/controller/dialogs/res_ErrorBar.cxx +++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx @@ -24,6 +24,7 @@ #include <chartview/ChartSfxItemIds.hxx> #include <vcl/weld.hxx> #include <ChartModel.hxx> +#include "DialogModel.hxx" #include <rtl/math.hxx> #include <comphelper/diagnose_ex.hxx> @@ -39,12 +40,6 @@ using namespace ::com::sun::star; namespace { -void lcl_enableRangeChoosing(bool bEnable, weld::DialogController* pController) -{ - weld::Window* pWeldDialog = pController->getDialog(); - pWeldDialog->set_modal(!bEnable); - pWeldDialog->set_visible(!bEnable); -} sal_uInt16 lcl_getLbEntryPosByErrorKind( SvxChartKindError eErrorKind ) { @@ -447,7 +442,7 @@ IMPL_LINK(ErrorBarResources, ChooseRange, weld::Button&, rButton, void) aUIString = m_xUIStringNeg->get_label(); } - lcl_enableRangeChoosing(true, m_pController); + enableRangeChoosing(true, m_pController); m_apRangeSelectionHelper->chooseRange( m_pCurrentRangeChoosingField->get_text(), aUIString, *this ); @@ -684,7 +679,7 @@ void ErrorBarResources::listeningFinished( m_pCurrentRangeChoosingField = nullptr; UpdateControlStates(); - lcl_enableRangeChoosing(false, m_pController); + enableRangeChoosing(false, m_pController); } void ErrorBarResources::disposingRangeSelection() diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index fdd7c9a83b62..577ef29c6b63 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -111,15 +111,6 @@ OUString lcl_GetSequenceNameForLabel(const ::chart::SeriesEntry* pEntry) return aResult; } -void lcl_enableRangeChoosing(bool bEnable, weld::DialogController* pDialog) -{ - if (!pDialog) - return; - weld::Dialog* pDlg = pDialog->getDialog(); - pDlg->set_modal(!bEnable); - pDlg->set_visible(!bEnable); -} - void lcl_addLSequenceToDataSource( const uno::Reference< chart2::data::XLabeledDataSequence > & xLSequence, const Reference< ::chart::DataSeries > & xSource ) @@ -526,7 +517,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, MainRangeButtonClickedHdl, weld::Button&, voi m_xLB_SERIES->get_text(nEntry)); } - lcl_enableRangeChoosing(true, m_pDialogController); + enableRangeChoosing(true, m_pDialogController); m_rDialogModel.getRangeSelectionHelper()->chooseRange( aSelectedRolesRange, aUIStr, *this ); } else @@ -542,7 +533,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, CategoriesRangeButtonClickedHdl, weld::Button return; OUString aStr(SchResId(m_xFT_CATEGORIES->get_visible() ? STR_DATA_SELECT_RANGE_FOR_CATEGORIES : STR_DATA_SELECT_RANGE_FOR_DATALABELS)); - lcl_enableRangeChoosing(true, m_pDialogController); + enableRangeChoosing(true, m_pDialogController); m_rDialogModel.getRangeSelectionHelper()->chooseRange( m_rDialogModel.getCategoriesRange(), aStr, *this ); } @@ -720,7 +711,7 @@ void DataSourceTabPage::listeningFinished( m_pCurrentRangeChoosingField = nullptr; updateControlState(); - lcl_enableRangeChoosing(false, m_pDialogController); + enableRangeChoosing(false, m_pDialogController); } void DataSourceTabPage::disposingRangeSelection() diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx index d5d4a621d8cf..4977569e2c13 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx @@ -41,15 +41,6 @@ namespace } } - void lcl_enableRangeChoosing(bool bEnable, weld::DialogController* pDialog) - { - if (!pDialog) - return; - weld::Dialog* pDlg = pDialog->getDialog(); - pDlg->set_modal(!bEnable); - pDlg->set_visible(!bEnable); - } - } // anonymous namespace namespace chart @@ -337,7 +328,7 @@ IMPL_LINK_NOARG(RangeChooserTabPage, ChooseRangeHdl, weld::Button&, void) OUString aRange = m_xED_Range->get_text(); OUString aTitle = m_xFTTitle->get_label(); - lcl_enableRangeChoosing(true, m_pDialogController); + enableRangeChoosing(true, m_pDialogController); m_rDialogModel.getRangeSelectionHelper()->chooseRange( aRange, aTitle, *this ); } @@ -361,7 +352,7 @@ void RangeChooserTabPage::listeningFinished( const OUString & rNewRange ) if( isValid()) changeDialogModelAccordingToControls(); - lcl_enableRangeChoosing(false, m_pDialogController); + enableRangeChoosing(false, m_pDialogController); } void RangeChooserTabPage::disposingRangeSelection() diff --git a/chart2/source/controller/inc/RangeSelectionListener.hxx b/chart2/source/controller/inc/RangeSelectionListener.hxx index 9117b4d9b2fc..0ca4644a96ad 100644 --- a/chart2/source/controller/inc/RangeSelectionListener.hxx +++ b/chart2/source/controller/inc/RangeSelectionListener.hxx @@ -27,6 +27,10 @@ namespace com::sun::star::frame { class XModel; } +namespace weld +{ +class DialogController; +} namespace chart { @@ -38,8 +42,13 @@ public: virtual void listeningFinished(const OUString& rNewRange) = 0; virtual void disposingRangeSelection() = 0; + void enableRangeChoosing(bool bEnable, weld::DialogController* pDialog); + protected: ~RangeSelectionListenerParent() {} + +private: + OUString m_sRestorePageIdent; }; class RangeSelectionListener final |