summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-04-27 18:39:04 -0800
committerJim Raykowski <raykowj@gmail.com>2021-05-05 08:00:27 +0200
commitb43ab86df783c7816deb5810d89d52e2c3a93b5a (patch)
tree6813466203cf614dd93044b39beaaa641715f618 /sw/source
parent36f35bd823ef9af454f1d4609ad302acbef0709b (diff)
tdf#140969 Select in Navigator all document selected drawing objects
when in Drawing objects content navigation view Change-Id: If5d78453f36f035a93936490ab8c2cd4223f1feb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114811 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/utlui/content.cxx49
-rw-r--r--sw/source/uibase/utlui/navipi.cxx4
2 files changed, 39 insertions, 14 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index afe313cfafcf..f1264d026f9a 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2536,11 +2536,11 @@ void SwContentTree::ToggleToRoot()
}
m_nRootType = pCntType->GetType();
m_bIsRoot = true;
- Display(State::HIDDEN != m_eState);
- if (m_nRootType == ContentTypeId::OUTLINE)
+ if (m_nRootType == ContentTypeId::OUTLINE || m_nRootType == ContentTypeId::DRAWOBJECT)
{
m_xTreeView->set_selection_mode(SelectionMode::Multiple);
}
+ Display(State::HIDDEN != m_eState);
}
}
else
@@ -2554,6 +2554,7 @@ void SwContentTree::ToggleToRoot()
m_pConfig->SetRootType( m_nRootType );
weld::Toolbar* pBox = GetParentWindow()->m_xContent5ToolBox.get();
pBox->set_item_active("root", m_bIsRoot);
+ UpdateTracking();
}
bool SwContentTree::HasContentChanged()
@@ -3309,6 +3310,31 @@ static void lcl_SelectByContentTypeAndName(SwContentTree* pThis, weld::TreeView&
}
}
+static void lcl_SelectDrawObjectByName(weld::TreeView& rContentTree, std::u16string_view rName)
+{
+ if (rName.empty())
+ return;
+
+ // find content type entry
+ std::unique_ptr<weld::TreeIter> xIter(rContentTree.make_iterator());
+ bool bFoundEntry = rContentTree.get_iter_first(*xIter);
+ while (bFoundEntry && SwResId(STR_CONTENT_TYPE_DRAWOBJECT) != rContentTree.get_text(*xIter))
+ bFoundEntry = rContentTree.iter_next_sibling(*xIter);
+ // find content type content entry and select it
+ if (bFoundEntry)
+ {
+ rContentTree.expand_row(*xIter); // assure content type entry is expanded
+ while (rContentTree.iter_next(*xIter) && lcl_IsContent(*xIter, rContentTree))
+ {
+ if (rName == rContentTree.get_text(*xIter))
+ {
+ rContentTree.select(*xIter);
+ break;
+ }
+ }
+ }
+}
+
/** No idle with focus or while dragging */
IMPL_LINK_NOARG(SwContentTree, TimerUpdate, Timer *, void)
{
@@ -3430,27 +3456,24 @@ void SwContentTree::UpdateTracking()
SelectionType::DbForm)) &&
!(m_bIsRoot && m_nRootType != ContentTypeId::DRAWOBJECT))
{
+ m_xTreeView->unselect_all();
SdrView* pSdrView = m_pActiveShell->GetDrawView();
- if(pSdrView && 1 == pSdrView->GetMarkedObjectCount())
+ if (pSdrView)
{
- SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0);
- OUString aName(pSelected->GetName());
- if (!aName.isEmpty())
- lcl_SelectByContentTypeAndName(this, *m_xTreeView,
- SwResId(STR_CONTENT_TYPE_DRAWOBJECT), aName);
- else
+ for (size_t nIdx(0); nIdx < pSdrView->GetMarkedObjectCount(); nIdx++)
{
- // clear treeview selections
- m_xTreeView->unselect_all();
- Select();
+ SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(nIdx);
+ OUString aName(pSelected->GetName());
+ if (!aName.isEmpty())
+ lcl_SelectDrawObjectByName(*m_xTreeView, aName);
}
}
else
{
// clear treeview selections
m_xTreeView->unselect_all();
- Select();
}
+ Select();
return;
}
// graphic, frame, and ole
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 05bbbe6a9e5b..1567f7605d7e 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -1121,7 +1121,7 @@ SwNavigatorWin::SwNavigatorWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr,
{
m_xNavi->m_xContentTree->SetRootType(nRootType);
m_xNavi->m_xContent5ToolBox->set_item_active("root", true);
- if (nRootType == ContentTypeId::OUTLINE)
+ if (nRootType == ContentTypeId::OUTLINE || nRootType == ContentTypeId::DRAWOBJECT)
{
m_xNavi->m_xContentTree->set_selection_mode(SelectionMode::Multiple);
}
@@ -1132,6 +1132,8 @@ SwNavigatorWin::SwNavigatorWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr,
SetMinOutputSizePixel(GetOptimalSize());
if (pNaviConfig->IsSmall())
m_xNavi->ZoomIn();
+
+ m_xNavi->m_xContentTree->UpdateTracking();
}
void SwNavigatorWin::StateChanged(StateChangedType nStateChange)