chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx | 2 include/svx/dlgctl3d.hxx | 1 sc/source/ui/undo/undotab.cxx | 48 +++++++++++ svx/source/dialog/dlgctl3d.cxx | 5 + 4 files changed, 56 insertions(+)
New commits: commit ab08825ec0588df2a7686da35ab7a98c58f6b28b Author: Marco Cecchetti <marco.cecche...@collabora.com> AuthorDate: Thu Feb 29 16:09:14 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun Mar 3 14:49:47 2024 +0100 lok: calc: sheet position not restored on undo a tab insert/delete/move Change-Id: I34158b267727048e703cf895cbc8e20b81da4944 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164166 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 46211c06f51f37eeaa61407c1e7681aeb7a9514f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164193 (cherry picked from commit a0c9071c8f2e7d8aa255da21b5f6d85dbf5d34b5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164272 Tested-by: Jenkins diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index 8c3cdc1dfdf3..20e40a416e7d 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -78,6 +78,46 @@ void lcl_OnTabsChanged(const ScTabViewShell* pViewShell, const ScDocument& rDoc, true /* bGroups */, nTabIndex); } } + +template<typename T> +void lcl_MakeJsonArray(tools::JsonWriter& rJson, const std::vector<T>& v, const char *pArrayName) +{ + if (!v.empty()) + { + auto jsonArray = rJson.startArray(pArrayName); + std::stringstream ss; + for (std::size_t i = 0; i < v.size(); ++i) + { + SCTAB tabIndex = v[i]; + ss << tabIndex; + if (i < v.size() - 1) + ss << ","; + ss << " "; + } + if (!ss.str().empty()) + rJson.putRaw(ss.str()); + } +} + +void lcl_UndoCommandResult(const ScTabViewShell* pViewShell, + const char *pCmdName, const char *pCmdType, + const std::vector<SCTAB>* pNewTabs, + const std::vector<SCTAB>* pOldTabs = nullptr) +{ + tools::JsonWriter aJson; + aJson.put("commandName", pCmdName); + aJson.put("success", true); + { + auto result = aJson.startNode("result"); + aJson.put("type", pCmdType); + if (pNewTabs) + lcl_MakeJsonArray(aJson, *pNewTabs, "newTabs"); + if (pOldTabs) + lcl_MakeJsonArray(aJson, *pOldTabs, "oldTabs"); + } + + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, aJson.finishAndGetAsOString()); +} } ScUndoInsertTab::ScUndoInsertTab( ScDocShell* pNewDocShell, @@ -141,6 +181,9 @@ void ScUndoInsertTab::Undo() { ScDocument& rDoc = pDocShell->GetDocument(); lcl_OnTabsChanged(pViewShell, rDoc, nTab); + std::vector<SCTAB> aTabs{nTab}; + lcl_UndoCommandResult(pViewShell, ".uno:Undo", "ScUndoInsertTab", &aTabs); + } // SetTabNo(...,sal_True) for all views to sync with drawing layer pages @@ -171,6 +214,8 @@ void ScUndoInsertTab::Redo() { ScDocument& rDoc = pDocShell->GetDocument(); lcl_OnTabsChanged(pViewShell, rDoc, nTab); + std::vector<SCTAB> aTabs{nTab}; + lcl_UndoCommandResult(pViewShell, ".uno:Redo", "ScUndoInsertTab", &aTabs); } } @@ -394,6 +439,7 @@ void ScUndoDeleteTab::Undo() if (comphelper::LibreOfficeKit::isActive() && !theTabs.empty()) { lcl_OnTabsChanged(pViewShell, rDoc, theTabs[0]); + lcl_UndoCommandResult(pViewShell, ".uno:Undo", "ScUndoDeleteTab", &theTabs); } for(SCTAB nTab: theTabs) @@ -432,6 +478,7 @@ void ScUndoDeleteTab::Redo() { ScDocument& rDoc = pDocShell->GetDocument(); lcl_OnTabsChanged(pViewShell, rDoc, theTabs[0]); + lcl_UndoCommandResult(pViewShell, ".uno:Redo", "ScUndoDeleteTab", &theTabs); } // SetTabNo(...,sal_True) for all views to sync with drawing layer pages @@ -589,6 +636,7 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const const auto oldTabsMinIt = std::min_element(mpOldTabs->begin(), mpOldTabs->end()); SCTAB nTab = std::min(*newTabsMinIt, *oldTabsMinIt); lcl_OnTabsChanged(pViewShell, rDoc, nTab, true /* bInvalidateTiles */); + lcl_UndoCommandResult(pViewShell, bUndo ? ".uno:Undo" : ".uno:Redo", "ScUndoMoveTab", mpOldTabs.get(), mpNewTabs.get()); } SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScTablesChanged ) ); // Navigator commit 217d918491398f68b826d7fa031d4cb84c1da8db Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat Mar 2 21:24:20 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun Mar 3 14:49:35 2024 +0100 Resolves: tdf#159879 Crash when closing "3D View" dialog Change-Id: I9c116007afe9cea97b597933ad8483dce25c3707 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164295 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index 2020365fd12f..3d7d2f327d65 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -251,6 +251,8 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Contain ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage() { + // drop page view before the widget it paints to is destroyed + m_xPreview->ClearPageView(); } IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void*, void) diff --git a/include/svx/dlgctl3d.hxx b/include/svx/dlgctl3d.hxx index 2be46b7b52b9..7adb1103dc1c 100644 --- a/include/svx/dlgctl3d.hxx +++ b/include/svx/dlgctl3d.hxx @@ -61,6 +61,7 @@ public: SvxPreviewObjectType GetObjectType() const { return mnObjectType; } SfxItemSet const & Get3DAttributes() const; virtual void Set3DAttributes(const SfxItemSet& rAttr); + void ClearPageView(); }; class SAL_WARN_UNUSED UNLESS_MERGELIBS(SVX_DLLPUBLIC) Svx3DLightControl final : public Svx3DPreviewControl diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index f822f16e3251..6222bd2e6ca1 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -58,6 +58,11 @@ void Svx3DPreviewControl::SetDrawingArea(weld::DrawingArea* pDrawingArea) Construct(); } +void Svx3DPreviewControl::ClearPageView() +{ + mp3DView->ClearPageView(); +} + Svx3DPreviewControl::~Svx3DPreviewControl() { mp3DObj.clear();