[Libreoffice-commits] core.git: sw/source

Oliver Specht oliver.specht at cib.de
Fri Jan 15 06:37:09 PST 2016


 sw/source/ui/fldui/fldref.cxx |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 5dbd8085ef32845b831e8ef1917578422d7b52fa
Author: Oliver Specht <oliver.specht at cib.de>
Date:   Fri Jan 15 12:33:35 2016 +0100

    tdf#64907: remember format selection in Insert/Reference dialog page
    
    Change-Id: If71a96d6d20a66114025c96fd83fb81e333d14b9
    Reviewed-on: https://gerrit.libreoffice.org/21487
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Oliver Specht <oliver.specht at cib.de>

diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 66a5a42..3110167 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: */


More information about the Libreoffice-commits mailing list