summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-03-26 13:35:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-26 18:02:19 +0100
commitb624b13b3d5a8e573c7de8158cadc66b1982d157 (patch)
tree56948e6a5e8d7f5a7cbde6328a27f13ecd8a72bc /sw/source/uibase/utlui
parent8136620ff432bf17815bef1f88c7531edb839d23 (diff)
loplugin:flatten
Change-Id: Ib7a895fba66f8dc9b6501e61631c02694053b7fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113157 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/utlui')
-rw-r--r--sw/source/uibase/utlui/content.cxx106
1 files changed, 53 insertions, 53 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index fe9da9cfc0e1..265f2b28dc90 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3165,34 +3165,34 @@ void SwContentTree::HideTree()
static void lcl_SelectByContentTypeAndName(SwContentTree* pThis, weld::TreeView& rContentTree,
std::u16string_view rContentTypeName, std::u16string_view rName)
{
- if (!rName.empty())
+ 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 && rContentTypeName != rContentTree.get_text(*xIter))
+ bFoundEntry = rContentTree.iter_next_sibling(*xIter);
+ // find content type content entry and select it
+ if (bFoundEntry)
{
- // find content type entry
- std::unique_ptr<weld::TreeIter> xIter(rContentTree.make_iterator());
- bool bFoundEntry = rContentTree.get_iter_first(*xIter);
- while (bFoundEntry && rContentTypeName != 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))
{
- 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))
{
- if (rName == rContentTree.get_text(*xIter))
+ // get first selected for comparison
+ std::unique_ptr<weld::TreeIter> xFirstSelected(rContentTree.make_iterator());
+ if (!rContentTree.get_selected(xFirstSelected.get()))
+ xFirstSelected.reset();
+ if (rContentTree.count_selected_rows() != 1 ||
+ rContentTree.iter_compare(*xIter, *xFirstSelected) != 0)
{
- // get first selected for comparison
- std::unique_ptr<weld::TreeIter> xFirstSelected(rContentTree.make_iterator());
- if (!rContentTree.get_selected(xFirstSelected.get()))
- xFirstSelected.reset();
- if (rContentTree.count_selected_rows() != 1 ||
- rContentTree.iter_compare(*xIter, *xFirstSelected) != 0)
- {
- // unselect all entries and make passed entry visible and selected
- rContentTree.set_cursor(*xIter);
- pThis->Select();
- }
- break;
+ // unselect all entries and make passed entry visible and selected
+ rContentTree.set_cursor(*xIter);
+ pThis->Select();
}
+ break;
}
}
}
@@ -3405,41 +3405,41 @@ void SwContentTree::SelectOutlinesWithSelection()
}
} while (pCursor && pCursor != pFirstCursor);
- if (!aOutlinePositions.empty())
- {
- // remove duplicates before selecting
- aOutlinePositions.erase(std::unique(aOutlinePositions.begin(), aOutlinePositions.end()),
- aOutlinePositions.end());
+ if (aOutlinePositions.empty())
+ return;
- m_xTreeView->unselect_all();
+ // remove duplicates before selecting
+ aOutlinePositions.erase(std::unique(aOutlinePositions.begin(), aOutlinePositions.end()),
+ aOutlinePositions.end());
- for (auto nOutlinePosition : aOutlinePositions)
- {
- m_xTreeView->all_foreach([this, nOutlinePosition](const weld::TreeIter& rEntry){
- if (lcl_IsContent(rEntry, *m_xTreeView) &&
- reinterpret_cast<SwContent*>(
- m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() ==
- ContentTypeId::OUTLINE)
+ m_xTreeView->unselect_all();
+
+ for (auto nOutlinePosition : aOutlinePositions)
+ {
+ m_xTreeView->all_foreach([this, nOutlinePosition](const weld::TreeIter& rEntry){
+ if (lcl_IsContent(rEntry, *m_xTreeView) &&
+ reinterpret_cast<SwContent*>(
+ m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() ==
+ ContentTypeId::OUTLINE)
+ {
+ if (reinterpret_cast<SwOutlineContent*>(
+ m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() ==
+ nOutlinePosition)
{
- if (reinterpret_cast<SwOutlineContent*>(
- m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() ==
- nOutlinePosition)
- {
- std::unique_ptr<weld::TreeIter> xParent =
- m_xTreeView->make_iterator(&rEntry);
- if (m_xTreeView->iter_parent(*xParent) &&
- !m_xTreeView->get_row_expanded(*xParent))
- m_xTreeView->expand_row(*xParent);
- m_xTreeView->select(rEntry);
- return true;
- }
+ std::unique_ptr<weld::TreeIter> xParent =
+ m_xTreeView->make_iterator(&rEntry);
+ if (m_xTreeView->iter_parent(*xParent) &&
+ !m_xTreeView->get_row_expanded(*xParent))
+ m_xTreeView->expand_row(*xParent);
+ m_xTreeView->select(rEntry);
+ return true;
}
- return false;
- });
- }
-
- Select();
+ }
+ return false;
+ });
}
+
+ Select();
}
void SwContentTree::MoveOutline(SwOutlineNodes::size_type nTargetPos)