From adb203bc05e3e36173cbd46b9951f79821a81799 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:27:54 +0200 Subject: Merging upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- svx/source/svdraw/svdhdl.cxx | 101 +++++++++++++++++++++--------------------- svx/source/svdraw/svdpagv.cxx | 17 ++++--- svx/source/svdraw/svdpntv.cxx | 15 ++----- 3 files changed, 67 insertions(+), 66 deletions(-) (limited to 'svx/source/svdraw') diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 867afa6a90..c8f1fa3159 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -1604,66 +1604,67 @@ ImpEdgeHdl::~ImpEdgeHdl() void ImpEdgeHdl::CreateB2dIAObject() { - if(m_nObjHdlNum <= 1 && m_pObj) + if(m_nObjHdlNum > 1 || !m_pObj) { - // first throw away old one - GetRidOfIAObject(); + // call parent + SdrHdl::CreateB2dIAObject(); + return; + } - BitmapColorIndex eColIndex = BitmapColorIndex::LightCyan; - BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_7x7; + // first throw away old one + GetRidOfIAObject(); - if(m_pHdlList) - { - SdrMarkView* pView = m_pHdlList->GetView(); + BitmapColorIndex eColIndex = BitmapColorIndex::LightCyan; + BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_7x7; - if(pView && !pView->areMarkHandlesHidden()) - { - const SdrEdgeObj* pEdge = static_cast(m_pObj); + if(!m_pHdlList) + return; - if(pEdge->GetConnectedNode(m_nObjHdlNum == 0) != nullptr) - eColIndex = BitmapColorIndex::LightRed; + SdrMarkView* pView = m_pHdlList->GetView(); - if(m_nPPntNum < 2) - { - // Handle with plus sign inside - eKindOfMarker = BitmapMarkerKind::Circ_7x7; - } + if(!pView || pView->areMarkHandlesHidden()) + return; - SdrPageView* pPageView = pView->GetSdrPageView(); + // tdf#159666 Crash when table and line object are selected at the same time + auto pEdge = dynamic_cast(m_pObj); + if (!pEdge) + return; - if(pPageView) - { - for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++) - { - const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b); - - if(rPageWindow.GetPaintWindow().OutputToWindow()) - { - const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager(); - if (xManager.is()) - { - basegfx::B2DPoint aPosition(m_aPos.X(), m_aPos.Y()); - std::unique_ptr pNewOverlayObject(CreateOverlayObject( - aPosition, - eColIndex, - eKindOfMarker)); - - // OVERLAYMANAGER - insertNewlyCreatedOverlayObjectForSdrHdl( - std::move(pNewOverlayObject), - rPageWindow.GetObjectContact(), - *xManager); - } - } - } - } - } - } + if(pEdge->GetConnectedNode(m_nObjHdlNum == 0) != nullptr) + eColIndex = BitmapColorIndex::LightRed; + + if(m_nPPntNum < 2) + { + // Handle with plus sign inside + eKindOfMarker = BitmapMarkerKind::Circ_7x7; } - else + + SdrPageView* pPageView = pView->GetSdrPageView(); + if(!pPageView) + return; + + for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++) { - // call parent - SdrHdl::CreateB2dIAObject(); + const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b); + + if(rPageWindow.GetPaintWindow().OutputToWindow()) + { + const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) + { + basegfx::B2DPoint aPosition(m_aPos.X(), m_aPos.Y()); + std::unique_ptr pNewOverlayObject(CreateOverlayObject( + aPosition, + eColIndex, + eKindOfMarker)); + + // OVERLAYMANAGER + insertNewlyCreatedOverlayObjectForSdrHdl( + std::move(pNewOverlayObject), + rPageWindow.GetObjectContact(), + *xManager); + } + } } } diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx index 86210865e7..4e5d7a4728 100644 --- a/svx/source/svdraw/svdpagv.cxx +++ b/svx/source/svdraw/svdpagv.cxx @@ -557,15 +557,22 @@ void SdrPageView::AdjHdl() GetView().AdjustMarkHdl(); } -void SdrPageView::SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa) +// return true if changed, false if unchanged +bool SdrPageView::SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa) { - if(!GetPage()) - return; + if (!GetPage()) + return false; SdrLayerID nID = GetPage()->GetLayerAdmin().GetLayerID(rName); - if(SDRLAYER_NOTFOUND != nID) - rBS.Set(nID, bJa); + if (SDRLAYER_NOTFOUND == nID) + return false; + + if (rBS.IsSet(nID) == bJa) + return false; + + rBS.Set(nID, bJa); + return true; } bool SdrPageView::IsLayer(const OUString& rName, const SdrLayerIDSet& rBS) const diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 4584e7f831..f092887250 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -414,22 +414,15 @@ void SdrPaintView::DeleteDeviceFromPaintView(OutputDevice& rOldDev) void SdrPaintView::SetLayerVisible(const OUString& rName, bool bShow) { - if(mpPageView) - { - mpPageView->SetLayerVisible(rName, bShow); - } - + const bool bChanged = mpPageView && mpPageView->SetLayerVisible(rName, bShow); + if (!bChanged) + return; InvalidateAllWin(); } bool SdrPaintView::IsLayerVisible(const OUString& rName) const { - if(mpPageView) - { - return mpPageView->IsLayerVisible(rName); - } - - return false; + return mpPageView && mpPageView->IsLayerVisible(rName); } void SdrPaintView::SetLayerLocked(const OUString& rName, bool bLock) -- cgit v1.2.3