[Libreoffice-commits] core.git: include/svl sc/source

Laurent Balland-Poirier laurent.balland-poirier at laposte.net
Tue Mar 14 23:34:30 UTC 2017


 include/svl/zformat.hxx          |    6 ++++++
 sc/source/core/data/documen4.cxx |    6 ++++++
 2 files changed, 12 insertions(+)

New commits:
commit 60d7644a46970e6eaee882e0c5d65692da206c24
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Sun Mar 12 14:11:36 2017 +0100

    tdf#106253 Precision as shown for thousand dividor
    
    Info().nThousand contains number of thousands dividors
    after which digits are not displayed, i.e. 12345 is displayed
    as 12 with format 0, (in en_US)
    
    Change-Id: Ifa5540f2efd8ab006a07eade53f7aa0d31a19eac
    Reviewed-on: https://gerrit.libreoffice.org/35097
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index 1dd05d2..2f382d8 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -226,6 +226,12 @@ public:
     sal_uInt16 GetFormatIntegerDigits( sal_uInt16 nIx = 0 ) const
         { return NumFor[nIx].Info().nCntPre; }
 
+    /** Count of hidden integer digits with thousands dividor:
+     * formats like "0," to show only thousands
+     */
+    sal_uInt16 GetThousandDivisorPrecision( sal_uInt16 nIx = 0 ) const
+        { return NumFor[nIx].Info().nThousand * 3; }
+
     //! Read/write access on a special sal_uInt16 component, may only be used on the
     //! standard format 0, 10000, ... and only by the number formatter!
     struct FormatterPrivateAccess { friend SvNumberFormatter; private: FormatterPrivateAccess() {} };
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 6bb280b..1cdc777 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -692,6 +692,12 @@ double ScDocument::RoundValueAsShown( double fVal, sal_uInt32 nFormat ) const
                 {
                     return pFormat->GetRoundFractionValue( fVal );
                 }
+                case css::util::NumberFormat::NUMBER:
+                case css::util::NumberFormat::CURRENCY:
+                {   // tdf#106253 Thousands dividors for format "0,"
+                    nPrecision -=  pFormat->GetThousandDivisorPrecision( nIdx );
+                    break;
+                }
             }
         }
         else


More information about the Libreoffice-commits mailing list