sc/source/ui/docshell/docsh4.cxx | 2 +- sc/source/ui/inc/dbfunc.hxx | 2 +- sc/source/ui/inc/sharedocdlg.hxx | 2 +- sc/source/ui/miscdlgs/sharedocdlg.cxx | 7 ++----- sc/source/ui/view/dbfunc.cxx | 24 ++++++++++++------------ 5 files changed, 17 insertions(+), 20 deletions(-)
New commits: commit 1f16e96920463348570ad268150d1fccd75d527b Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Sat Apr 26 10:05:40 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Sat Apr 26 13:07:15 2025 +0200 ApplyAutoFilter: pass ScViewData by ref Change-Id: Ie65b3347fcfad7ba3be2af48dc73e06c027231dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184659 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx index 79da5609f714..f04c7b6d0a0e 100644 --- a/sc/source/ui/inc/dbfunc.hxx +++ b/sc/source/ui/inc/dbfunc.hxx @@ -36,7 +36,7 @@ class SAL_DLLPUBLIC_RTTI ScDBFunc : public ScViewFunc private: void GetSelectedMemberList(ScDPUniqueStringSet& rEntries, tools::Long& rDimension); static void ModifiedAutoFilter(ScDocShell* pDocSh); - static void ApplyAutoFilter(ScDocShell* pDocSh, const ScViewData* pViewData, ScDBData* pDBData, + static void ApplyAutoFilter(ScDocShell* pDocSh, ScViewData& rViewData, ScDBData* pDBData, SCROW nRow, SCTAB nTab, const ScQueryParam& aParam); DECL_STATIC_LINK(ScDBFunc, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*); diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 197daf644b6d..11b6d8d20e5c 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -275,11 +275,11 @@ void ScDBFunc::Query( const ScQueryParam& rQueryParam, const ScRange* pAdvSource void ScDBFunc::ToggleAutoFilter() { - ScViewData* pViewData = &GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScViewData& rViewData = GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); ScQueryParam aParam; - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); ScDBData* pDBData = GetDBData(false, SC_DB_AUTOFILTER, ScGetDBSelection::RowDown); pDBData->SetByRow( true ); //! undo, retrieve beforehand ?? @@ -287,7 +287,7 @@ void ScDBFunc::ToggleAutoFilter() SCCOL nCol; SCROW nRow = aParam.nRow1; - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = rViewData.GetTabNo(); ScMF nFlag; bool bHasAuto = true; bool bHeader = pDBData->HasHeader(); @@ -316,7 +316,7 @@ void ScDBFunc::ToggleAutoFilter() // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation OUString aUndo = ScResId( STR_UNDO_QUERY ); - pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pViewData->GetViewShell()->GetViewShellId() ); + pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, rViewData.GetViewShell()->GetViewShellId() ); ScRange aRange; pDBData->GetArea( aRange ); @@ -339,7 +339,7 @@ void ScDBFunc::ToggleAutoFilter() { if (!bHeader) { - std::shared_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pViewData->GetDialogParent(), + std::shared_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(rViewData.GetDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, // header from first row? @@ -347,21 +347,21 @@ void ScDBFunc::ToggleAutoFilter() xBox->set_title(ScResId(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc" xBox->set_default_response(RET_YES); xBox->SetInstallLOKNotifierHdl(LINK(this, ScDBFunc, InstallLOKNotifierHdl)); - xBox->runAsync(xBox, [pDocSh, pViewData, pDBData, nRow, nTab, aParam] (sal_Int32 nResult) { + xBox->runAsync(xBox, [pDocSh, &rViewData, pDBData, nRow, nTab, aParam] (sal_Int32 nResult) { if (nResult == RET_YES) { pDBData->SetHeader( true ); //! Undo ?? } - ApplyAutoFilter(pDocSh, pViewData, pDBData, nRow, nTab, aParam); + ApplyAutoFilter(pDocSh, rViewData, pDBData, nRow, nTab, aParam); }); } else - ApplyAutoFilter(pDocSh, pViewData, pDBData, nRow, nTab, aParam); + ApplyAutoFilter(pDocSh, rViewData, pDBData, nRow, nTab, aParam); } else { - std::shared_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pViewData->GetDialogParent(), + std::shared_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(rViewData.GetDialogParent(), VclMessageType::Warning, VclButtonsType::Ok, ScResId(STR_ERR_AUTOFILTER))); xErrorBox->SetInstallLOKNotifierHdl(LINK(this, ScDBFunc, InstallLOKNotifierHdl)); @@ -375,10 +375,10 @@ IMPL_STATIC_LINK_NOARG(ScDBFunc, InstallLOKNotifierHdl, void*, vcl::ILibreOffice return GetpApp(); } -void ScDBFunc::ApplyAutoFilter(ScDocShell* pDocSh, const ScViewData* pViewData, ScDBData* pDBData, +void ScDBFunc::ApplyAutoFilter(ScDocShell* pDocSh, ScViewData& rViewData, ScDBData* pDBData, SCROW nRow, SCTAB nTab, const ScQueryParam& aParam) { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); ScRange aRange; pDBData->GetArea(aRange); pDocSh->GetUndoManager()->AddUndoAction( commit 08ecccdab71b58cef6aa8b2ee8b0451ad8e562de Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Sat Apr 26 09:54:02 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Sat Apr 26 13:07:09 2025 +0200 ScShareDocumentDlg: pass ScViewData by ref Change-Id: I6308802006c957a693db88746692a8dc63e53026 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184658 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 18f75ccc8c44..3a8a8bb3044c 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -956,7 +956,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) } weld::Window* pWin = GetActiveDialogParent(); - ScShareDocumentDlg aDlg(pWin, pViewData); + ScShareDocumentDlg aDlg(pWin, *pViewData); if (aDlg.run() == RET_OK) { bool bSetShared = aDlg.IsShareDocumentChecked(); diff --git a/sc/source/ui/inc/sharedocdlg.hxx b/sc/source/ui/inc/sharedocdlg.hxx index d6dcc4810d86..ba83b1787b84 100644 --- a/sc/source/ui/inc/sharedocdlg.hxx +++ b/sc/source/ui/inc/sharedocdlg.hxx @@ -42,7 +42,7 @@ private: DECL_LINK(SizeAllocated, const Size&, void); public: - ScShareDocumentDlg(weld::Window* pParent, const ScViewData* pViewData); + ScShareDocumentDlg(weld::Window* pParent, ScViewData& rViewData); virtual ~ScShareDocumentDlg() override; bool IsShareDocumentChecked() const; diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index 34044fa4f87d..072e83562707 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -49,20 +49,17 @@ IMPL_LINK(ScShareDocumentDlg, SizeAllocated, const Size&, rSize, void) } -ScShareDocumentDlg::ScShareDocumentDlg(weld::Window* pParent, const ScViewData* pViewData) +ScShareDocumentDlg::ScShareDocumentDlg(weld::Window* pParent, ScViewData& rViewData) : GenericDialogController(pParent, u"modules/scalc/ui/sharedocumentdlg.ui"_ustr, u"ShareDocumentDialog"_ustr) , m_aStrNoUserData(ScResId(STR_NO_USER_DATA_AVAILABLE)) , m_aStrUnknownUser(ScResId(STR_UNKNOWN_USER_CONFLICT)) , m_aStrExclusiveAccess(ScResId(STR_EXCLUSIVE_ACCESS)) - , mpDocShell(nullptr) + , mpDocShell(rViewData.GetDocShell()) , m_xCbShare(m_xBuilder->weld_check_button(u"share"_ustr)) , m_xFtWarning(m_xBuilder->weld_label(u"warning"_ustr)) , m_xLbUsers(m_xBuilder->weld_tree_view(u"users"_ustr)) { - - OSL_ENSURE( pViewData, "ScShareDocumentDlg CTOR: mpViewData is null!" ); - mpDocShell = ( pViewData ? pViewData->GetDocShell() : nullptr ); OSL_ENSURE( mpDocShell, "ScShareDocumentDlg CTOR: mpDocShell is null!" ); std::vector<int> aWidths