chart2/source/tools/NumberFormatterWrapper.cxx |    3 +++
 sw/qa/extras/layout/data/tdf130969.docx        |binary
 sw/qa/extras/layout/layout.cxx                 |   16 ++++++++++++++++
 3 files changed, 19 insertions(+)

New commits:
commit 61aa663d9b1d75d1bb0cfc7c4c9e4cb17d8dd00a
Author:     Balazs Varga <balazs.varga...@gmail.com>
AuthorDate: Tue Mar 24 14:13:48 2020 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Apr 1 11:19:59 2020 +0200

    tdf#130969 Chart view: fix incorrect precision of axis labels
    
    Use UNLIMITED_PRECISION in case of GENERAL number format of labels
    in embedded charts, just like we do in Calc.
    
    Regression from commit: 7f373a4c88961348f35e4f990182628488878efe
    (tdf#48041 Chart: do not duplicate major value)
    
    Change-Id: I298353d748f34e23bc642b3b0c365df6e73c23aa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90984
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/chart2/source/tools/NumberFormatterWrapper.cxx 
b/chart2/source/tools/NumberFormatterWrapper.cxx
index a585c04b7dc3..50f6dc7fb132 100644
--- a/chart2/source/tools/NumberFormatterWrapper.cxx
+++ b/chart2/source/tools/NumberFormatterWrapper.cxx
@@ -105,6 +105,9 @@ OUString NumberFormatterWrapper::getFormattedString( 
sal_Int32 nNumberFormatKey,
         m_aNullDate >>= aNewNullDate;
         
m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year);
     }
+    // tdf#130969: use UNLIMITED_PRECISION in case of GENERAL Number Format
+    if( m_pNumberFormatter->GetStandardPrec() != 
SvNumberFormatter::UNLIMITED_PRECISION )
+        
m_pNumberFormatter->ChangeStandardPrec(SvNumberFormatter::UNLIMITED_PRECISION);
     m_pNumberFormatter->GetOutputString(fValue, nNumberFormatKey, aText, 
&pTextColor);
     if ( m_aNullDate.hasValue() )
     {
diff --git a/sw/qa/extras/layout/data/tdf130969.docx 
b/sw/qa/extras/layout/data/tdf130969.docx
new file mode 100644
index 000000000000..446dc16e7dd8
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf130969.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index b6295cab0ef5..2a24e68ccd35 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2547,6 +2547,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796)
         "15");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130969)
+{
+    SwDoc* pDoc = createDoc("tdf130969.docx");
+    SwDocShell* pShell = pDoc->GetDocShell();
+
+    // Dump the rendering of the first page as an XML file.
+    std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+    MetafileXmlDump dumper;
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    // This failed, if the minimum value of Y axis is not 0.35781
+    assertXPathContent(
+        pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[5]/text", 
"0.35781");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129054)
 {
     SwDoc* pDoc = createDoc("tdf129054.docx");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to