summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-18 12:42:41 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-11-18 17:55:48 +0100
commit43570eb811ec731d5f86b5fa00bb5dfacaceb2ef (patch)
treecb7c10bf4be97e501dd4e44ad3560ef3e3959f83 /svx
parenta7528cd6f17ea5c5b29e7d607e54c62de0d9e7db (diff)
rhbz#1773525 reducing the amount of saved search/replace entries didn't work
Change-Id: I1512ef507130718859271079e603a95cf2105c58 Reviewed-on: https://gerrit.libreoffice.org/83088 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/srchdlg.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 92fa6a1603ee..a2d2747e0221 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -149,7 +149,7 @@ struct SearchDlg_Impl
}
};
-static void ListToStrArr_Impl( sal_uInt16 nId, std::vector<OUString>& rStrLst, weld::ComboBox& rCBox )
+static void ListToStrArr_Impl(sal_uInt16 nId, std::vector<OUString>& rStrLst, weld::ComboBox& rCBox, sal_uInt16 nRememberSize)
{
const SfxStringListItem* pSrchItem =
static_cast<const SfxStringListItem*>(SfxGetpApp()->GetItem( nId ));
@@ -158,6 +158,9 @@ static void ListToStrArr_Impl( sal_uInt16 nId, std::vector<OUString>& rStrLst, w
{
std::vector<OUString> aLst = pSrchItem->GetList();
+ if (aLst.size() > nRememberSize)
+ aLst.resize(nRememberSize);
+
for (const OUString & s : aLst)
{
rStrLst.push_back(s);
@@ -375,9 +378,9 @@ void SvxSearchDialog::Construct_Impl()
// Get stored search-strings from the application
ListToStrArr_Impl(SID_SEARCHDLG_SEARCHSTRINGS,
- aSearchStrings, *m_xSearchLB);
+ aSearchStrings, *m_xSearchLB, nRememberSize);
ListToStrArr_Impl(SID_SEARCHDLG_REPLACESTRINGS,
- aReplaceStrings, *m_xReplaceLB);
+ aReplaceStrings, *m_xReplaceLB, nRememberSize);
InitControls_Impl();