summaryrefslogtreecommitdiff
path: root/sw/source/ui/misc/glossary.cxx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-01-27 19:54:58 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-02-04 21:59:32 +0100
commit148bc64fce5c7980e13de4743f67c0ef65412b7f (patch)
treec01f2097dad8f2ce7b53449cd747b9c8e4091619 /sw/source/ui/misc/glossary.cxx
parentf0c7e840b02511d1fffb44ee9fc31b23b1fbb538 (diff)
Group common code
Change-Id: Id836c9e4bce7ae36e3ebbfea2d84f1eb095bd298 Reviewed-on: https://gerrit.libreoffice.org/67311 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'sw/source/ui/misc/glossary.cxx')
-rw-r--r--sw/source/ui/misc/glossary.cxx34
1 files changed, 19 insertions, 15 deletions
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 43c616deece3..27c210083eaf 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -262,6 +262,22 @@ void SwGlossaryDlg::dispose()
SvxStandardDialog::dispose();
}
+namespace
+{
+
+OUString getCurrentGlossary()
+{
+ const OUString sTemp{ ::GetCurrGlosGroup() };
+
+ // the zeroth path is not being recorded!
+ if (sTemp.getToken(1, GLOS_DELIM).startsWith("0"))
+ return sTemp.getToken(0, GLOS_DELIM);
+
+ return sTemp;
+}
+
+}
+
// select new group
IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox, void )
{
@@ -299,11 +315,7 @@ IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox, void )
if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
{
SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_SET_ACT_GLOSSARY );
- OUString sTemp(::GetCurrGlosGroup());
- // the zeroth path is not being recorded!
- if (sTemp.getToken(1, GLOS_DELIM).startsWith("0"))
- sTemp = sTemp.getToken(0, GLOS_DELIM);
- aReq.AppendItem(SfxStringItem(FN_SET_ACT_GLOSSARY, sTemp));
+ aReq.AppendItem(SfxStringItem(FN_SET_ACT_GLOSSARY, getCurrentGlossary()));
aReq.Done();
}
Invalidate(InvalidateFlags::Update);
@@ -319,11 +331,7 @@ void SwGlossaryDlg::Apply()
if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
{
SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_INSERT_GLOSSARY );
- OUString sTemp(::GetCurrGlosGroup());
- // the zeroth path is not being recorded!
- if (sTemp.getToken(1, GLOS_DELIM).startsWith("0"))
- sTemp = sTemp.getToken(0, GLOS_DELIM);
- aReq.AppendItem(SfxStringItem(FN_INSERT_GLOSSARY, sTemp));
+ aReq.AppendItem(SfxStringItem(FN_INSERT_GLOSSARY, getCurrentGlossary()));
aReq.AppendItem(SfxStringItem(FN_PARAM_1, aGlosName));
aReq.Done();
}
@@ -474,11 +482,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool )
if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
{
SfxRequest aReq(pSh->GetView().GetViewFrame(), FN_NEW_GLOSSARY);
- OUString sTemp(::GetCurrGlosGroup());
- // the zeroth path is not being recorded!
- if (sTemp.getToken(1, GLOS_DELIM).startsWith("0"))
- sTemp = sTemp.getToken(0, GLOS_DELIM);
- aReq.AppendItem(SfxStringItem(FN_NEW_GLOSSARY, sTemp));
+ aReq.AppendItem(SfxStringItem(FN_NEW_GLOSSARY, getCurrentGlossary()));
aReq.AppendItem(SfxStringItem(FN_PARAM_1, aShortName));
aReq.AppendItem(SfxStringItem(FN_PARAM_2, aStr));
aReq.Done();