sc/inc/scabstdlg.hxx | 1 + sc/source/ui/attrdlg/scdlgfact.cxx | 4 ++-- sc/source/ui/attrdlg/scdlgfact.hxx | 1 + sc/source/ui/inc/inscldlg.hxx | 3 ++- sc/source/ui/miscdlgs/inscldlg.cxx | 8 ++++---- sc/source/ui/view/cellsh1.cxx | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-)
New commits: commit 5c2193f842a26f576700cd58c076839f112d5355 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri May 2 12:11:00 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri May 2 15:07:30 2025 +0200 ScInsertCellDlg: pass ScViewData from caller Change-Id: Ic059f4c964f761f9d1b2c0734f8b6908501fd5d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184898 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index b4ffbee6ba5c..f7b817d237ed 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -462,6 +462,7 @@ public: virtual VclPtr<AbstractScGroupDlg> CreateAbstractScGroupDlg(weld::Window* pParent, bool bUnGroup = false) = 0; virtual VclPtr<AbstractScInsertCellDlg> CreateScInsertCellDlg(weld::Window* pParent, + ScViewData& rViewData, bool bDisallowCellMove) = 0; virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent, diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 8867a952be19..a0e113fc2457 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -375,9 +375,9 @@ public: } VclPtr<AbstractScInsertCellDlg> ScAbstractDialogFactory_Impl::CreateScInsertCellDlg(weld::Window* pParent, - bool bDisallowCellMove) + ScViewData& rViewData, bool bDisallowCellMove) { - return VclPtr<AbstractScInsertCellDlg_Impl>::Create(pParent, bDisallowCellMove); + return VclPtr<AbstractScInsertCellDlg_Impl>::Create(pParent, rViewData, bDisallowCellMove); } namespace diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index c5083fbbb632..3e246df150d1 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -74,6 +74,7 @@ public: virtual VclPtr<AbstractScGroupDlg> CreateAbstractScGroupDlg(weld::Window* pParent, bool bUnGroup = false) override; virtual VclPtr<AbstractScInsertCellDlg> CreateScInsertCellDlg(weld::Window* pParent, + ScViewData& rViewData, bool bDisallowCellMove) override; virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent, diff --git a/sc/source/ui/inc/inscldlg.hxx b/sc/source/ui/inc/inscldlg.hxx index c9de99edc2be..c8906ece36bc 100644 --- a/sc/source/ui/inc/inscldlg.hxx +++ b/sc/source/ui/inc/inscldlg.hxx @@ -22,6 +22,7 @@ #include <vcl/weld.hxx> #include <global.hxx> +#include "viewdata.hxx" class ScInsertCellDlg : public weld::GenericDialogController { @@ -38,7 +39,7 @@ private: static constexpr size_t MAX_INS_COLS = 4000; public: - ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove); + ScInsertCellDlg(weld::Window* pParent, ScViewData& rViewData, bool bDisallowCellMove); virtual ~ScInsertCellDlg() override; InsCellCmd GetInsCellCmd() const; diff --git a/sc/source/ui/miscdlgs/inscldlg.cxx b/sc/source/ui/miscdlgs/inscldlg.cxx index 21ede36e8f3b..bf11574c3ded 100644 --- a/sc/source/ui/miscdlgs/inscldlg.cxx +++ b/sc/source/ui/miscdlgs/inscldlg.cxx @@ -26,7 +26,8 @@ static sal_uInt8 nInsItemChecked = 0; -ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove) +ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, ScViewData& rViewData, + bool bDisallowCellMove) : GenericDialogController(pParent, u"modules/scalc/ui/insertcells.ui"_ustr, u"InsertCellsDialog"_ustr) , m_xBtnCellsDown(m_xBuilder->weld_radio_button(u"down"_ustr)) @@ -36,8 +37,7 @@ ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove) , m_xNumberOfRows(m_xBuilder->weld_spin_button(u"number_of_rows"_ustr)) , m_xNumberOfCols(m_xBuilder->weld_spin_button(u"number_of_columns"_ustr)) { - const ScViewData* pViewData = ScDocShell::GetViewData(); - if (pViewData && pViewData->GetDocument().IsLayoutRTL(pViewData->GetTabNo())) + if (rViewData.GetDocument().IsLayoutRTL(rViewData.GetTabNo())) m_xBtnCellsRight->set_label(ScResId(SCSTR_INSERT_RTL)); m_xNumberOfRows->set_range(1, MAX_INS_ROWS); @@ -96,7 +96,7 @@ ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove) } // if some cells are selected, then disable the SpinButtons - const bool bMarked = pViewData && pViewData->GetMarkData().IsMarked(); + const bool bMarked = rViewData.GetMarkData().IsMarked(); m_xNumberOfCols->set_sensitive(bColCount && !bMarked); m_xNumberOfRows->set_sensitive(bRowsCount && !bMarked); } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 91a1143f2695..2c73556bac87 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -386,7 +386,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - VclPtr<AbstractScInsertCellDlg> pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), bTheFlag)); + VclPtr<AbstractScInsertCellDlg> pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), GetViewData(), bTheFlag)); pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){ if (nResult == RET_OK) {