summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2016-01-15 12:33:35 +0100
committerOliver Specht <oliver.specht@cib.de>2016-01-15 14:36:43 +0000
commit5dbd8085ef32845b831e8ef1917578422d7b52fa (patch)
treee30bda407ed2cbb42365ac2fef3c8232af8df956
parentf65162e850b2d94fca500d1ccd562105b2d8c73f (diff)
tdf#64907: remember format selection in Insert/Reference dialog page
Change-Id: If71a96d6d20a66114025c96fd83fb81e333d14b9 Reviewed-on: https://gerrit.libreoffice.org/21487 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
-rw-r--r--sw/source/ui/fldui/fldref.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 66a5a42d43bf..3110167c41a0 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -245,6 +245,7 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
nFieldDlgFormatSel = 0;
+ sal_uInt16 nFormatBoxPosition = USHRT_MAX;
if( !IsRefresh() )
{
OUString sUserData = GetUserData();
@@ -256,16 +257,26 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
if(nVal != USHRT_MAX)
{
for(sal_Int32 i = 0; i < m_pTypeLB->GetEntryCount(); i++)
+ {
if(nVal == (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(i)))
{
m_pTypeLB->SelectEntryPos(i);
break;
}
+ }
+ sVal = sUserData.getToken(2, ';');
+ if(!sVal.isEmpty())
+ {
+ nFormatBoxPosition = static_cast< sal_uInt16 >(sVal.toInt32());
+ }
}
}
}
TypeHdl(*m_pTypeLB);
-
+ if(nFormatBoxPosition != USHRT_MAX)
+ {
+ m_pFormatLB->SelectEntryPos(nFormatBoxPosition);
+ }
if (IsFieldEdit())
{
m_pTypeLB->SaveValue();
@@ -975,7 +986,11 @@ void SwFieldRefPage::FillUserData()
? USHRT_MAX
: sal::static_int_cast< sal_uInt16 >
(reinterpret_cast< sal_uIntPtr >(m_pTypeLB->GetEntryData( nEntryPos )));
- SetUserData( USER_DATA_VERSION ";" + OUString::number( nTypeSel ));
+ const sal_Int32 nFormatEntryPos = m_pFormatLB->GetSelectEntryPos();
+ const sal_uInt32 nFormatSel = LISTBOX_ENTRY_NOTFOUND == nFormatEntryPos ? USHRT_MAX : nFormatEntryPos;
+ SetUserData( USER_DATA_VERSION ";" +
+ OUString::number( nTypeSel ) + ";" +
+ OUString::number( nFormatSel ));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */