From d3adc15ba3091fea5a90b654ee667b25797501db Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Thu, 18 Nov 2021 10:21:27 -0900 Subject: SwNavigator: Check for graphic, frame, or ole types before entering the block that handles these in UpdateTracking Change-Id: I4b435351133b28f1fc34e2733a9d453de5c117a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125508 Tested-by: Jenkins Reviewed-by: Jim Raykowski --- sw/source/uibase/utlui/content.cxx | 52 ++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 36686253ff83..1d18fa291da1 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3689,33 +3689,35 @@ void SwContentTree::UpdateTracking() if (bTrack) { - { // graphic, frame, and ole - OUString aContentTypeName; - if (m_pActiveShell->GetSelectionType() == SelectionType::Graphic && - !(m_bIsRoot && m_nRootType != ContentTypeId::GRAPHIC)) - { - if (!m_bImageTracking) return; - aContentTypeName = SwResId(STR_CONTENT_TYPE_GRAPHIC); - } - else if (m_pActiveShell->GetSelectionType() == SelectionType::Frame && - !(m_bIsRoot && m_nRootType != ContentTypeId::FRAME)) - { - if (!m_bFrameTracking) return; - aContentTypeName = SwResId(STR_CONTENT_TYPE_FRAME); - } - else if (m_pActiveShell->GetSelectionType() == SelectionType::Ole && - !(m_bIsRoot && m_nRootType != ContentTypeId::OLE)) + if (m_pActiveShell->GetSelectionType() & + (SelectionType::Graphic | SelectionType::Frame | SelectionType::Ole)) { - if (!m_bOLEobjectTracking) return; - aContentTypeName = SwResId(STR_CONTENT_TYPE_OLE); - } - if (!aContentTypeName.isEmpty()) - { - OUString aName(m_pActiveShell->GetFlyName()); - lcl_SelectByContentTypeAndName(this, *m_xTreeView, aContentTypeName, aName); - return; - } + OUString aContentTypeName; + if (m_pActiveShell->GetSelectionType() == SelectionType::Graphic && + !(m_bIsRoot && m_nRootType != ContentTypeId::GRAPHIC)) + { + if (!m_bImageTracking) return; + aContentTypeName = SwResId(STR_CONTENT_TYPE_GRAPHIC); + } + else if (m_pActiveShell->GetSelectionType() == SelectionType::Frame && + !(m_bIsRoot && m_nRootType != ContentTypeId::FRAME)) + { + if (!m_bFrameTracking) return; + aContentTypeName = SwResId(STR_CONTENT_TYPE_FRAME); + } + else if (m_pActiveShell->GetSelectionType() == SelectionType::Ole && + !(m_bIsRoot && m_nRootType != ContentTypeId::OLE)) + { + if (!m_bOLEobjectTracking) return; + aContentTypeName = SwResId(STR_CONTENT_TYPE_OLE); + } + if (!aContentTypeName.isEmpty()) + { + OUString aName(m_pActiveShell->GetFlyName()); + lcl_SelectByContentTypeAndName(this, *m_xTreeView, aContentTypeName, aName); + return; + } } // drawing if ((m_pActiveShell->GetSelectionType() & (SelectionType::DrawObject | -- cgit v1.2.3