Kaydet (Commit) 5dbd8085 authored tarafından Oliver Specht's avatar Oliver Specht

tdf#64907: remember format selection in Insert/Reference dialog page

Change-Id: If71a96d6d20a66114025c96fd83fb81e333d14b9
Reviewed-on: https://gerrit.libreoffice.org/21487Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarOliver Specht <oliver.specht@cib.de>
üst f65162e8
...@@ -245,6 +245,7 @@ void SwFieldRefPage::Reset(const SfxItemSet* ) ...@@ -245,6 +245,7 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
nFieldDlgFormatSel = 0; nFieldDlgFormatSel = 0;
sal_uInt16 nFormatBoxPosition = USHRT_MAX;
if( !IsRefresh() ) if( !IsRefresh() )
{ {
OUString sUserData = GetUserData(); OUString sUserData = GetUserData();
...@@ -256,16 +257,26 @@ void SwFieldRefPage::Reset(const SfxItemSet* ) ...@@ -256,16 +257,26 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
if(nVal != USHRT_MAX) if(nVal != USHRT_MAX)
{ {
for(sal_Int32 i = 0; i < m_pTypeLB->GetEntryCount(); i++) for(sal_Int32 i = 0; i < m_pTypeLB->GetEntryCount(); i++)
{
if(nVal == (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(i))) if(nVal == (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(i)))
{ {
m_pTypeLB->SelectEntryPos(i); m_pTypeLB->SelectEntryPos(i);
break; break;
} }
}
sVal = sUserData.getToken(2, ';');
if(!sVal.isEmpty())
{
nFormatBoxPosition = static_cast< sal_uInt16 >(sVal.toInt32());
}
} }
} }
} }
TypeHdl(*m_pTypeLB); TypeHdl(*m_pTypeLB);
if(nFormatBoxPosition != USHRT_MAX)
{
m_pFormatLB->SelectEntryPos(nFormatBoxPosition);
}
if (IsFieldEdit()) if (IsFieldEdit())
{ {
m_pTypeLB->SaveValue(); m_pTypeLB->SaveValue();
...@@ -975,7 +986,11 @@ void SwFieldRefPage::FillUserData() ...@@ -975,7 +986,11 @@ void SwFieldRefPage::FillUserData()
? USHRT_MAX ? USHRT_MAX
: sal::static_int_cast< sal_uInt16 > : sal::static_int_cast< sal_uInt16 >
(reinterpret_cast< sal_uIntPtr >(m_pTypeLB->GetEntryData( nEntryPos ))); (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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment