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

Eike Rathke erack at redhat.com
Tue Dec 13 17:46:10 UTC 2016


 svx/source/dialog/pagenumbering.src            |    4 +++-
 svx/source/dialog/pagenumberlistbox.cxx        |   18 +++++++++++++++---
 sw/source/uibase/fldui/fldmgr.cxx              |    9 +++++----
 sw/source/uibase/misc/numberingtypelistbox.cxx |   11 ++++++-----
 4 files changed, 29 insertions(+), 13 deletions(-)

New commits:
commit b845be872cd3fc6b4dc0e6175675a9b31ef7fc42
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Dec 13 18:44:34 2016 +0100

    use RID_SVXSTRARY_PAGE_NUMBERING StringArray also in Writer
    
    ... and add the two missing extra strings from
    sw/source/ui/misc/numberingtypelistbox.src to
    svx/source/dialog/pagenumbering.src and filter them out for the page number
    dialog, so later we can get rid of yet a 3rd place where those strings are to
    be translated and maintained.
    
    Change-Id: If7d124692c752f341d4ea11a8914b099f711fa10

diff --git a/svx/source/dialog/pagenumbering.src b/svx/source/dialog/pagenumbering.src
index c3b8852..2c3a001 100644
--- a/svx/source/dialog/pagenumbering.src
+++ b/svx/source/dialog/pagenumbering.src
@@ -23,12 +23,14 @@ StringArray RID_SVXSTRARY_PAGE_NUMBERING
 {
     ItemList [ en-US ] =
     {
+        < "None" ;                                  5/*SVX_NUM_NUMBER_NONE         */; > ;
+        < "Bullet" ;                                6/*SVX_NUM_CHAR_SPECIAL        */; > ;
+        < "Graphics" ;                              8/*SVX_NUM_BITMAP              */; > ;
         < "1, 2, 3, ..." ;                          4/*SVX_NUM_ARABIC              */; > ;
         < "A, B, C, ..." ;                          0/*SVX_NUM_CHARS_UPPER_LETTER  */; > ;
         < "a, b, c, ..." ;                          1/*SVX_NUM_CHARS_LOWER_LETTER  */; > ;
         < "I, II, III, ..." ;                       2/*SVX_NUM_ROMAN_UPPER         */; > ;
         < "i, ii, iii, ..." ;                       3/*SVX_NUM_ROMAN_LOWER         */; > ;
-        < "None" ;                                  5/*SVX_NUM_NUMBER_NONE         */; > ;
         < "A, .., AA, .., AAA, ..." ;               9/*SVX_NUM_CHARS_UPPER_LETTER_N*/; > ;
         < "a, .., aa, .., aaa, ..." ;               10/*SVX_NUM_CHARS_LOWER_LETTER_N*/; > ;
         < "Native Numbering" ;                      12 /*NATIVE_NUMBERING                   */; > ;
diff --git a/svx/source/dialog/pagenumberlistbox.cxx b/svx/source/dialog/pagenumberlistbox.cxx
index d02767a..94a9585 100644
--- a/svx/source/dialog/pagenumberlistbox.cxx
+++ b/svx/source/dialog/pagenumberlistbox.cxx
@@ -21,6 +21,7 @@
 #include <svx/pagenumberlistbox.hxx>
 #include <tools/resary.hxx>
 #include <vcl/builderfactory.hxx>
+#include <com/sun/star/style/NumberingType.hpp>
 
 PageNumberListBox::PageNumberListBox(vcl::Window* pParent)
     : ListBox( pParent, WB_BORDER | WB_DROPDOWN)
@@ -30,10 +31,21 @@ PageNumberListBox::PageNumberListBox(vcl::Window* pParent)
 
     for ( sal_uInt32 i = 0; i < nCnt; ++i )
     {
-        OUString aStr = aPaperAry.GetString(i);
         sal_uInt16 nData = aPaperAry.GetValue(i);
-        sal_Int32 nPos = InsertEntry( aStr );
-        SetEntryData( nPos, reinterpret_cast<void*>((sal_uLong)nData) );
+        switch (nData)
+        {
+            // String list array is also used in Writer and contains strings
+            // for Bullet and Graphics, ignore those here.
+            case css::style::NumberingType::CHAR_SPECIAL:
+            case css::style::NumberingType::BITMAP:
+            break;
+            default:
+                {
+                    OUString aStr = aPaperAry.GetString(i);
+                    sal_Int32 nPos = InsertEntry( aStr );
+                    SetEntryData( nPos, reinterpret_cast<void*>((sal_uLong)nData) );
+                }
+        }
     }
     SetDropDownLineCount(6);
 }
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index 006b958..600b544 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -39,6 +39,8 @@
 #include <sfx2/objsh.hxx>
 #include <sfx2/linkmgr.hxx>
 #include <sfx2/app.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
 #include <basic/basmgr.hxx>
 #include <editeng/langitem.hxx>
 #include <svl/macitem.hxx>
@@ -592,8 +594,7 @@ OUString SwFieldMgr::GetFormatStr(sal_uInt16 nTypeId, sal_uLong nFormatId) const
     {
         if(xNumberingInfo.is())
         {
-            SwOLENames aNames(SW_RES(STRRES_NUMTYPES));
-            ResStringArray& rNames = aNames.GetNames();
+            ResStringArray aNames( SVX_RES( RID_SVXSTRARY_PAGE_NUMBERING ));
 
             Sequence<sal_Int16> aTypes = xNumberingInfo->getSupportedNumberingTypes();
             const sal_Int16* pTypes = aTypes.getConstArray();
@@ -606,10 +607,10 @@ OUString SwFieldMgr::GetFormatStr(sal_uInt16 nTypeId, sal_uLong nFormatId) const
                 {
                     if(nValidEntry == ((sal_Int32)nFormatId) - nOffset)
                     {
-                        sal_uInt32 n = rNames.FindIndex(pTypes[nType]);
+                        sal_uInt32 n = aNames.FindIndex(pTypes[nType]);
                         if (n != RESARRAY_INDEX_NOTFOUND)
                         {
-                            aRet = rNames.GetString(n);
+                            aRet = aNames.GetString(n);
                         }
                         else
                         {
diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx
index a0eeb51..32b4eff 100644
--- a/sw/source/uibase/misc/numberingtypelistbox.cxx
+++ b/sw/source/uibase/misc/numberingtypelistbox.cxx
@@ -26,6 +26,8 @@
 #include <comphelper/processfactory.hxx>
 #include <com/sun/star/text/XNumberingTypeInfo.hpp>
 #include <vcl/builderfactory.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
 
 #include <unomid.h>
 
@@ -87,11 +89,10 @@ void SwNumberingTypeListBox::Reload(SwInsertNumTypes nTypeFlags)
             pTypes = aTypes.getConstArray();
         }
     }
-    SwOLENames aNames(SW_RES(STRRES_NUMTYPES));
-    ResStringArray& rNames = aNames.GetNames();
-    for(size_t i = 0; i < rNames.Count(); i++)
+    ResStringArray aNames( SVX_RES( RID_SVXSTRARY_PAGE_NUMBERING ));
+    for(size_t i = 0; i < aNames.Count(); i++)
     {
-        sal_IntPtr nValue = rNames.GetValue(i);
+        sal_IntPtr nValue = aNames.GetValue(i);
         bool bInsert = true;
         sal_Int32 nPos = LISTBOX_APPEND;
         switch(nValue)
@@ -133,7 +134,7 @@ void SwNumberingTypeListBox::Reload(SwInsertNumTypes nTypeFlags)
         }
         if(bInsert)
         {
-            sal_Int32 nEntry = InsertEntry(rNames.GetString(i), nPos);
+            sal_Int32 nEntry = InsertEntry(aNames.GetString(i), nPos);
             SetEntryData( nEntry, reinterpret_cast<void*>(nValue) );
         }
     }


More information about the Libreoffice-commits mailing list