tdf#154322 select the first entry of the current page by default
rather than default to nothing selected, if we switch pages and then
back to page 1 this will be selected anyway, so start off that way
Change-Id: Ia684a5e44b12c984df3920f18b34c99693a2702c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149428
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 5d3242e..635e55c 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -189,6 +189,15 @@ namespace svxform
m_xItemList->clear();
}
void XFormsPage::SelectFirstEntry()
{
if (m_xItemList->get_iter_first(*m_xScratchIter))
{
m_xItemList->select(*m_xScratchIter);
ItemSelectHdl(*m_xItemList);
}
}
XFormsPage::XFormsPage(weld::Container* pPage, DataNavigatorWindow* _pNaviWin, DataGroupType _eGroup)
: BuilderPage(pPage, nullptr, "svx/ui/xformspage.ui", "XFormsPage")
, m_pParent(pPage)
@@ -1316,6 +1325,10 @@ namespace svxform
// load xforms models of the current document
LoadModels();
// tdf#154322 select the first entry of the current page by default
if (XFormsPage* pPage = GetPage(sPageId))
pPage->SelectFirstEntry();
}
DataNavigatorWindow::~DataNavigatorWindow()
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index b165b9a..fe26bd2 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -237,6 +237,7 @@ namespace svxform
bool DoMenuAction(std::string_view rMenuID);
void EnableMenuItems();
void SelectFirstEntry();
const OUString& GetInstanceName() const { return m_sInstanceName; }
const OUString& GetInstanceURL() const { return m_sInstanceURL; }