[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - include/svl svl/source xmloff/source

Laurent Balland-Poirier laurent.balland-poirier at laposte.net
Wed May 25 15:42:56 UTC 2016


 include/svl/zformat.hxx          |    2 ++
 svl/source/numbers/zformat.cxx   |   10 ++++++++++
 xmloff/source/style/xmlnumfe.cxx |    4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit f3de0caba189ff7d17a2f37495147673e68c2e7f
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Sat Apr 30 21:44:29 2016 +0200

    tdf#31449 Correctly test if fraction has no integer part
    
    Test if fraction format has no integer part is modified
    to take into account all cases: ??/?? or ##/##
    and do not detect false positive like ? ??/??
    
    Change-Id: Ia8677a5ad496e5df56ce6bf1290323555e46ba0a
    Reviewed-on: https://gerrit.libreoffice.org/24540
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 3beb146b34fa931e2d63f4738a3ae69fe286545f)
    Reviewed-on: https://gerrit.libreoffice.org/25452
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index 3ae701ab..a090595 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -276,6 +276,8 @@ public:
             }
             return false;
         }
+    /** Get the count of numbers among string elements **/
+    sal_uInt16 GetNumForNumberElementCount( sal_uInt16 nNumFor ) const;
 
     /** Get the scanned type of the specified subformat. */
     short GetNumForInfoScannedType( sal_uInt16 nNumFor ) const
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 3b6384e..c9f08ad 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -5126,6 +5126,16 @@ sal_Int32 SvNumberformat::GetQuoteEnd( const OUString& rStr, sal_Int32 nPos,
     return nLen; // End of String
 }
 
+sal_uInt16 SvNumberformat::GetNumForNumberElementCount( sal_uInt16 nNumFor ) const
+{
+    if ( nNumFor < 4 )
+    {
+        sal_uInt16 nAnz = NumFor[nNumFor].GetCount();
+        return nAnz - ImpGetNumForStringElementCount( nNumFor );
+    }
+    return 0;
+}
+
 sal_uInt16 SvNumberformat::ImpGetNumForStringElementCount( sal_uInt16 nNumFor ) const
 {
     sal_uInt16 nCnt = 0;
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 41c549d..068ca83 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1457,9 +1457,9 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
                             case css::util::NumberFormat::FRACTION:
                                 {
                                     sal_Int32 nInteger = nLeading;
-                                    if ( pElemStr && (*pElemStr)[0] == '?' )
+                                    if ( rFormat.GetNumForNumberElementCount( nPart ) == 3 )
                                     {
-                                        //  If the first digit character is a question mark,
+                                        //  If there is only two numbers + fraction in format string
                                         //  the fraction doesn't have an integer part, and no
                                         //  min-integer-digits attribute must be written.
                                         nInteger = -1;


More information about the Libreoffice-commits mailing list