[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/charttypes/VSeriesPlotter.cxx |8 +++- sw/qa/extras/layout/data/tdf134866.docx |binary sw/qa/extras/layout/layout.cxx | 16 3 files changed, 23 insertions(+), 1 deletion(-) New commits: commit a3f1a891ba347f4035ba2925f9f05aa6f1cf9bf1 Author: Tünde Tóth AuthorDate: Fri Jul 24 10:06:40 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Sep 17 14:02:34 2020 +0200 tdf#134866 Chart OOXML import: fix percentage in custom pie chart label Custom pie chart label showed incorrect percentage value. Follow-up of commit 8c1dc30cc9fc96ef3d3ab0c4445959473248ae4d (tdf#125444 Percentage as custom chart label). Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99353 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit c0fac974cefffb16e811259fbc66148712533190) Change-Id: I2fe9cbca876da26a7c3a371c1e711b9e1fc33b1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102770 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 5acd2d587914..e0b25ba74811 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -530,7 +530,13 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re } case DataPointCustomLabelFieldType_PERCENTAGE: { -aTextList[i] = getLabelTextForValue( rDataSeries, nPointIndex, fValue, true ); +if(fSumValue == 0.0) + fSumValue = 1.0; +fValue /= fSumValue; +if(fValue < 0) + fValue *= -1.0; + +aTextList[i] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true); break; } case DataPointCustomLabelFieldType_CELLREF: diff --git a/sw/qa/extras/layout/data/tdf134866.docx b/sw/qa/extras/layout/data/tdf134866.docx new file mode 100644 index ..3358b527133c Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134866.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index adb19aee2646..ade9607847de 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2687,6 +2687,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129173) pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[22]/text", "56"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134866) +{ +SwDoc* pDoc = createDoc("tdf134866.docx"); +SwDocShell* pShell = pDoc->GetDocShell(); + +// Dump the rendering of the first page as an XML file. +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; +xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + +// Check the data label of pie chart. +assertXPathContent( +pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[2]/text", "100%"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129095) { SwDoc* pDoc = createDoc("tdf129095.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/main/ChartView.cxx |6 ++ sw/qa/extras/layout/data/tdf134676.docx |binary sw/qa/extras/layout/layout.cxx | 17 + 3 files changed, 23 insertions(+) New commits: commit 4129658aeb4cb3afee71c22313bf8c26ce8a46fd Author: Tünde Tóth AuthorDate: Fri Jul 10 11:42:08 2020 +0200 Commit: Gabor Kelemen CommitDate: Sun Sep 13 16:26:53 2020 +0200 tdf#134676 Chart OOXML import: fix X axis title width Set length of the horizontal axis title box is about to 80% of the length of the chart area, to avoid of collision of axis titles, like MSO does. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98484 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 02c4b116cc927688fde8401413b126df72fc9b43) Change-Id: Ie01308e2ddc8c1c4d19f812231ede21ff939cb98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102564 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 18bf1c873644..cf9d9f11f50e 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2167,6 +2167,12 @@ std::shared_ptr lcl_createTitle( TitleHelper::eTitleType eType aTextMaxWidth.Width = static_cast(rPageSize.Width * 0.8); aTextMaxWidth.Height = static_cast(rPageSize.Height * 0.5); } +else if (eType == TitleHelper::X_AXIS_TITLE || eType == TitleHelper::SECONDARY_X_AXIS_TITLE + || eType == TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION) +{ +aTextMaxWidth.Width = static_cast(rPageSize.Width * 0.8); +aTextMaxWidth.Height = static_cast(rPageSize.Height * 0.2); +} else if (eType == TitleHelper::Y_AXIS_TITLE || eType == TitleHelper::SECONDARY_Y_AXIS_TITLE || eType == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION) { diff --git a/sw/qa/extras/layout/data/tdf134676.docx b/sw/qa/extras/layout/data/tdf134676.docx new file mode 100644 index ..2a7651dee32f Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134676.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 0228cae06346..fae3e8f7dfd6 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2772,6 +2772,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134235) assertXPath(pXmlDoc, "//textarray", 14); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134676) +{ +SwDoc* pDoc = createDoc("tdf134676.docx"); +SwDocShell* pShell = pDoc->GetDocShell(); + +// Dump the rendering of the first page as an XML file. +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; +xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 14 +// - Actual : 13 +// i.e. the X axis title didn't break to multiple lines. +assertXPath(pXmlDoc, "//textarray", 14); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134146) { SwDoc* pDoc = createDoc("tdf134146.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/charttypes/VSeriesPlotter.cxx | 19 +++ chart2/source/view/inc/LegendEntryProvider.hxx |4 ++-- chart2/source/view/inc/VSeriesPlotter.hxx |2 +- chart2/source/view/main/VLegend.cxx|2 +- sw/qa/extras/layout/data/legend-itemorder-min.docx |binary sw/qa/extras/layout/layout.cxx | 17 + 6 files changed, 28 insertions(+), 16 deletions(-) New commits: commit 106cbf91ff018266bd61e8ae031fee22fd88eefd Author: Tünde Tóth AuthorDate: Tue Jun 23 13:52:39 2020 +0200 Commit: Gabor Kelemen CommitDate: Sun Sep 13 13:40:37 2020 +0200 tdf#134247 Chart OOXML import: fix order of legend entries The order of legend entries was reversed in stacked column, line and area charts. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96941 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit b3057b7944dc52cc2ee3c57f44d4265c625e8dad) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97675 Reviewed-by: Xisco Fauli (cherry picked from commit 305250469e0b22307454ebbf294457f4f2097ba9) Change-Id: Ia4a439aa6cee0619ad323c3fb728ff358cf28537 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102559 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 8189ece987e9..5acd2d587914 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -2351,7 +2351,7 @@ bool VSeriesPlotter::shouldSnapRectToUsedArea() std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( const awt::Size& rEntryKeyAspectRatio -, css::chart::ChartLegendExpansion eLegendExpansion +, LegendPosition eLegendPosition , const Reference< beans::XPropertySet >& xTextProperties , const Reference< drawing::XShapes >& xTarget , const Reference< lang::XMultiServiceFactory >& xShapeFactory @@ -2407,24 +2407,19 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( bBreak = true; bFirstSeries = false; -// add entries reverse if chart is stacked in y-direction and the legend is not wide. -// If the legend is wide and we have a stacked bar-chart the normal order +// add entries reverse if chart is stacked in y-direction and the legend position is right or left. +// If the legend is top or bottom and we have a stacked bar-chart the normal order // is the correct one, unless the chart type is horizontal bar-chart. bool bReverse = false; -if( eLegendExpansion != css::chart::ChartLegendExpansion_WIDE ) +if ( bSwapXAndY ) { StackingDirection eStackingDirection( pSeries->getStackingDirection() ); -bReverse = ( eStackingDirection == StackingDirection_Y_STACKING ); - -if( bSwapXAndY ) -{ -bReverse = !bReverse; -} +bReverse = ( eStackingDirection != StackingDirection_Y_STACKING ); } -else if( bSwapXAndY ) +else if ( eLegendPosition == LegendPosition_LINE_START || eLegendPosition == LegendPosition_LINE_END ) { StackingDirection eStackingDirection( pSeries->getStackingDirection() ); -bReverse = ( eStackingDirection != StackingDirection_Y_STACKING ); +bReverse = ( eStackingDirection == StackingDirection_Y_STACKING ); } if (bReverse) diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx b/chart2/source/view/inc/LegendEntryProvider.hxx index 481583d5a5f8..8a68809e77a5 100644 --- a/chart2/source/view/inc/LegendEntryProvider.hxx +++ b/chart2/source/view/inc/LegendEntryProvider.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_LEGENDENTRYPROVIDER_HXX #define INCLUDED_CHART2_SOURCE_VIEW_INC_LEGENDENTRYPROVIDER_HXX -#include +#include #include #include #include @@ -72,7 +72,7 @@ public: virtual std::vector< ViewLegendEntry > createLegendEntries( const css::awt::Size& rEntryKeyAspectRatio, -css::chart::ChartLegendExpansion eLegendExpansion, +css::chart2::LegendPosition eLegendPosition, const css::uno::Reference< css::beans::XPropertySet >& xTextProperties, const css::uno::Reference< css::drawing::XShapes >& xTarget, const css::uno::Reference<
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/main/VLegend.cxx |2 +- sw/qa/extras/layout/data/tdf15.docx |binary sw/qa/extras/layout/layout.cxx | 17 + 3 files changed, 18 insertions(+), 1 deletion(-) New commits: commit 9821b32fe334eb79ec7ba4f9b32271379b916e6f Author: Tünde Tóth AuthorDate: Mon Jun 22 15:51:51 2020 +0200 Commit: Gabor Kelemen CommitDate: Sun Sep 13 13:11:28 2020 +0200 tdf#15 Chart OOXML import: fix missing legend text resulted by inaccurate calculation of nMaxTextWidth. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96926 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 8c73d6b63714fb41486fd53ec4c7f68ad63cd190) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97372 Tested-by: Jenkins Reviewed-by: Tünde Tóth (cherry picked from commit 936259e7965857541a9ec02db1eebd966718beb4) Change-Id: Ie41bbc30074c6bbccacbc58adda5d9f2cfdfeba8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102558 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 9962b3704089..9c8842f559c4 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -289,7 +289,7 @@ awt::Size lcl_placeLegendEntries( const sal_Int32 nSymbolToTextDistance = static_cast< sal_Int32 >( std::max( 100.0, fViewFontSize * 0.22 ) );//minimum 1mm const sal_Int32 nSymbolPlusDistanceWidth = rMaxSymbolExtent.Width + nSymbolToTextDistance; -sal_Int32 nMaxTextWidth = rRemainingSpace.Width - (2 * nXPadding) - nSymbolPlusDistanceWidth; +sal_Int32 nMaxTextWidth = rRemainingSpace.Width - nSymbolPlusDistanceWidth; uno::Any* pFrameWidthAny = PropertyMapper::getValuePointer( rTextProperties.second, rTextProperties.first, "TextMaximumFrameWidth"); if(pFrameWidthAny) { diff --git a/sw/qa/extras/layout/data/tdf15.docx b/sw/qa/extras/layout/data/tdf15.docx new file mode 100644 index ..2b2b24a5548d Binary files /dev/null and b/sw/qa/extras/layout/data/tdf15.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 83aad11bf537..b0a882ae1af6 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2309,6 +2309,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf114163) // This failed, if the legend first label is not "Data3". The legend position is right. } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf15) +{ +SwDoc* pDoc = createDoc("tdf15.docx"); +SwDocShell* pShell = pDoc->GetDocShell(); + +// Dump the rendering of the first page as an XML file. +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; +xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + +assertXPathContent(pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[8]/text", + "Advanced Diploma"); +// This failed, if the legend label is not "Advanced Diploma". +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125335) { SwDoc* pDoc = createDoc("tdf125335.odt"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/main/PropertyMapper.cxx |2 ++ sw/qa/extras/layout/data/tdf134659.docx|binary sw/qa/extras/layout/layout.cxx | 21 - 3 files changed, 22 insertions(+), 1 deletion(-) New commits: commit 841e9de2ca39ff05b0adef3cdeea6c2669523cf2 Author: Balazs Varga AuthorDate: Thu Jul 9 11:08:38 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Jul 31 14:09:09 2020 +0200 tdf#134659 chart2: use centered label alignment at text break instead of left for axis labels broken into several lines. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98413 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 9eb614f8d2d9cc983c51bcdde211ee0c59c3a96c) Change-Id: Iaf516055748189fa50165f0e954dfe0db15bbfb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99841 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx index f96c7b101509..9866ab300d43 100644 --- a/chart2/source/view/main/PropertyMapper.cxx +++ b/chart2/source/view/main/PropertyMapper.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -453,6 +454,7 @@ void PropertyMapper::getTextLabelMultiPropertyLists( aValueMap.emplace( "TextVerticalAdjust", uno::Any(drawing::TextVerticalAdjust_CENTER) ); //drawing::TextVerticalAdjust - needs to be overwritten aValueMap.emplace( "TextAutoGrowHeight", uno::Any(true) ); // sal_Bool aValueMap.emplace( "TextAutoGrowWidth", uno::Any(true) ); // sal_Bool +aValueMap.emplace( "ParaAdjust", uno::Any(style::ParagraphAdjust_CENTER) ); // style::ParagraphAdjust_CENTER - needs to be overwritten if( bName ) aValueMap.emplace( "Name", uno::Any( OUString() ) ); //CID OUString - needs to be overwritten for each point diff --git a/sw/qa/extras/layout/data/tdf134659.docx b/sw/qa/extras/layout/data/tdf134659.docx new file mode 100644 index ..7fb0bed23d7f Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134659.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index c5de691dc49e..f109a809355e 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2677,6 +2677,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf132956) } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122014) + { SwDoc* pDoc = createDoc("tdf122014.docx"); SwDocShell* pShell = pDoc->GetDocShell(); @@ -2684,7 +2685,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122014) // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; -xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // This failed, if the chart title is aligned to left. @@ -2693,6 +2694,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122014) CPPUNIT_ASSERT_GREATER(nX1 + 100, nX2); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134659) + +{ +SwDoc* pDoc = createDoc("tdf134659.docx"); +SwDocShell* pShell = pDoc->GetDocShell(); + +// Dump the rendering of the first page as an XML file. +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; +xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + +// This failed, if the axis label is aligned to left. +sal_Int32 nX1 = getXPath(pXmlDoc, "//textarray[1]", "x").toInt32(); +sal_Int32 nX2 = getXPath(pXmlDoc, "//textarray[2]", "x").toInt32(); +CPPUNIT_ASSERT_GREATER(nX1 + 250, nX2); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134235) { SwDoc* pDoc = createDoc("tdf134235.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/main/ShapeFactory.cxx |5 - sw/qa/extras/layout/data/tdf122014.docx |binary sw/qa/extras/layout/layout.cxx | 17 + 3 files changed, 21 insertions(+), 1 deletion(-) New commits: commit 7f347ba951cb6ddc7933de25007864e0f6d2d53e Author: Tünde Tóth AuthorDate: Tue Jul 7 10:50:24 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Jul 31 13:27:43 2020 +0200 tdf#122014 Chart OOXML import: set chart title alignment to center Regression from commit: d4190685ac208677bc77f66976287dda0360c42d (tdf#114836, only set changed SfxItemSet properties) Change-Id: If33fa39019bbd36632d15eb3cc0606727e58b111 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98241 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit f6fc6ab2a2792c22a3e74cce83ac7d19c820c9b4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98753 Reviewed-by: Xisco Fauli (cherry picked from commit 944892091ad30c5da192b20d189c7a4388b0c91d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99840 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 8716550d1810..9627fd5bf98f 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -2406,7 +2407,7 @@ uno::Reference< drawing::XShape > aValueMap.insert( { "TextVerticalAdjust", uno::Any(drawing::TextVerticalAdjust_CENTER) } ); //drawing::TextVerticalAdjust aValueMap.insert( { "TextAutoGrowHeight", uno::Any(true) } ); // sal_Bool aValueMap.insert( { "TextAutoGrowWidth", uno::Any(true) } ); // sal_Bool -aValueMap.insert({ "TextMaximumFrameWidth", uno::Any(nTextMaxWidth) }); // sal_Int32 +aValueMap.insert( { "TextMaximumFrameWidth", uno::Any(nTextMaxWidth) } ); // sal_Int32 //set name/classified ObjectID (CID) if( !aName.isEmpty() ) @@ -2506,6 +2507,8 @@ uno::Reference< drawing::XShape > aM.rotate( -basegfx::deg2rad(nRotation) );//#i78696#->#i80521# aM.translate( nXPos, nYPos ); xShapeProp->setPropertyValue( "Transformation", uno::Any( B2DHomMatrixToHomogenMatrix3(aM) ) ); + +xShapeProp->setPropertyValue( "ParaAdjust", uno::Any( style::ParagraphAdjust_CENTER ) ); } catch( const uno::Exception& ) { diff --git a/sw/qa/extras/layout/data/tdf122014.docx b/sw/qa/extras/layout/data/tdf122014.docx new file mode 100644 index ..400939495984 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf122014.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index f7d534e2aa69..c5de691dc49e 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2676,6 +2676,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf132956) "Category 1"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122014) +{ +SwDoc* pDoc = createDoc("tdf122014.docx"); +SwDocShell* pShell = pDoc->GetDocShell(); + +// Dump the rendering of the first page as an XML file. +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; +xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + +// This failed, if the chart title is aligned to left. +sal_Int32 nX1 = getXPath(pXmlDoc, "//textarray[13]", "x").toInt32(); +sal_Int32 nX2 = getXPath(pXmlDoc, "//textarray[14]", "x").toInt32(); +CPPUNIT_ASSERT_GREATER(nX1 + 100, nX2); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134235) { SwDoc* pDoc = createDoc("tdf134235.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/main/ChartView.cxx | 10 +- chart2/source/view/main/VTitle.cxx | 15 --- chart2/source/view/main/VTitle.hxx |3 ++- sw/qa/extras/layout/data/tdf134146.docx |binary sw/qa/extras/layout/layout.cxx | 17 + 5 files changed, 40 insertions(+), 5 deletions(-) New commits: commit 3d48a1ea10e2e01339e3d1676bfd44d5e39102ad Author: Tünde Tóth AuthorDate: Wed Jul 1 15:48:19 2020 +0200 Commit: Gabor Kelemen CommitDate: Tue Jul 28 17:05:18 2020 +0200 tdf#134146 Chart OOXML import: break long horizontal Y axis title Workaround to handle long (near) horizontal Y axis titles, like MSO does. See commit 17f131fcb3f534792a3b2ec6048d03fb54b55eb1 (tdf#134235 Chart OOXML import: fix long chart title). Change-Id: I215aaa8e2ca18920e2b7ca5761c5bed7e8d19663 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97631 Tested-by: László Németh Reviewed-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99596 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 44fcd27c1f33..18bf1c873644 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2161,16 +2161,24 @@ std::shared_ptr lcl_createTitle( TitleHelper::eTitleType eType //create title awt::Size aTextMaxWidth(rPageSize.Width, rPageSize.Height); +bool bYAxisTitle = false; if (eType == TitleHelper::MAIN_TITLE || eType == TitleHelper::SUB_TITLE) { aTextMaxWidth.Width = static_cast(rPageSize.Width * 0.8); aTextMaxWidth.Height = static_cast(rPageSize.Height * 0.5); } +else if (eType == TitleHelper::Y_AXIS_TITLE || eType == TitleHelper::SECONDARY_Y_AXIS_TITLE + || eType == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION) +{ +aTextMaxWidth.Width = static_cast(rPageSize.Width * 0.2); +aTextMaxWidth.Height = static_cast(rPageSize.Height * 0.8); +bYAxisTitle = true; +} apVTitle = std::make_shared(xTitle); OUString aCID = ObjectIdentifier::createClassifiedIdentifierForObject(xTitle, rModel); apVTitle->init(xPageShapes, xShapeFactory, aCID); -apVTitle->createShapes(awt::Point(0, 0), rPageSize, aTextMaxWidth); +apVTitle->createShapes(awt::Point(0, 0), rPageSize, aTextMaxWidth, bYAxisTitle); awt::Size aTitleUnrotatedSize = apVTitle->getUnrotatedSize(); awt::Size aTitleSize = apVTitle->getFinalSize(); diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx index 463dc5e7ba14..8f221a113be5 100644 --- a/chart2/source/view/main/VTitle.cxx +++ b/chart2/source/view/main/VTitle.cxx @@ -101,7 +101,8 @@ void VTitle::changePosition( const awt::Point& rPos ) void VTitle::createShapes( const awt::Point& rPos , const awt::Size& rReferenceSize -, const awt::Size& rTextMaxWidth ) +, const awt::Size& rTextMaxWidth +, bool bYAxisTitle ) { if(!m_xTitle.is()) return; @@ -127,8 +128,16 @@ void VTitle::createShapes( } sal_Int32 nTextMaxWidth; -if (m_fRotationAngleDegree <= 15.0 || m_fRotationAngleDegree >= 345.0 -|| (m_fRotationAngleDegree >= 165.0 && m_fRotationAngleDegree <= 195.0)) +if (bYAxisTitle) +{ +if (m_fRotationAngleDegree < 75.0 || m_fRotationAngleDegree > 285.0 +|| (m_fRotationAngleDegree > 105.0 && m_fRotationAngleDegree < 255.0)) +nTextMaxWidth = rTextMaxWidth.Width; +else +nTextMaxWidth = rTextMaxWidth.Height; +} +else if (m_fRotationAngleDegree <= 15.0 || m_fRotationAngleDegree >= 345.0 + || (m_fRotationAngleDegree >= 165.0 && m_fRotationAngleDegree <= 195.0)) nTextMaxWidth = rTextMaxWidth.Width; else nTextMaxWidth = rTextMaxWidth.Height; diff --git a/chart2/source/view/main/VTitle.hxx b/chart2/source/view/main/VTitle.hxx index f229dda68e3e..c4a790b22101 100644 --- a/chart2/source/view/main/VTitle.hxx +++ b/chart2/source/view/main/VTitle.hxx @@ -45,7 +45,8 @@ public: voidcreateShapes( const css::awt::Point& rPos , const css::awt::Size& rReferenceSize - , const css::awt::Size& nTextMaxWidth ); + , const css::awt::Size& nTextMaxWidth + , bool bYAxisTitle ); double getRotationAnglePi() const; css::awt::Size getUnrotatedSize() const; diff --git a/sw/qa/extras/layout/data/tdf134146.docx b/sw/qa/extras/layout/data/tdf134146.docx new file mode 100644 index ..9fe1bc06196f Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134146.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index cf7cc4965667..2da0437c4598 100644 --- a/sw/qa/extras/layout/layout.cxx +++
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/inc/ShapeFactory.hxx |2 +- chart2/source/view/main/ChartView.cxx| 12 ++-- chart2/source/view/main/ShapeFactory.cxx |4 ++-- chart2/source/view/main/VTitle.cxx | 14 +++--- chart2/source/view/main/VTitle.hxx |3 ++- sw/qa/extras/layout/data/tdf134235.docx |binary sw/qa/extras/layout/layout.cxx | 17 + 7 files changed, 43 insertions(+), 9 deletions(-) New commits: commit 6598665a14a5c5e2dea345c4c313a5499d1decf6 Author: Tünde Tóth AuthorDate: Thu Jun 25 10:43:58 2020 +0200 Commit: Gabor Kelemen CommitDate: Tue Jul 28 15:27:11 2020 +0200 tdf#134235 Chart OOXML import: fix long chart title Workaround to handle long (sub)titles which resulted broken charts. See commit 96a29c12a9d8734c9d2a812f38fc6654b5df9c48 (tdf#101322 Chart OOXML Export: fix missing subtitle). Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97092 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 17f131fcb3f534792a3b2ec6048d03fb54b55eb1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97384 Tested-by: Jenkins Reviewed-by: Tünde Tóth (cherry picked from commit 4d2f76e59b9b6d459a623366912eac00864a956d) Change-Id: I22bb4699bdda8dea5f31c715cc1f439085a0718f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99597 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index 50f4b39b8532..72182814a933 100644 --- a/chart2/source/view/inc/ShapeFactory.hxx +++ b/chart2/source/view/inc/ShapeFactory.hxx @@ -247,7 +247,7 @@ public: const css::awt::Point& rPosition, css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString, const css::uno::Reference< css::beans::XPropertySet > & xTextProperties, -double nRotation, const OUString& aName ); +double nRotation, const OUString& aName, sal_Int32 nTextMaxWidth ); css::uno::Reference< css::drawing::XShape > createInvisibleRectangle( diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index f0f84a9783f2..44fcd27c1f33 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2159,10 +2159,18 @@ std::shared_ptr lcl_createTitle( TitleHelper::eTitleType eType return apVTitle; //create title -apVTitle.reset(new VTitle(xTitle)); + +awt::Size aTextMaxWidth(rPageSize.Width, rPageSize.Height); +if (eType == TitleHelper::MAIN_TITLE || eType == TitleHelper::SUB_TITLE) +{ +aTextMaxWidth.Width = static_cast(rPageSize.Width * 0.8); +aTextMaxWidth.Height = static_cast(rPageSize.Height * 0.5); +} +apVTitle = std::make_shared(xTitle); + OUString aCID = ObjectIdentifier::createClassifiedIdentifierForObject(xTitle, rModel); apVTitle->init(xPageShapes, xShapeFactory, aCID); -apVTitle->createShapes(awt::Point(0,0), rPageSize); +apVTitle->createShapes(awt::Point(0, 0), rPageSize, aTextMaxWidth); awt::Size aTitleUnrotatedSize = apVTitle->getUnrotatedSize(); awt::Size aTitleSize = apVTitle->getFinalSize(); diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index f6219c650151..8716550d1810 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -2373,7 +2373,7 @@ uno::Reference< drawing::XShape > uno::Sequence< uno::Reference< chart2::XFormattedString > >& xFormattedString, const uno::Reference< beans::XPropertySet > & xTextProperties, -double nRotation, const OUString& aName ) +double nRotation, const OUString& aName, sal_Int32 nTextMaxWidth ) { //create shape and add to page uno::Reference< drawing::XShape > xShape( @@ -2406,7 +2406,7 @@ uno::Reference< drawing::XShape > aValueMap.insert( { "TextVerticalAdjust", uno::Any(drawing::TextVerticalAdjust_CENTER) } ); //drawing::TextVerticalAdjust aValueMap.insert( { "TextAutoGrowHeight", uno::Any(true) } ); // sal_Bool aValueMap.insert( { "TextAutoGrowWidth", uno::Any(true) } ); // sal_Bool -aValueMap.insert( { "TextMaximumFrameWidth", uno::Any(rSize.Width) } ); // sal_Int32 +aValueMap.insert({ "TextMaximumFrameWidth", uno::Any(nTextMaxWidth) }); // sal_Int32 //set name/classified ObjectID (CID) if( !aName.isEmpty() ) diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx index d0633263f8af..463dc5e7ba14 100644 --- a/chart2/source/view/main/VTitle.cxx +++ b/chart2/source/view/main/VTitle.cxx @@ -100,7 +100,8 @@ void VTitle::changePosition( const
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/main/VLegend.cxx| 56 ++--- sw/qa/extras/layout/data/long_legendentry.docx |binary sw/qa/extras/layout/layout.cxx | 17 +++ 3 files changed, 67 insertions(+), 6 deletions(-) New commits: commit 1010aa9b2e064446082a0523aa746a2f9cb7458b Author: Tünde Tóth AuthorDate: Mon Jun 15 16:42:40 2020 +0200 Commit: Gabor Kelemen CommitDate: Mon Jul 27 23:26:07 2020 +0200 tdf#126425 Chart: fix missing legend with exceeding text Ellipsize legend box contents, if the custom size of the chart legend is too small to contain the text. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96437 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 72613bd2a04b4b1ba614c0f645e9804ebfe73682) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97503 Tested-by: Jenkins Reviewed-by: Tünde Tóth (cherry picked from commit dc219b0fe04d07a1e5c7c4c37bff94c29d4a1171) Change-Id: I91ef913f509b233912a8bfb878a1c80d577e2a88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99537 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index f9d836921ebe..9962b3704089 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -407,18 +407,62 @@ awt::Size lcl_placeLegendEntries( DrawModelWrapper::removeShape( aTextShapes[nEntry] ); aTextShapes.pop_back(); } -if( nEntry < nNumberOfEntries ) +if( nEntry < nNumberOfEntries && ( nEntry != 0 || nNumberOfColumns != 1 ) ) { DrawModelWrapper::removeShape( rEntries[ nEntry ].aSymbol ); rEntries.pop_back(); nNumberOfEntries--; } } -nSumHeight -= aRowHeights[nRow]; -aRowHeights.pop_back(); -nRemainingSpace = rRemainingSpace.Height - nSumHeight; -if( nRemainingSpace>=0 ) -break; +if (nRow == 0 && nNumberOfColumns == 1) +{ +try +{ +OUString aLabelString = rEntries[0].aLabel[0]->getString(); +const OUString sDots = "..."; +ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory); +for (sal_Int32 nNewLen = aLabelString.getLength() - sDots.getLength(); nNewLen > 0; nNewLen--) +{ +OUString aNewLabel = aLabelString.copy(0, nNewLen) + sDots; +Reference xEntry = pShapeFactory->createText( +xTarget, aNewLabel, rTextProperties.first, rTextProperties.second, uno::Any()); +nSumHeight = xEntry->getSize().Height; +nRemainingSpace = rRemainingSpace.Height - nSumHeight; +if (nRemainingSpace >= 0) +{ +sal_Int32 nWidth = xEntry->getSize().Width + nSymbolPlusDistanceWidth; +if (rRemainingSpace.Width - nWidth >= 0) +{ +aTextShapes.push_back(xEntry); + rEntries[0].aLabel[0]->setString(aNewLabel); +aRowHeights[0] = nSumHeight; +aColumnWidths[0] = nWidth; +break; +} +} +DrawModelWrapper::removeShape(xEntry); +} +if (aTextShapes.size() == 0) +{ +DrawModelWrapper::removeShape(rEntries[0].aSymbol); +rEntries.pop_back(); +nNumberOfEntries--; +aRowHeights.pop_back(); +} +} +catch (const uno::Exception&) +{ +DBG_UNHANDLED_EXCEPTION("chart2"); +} +} +else +{ +nSumHeight -= aRowHeights[nRow]; +aRowHeights.pop_back(); +nRemainingSpace = rRemainingSpace.Height - nSumHeight; +if (nRemainingSpace >= 0) +break; +} } nNumberOfRows = static_cast(aRowHeights.size()); } diff --git a/sw/qa/extras/layout/data/long_legendentry.docx
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
chart2/source/view/main/ChartView.cxx |5 +++-- chart2/source/view/main/VLegend.cxx | 19 +-- chart2/source/view/main/VLegend.hxx |6 -- sw/qa/extras/layout/data/tdf132956.docx |binary sw/qa/extras/layout/layout.cxx | 20 ++-- 5 files changed, 38 insertions(+), 12 deletions(-) New commits: commit b86933f45f0c32ac7aebcd5675224228204e4208 Author: Balazs Varga AuthorDate: Tue May 12 15:36:06 2020 +0200 Commit: Gabor Kelemen CommitDate: Tue Jul 14 20:19:36 2020 +0200 tdf#132956 Chart view: fix missing plot area Do not reduce the inside area of the chart depending on the size of the legend. Use the default legend size. Regression from commit: 739ed2c29f49ea5e83bcd1352b2644c2e2d09f7b (tdf#115630 tdf#88922 Chart: fix custom legend position and size) cherry picked from commit cf46500243c51071227e08c5067041e414180ebc Change-Id: Ic191229d7ceab1f2689ab07424353108f8cb2b95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94059 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: Tünde Tóth Reviewed-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95583 Reviewed-by: Xisco Fauli (cherry picked from commit d1e570f2db9903cba2d8d91343922ef1393d4895) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98763 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 44ca2853f503..f0f84a9783f2 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2252,12 +2252,13 @@ bool lcl_createLegend( const uno::Reference< XLegend > & xLegend if (!VLegend::isVisible(xLegend)) return false; +awt::Size rDefaultLegendSize; VLegend aVLegend( xLegend, xContext, rLegendEntryProviderList, xPageShapes, xShapeFactory, rModel); aVLegend.setDefaultWritingMode( nDefaultWritingMode ); aVLegend.createShapes( awt::Size( rRemainingSpace.Width, rRemainingSpace.Height ), - rPageSize ); -aVLegend.changePosition( rRemainingSpace, rPageSize ); + rPageSize, rDefaultLegendSize ); +aVLegend.changePosition( rRemainingSpace, rPageSize, rDefaultLegendSize ); return true; } diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 8272696ea102..f9d836921ebe 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -270,7 +270,8 @@ awt::Size lcl_placeLegendEntries( const awt::Size& rRemainingSpace, sal_Int32 nYStartPosition, const awt::Size& rPageSize, -bool bIsPivotChart) +bool bIsPivotChart, +awt::Size& rDefaultLegendSize) { bool bIsCustomSize = (eExpansion == css::chart::ChartLegendExpansion_CUSTOM); awt::Size aResultingLegendSize(0,0); @@ -309,6 +310,9 @@ awt::Size lcl_placeLegendEntries( sal_Int32 nMaxEntryHeight = nYOffset + aMaxEntryExtent.Height; sal_Int32 nNumberOfEntries = rEntries.size(); +rDefaultLegendSize.Width = nMaxEntryWidth; +rDefaultLegendSize.Height = nMaxEntryHeight + nYPadding; + sal_Int32 nNumberOfColumns = 0, nNumberOfRows = 0; std::vector< sal_Int32 > aColumnWidths; std::vector< sal_Int32 > aRowHeights; @@ -870,7 +874,8 @@ bool VLegend::isVisible( const Reference< XLegend > & xLegend ) void VLegend::createShapes( const awt::Size & rAvailableSpace, -const awt::Size & rPageSize ) +const awt::Size & rPageSize, +awt::Size & rDefaultLegendSize ) { if(! (m_xLegend.is() && m_xShapeFactory.is() && @@ -980,7 +985,7 @@ void VLegend::createShapes( // place the legend entries aLegendSize = lcl_placeLegendEntries(aViewEntries, eExpansion, bSymbolsLeftSide, fViewFontSize, aMaxSymbolExtent, aTextProperties, xLegendContainer, - m_xShapeFactory, aLegendSize, nUsedButtonHeight, rPageSize, bIsPivotChart); + m_xShapeFactory, aLegendSize, nUsedButtonHeight, rPageSize, bIsPivotChart, rDefaultLegendSize); uno::Reference xModelPage(mrModel.getPageBackground()); @@ -1014,7 +1019,8 @@ void VLegend::createShapes( void VLegend::changePosition( awt::Rectangle & rOutAvailableSpace, -const awt::Size & rPageSize ) +const awt::Size & rPageSize, +const css::awt::Size & rDefaultLegendSize ) { if(! m_xShape.is()) return; @@ -1026,6 +1032,7 @@ void VLegend::changePosition( Reference< beans::XPropertySet > xLegendProp( m_xLegend, uno::UNO_QUERY_THROW ); chart2::RelativePosition aRelativePosition; +bool bDefaultLegendSize = rDefaultLegendSize.Width != 0 ||
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - chart2/source sw/qa
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 cd9e04eebf4a3a8f2c34061f8d8c7b67c7b1de51 Author: Balazs Varga AuthorDate: Tue Mar 24 14:13:48 2020 +0100 Commit: Gabor Kelemen CommitDate: Thu Jun 11 18:51:36 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 (cherry picked from commit 61aa663d9b1d75d1bb0cfc7c4c9e4cb17d8dd00a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96139 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen 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, ); 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 ..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 790d3485a337..d90cc3c4521c 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2551,6 +2551,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 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