diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-03-25 16:44:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-03-26 09:45:03 +0100 |
commit | dbaac810a59a391e6ba5c52c6b6b38088cc1ace7 (patch) | |
tree | adfd57c8cb8bcbb5e456db57c8b8d7b9464c3c17 /sw | |
parent | bc94b6d201717ade113e9eea77a109c99bdf137c (diff) |
extract GetAbsPos for reuse
Change-Id: Ida6b70f4166f8b1e19990300a5856ee54556a9f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91065
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index cfa216925470..49f936959429 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -31,6 +31,7 @@ #include <vcl/commandevent.hxx> #include <vcl/help.hxx> #include <vcl/settings.hxx> +#include <vcl/weldutils.hxx> #include <sot/formats.hxx> #include <uiitems.hxx> #include <fmtinfmt.hxx> @@ -1755,20 +1756,7 @@ namespace size_t SwContentTree::GetAbsPos(const weld::TreeIter& rIter) { - size_t nAbsPos = 0; - - std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator(&rIter)); - if (!m_xTreeView->get_iter_first(*xEntry)) - xEntry.reset(); - - while (xEntry && m_xTreeView->iter_compare(*xEntry, rIter) != 0) - { - if (!m_xTreeView->iter_next(*xEntry)) - xEntry.reset(); - nAbsPos++; - } - - return nAbsPos; + return weld::GetAbsPos(*m_xTreeView, rIter); } size_t SwContentTree::GetEntryCount() const |