core.git: chart2/source sw/qa
chart2/source/view/main/SeriesPlotterContainer.cxx |7 + chart2/source/view/main/SeriesPlotterContainer.hxx |2 - sw/qa/extras/layout/layout3.cxx| 25 + 3 files changed, 28 insertions(+), 6 deletions(-) New commits: commit 40a19e61efff859d83e0689c0ed7d40c8e9ae8fe Author: Balazs Varga AuthorDate: Thu Mar 7 14:32:44 2024 +0100 Commit: Balazs Varga CommitDate: Fri Mar 8 09:42:42 2024 +0100 tdf#159456 - chart view: fix wrongly shifted value Y axis We only have to shift the category axis only, and not the value axis, if we have a chart data table. Change-Id: Ie77ea829e8f8987702dce7d17cb3e20054f3d8cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164539 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx index b70e51510b7d..06a22207634d 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -174,7 +174,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart } if (xDiagram->getDataTable().is()) -m_bForceShiftPosition = true; +m_bTableShiftPosition = true; //prepare for autoscaling and shape creation // - create plotter for charttypes (for each first scale group at each plotter, as they are independent) @@ -357,12 +357,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart bool SeriesPlotterContainer::isCategoryPositionShifted(const chart2::ScaleData& rSourceScale, bool bHasComplexCategories) { -if (m_bForceShiftPosition) -return true; - if (rSourceScale.AxisType == AxisType::CATEGORY) return bHasComplexCategories || rSourceScale.ShiftedCategoryPosition - || m_bChartTypeUsesShiftedCategoryPositionPerDefault; + || m_bTableShiftPosition || m_bChartTypeUsesShiftedCategoryPositionPerDefault; if (rSourceScale.AxisType == AxisType::DATE) return rSourceScale.ShiftedCategoryPosition; diff --git a/chart2/source/view/main/SeriesPlotterContainer.hxx b/chart2/source/view/main/SeriesPlotterContainer.hxx index 578f2ba2760c..38f3c8b909c8 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.hxx +++ b/chart2/source/view/main/SeriesPlotterContainer.hxx @@ -151,7 +151,7 @@ private: sal_Int32 m_nMaxAxisIndex; bool m_bChartTypeUsesShiftedCategoryPositionPerDefault; -bool m_bForceShiftPosition = false; +bool m_bTableShiftPosition = false; sal_Int32 m_nDefaultDateNumberFormat; }; diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 7bb1dbced75c..9d2de1ea0497 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -2458,6 +2458,31 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159422) CPPUNIT_ASSERT_DOUBLES_EQUAL(6573, nYSymbol3, 20); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159456) +{ +// Given a document with chart, which have a datatable +createSwDoc("charttable.odt"); +SwDoc* pDoc = getSwDoc(); +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); + Without the fix, this would fail: + - Expected: 1 + - Actual : 1.5 + - In <>, XPath contents of child does not match +assertXPathContent( +pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[103]/textarray/text"_ostr, +"1"); +assertXPathContent( +pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[104]/textarray/text"_ostr, +"2"); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
core.git: chart2/source sw/qa
chart2/source/view/main/DataTableView.cxx |9 +++--- sw/qa/extras/layout/data/charttable.odt |binary sw/qa/extras/layout/layout3.cxx | 39 ++ 3 files changed, 44 insertions(+), 4 deletions(-) New commits: commit f4ba83e82aafc206d17d2fa66a27573ebc5a3624 Author: Balazs Varga AuthorDate: Wed Mar 6 22:52:44 2024 +0100 Commit: Balazs Varga CommitDate: Fri Mar 8 09:41:15 2024 +0100 tdf#159422 - chart view: fix symbols position of data table legend Calculate the correct/optimal row height after calculating and set correct width of a table cell. Then we will have the correct row height for the symbol positions. Change-Id: I65bc0f0579ea100906b0b32449c2200a54c2a353 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164512 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/chart2/source/view/main/DataTableView.cxx b/chart2/source/view/main/DataTableView.cxx index c3c807ca099b..eacd91a6a651 100644 --- a/chart2/source/view/main/DataTableView.cxx +++ b/chart2/source/view/main/DataTableView.cxx @@ -455,11 +455,9 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV nRow++; } +// force recalculation of column widths in the table shape xBroadcaster->unlockBroadcasts(); - -// force recalculation of all cells in the table shape pTableObject->DistributeColumns(0, nColumnCount, true, true); -pTableObject->DistributeRows(0, nRowCount, true, true); xBroadcaster->lockBroadcasts(); @@ -477,6 +475,10 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV xPropertySet->setPropertyValue("Width", uno::Any(nColumnWidth)); } +// force recalculation of row heights in the table shape +xBroadcaster->unlockBroadcasts(); +pTableObject->DistributeRows(0, nRowCount, true, true); + if (bKeys) { sal_Int32 nTotalHeight = 0; @@ -501,7 +503,6 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV } } } -xBroadcaster->unlockBroadcasts(); } void DataTableView::changePosition(sal_Int32 x, sal_Int32 y) diff --git a/sw/qa/extras/layout/data/charttable.odt b/sw/qa/extras/layout/data/charttable.odt new file mode 100644 index ..e8dfa37d8006 Binary files /dev/null and b/sw/qa/extras/layout/data/charttable.odt differ diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index f96b786cc093..7bb1dbced75c 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -2419,6 +2419,45 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159443) "4.3"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159422) +{ +// Given a document with chart, which have a datatable +createSwDoc("charttable.odt"); +SwDoc* pDoc = getSwDoc(); +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); + Without the fix, this would fail: + - Expected: 5877 + - Actual : 5649 + - Delta : 20 +sal_Int32 nYSymbol1 += getXPath( + pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[99]/polypolygon/polygon/point[1]"_ostr, + "y"_ostr) + .toInt32(); +CPPUNIT_ASSERT_DOUBLES_EQUAL(5877, nYSymbol1, 20); +sal_Int32 nYSymbol2 += getXPath( + pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[100]/polypolygon/polygon/point[1]"_ostr, + "y"_ostr) + .toInt32(); +CPPUNIT_ASSERT_DOUBLES_EQUAL(6225, nYSymbol2, 20); +sal_Int32 nYSymbol3 += getXPath( + pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[101]/polypolygon/polygon/point[1]"_ostr, + "y"_ostr) + .toInt32(); +CPPUNIT_ASSERT_DOUBLES_EQUAL(6573, nYSymbol3, 20); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
core.git: chart2/source sw/qa
chart2/source/view/axes/VCartesianAxis.cxx |7 ++ sw/qa/extras/layout/data/tdf159443.odt |binary sw/qa/extras/layout/layout3.cxx| 30 + 3 files changed, 37 insertions(+) New commits: commit f856733ed18353b8ac7d7e19348cf9b1107cc14b Author: Balazs Varga AuthorDate: Wed Mar 6 14:54:22 2024 +0100 Commit: Balazs Varga CommitDate: Fri Mar 8 09:40:14 2024 +0100 tdf#159443 - chart view: fix Data table is not rendered below chart If we have 1 dataseries we will have no tickmarks, in that case the distance between two tickmarks is the width of the chart. Change-Id: Ifea11329f1dcb80e8e390c1408306d1df7d49ded Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164471 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 8163058ad5e0..a0c4a329d76d 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -1687,6 +1687,13 @@ void VCartesianAxis::createDataTableShape(std::unique_ptr const& nDistance *= 2; } +if (nDistance <= 0) +{ +// we only have one data series so we have no TickMarks, therefor calculate and use the table size +auto rDelta = aEnd - aStart; +nDistance = basegfx::fround(rDelta.getX()); +} + if (nDistance > 0) { m_pDataTableView->createShapes(aStart, aEnd, nDistance); diff --git a/sw/qa/extras/layout/data/tdf159443.odt b/sw/qa/extras/layout/data/tdf159443.odt new file mode 100644 index ..8ec733aedb06 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf159443.odt differ diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index de11ac7d788d..f96b786cc093 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -2389,6 +2389,36 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testPageBreakInHiddenSection) assertXPath(pXmlDoc, "//page[4]/body/section/infos/bounds"_ostr, "height"_ostr, u"0"_ustr); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159443) +{ +// Given a document with chart, which have a datatable +createSwDoc("tdf159443.odt"); +SwDoc* pDoc = getSwDoc(); +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); + Without the fix, this would fail: + - Expected: DataSeries1 + - Actual : 1.25 + - In <>, XPath contents of child does not match +assertXPathContent( +pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[47]/textarray/text"_ostr, +"DataSeries1"); +assertXPathContent( +pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[49]/textarray/text"_ostr, +"Category1"); +assertXPathContent( +pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[51]/textarray/text"_ostr, +"4.3"); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/controller/dialogs/DialogModel.cxx | 17 + sw/qa/uitest/writer_tests7/tdf132714.py | 28 +++ 2 files changed, 40 insertions(+), 5 deletions(-) New commits: commit e706698353a7187f46ddbf0faf1f6f7772753df6 Author: László Németh AuthorDate: Mon Feb 27 13:56:01 2023 +0100 Commit: László Németh CommitDate: Mon Feb 27 22:46:29 2023 + tdf#153859 sw: crash fix for setting chart with deleted data table Opening Data Ranges dialog window of a chart with deleted data table crashed Writer immediately. Follow-up to commit 5b9855acc7fa6d1e4a5f53ff0bc47e1dd4729827 "tdf#132714 sw: fix crash at table row deletion associated to a chart". Change-Id: I96e901db75d40ae234f58827a957204bca13aa92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147893 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 564343c62671..d6d1fbd71b97 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -631,13 +631,20 @@ void DialogModel::setCategories( const Reference< chart2::data::XLabeledDataSequ OUString DialogModel::getCategoriesRange() const { -uno::Reference< chart2::data::XLabeledDataSequence > xLSeq( getCategories()); OUString aRange; -if( xLSeq.is()) +try +{ +uno::Reference< chart2::data::XLabeledDataSequence > xLSeq( getCategories()); +if( xLSeq.is()) +{ +Reference< data::XDataSequence > xSeq( xLSeq->getValues()); +if( xSeq.is()) +aRange = xSeq->getSourceRangeRepresentation(); +} +} +catch (const lang::DisposedException&) { -Reference< data::XDataSequence > xSeq( xLSeq->getValues()); -if( xSeq.is()) -aRange = xSeq->getSourceRangeRepresentation(); +TOOLS_WARN_EXCEPTION( "chart2", "unexpected exception caught" ); } return aRange; } diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py index 7ccedbeb6f4d..cad8ff24e80d 100644 --- a/sw/qa/uitest/writer_tests7/tdf132714.py +++ b/sw/qa/uitest/writer_tests7/tdf132714.py @@ -66,4 +66,32 @@ class tdf132714(UITestCase): # Without the fix in place, this test would have crashed here xToolkitRobot.mouseMove(xMouseEvent) +def test_data_ranges(self): +with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + +# delete second row (first data row) in the associated text table of the chart +self.xUITest.executeCommand(".uno:GoDown") +self.xUITest.executeCommand(".uno:GoDown") +# Without the fix in place, at this point crash occurs. +self.xUITest.executeCommand(".uno:DeleteTable") + +# select embedded chart +self.assertEqual(1, document.EmbeddedObjects.Count) + document.CurrentController.select(document.getEmbeddedObjects().getByIndex(0)) +self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName()) + +xChartMainTop = self.xUITest.getTopFocusWindow() +xWriterEdit = xChartMainTop.getChild("writer_edit") +# edit object by pressing Enter +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + +# open DataRanges dialog window +xChartMain = xChartMainTop.getChild("chart_window") +xSeriesObj = xChartMain.getChild("CID/Page=") + +# Without the fix in place, this test would have crashed here +with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) as xDialog: +pass + + # vim: set shiftwidth=4 softtabstop=4 expandtab:
[Libreoffice-commits] core.git: chart2/source sw/qa sw/source
chart2/source/controller/dialogs/ObjectNameProvider.cxx | 26 + chart2/source/tools/DataSeriesHelper.cxx| 13 +++- sw/qa/uitest/writer_tests7/tdf132714.py | 46 sw/source/core/unocore/unochart.cxx | 25 +--- 4 files changed, 89 insertions(+), 21 deletions(-) New commits: commit 4f2dcc4bc70c3602e2612dab611b610410637920 Author: László Németh AuthorDate: Mon Feb 27 11:20:09 2023 +0100 Commit: László Németh CommitDate: Mon Feb 27 15:22:52 2023 + tdf#153858 sw: crash fix for chart with deleted data table Using mouse, e.g. simply moving the mouse pointer during editing a chart with a deleted data table crashed Writer immediately. Follow-up to commit 5b9855acc7fa6d1e4a5f53ff0bc47e1dd4729827 "tdf#132714 sw: fix crash at table row deletion associated to a chart". Change-Id: I6d89eabc84565c548e2d9ded922789d623367ce4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147882 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 2bf6af62..c60ff1ca364a 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -124,13 +124,15 @@ OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries, uno::Reference xDataSequence( aDataSequences[nN]->getValues()); if( !xDataSequence.is() ) continue; -Sequence< Any > aData( xDataSequence->getData() ); -if( nPointIndex >= aData.getLength() ) -continue; -uno::Reference xProp(xDataSequence, uno::UNO_QUERY ); -if( xProp.is()) + +try { -try +Sequence< Any > aData( xDataSequence->getData() ); + +if( nPointIndex >= aData.getLength() ) +continue; +uno::Reference xProp(xDataSequence, uno::UNO_QUERY ); +if( xProp.is()) { uno::Any aARole = xProp->getPropertyValue( "Role" ); OUString aRole; @@ -179,10 +181,14 @@ OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries, a_Size = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged ); } } -catch( const uno::Exception& ) -{ -TOOLS_WARN_EXCEPTION("chart2", "" ); -} +} +catch (const lang::DisposedException&) +{ +TOOLS_WARN_EXCEPTION( "chart2", "unexpected exception caught" ); +} +catch( const uno::Exception& ) +{ +TOOLS_WARN_EXCEPTION("chart2", "" ); } } diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index 52c4c0637179..a2c25366dd3a 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -208,10 +208,17 @@ uno::Reference< chart2::data::XLabeledDataSequence > if( ! xSource.is()) return aNoResult; const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLabeledSeq( xSource->getDataSequences()); -for (auto const & i : aLabeledSeq) +try +{ +for (auto const & i : aLabeledSeq) +{ +if (lcl_MatchesRole(aRole, bMatchPrefix)(i)) +return i; +} +} +catch (const lang::DisposedException&) { -if (lcl_MatchesRole(aRole, bMatchPrefix)(i)) -return i; +TOOLS_WARN_EXCEPTION( "chart2", "unexpected exception caught" ); } return aNoResult; diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py index 971db5f97ad3..7ccedbeb6f4d 100644 --- a/sw/qa/uitest/writer_tests7/tdf132714.py +++ b/sw/qa/uitest/writer_tests7/tdf132714.py @@ -8,6 +8,9 @@ # from uitest.framework import UITestCase from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.awt import MouseButton +from com.sun.star.awt import MouseEvent class tdf132714(UITestCase): def test_tdf132714(self): @@ -20,4 +23,47 @@ class tdf132714(UITestCase): # Without the fix in place, at this point crash occurs. self.xUITest.executeCommand(".uno:DeleteRows") +def test_delete_table(self): +with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + +# delete second row (first data row) in the associated text table of the chart +self.xUITest.executeCommand(".uno:GoDown") +self.xUITest.executeCommand(".uno:GoDown") +# Without the fix in place, at this point crash occurs. +
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/charttypes/PieChart.cxx | 38 + sw/qa/extras/layout/data/tdf138018.docx|binary sw/qa/extras/layout/layout2.cxx| 17 3 files changed, 40 insertions(+), 15 deletions(-) New commits: commit 3c7d0c8a32f71d597f33c9219fe8099e5381ca35 Author: Tünde Tóth AuthorDate: Mon Nov 16 11:57:44 2020 +0100 Commit: László Németh CommitDate: Tue Nov 17 10:10:04 2020 +0100 tdf#138018 don't show leader lines inside pie chart Show leader lines to data labels in custom position only outside of pie chart, as intended. Change-Id: I87dee2d33f4f876ffca208f69a069e1f0bcee688 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105920 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index b3dd54dec86d..7bf2eaa2a89b 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -492,23 +492,31 @@ void PieChart::createTextLabelShape( else if (nY1 > aRect.getMaxY()) nY2 = aRect.getMaxY(); -drawing::PointSequenceSequence aPoints(1); -aPoints[0].realloc(2); -aPoints[0][0].X = nX1; -aPoints[0][0].Y = nY1; -aPoints[0][1].X = nX2; -aPoints[0][1].Y = nY2; - -uno::Reference xProp(aPieLabelInfo.xTextShape, uno::UNO_QUERY); -VLineProperties aVLineProperties; -if (xProp.is()) +sal_Int32 nSquaredDistanceFromOrigin += (nX2 - aOrigin.X) * (nX2 - aOrigin.X) + (nY2 - aOrigin.Y) * (nY2 - aOrigin.Y); + +// tdf#138018 Don't show leader line when custom positioned data label is inside pie chart +if (nSquaredDistanceFromOrigin > fSquaredPieRadius) { -sal_Int32 nColor = 0; -xProp->getPropertyValue("CharColor") >>= nColor; -if (nColor != -1) //automatic font color does not work for lines -> fallback to black -aVLineProperties.Color <<= nColor; +drawing::PointSequenceSequence aPoints(1); +aPoints[0].realloc(2); +aPoints[0][0].X = nX1; +aPoints[0][0].Y = nY1; +aPoints[0][1].X = nX2; +aPoints[0][1].Y = nY2; + +uno::Reference xProp(aPieLabelInfo.xTextShape, uno::UNO_QUERY); +VLineProperties aVLineProperties; +if (xProp.is()) +{ +sal_Int32 nColor = 0; +xProp->getPropertyValue("CharColor") >>= nColor; +//automatic font color does not work for lines -> fallback to black +if (nColor != -1) +aVLineProperties.Color <<= nColor; +} +m_pShapeFactory->createLine2D(xTextTarget, aPoints, ); } -m_pShapeFactory->createLine2D(xTextTarget, aPoints, ); } aPieLabelInfo.fValue = nVal; diff --git a/sw/qa/extras/layout/data/tdf138018.docx b/sw/qa/extras/layout/data/tdf138018.docx new file mode 100644 index ..96183f94946f Binary files /dev/null and b/sw/qa/extras/layout/data/tdf138018.docx differ diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 271087fbbad3..86bc9f43688c 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -893,6 +893,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134121) assertXPath(pXmlDoc, "//polyline", 1); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138018) +{ +SwDoc* pDoc = createDoc("tdf138018.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); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 2 +// - Actual : 3 +// i.e. the leader line was visible. +assertXPath(pXmlDoc, "//polyline", 2); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130380) { SwDoc* pDoc = createDoc("tdf130380.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/charttypes/PieChart.cxx | 117 +++ chart2/source/view/charttypes/PieChart.hxx |2 sw/qa/extras/layout/data/piechart_leaderline.odt |binary sw/qa/extras/layout/layout2.cxx | 15 ++ 4 files changed, 94 insertions(+), 40 deletions(-) New commits: commit 657ea0d1250624312e104f9acfb6a04a3ba4cce3 Author: Tünde Tóth AuthorDate: Fri Oct 16 08:57:53 2020 +0200 Commit: László Németh CommitDate: Mon Oct 19 13:00:50 2020 +0200 tdf#134121 pie chart: add leader lines to data labels with custom position. See commit 769433ad93040bc81f06672c8a2c01e2b76fece3 (tdf#90749 chart: add leader lines to custom data label positions) Change-Id: If5d912cc04993e59bd5ab93b644ea49ba8642b49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104410 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 55eb67037b9a..9b7279599f8b 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -102,6 +102,29 @@ struct PieChart::ShapeParam mfDepth(0.0) {} }; +namespace +{ +::basegfx::B2IRectangle lcl_getRect(const uno::Reference& xShape) +{ +::basegfx::B2IRectangle aRect; +if (xShape.is()) +aRect = BaseGFXHelper::makeRectangle(xShape->getPosition(), xShape->getSize()); +return aRect; +} + +bool lcl_isInsidePage(const awt::Point& rPos, const awt::Size& rSize, const awt::Size& rPageSize) +{ +if (rPos.X < 0 || rPos.Y < 0) +return false; +if ((rPos.X + rSize.Width) > rPageSize.Width) +return false; +if ((rPos.Y + rSize.Height) > rPageSize.Height) +return false; +return true; +} + +} //end anonymous namespace + class PiePositionHelper : public PolarPlottingPositionHelper { public: @@ -349,17 +372,22 @@ void PieChart::createTextLabelShape( aOuterCirclePoint.Y - aPieLabelInfo.aOrigin.getY() ); double fSquaredPieRadius = aRadiusVector.scalar(aRadiusVector); double fPieRadius = sqrt( fSquaredPieRadius ); +double fAngleDegree += rParam.mfUnitCircleStartAngleDegree + rParam.mfUnitCircleWidthAngleDegree / 2.0; +while (fAngleDegree > 360.0) +fAngleDegree -= 360.0; +while (fAngleDegree < 0.0) +fAngleDegree += 360.0; + +awt::Point aOuterPosition = PlottingPositionHelper::transformSceneToScreenPosition( +m_pPosHelper->transformUnitCircleToScene(fAngleDegree, rParam.mfUnitCircleOuterRadius, 0), +m_xLogicTarget, m_pShapeFactory, m_nDimension); +aPieLabelInfo.aOuterPosition = basegfx::B2IVector(aOuterPosition.X, aOuterPosition.Y); // set the maximum text width to be used when text wrapping is enabled double fTextMaximumFrameWidth = 0.8 * fPieRadius; if( nLabelPlacement == css::chart::DataLabelPlacement::OUTSIDE && m_aAvailableOuterRect.getWidth() ) { -double fAngleDegree = rParam.mfUnitCircleStartAngleDegree + rParam.mfUnitCircleWidthAngleDegree / 2.0; -while (fAngleDegree > 360.0) -fAngleDegree -= 360.0; -while (fAngleDegree < 0.0) -fAngleDegree += 360.0; - if (fAngleDegree < 67.5 || fAngleDegree >= 292.5) fTextMaximumFrameWidth = m_aAvailableOuterRect.getMaxX() - aPieLabelInfo.aFirstPosition.getX(); else if (fAngleDegree < 112.5 || fAngleDegree >= 247.5) @@ -396,13 +424,6 @@ void PieChart::createTextLabelShape( { if (m_aAvailableOuterRect.getWidth()) { -double fAngleDegree = rParam.mfUnitCircleStartAngleDegree - + rParam.mfUnitCircleWidthAngleDegree / 2.0; -while (fAngleDegree > 360.0) -fAngleDegree -= 360.0; -while (fAngleDegree < 0.0) -fAngleDegree += 360.0; - if (fAngleDegree < 67.5 || fAngleDegree >= 292.5) fTextMaximumFrameWidth = 0.8 @@ -451,10 +472,50 @@ void PieChart::createTextLabelShape( } } +bool bShowLeaderLine = rSeries.getPropertiesOfSeries() + ->getPropertyValue("ShowCustomLeaderLines") +.get(); +if (m_bPieLabelsAllowToMove && rSeries.isLabelCustomPos(nPointIndex) && bShowLeaderLine) +{ +sal_Int32 nX1 = aPieLabelInfo.aOuterPosition.getX(); +sal_Int32 nY1 = aPieLabelInfo.aOuterPosition.getY(); +sal_Int32 nX2 = nX1; +sal_Int32 nY2 = nY1; +::basegfx::B2IRectangle aRect(lcl_getRect(aPieLabelInfo.xLabelGroupShape)); +if (nX1 < aRect.getMinX()) +nX2 = aRect.getMinX(); +else if (nX1 > aRect.getMaxX()) +nX2 = aRect.getMaxX(); + +if (nY1 < aRect.getMinY()) +nY2 =
[Libreoffice-commits] core.git: 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 c0fac974cefffb16e811259fbc66148712533190 Author: Tünde Tóth AuthorDate: Fri Jul 24 10:06:40 2020 +0200 Commit: László Németh CommitDate: Mon Jul 27 14:11:10 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). Change-Id: I2fe9cbca876da26a7c3a371c1e711b9e1fc33b1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99353 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index dbb8dbd8fbd4..14b322e8f587 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -533,7 +533,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 710efbf54f89..d6249e412b44 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2785,6 +2785,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; +xmlDocUniquePtr 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, testTdf130031) { SwDoc* pDoc = createDoc("tdf130031.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/charttypes/VSeriesPlotter.cxx | 33 --- chart2/source/view/inc/ShapeFactory.hxx | 36 --- chart2/source/view/main/ShapeFactory.cxx | 104 --- sw/qa/extras/layout/layout.cxx |2 4 files changed, 2 insertions(+), 173 deletions(-) New commits: commit b877b9bc894892e61f0d6311729f7b01139923d6 Author: Tünde Tóth AuthorDate: Fri Jul 17 11:37:31 2020 +0200 Commit: László Németh CommitDate: Wed Jul 22 11:08:59 2020 +0200 chart2: clean-up redundant ShapeFactory::createText() It's needless since commit 9eb614f8d2d9cc983c51bcdde211ee0c59c3a96c (tdf#134659 chart2: use centered label alignment at text break). Change-Id: I8607cf1c85e13152bab2543a7970a77f9c72db6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98946 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index bbc1788ec148..dbb8dbd8fbd4 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -613,40 +613,11 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re aFormattedLabels[i] = aCustomLabels[i]; } -// center the text -sal_uInt32 nProperties = pPropNames->getLength(); -pPropNames->realloc( nProperties + 1 ); -pPropValues->realloc( nProperties + 1 ); -(*pPropNames)[ nProperties ] = UNO_NAME_EDIT_PARA_ADJUST; -(*pPropValues)[ nProperties ] <<= style::ParagraphAdjust_CENTER; - // create text shape xTextShape = ShapeFactory::getOrCreateShapeFactory( m_xShapeFactory )-> createText( xTarget_, aFormattedLabels, *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) ); } -else if( bMultiLineLabel ) -{ -// prepare properties for each paragraph -// we want to have the value and percent value centered respect -// with the category name -Sequence< tNameSequence > aParaPropNames(3); -aParaPropNames[1].realloc(1); -aParaPropNames[1][0] = "ParaAdjust"; -aParaPropNames[2].realloc(1); -aParaPropNames[2][0] = "ParaAdjust"; - -Sequence< tAnySequence > aParaPropValues(3); -aParaPropValues[1].realloc(1); -aParaPropValues[1][0] <<= style::ParagraphAdjust_CENTER; -aParaPropValues[2].realloc(1); -aParaPropValues[2][0] <<= style::ParagraphAdjust_CENTER; - -//create text shape -xTextShape = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)-> -createText( xTarget_, aTextList, aParaPropNames, aParaPropValues -, *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) ); -} else { // join text list elements @@ -665,8 +636,8 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re //create text shape xTextShape = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)-> -createText( xTarget_, aText.makeStringAndClear() -, *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) ); +createText( xTarget_, aText.makeStringAndClear(), *pPropNames, *pPropValues, +ShapeFactory::makeTransformation( aScreenPosition2D ) ); } if( !xTextShape.is() ) diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index 7a698e4b9d87..83b8d8294d16 100644 --- a/chart2/source/view/inc/ShapeFactory.hxx +++ b/chart2/source/view/inc/ShapeFactory.hxx @@ -198,42 +198,6 @@ public: , const css::uno::Any& rATransformation ); -/** This method creates a text shape made up by a set of paragraphs. - * For each paragraph the related text style is passed to the method. - * - * @param xTarget - * where to append the new created text shape. - * - * @param rTextParagraphs - * the set of paragraphs which made up the text shape. - * - * @param rParaPropNames - * a collection of lists of text property names: - * there must be a list of text property names for each paragraph. - * - * @param rParaPropValues - * a collection of lists of text property values: - * there must be a list of text property values for each paragraph. - * - * @param rPropNames - * a list of text property names to be applied to the whole text shape. - * - * @param rPropValues - * a list of text property
[Libreoffice-commits] core.git: 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 | 19 +++ 3 files changed, 21 insertions(+) New commits: commit 9eb614f8d2d9cc983c51bcdde211ee0c59c3a96c Author: Balazs Varga AuthorDate: Thu Jul 9 11:08:38 2020 +0200 Commit: László Németh CommitDate: Wed Jul 15 18:01:31 2020 +0200 tdf#134659 chart2: use centered label alignment at text break instead of left for axis labels broken into several lines. Change-Id: Iaf516055748189fa50165f0e954dfe0db15bbfb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98413 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx index c062eb2b451a..0550cdd5ce11 100644 --- a/chart2/source/view/main/PropertyMapper.cxx +++ b/chart2/source/view/main/PropertyMapper.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -457,6 +458,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 e9d850bdcf2d..f342c2c94f5b 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2824,6 +2824,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf132956) } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122014) + { SwDoc* pDoc = createDoc("tdf122014.docx"); SwDocShell* pShell = pDoc->GetDocShell(); @@ -2840,6 +2841,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; +xmlDocUniquePtr 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: 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 02c4b116cc927688fde8401413b126df72fc9b43 Author: Tünde Tóth AuthorDate: Fri Jul 10 11:42:08 2020 +0200 Commit: László Németh CommitDate: Mon Jul 13 11:30:24 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. Change-Id: Ie01308e2ddc8c1c4d19f812231ede21ff939cb98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98484 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index a6c09be30b1d..a70738adb906 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2145,6 +2145,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 967d849c7f06..aec3faac5665 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2857,6 +2857,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; +xmlDocUniquePtr 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: 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 f6fc6ab2a2792c22a3e74cce83ac7d19c820c9b4 Author: Tünde Tóth AuthorDate: Tue Jul 7 10:50:24 2020 +0200 Commit: László Németh CommitDate: Mon Jul 13 10:48:53 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 diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 23953def50d7..b2e19781c8ef 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -2407,7 +2408,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 4707328fa494..967d849c7f06 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2823,6 +2823,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: 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 23b73bc02536455df75438e19b5c70bacc9aa700 Author: Tünde Tóth AuthorDate: Wed Jul 1 15:48:19 2020 +0200 Commit: László Németh CommitDate: Tue Jul 7 10:13:38 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 diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index faa7fbe3511a..a6c09be30b1d 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2139,15 +2139,23 @@ 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 53e214f76999..f0befe954659 100644 --- a/chart2/source/view/main/VTitle.cxx +++ b/chart2/source/view/main/VTitle.cxx @@ -100,7 +100,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; @@ -126,8 +127,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 261458025956..9fb0e905fa8a 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 a4c46a3d69de..94cd82d26782 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2840,6 +2840,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134235) assertXPath(pXmlDoc, "//textarray",
[Libreoffice-commits] core.git: 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 72613bd2a04b4b1ba614c0f645e9804ebfe73682 Author: Tünde Tóth AuthorDate: Mon Jun 15 16:42:40 2020 +0200 Commit: László Németh CommitDate: Tue Jun 30 12:44:23 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. Change-Id: I91ef913f509b233912a8bfb878a1c80d577e2a88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96437 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 4642b63f55d4..d16495e426f3 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -408,18 +408,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 b/sw/qa/extras/layout/data/long_legendentry.docx new file mode 100644 index ..6259438a16e3 Binary files /dev/null and b/sw/qa/extras/layout/data/long_legendentry.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index e5c2784c17cb..c8b5665c5e00 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2363,6
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/inc/ShapeFactory.hxx |2 +- chart2/source/view/main/ChartView.cxx|8 +++- 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, 40 insertions(+), 8 deletions(-) New commits: commit 17f131fcb3f534792a3b2ec6048d03fb54b55eb1 Author: Tünde Tóth AuthorDate: Thu Jun 25 10:43:58 2020 +0200 Commit: László Németh CommitDate: Mon Jun 29 12:52:44 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). Change-Id: I22bb4699bdda8dea5f31c715cc1f439085a0718f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97092 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index 02faf45b8716..7a698e4b9d87 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 a5e0ab5da984..4b6b1fa9b48f 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2137,10 +2137,16 @@ std::shared_ptr lcl_createTitle( TitleHelper::eTitleType eType return apVTitle; //create title +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 26a598931c29..23953def50d7 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -2374,7 +2374,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( @@ -2407,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(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 39989f191aa0..53e214f76999 100644 --- a/chart2/source/view/main/VTitle.cxx +++ b/chart2/source/view/main/VTitle.cxx @@ -99,7 +99,8 @@ void VTitle::changePosition( const awt::Point& rPos ) void VTitle::createShapes( const awt::Point& rPos -, const awt::Size& rReferenceSize ) +, const awt::Size& rReferenceSize +, const awt::Size& rTextMaxWidth ) { if(!m_xTitle.is()) return; @@ -124,9 +125,16 @@ void VTitle::createShapes( TOOLS_WARN_EXCEPTION("chart2", "" ); } +sal_Int32 nTextMaxWidth; +if (m_fRotationAngleDegree <= 15.0 || m_fRotationAngleDegree >=
[Libreoffice-commits] core.git: 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 b3057b7944dc52cc2ee3c57f44d4265c625e8dad Author: Tünde Tóth AuthorDate: Tue Jun 23 13:52:39 2020 +0200 Commit: László Németh CommitDate: Mon Jun 29 12:04:52 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. Change-Id: Ia4a439aa6cee0619ad323c3fb728ff358cf28537 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96941 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 19b43ae3d964..75a0ea173aba 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -2394,7 +2394,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 @@ -2450,24 +2450,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 88693900e8fb..8c7ae00fafab 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< css::lang::XMultiServiceFactory >& xShapeFactory, diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 7e60be2bdf1b..17215faae4b5 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -182,7 +182,7 @@ public: virtual std::vector< ViewLegendEntry >
[Libreoffice-commits] core.git: 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 8c73d6b63714fb41486fd53ec4c7f68ad63cd190 Author: Tünde Tóth AuthorDate: Mon Jun 22 15:51:51 2020 +0200 Commit: László Németh CommitDate: Mon Jun 29 10:48:48 2020 +0200 tdf#15 Chart OOXML import: fix missing legend text resulted by inaccurate calculation of nMaxTextWidth. Change-Id: Ie41bbc30074c6bbccacbc58adda5d9f2cfdfeba8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96926 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 669e575a18ac..9bfd679e95f1 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -290,7 +290,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 50ba98b146b9..2f324bb026bd 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2289,6 +2289,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf131707) assertXPath(pXmlDoc, "//body/tab/row[3]/cell[2]/txt/anchored/fly/infos/bounds", "top", "2185"); } +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; +xmlDocUniquePtr 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: chart2/source sw/qa
chart2/source/controller/dialogs/dlg_ObjectProperties.cxx |2 - chart2/source/view/main/ChartView.cxx | 14 ++- sw/qa/extras/layout/data/tdf133005.odt|binary sw/qa/extras/layout/layout.cxx| 26 ++ 4 files changed, 31 insertions(+), 11 deletions(-) New commits: commit ed2c880a691a0b179bbc92a8ce4ee49eac004035 Author: Tünde Tóth AuthorDate: Thu May 21 10:20:43 2020 +0200 Commit: László Németh CommitDate: Mon May 25 13:41:49 2020 +0200 tdf#133005 Chart: fix ODF import of date axis position Chart with date axis setting "On tick marks" wasn't imported correctly. See commit 40d83914d43f60a196dfabddea0b52e2046b333a (tdf#127792 implement UNO chart attribute MajorOrigin) Change-Id: I5967c4bab8690df1f191b33ecb0e5b043bca68a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94621 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index 57375c33bfee..1add0435b0bc 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -191,7 +191,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel if( nDimensionIndex==1 && nAxisIndex==1 && ChartTypeHelper::isSupportingBaseValue( xChartType ) ) m_bShowAxisOrigin = true; -if ( nDimensionIndex == 0 && aData.AxisType == chart2::AxisType::CATEGORY ) +if ( nDimensionIndex == 0 && ( aData.AxisType == chart2::AxisType::CATEGORY || aData.AxisType == chart2::AxisType::DATE ) ) { ChartModel* pModel = dynamic_cast(xChartModel.get()); if (pModel) diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index bc9d7a18d1d3..d3b0e8832e36 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -628,19 +628,13 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( bool SeriesPlotterContainer::isCategoryPositionShifted( const chart2::ScaleData& rSourceScale, bool bHasComplexCategories ) { -if (rSourceScale.AxisType == AxisType::CATEGORY && rSourceScale.ShiftedCategoryPosition) -return true; - -if (rSourceScale.AxisType == AxisType::CATEGORY && bHasComplexCategories) -return true; +if (rSourceScale.AxisType == AxisType::CATEGORY) +return bHasComplexCategories || rSourceScale.ShiftedCategoryPosition; if (rSourceScale.AxisType == AxisType::DATE) -return true; +return rSourceScale.ShiftedCategoryPosition; -if (rSourceScale.AxisType == AxisType::SERIES) -return true; - -return false; +return rSourceScale.AxisType == AxisType::SERIES; } void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate) diff --git a/sw/qa/extras/layout/data/tdf133005.odt b/sw/qa/extras/layout/data/tdf133005.odt new file mode 100644 index ..660112d66712 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf133005.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 853d6b997381..adac583c8ed2 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2347,6 +2347,32 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123268) 41); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf133005) +{ +SwDoc* pDoc = createDoc("tdf133005.odt"); +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); + +sal_Int32 nXChartWall = getXPath(pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/" + "push[1]/push[1]/polyline[1]/point[2]", + "x") +.toInt32(); +sal_Int32 nXColumn = getXPath(pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/" + "push[1]/push[42]/polypolygon/polygon/point[1]", + "x") + .toInt32(); + +// This failed, if the value axis doesn't appear inside category. +CPPUNIT_ASSERT_DOUBLES_EQUAL(nXChartWall, nXColumn, 5); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115630) { SwDoc* pDoc = createDoc("tdf115630.docx"); ___ Libreoffice-commits mailing list
[Libreoffice-commits] core.git: 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 cf46500243c51071227e08c5067041e414180ebc Author: Balazs Varga AuthorDate: Tue May 12 15:36:06 2020 +0200 Commit: László Németh CommitDate: Thu May 21 12:06:33 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) 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 diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 84961438c24a..bc9d7a18d1d3 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2233,12 +2233,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 facfe388fa42..669e575a18ac 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -271,7 +271,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); @@ -310,6 +311,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 || rDefaultLegendSize.Height != 0; bool bAutoPosition = ! (xLegendProp->getPropertyValue( "RelativePosition") >>= aRelativePosition); @@ -1048,7 +1055,7 @@ void VLegend::changePosition( // manual position: relative to whole page awt::Rectangle aAvailableSpace( 0, 0, rPageSize.Width, rPageSize.Height ); awt::Point
[Libreoffice-commits] core.git: 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 61aa663d9b1d75d1bb0cfc7c4c9e4cb17d8dd00a Author: Balazs Varga AuthorDate: Tue Mar 24 14:13:48 2020 +0100 Commit: László Németh 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 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 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 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
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/axes/VCartesianAxis.cxx | 39 ++-- sw/qa/extras/layout/data/testTruncatedAxisLabel.odt |binary sw/qa/extras/layout/layout.cxx | 24 3 files changed, 52 insertions(+), 11 deletions(-) New commits: commit 7c300296dd727990455449b19b111b9fc49eadad Author: Balazs Varga AuthorDate: Mon Mar 2 13:55:35 2020 +0100 Commit: László Németh CommitDate: Mon Mar 9 11:57:29 2020 +0100 tdf#131060 tdf#117088 chart view: fix missing or truncated axis labels if we have enough space under the horizontal X axis. Note: allow truncation of vertical X axis labels only if they are text labels and the position is NEAR_AXIS or OUTSIDE_START. Regressions from commit 35d062f7879d5414334643cb90bff411726b2168 (tdf#116163: Limit label height in chart if needed) and commit 26caf1bc59c81704f11225e3e431e412deb8c475 (tdf#114179: Custom size and position of the chart wall) Change-Id: Idf86bc2b5482bb50a266cda57cc502621c2e08ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89829 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 49d4d860c435..52dc4bdb20c8 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -76,28 +76,29 @@ static void lcl_ResizeTextShapeToFitAvailableSpace( Reference< drawing::XShape > const AxisLabelProperties& rAxisLabelProperties, const OUString& rLabel, const tNameSequence& rPropNames, - const tAnySequence& rPropValues ) + const tAnySequence& rPropValues, + const bool bIsHorizontalAxis ) { uno::Reference< text::XTextRange > xTextRange( xShape2DText, uno::UNO_QUERY ); if( !xTextRange.is() ) return; -const sal_Int32 nFullHeight = rAxisLabelProperties.m_aFontReferenceSize.Height; +const sal_Int32 nFullSize = bIsHorizontalAxis ? rAxisLabelProperties.m_aFontReferenceSize.Height : rAxisLabelProperties.m_aFontReferenceSize.Width; -if( !nFullHeight || !rLabel.getLength() ) +if( !nFullSize || !rLabel.getLength() ) return; -sal_Int32 nMaxLabelsHeight = nFullHeight - rAxisLabelProperties.m_aMaximumSpaceForLabels.Height - rAxisLabelProperties.m_aMaximumSpaceForLabels.Y; +sal_Int32 nMaxLabelsSize = bIsHorizontalAxis ? rAxisLabelProperties.m_aMaximumSpaceForLabels.Height : rAxisLabelProperties.m_aMaximumSpaceForLabels.Width; const sal_Int32 nAvgCharWidth = xShape2DText->getSize().Width / rLabel.getLength(); -const sal_Int32 nTextSize = ShapeFactory::getSizeAfterRotation( xShape2DText, - rAxisLabelProperties.fRotationAngleDegree ).Height; +const sal_Int32 nTextSize = bIsHorizontalAxis ? ShapeFactory::getSizeAfterRotation(xShape2DText, rAxisLabelProperties.fRotationAngleDegree).Height : + ShapeFactory::getSizeAfterRotation(xShape2DText, rAxisLabelProperties.fRotationAngleDegree).Width; if( !nAvgCharWidth ) return; const OUString sDots = "..."; -const sal_Int32 nCharsToRemove = ( nTextSize - nMaxLabelsHeight ) / nAvgCharWidth + 1; +const sal_Int32 nCharsToRemove = ( nTextSize - nMaxLabelsSize ) / nAvgCharWidth + 1; sal_Int32 nNewLen = rLabel.getLength() - nCharsToRemove - sDots.getLength(); // Prevent from showing only dots if (nNewLen < 0) @@ -128,6 +129,7 @@ static Reference< drawing::XShape > createSingleLabel( , const AxisProperties& rAxisProperties , const tNameSequence& rPropNames , const tAnySequence& rPropValues + , const bool bIsHorizontalAxis ) { if(rLabel.isEmpty()) @@ -142,7 +144,7 @@ static Reference< drawing::XShape > createSingleLabel( ->createText( xTarget, aLabel, rPropNames, rPropValues, aATransformation ); if( rAxisProperties.m_bLimitSpaceForLabels ) -lcl_ResizeTextShapeToFitAvailableSpace(xShape2DText, rAxisLabelProperties, aLabel, rPropNames, rPropValues); +lcl_ResizeTextShapeToFitAvailableSpace(xShape2DText, rAxisLabelProperties, aLabel, rPropNames, rPropValues, bIsHorizontalAxis); LabelPositionHelper::correctPositionForRotation( xShape2DText , rAxisProperties.maLabelAlignment.meAlignment, rAxisLabelProperties.fRotationAngleDegree, rAxisProperties.m_bComplexCategories ); @@ -716,6 +718,21 @@ bool VCartesianAxis::createTextShapes( const bool bIsHorizontalAxis = pTickFactory->isHorizontalAxis(); const bool bIsVerticalAxis = pTickFactory->isVerticalAxis(); +
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/main/VLegend.cxx|2 ++ sw/qa/extras/layout/data/tdf123268.odt |binary sw/qa/extras/layout/layout.cxx | 18 ++ 3 files changed, 20 insertions(+) New commits: commit 300e65cc47f3d6ae1563350757dbfadc080d7452 Author: Tünde Tóth AuthorDate: Thu Feb 20 14:39:11 2020 +0100 Commit: László Németh CommitDate: Fri Mar 6 10:42:25 2020 +0100 tdf#123268 fix lost chart if all legend entries are hidden See also commit 19b2ed4dee1ec33ad55473d43bfcd0bfa194cbee (related tdf#51671, add UI options for new "hide legend entry" feature) Change-Id: If20ab167d867d2845fa414ba0bbc490bed09f61c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89123 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 919dc57ddbf3..0fa0b3552d88 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -950,6 +950,8 @@ void VLegend::createShapes( std::vector aNewEntries = pLegendEntryProvider->createLegendEntries( aMaxSymbolExtent, eExpansion, xLegendProp, xLegendContainer, m_xShapeFactory, m_xContext, mrModel); +if (aNewEntries.size() == 0) +return; aViewEntries.insert( aViewEntries.end(), aNewEntries.begin(), aNewEntries.end() ); } } diff --git a/sw/qa/extras/layout/data/tdf123268.odt b/sw/qa/extras/layout/data/tdf123268.odt new file mode 100644 index ..e68c8139f52c Binary files /dev/null and b/sw/qa/extras/layout/data/tdf123268.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 9e153c86e7b5..2fcc9f8da6f4 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2319,6 +2319,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf75659) // These failed, if the legend names are empty strings. } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123268) +{ +SwDoc* pDoc = createDoc("tdf123268.odt"); +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: 41 +// - Actual : 0 +// i.e. the chart lost. +assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push", +41); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115630) { SwDoc* pDoc = createDoc("tdf115630.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/charttypes/AreaChart.cxx |5 - sw/qa/extras/layout/data/tdf130380.docx |binary sw/qa/extras/layout/layout.cxx | 23 +++ 3 files changed, 27 insertions(+), 1 deletion(-) New commits: commit a979047eefec607b311773c7e2a71bb3ee2c6362 Author: Tünde Tóth AuthorDate: Mon Feb 3 15:51:52 2020 +0100 Commit: László Németh CommitDate: Fri Feb 7 18:36:18 2020 +0100 tdf#130380 Chart: Fix area chart data labels position Regression from commit: f8966bb398cf0623be841c618b123866801a063c (tdf#130031 Chart OOXML import: fix area chart data label position) Change-Id: Iafcbacb0ecf6f8a175adbf0782ee3e3a1185a726 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87881 Tested-by: Jenkins Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 158d3f21bca6..f6101c15917c 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -903,7 +903,10 @@ void AreaChart::createShapes() if (m_bArea && nLabelPlacement == css::chart::DataLabelPlacement::CENTER) { -fLogicY -= (fLogicY - fPreviousYValue) / 2.0; +if (fPreviousYValue) +fLogicY -= (fLogicY - fPreviousYValue) / 2.0; +else +fLogicY = (fLogicY + rPosHelper.getLogicMinY()) / 2.0; aScenePosition = rPosHelper.transformLogicToScene(fLogicX, fLogicY, fLogicZ, false); } diff --git a/sw/qa/extras/layout/data/tdf130380.docx b/sw/qa/extras/layout/data/tdf130380.docx new file mode 100644 index ..b76c5efd1405 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf130380.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index bd1e609fdce1..ae3548737210 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2550,6 +2550,29 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130242) CPPUNIT_ASSERT_DOUBLES_EQUAL(3018, nY, 50); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130380) +{ +SwDoc* pDoc = createDoc("tdf130380.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); +sal_Int32 nY = getXPath(pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/push[1]/polypolygon/" +"polygon/point[1]", +"y") + .toInt32(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 6727 +// - Actual : 4411 +// - Delta : 50 +// i.e. the area chart shrank. +CPPUNIT_ASSERT_DOUBLES_EQUAL(6727, nY, 50); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116925) { SwDoc* pDoc = createDoc("tdf116925.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/tools/ChartTypeHelper.cxx | 20 ++-- sw/qa/extras/layout/data/tdf130242.odt |binary sw/qa/extras/layout/layout.cxx | 32 3 files changed, 50 insertions(+), 2 deletions(-) New commits: commit be936c5896045794b251a63ab1175ac06a36eee5 Author: Tünde Tóth AuthorDate: Thu Jan 30 14:22:51 2020 +0100 Commit: László Németh CommitDate: Tue Feb 4 11:22:30 2020 +0100 tdf#130242 chart: default center label placement in stacked area charts instead of top label placement, like MSO does (or LO has already done in stacked bar charts) for readability. Change-Id: Icac6e8703d0d04122f9cc28254b053ee9fd434ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87846 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index b7b3e889e1a1..b54e410bcb73 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -314,10 +314,26 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) ) { +bool bStacked = false; +{ +uno::Reference xSeriesProp(xSeries, uno::UNO_QUERY); +chart2::StackingDirection eStacking = chart2::StackingDirection_NO_STACKING; +xSeriesProp->getPropertyValue("StackingDirection") >>= eStacking; +bStacked = (eStacking == chart2::StackingDirection_Y_STACKING); +} + aRet.realloc(2); sal_Int32* pSeq = aRet.getArray(); -*pSeq++ = css::chart::DataLabelPlacement::TOP; -*pSeq++ = css::chart::DataLabelPlacement::CENTER; +if (bStacked) +{ +*pSeq++ = css::chart::DataLabelPlacement::CENTER; +*pSeq++ = css::chart::DataLabelPlacement::TOP; +} +else +{ +*pSeq++ = css::chart::DataLabelPlacement::TOP; +*pSeq++ = css::chart::DataLabelPlacement::CENTER; +} } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) { diff --git a/sw/qa/extras/layout/data/tdf130242.odt b/sw/qa/extras/layout/data/tdf130242.odt new file mode 100644 index ..3e97bd3e5fe1 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf130242.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index b6bdd958cbed..c1c43399c9f4 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2515,9 +2515,41 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130031) xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); sal_Int32 nY = getXPath(pXmlDoc, "//textarray[11]", "y").toInt32(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 4339 +// - Actual : 2182 +// - Delta : 50 +// i.e. the data label appeared above the data point. CPPUNIT_ASSERT_DOUBLES_EQUAL(4339, nY, 50); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130242) +{ +SwDoc* pDoc = createDoc("tdf130242.odt"); +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); +sal_Int32 nY = getXPath(pXmlDoc, "//textarray[11]", "y").toInt32(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 4958 +// - Actual : 3352 +// - Delta : 50 +// i.e. the data label appeared above the data point. +CPPUNIT_ASSERT_DOUBLES_EQUAL(4958, nY, 50); + +nY = getXPath(pXmlDoc, "//textarray[13]", "y").toInt32(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 3018 +// - Actual : 2343 +// - Delta : 50 +// i.e. the data label appeared above the data point. +CPPUNIT_ASSERT_DOUBLES_EQUAL(3018, nY, 50); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116925) { SwDoc* pDoc = createDoc("tdf116925.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/tools/ChartTypeHelper.cxx |3 ++- chart2/source/view/charttypes/AreaChart.cxx | 14 ++ sw/qa/extras/layout/data/tdf130031.docx |binary sw/qa/extras/layout/layout.cxx | 14 ++ 4 files changed, 26 insertions(+), 5 deletions(-) New commits: commit f8966bb398cf0623be841c618b123866801a063c Author: Tünde Tóth AuthorDate: Thu Jan 16 12:10:24 2020 +0100 Commit: László Németh CommitDate: Tue Jan 28 09:51:07 2020 +0100 tdf#130031 Chart OOXML import: fix area chart data label position Default data label positioning of area charts in Excel is vertically centered between the X axes and the data point. In LibreOffice the data labels positioning was above the data point. Change-Id: Icff3e2554dee7b5ee264bc6f9579a84852da6f7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86927 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index ebd2af04ab45..b7b3e889e1a1 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -314,9 +314,10 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) ) { -aRet.realloc(1); +aRet.realloc(2); sal_Int32* pSeq = aRet.getArray(); *pSeq++ = css::chart::DataLabelPlacement::TOP; +*pSeq++ = css::chart::DataLabelPlacement::CENTER; } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) { diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 6d67d0b6a94c..158d3f21bca6 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -750,6 +750,7 @@ void AreaChart::createShapes() if( rLogicYForNextSeriesMap.find(nAttachedAxisIndex) == rLogicYForNextSeriesMap.end() ) rLogicYForNextSeriesMap[nAttachedAxisIndex] = 0.0; +double fPreviousYValue = rLogicYForNextSeriesMap[nAttachedAxisIndex]; fLogicY += rLogicYForNextSeriesMap[nAttachedAxisIndex]; rLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY; @@ -897,13 +898,19 @@ void AreaChart::createShapes() if( pSeries->getDataPointLabelIfLabel(nIndex) ) { LabelAlignment eAlignment = LABEL_ALIGN_TOP; +sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( +nIndex, m_xChartTypeModel, rPosHelper.isSwapXAndY()); + +if (m_bArea && nLabelPlacement == css::chart::DataLabelPlacement::CENTER) +{ +fLogicY -= (fLogicY - fPreviousYValue) / 2.0; +aScenePosition = rPosHelper.transformLogicToScene(fLogicX, fLogicY, fLogicZ, false); +} + drawing::Position3D aScenePosition3D( aScenePosition.PositionX , aScenePosition.PositionY , aScenePosition.PositionZ+getTransformedDepth() ); -sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( -nIndex, m_xChartTypeModel, rPosHelper.isSwapXAndY()); - switch(nLabelPlacement) { case css::chart::DataLabelPlacement::TOP: @@ -924,7 +931,6 @@ void AreaChart::createShapes() break; case css::chart::DataLabelPlacement::CENTER: eAlignment = LABEL_ALIGN_CENTER; -//todo implement this different for area charts break; default: OSL_FAIL("this label alignment is not implemented yet"); diff --git a/sw/qa/extras/layout/data/tdf130031.docx b/sw/qa/extras/layout/data/tdf130031.docx new file mode 100644 index ..4ac420a83c8e Binary files /dev/null and b/sw/qa/extras/layout/data/tdf130031.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 862f4a30eb41..567fdea446f0 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2504,6 +2504,20 @@ 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, testTdf130031) +{ +SwDoc* pDoc = createDoc("tdf130031.docx"); +SwDocShell* pShell =
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/axes/Tickmarks.cxx |5 + chart2/source/view/axes/Tickmarks.hxx |1 + chart2/source/view/axes/VCartesianAxis.cxx | 15 --- sw/qa/extras/layout/data/tdf128996.docx|binary sw/qa/extras/layout/layout.cxx | 16 5 files changed, 26 insertions(+), 11 deletions(-) New commits: commit d53de6b0bfff08dfbde4fe305e2a9b7a60255458 Author: Balazs Varga AuthorDate: Mon Dec 30 15:53:08 2019 +0100 Commit: László Németh CommitDate: Mon Jan 6 10:33:54 2020 +0100 tdf#128996 Chart: Fix disappeared vertical X axis labels Regression from commit: 75ef0e41ea8a9096ac619356d2b837c5333b47e6 (tdf#125334 Chart: allow text break in bar chart axis labels) Change-Id: Ib935de74314b7dec489d94a4aa3c65072e18d9e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86010 Tested-by: Jenkins Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/source/view/axes/Tickmarks.cxx b/chart2/source/view/axes/Tickmarks.cxx index 45e311ce3cfa..e1dc3953bd11 100644 --- a/chart2/source/view/axes/Tickmarks.cxx +++ b/chart2/source/view/axes/Tickmarks.cxx @@ -204,6 +204,11 @@ sal_Int32 TickFactory2D::getTickScreenDistance( TickIter& rIter ) return pFirstTickInfo->getScreenDistanceBetweenTicks( *pSecondTickInfo ); } +B2DVector TickFactory2D::getXaxisStartPos() const +{ +return m_aAxisStartScreenPosition2D; +} + B2DVector TickFactory2D::getTickScreenPosition2D( double fScaledLogicTickValue ) const { B2DVector aRet(m_aAxisStartScreenPosition2D); diff --git a/chart2/source/view/axes/Tickmarks.hxx b/chart2/source/view/axes/Tickmarks.hxx index b0cb774dbf5d..34addbeb45db 100644 --- a/chart2/source/view/axes/Tickmarks.hxx +++ b/chart2/source/view/axes/Tickmarks.hxx @@ -135,6 +135,7 @@ public: bool isHorizontalAxis() const; bool isVerticalAxis() const; +::basegfx::B2DVector getXaxisStartPos() const; private: ::basegfx::B2DVector getTickScreenPosition2D( double fScaledLogicTickValue ) const; diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 7257a6432605..49d4d860c435 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -745,22 +745,15 @@ bool VCartesianAxis::createTextShapes( // recalculate the nLimitedSpaceForText in case of 90 and 270 degree if the text break is true if ( rAxisLabelProperties.fRotationAngleDegree == 90.0 || rAxisLabelProperties.fRotationAngleDegree == 270.0 ) { -if ( rAxisLabelProperties.m_aFontReferenceSize.Height - rAxisLabelProperties.m_aMaximumSpaceForLabels.Height > 2 * rAxisLabelProperties.m_aMaximumSpaceForLabels.Y ) -{ -const sal_Int32 nFullHeight = rAxisLabelProperties.m_aFontReferenceSize.Height; -sal_Int32 nMaxLabelsHeight = nFullHeight - ( rAxisLabelProperties.m_aMaximumSpaceForLabels.Height + rAxisLabelProperties.m_aMaximumSpaceForLabels.Y ); -nLimitedSpaceForText = nMaxLabelsHeight; -} -else -{ -nLimitedSpaceForText = -1; -} +nLimitedSpaceForText = rAxisLabelProperties.m_aFontReferenceSize.Height - pTickFactory->getXaxisStartPos().getY(); +m_aAxisProperties.m_bLimitSpaceForLabels = false; } // recalculate the nLimitedSpaceForText in case of vertical category axis if the text break is true if ( m_aAxisProperties.m_bSwapXAndY && bIsVerticalAxis && rAxisLabelProperties.fRotationAngleDegree == 0.0 ) { -nLimitedSpaceForText = rAxisLabelProperties.m_aMaximumSpaceForLabels.X; +nLimitedSpaceForText = pTickFactory->getXaxisStartPos().getX(); +m_aAxisProperties.m_bLimitSpaceForLabels = false; } } diff --git a/sw/qa/extras/layout/data/tdf128996.docx b/sw/qa/extras/layout/data/tdf128996.docx new file mode 100644 index ..8b6e77214b0c Binary files /dev/null and b/sw/qa/extras/layout/data/tdf128996.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 8825d2e77513..dd906b83fbee 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2365,6 +2365,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122800) // This failed, if the textarray length of the first axis label not 22. } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128996) +{ +SwDoc* pDoc = createDoc("tdf128996.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, +
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/inc/ChartTypeHelper.hxx |3 - chart2/source/tools/ChartTypeHelper.cxx |9 - chart2/source/view/charttypes/AreaChart.cxx |3 - chart2/source/view/charttypes/VSeriesPlotter.cxx|5 -- chart2/source/view/inc/VDataSeries.hxx |1 chart2/source/view/main/ChartView.cxx | 28 +--- chart2/source/view/main/VDataSeries.cxx | 16 +++-- sw/qa/extras/layout/data/testAreaChartNumberFormat.docx |binary sw/qa/extras/layout/layout.cxx | 16 + 9 files changed, 33 insertions(+), 48 deletions(-) New commits: commit e57d90cd4e51a1353eafc87bb29cfe6076704a7c Author: Balazs Varga AuthorDate: Tue Dec 10 12:53:08 2019 +0100 Commit: László Németh CommitDate: Mon Dec 16 08:58:25 2019 +0100 tdf#129173 tdf#129175 Fix number format of data labels Show the real value (cell value) of datapoints instead of the recalculated value in case of Percent Stacked Area chart. Also fix: tdf#95425 Do not reset number format of data labels when open dialog of 'Format data series' and close dialog. Note: Inherits the data series/point label format from the cell format and not the axis format, if we set the 'link to source data' option to true. Change-Id: I04e9968034a67c6bc6b92941df61d945b4292d79 Reviewed-on: https://gerrit.libreoffice.org/84819 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index c570a15163bd..b4af58240460 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -79,9 +79,6 @@ public: static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const css::uno::Reference< css::chart2::XChartType >& xChartType ); -static bool shouldLabelNumberFormatKeyBeDetectedFromYAxis( const css::uno::Reference< -css::chart2::XChartType >& xChartType ); - static bool isSupportingOnlyDeepStackingFor3D( const css::uno::Reference< css::chart2::XChartType >& xChartType ); }; diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 92974f5c5585..ebd2af04ab45 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -668,15 +668,6 @@ OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( co return aRet; } -bool ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( const uno::Reference< XChartType >& xChartType ) -{ -bool bRet = true; -OUString aChartTypeName = xChartType->getChartType(); -if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) -bRet = false; -return bRet; -} - bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const uno::Reference< XChartType >& xChartType ) { bool bRet = false; diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index ca2218087a43..6d67d0b6a94c 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -722,6 +722,7 @@ void AreaChart::createShapes() if( m_nDimension==3 && m_bArea && rXSlot.m_aSeriesVector.size()!=1 ) fLogicY = fabs( fLogicY ); +double fLogicValueForLabeDisplay = fLogicY; std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex]; if (rPosHelper.isPercentY() && rLogicYSumMap[nAttachedAxisIndex] != 0.0) { @@ -749,8 +750,6 @@ void AreaChart::createShapes() if( rLogicYForNextSeriesMap.find(nAttachedAxisIndex) == rLogicYForNextSeriesMap.end() ) rLogicYForNextSeriesMap[nAttachedAxisIndex] = 0.0; -double fLogicValueForLabeDisplay = fLogicY; - fLogicY += rLogicYForNextSeriesMap[nAttachedAxisIndex]; rLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY; diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 33424056d720..2a814e2fd73a 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -367,10 +367,7 @@ OUString VSeriesPlotter::getLabelTextForValue( VDataSeries const & rDataSeries } else { -if( rDataSeries.shouldLabelNumberFormatKeyBeDetectedFromYAxis() && m_aAxesNumberFormats.hasFormat(1,rDataSeries.getAttachedAxisIndex()) ) //y-axis -nNumberFormatKey = m_aAxesNumberFormats.getFormat(1,rDataSeries.getAttachedAxisIndex()); -else -nNumberFormatKey = rDataSeries.detectNumberFormatKey( nPointIndex ); +
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/main/DrawModelWrapper.cxx |2 +- sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 986014036428dbb76ab39e665552dda58bea527c Author: Andrea Gelmini AuthorDate: Sat Dec 7 13:43:57 2019 +0100 Commit: Julien Nabet CommitDate: Sat Dec 7 15:40:04 2019 +0100 Fix typos Change-Id: Ibaaf738abdb4abcb9edb66ea35b6ebabdbe02507 Reviewed-on: https://gerrit.libreoffice.org/84681 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index 1d9d39cf0ca7..dcbee5457dce 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -82,7 +82,7 @@ DrawModelWrapper::DrawModelWrapper() b3dFactoryInitialized = true; } -//Hyphenyation and spellchecking +//Hyphenation and spellchecking SdrOutliner& rOutliner = GetDrawOutliner(); try { diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index d4aa8d886626..a20612f1f2a6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -299,7 +299,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf115719b, "tdf115719b.docx") // Without the accompanying fix in place, this test would have failed with: // - Expected: 2 // - Actual : 1 -// i.e. the the textboxes did not appear on the 2nd page, but everything was on a single page. +// i.e. the textboxes did not appear on the 2nd page, but everything was on a single page. CPPUNIT_ASSERT_EQUAL(2, getPages()); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/inc/ChartTypeHelper.hxx |1 + chart2/source/tools/ChartTypeHelper.cxx | 11 +++ chart2/source/view/main/ChartView.cxx |3 ++- sw/qa/extras/layout/data/tdf129054.docx |binary sw/qa/extras/layout/layout.cxx | 26 ++ 5 files changed, 40 insertions(+), 1 deletion(-) New commits: commit ea97f0926e138712c3800f5274012f0f04fc1c47 Author: Balazs Varga AuthorDate: Wed Nov 27 10:31:48 2019 +0100 Commit: László Németh CommitDate: Mon Dec 2 08:30:33 2019 +0100 tdf#129054 Chart OOXML Import: Fix size of Pie Chart Do not shift (set to false ShiftedCategoryPosition) the category axis for Pie chart with complex category. Change-Id: I3b1d99899a2daf9fd7a596c88531797aa5084734 Reviewed-on: https://gerrit.libreoffice.org/83871 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index c2945dfb9380..c570a15163bd 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -49,6 +49,7 @@ public: static bool shiftCategoryPosAtXAxisPerDefault( const css::uno::Reference< css::chart2::XChartType >& xChartType ); static bool isSupportingAxisPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionIndex ); +static bool isSupportingComplexCategory( const css::uno::Reference< css::chart2::XChartType >& xChartType ); //returns sequence of css::chart::DataLabelPlacement static css::uno::Sequence < sal_Int32 > getSupportedLabelPlacements( diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 78d841755374..92974f5c5585 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -419,6 +419,17 @@ bool ChartTypeHelper::isSupportingDateAxis( const uno::Reference< chart2::XChart return true; } +bool ChartTypeHelper::isSupportingComplexCategory( const uno::Reference< chart2::XChartType >& xChartType ) +{ +if( xChartType.is() ) +{ +OUString aChartTypeName = xChartType->getChartType(); +if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) +return false; +} +return true; +} + bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const uno::Reference< chart2::XChartType >& xChartType ) { if(xChartType.is()) diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index ae2a3d7d0ae6..83385f4f5d22 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -652,6 +652,7 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate) { uno::Reference xCooSys = pVCooSys->getModel(); sal_Int32 nDimCount = xCooSys->getDimension(); +bool bComplexCategoryAllowed = ChartTypeHelper::isSupportingComplexCategory(AxisHelper::getChartTypeByIndex(xCooSys, 0)); for (sal_Int32 nDimIndex = 0; nDimIndex < nDimCount; ++nDimIndex) { @@ -676,7 +677,7 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate) if (nDimIndex == 0) AxisHelper::checkDateAxis( aSourceScale, pCatProvider, bDateAxisAllowed ); -bool bHasComplexCat = pCatProvider && pCatProvider->hasComplexCategories(); +bool bHasComplexCat = pCatProvider && pCatProvider->hasComplexCategories() && bComplexCategoryAllowed; aSourceScale.ShiftedCategoryPosition = isCategoryPositionShifted(aSourceScale, bHasComplexCat); m_aAxisUsageList[xAxis].aAutoScaling = ScaleAutomatism(aSourceScale, rNullDate); diff --git a/sw/qa/extras/layout/data/tdf129054.docx b/sw/qa/extras/layout/data/tdf129054.docx new file mode 100644 index ..5d02d7e87a33 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf129054.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index d1517323b581..82febf907297 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2447,6 +2447,32 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) "15"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129054) +{ +SwDoc* pDoc = createDoc("tdf129054.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); + +// Test the size of diameter of Pie chart. +sal_Int32 nYTop += getXPath(pXmlDoc, +
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/controller/main/PositionAndSizeHelper.cxx |1 chart2/source/view/main/VLegend.cxx | 36 sw/qa/extras/layout/data/tdf115630.docx |binary sw/qa/extras/layout/layout.cxx | 25 +++ 4 files changed, 43 insertions(+), 19 deletions(-) New commits: commit 739ed2c29f49ea5e83bcd1352b2644c2e2d09f7b Author: Balazs Varga AuthorDate: Thu Nov 21 14:56:43 2019 +0100 Commit: László Németh CommitDate: Wed Nov 27 12:02:50 2019 +0100 tdf#115630 tdf#88922 Chart: fix custom legend position and size Do not need to set the "AnchorPosition" value, when we move the legend object. It is enough to set only the "Expansion" as custom, so we keep the previously set "AnchorPosition" value and we can use the lcl_calculatePositionAndRemainingSpace function to calculate the remaining space of the inner chart area. Change-Id: I7b577bc6acf2de9b6755329b92603ea5ba631d57 Reviewed-on: https://gerrit.libreoffice.org/83399 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/chart2/source/controller/main/PositionAndSizeHelper.cxx b/chart2/source/controller/main/PositionAndSizeHelper.cxx index 40972d47c3f4..d9100c839a14 100644 --- a/chart2/source/controller/main/PositionAndSizeHelper.cxx +++ b/chart2/source/controller/main/PositionAndSizeHelper.cxx @@ -72,7 +72,6 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType } else if(eObjectType==OBJECTTYPE_LEGEND) { -xObjectProp->setPropertyValue( "AnchorPosition", uno::Any(LegendPosition_CUSTOM)); xObjectProp->setPropertyValue( "Expansion", uno::Any(css::chart::ChartLegendExpansion_CUSTOM)); chart2::RelativePosition aRelativePosition; chart2::RelativeSize aRelativeSize; diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index c8edeeed00a0..df5ca49cea74 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -701,29 +701,29 @@ awt::Point lcl_calculatePositionAndRemainingSpace( switch( ePos ) { case LegendPosition_LINE_START: -{ -sal_Int32 nExtent = aLegendSize.Width; -rRemainingSpace.Width -= ( nExtent + nXDistance ); -rRemainingSpace.X += ( nExtent + nXDistance ); -} +{ +sal_Int32 nExtent = aLegendSize.Width; +rRemainingSpace.Width -= ( nExtent + nXDistance ); +rRemainingSpace.X += ( nExtent + nXDistance ); +} break; case LegendPosition_LINE_END: -{ -rRemainingSpace.Width -= ( aLegendSize.Width + nXDistance ); -} -break; +{ +rRemainingSpace.Width -= ( aLegendSize.Width + nXDistance ); +} +break; case LegendPosition_PAGE_START: -{ -sal_Int32 nExtent = aLegendSize.Height; -rRemainingSpace.Height -= ( nExtent + nYDistance ); -rRemainingSpace.Y += ( nExtent + nYDistance ); -} +{ +sal_Int32 nExtent = aLegendSize.Height; +rRemainingSpace.Height -= ( nExtent + nYDistance ); +rRemainingSpace.Y += ( nExtent + nYDistance ); +} break; case LegendPosition_PAGE_END: -{ -rRemainingSpace.Height -= ( aLegendSize.Height + nYDistance ); -} -break; +{ +rRemainingSpace.Height -= ( aLegendSize.Height + nYDistance ); +} +break; default: // nothing diff --git a/sw/qa/extras/layout/data/tdf115630.docx b/sw/qa/extras/layout/data/tdf115630.docx new file mode 100644 index ..e9f6339a1242 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf115630.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 89df9aa18d90..d1517323b581 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2285,6 +2285,31 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf75659) // These failed, if the legend names are empty strings. } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115630) +{ +SwDoc* pDoc = createDoc("tdf115630.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); + +// Test wide of inner chart area. +sal_Int32 nXRight += getXPath(pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/push[3]/polyline[1]/point[1]", + "x") + .toInt32(); +sal_Int32 nXLeft += getXPath(pXmlDoc, +
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/axes/VCartesianAxis.cxx | 17 +++-- sw/qa/extras/layout/data/horizontal_multilevel.odt |binary sw/qa/extras/layout/layout.cxx | 15 +++ 3 files changed, 30 insertions(+), 2 deletions(-) New commits: commit 55136439e71b7adc62a46a3d3dc8de26d54d989d Author: Balazs Varga AuthorDate: Thu Sep 5 16:43:23 2019 +0200 Commit: László Németh CommitDate: Mon Sep 9 11:18:28 2019 +0200 tdf127448 Chart: Avoid distortion of charts with multilevel axis labels and too long tickmark lines. Note: larger chart distortion is a regression from commit: 4b3a648a2fd7d733674f95bb7f20670c57e99252 (tdf#127304 Chart: fix rotation of multilevel axis labels) Change-Id: Idbcd40d93c21a685e9ad1e49eb8c088a20ecae15 Reviewed-on: https://gerrit.libreoffice.org/78662 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 4874f7f9575f..ce795abb17d0 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -1619,7 +1619,11 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel if( nTextLevel>0 ) { lcl_shiftLabels(*apTickIter, aCummulatedLabelsDistance); -fRotationAngleDegree = 0.0; +//multilevel labels: 0 or 90 by default +if( m_aAxisProperties.m_bSwapXAndY ) +fRotationAngleDegree = 90.0; +else +fRotationAngleDegree = 0.0; } aCummulatedLabelsDistance += lcl_getLabelsDistance( *apTickIter, pTickFactory2D->getDistanceAxisTickToText(m_aAxisProperties), @@ -1682,6 +1686,7 @@ void VCartesianAxis::createLabels() aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0; if( nTextLevel > 0 ) { +//multilevel labels: 0 or 90 by default if( m_aAxisProperties.m_bSwapXAndY ) aComplexProps.fRotationAngleDegree = 90.0; else @@ -1769,7 +1774,7 @@ void VCartesianAxis::updatePositions() double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree; if( nDepth > 0 ) { -/* Multi-level Labels: default to 0 or 90 */ +//multilevel labels: 0 or 90 by default if( pTickFactory2D->isHorizontalAxis() ) fRotationAngleDegree = 0.0; else @@ -1863,6 +1868,14 @@ void VCartesianAxis::createShapes() if( apTickIter ) { double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree; +if( nTextLevel > 0 ) +{ +//Multi-level Labels: default to 0 or 90 +if( m_aAxisProperties.m_bSwapXAndY ) +fRotationAngleDegree = 90.0; +else +fRotationAngleDegree = 0.0; +} B2DVector aLabelsDistance(lcl_getLabelsDistance( *apTickIter, pTickFactory2D->getDistanceAxisTickToText(m_aAxisProperties), fRotationAngleDegree)); diff --git a/sw/qa/extras/layout/data/horizontal_multilevel.odt b/sw/qa/extras/layout/data/horizontal_multilevel.odt new file mode 100644 index ..9bd12586500a Binary files /dev/null and b/sw/qa/extras/layout/data/horizontal_multilevel.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 6fd861d68dc8..43f2381ada5b 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2341,6 +2341,21 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127304) "0"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testHorizontal_multilevel) +{ +SwDoc* pDoc = createDoc("horizontal_multilevel.odt"); +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); +// Test the Y position of horizontal category axis label. +assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/textarray[7]", "y", +"7945"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) { SwDoc* pDoc = createDoc("tdf124796.odt"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/axes/VCartesianAxis.cxx | 12 +++- sw/qa/extras/layout/data/tdf127304.odt |binary sw/qa/extras/layout/layout.cxx | 21 + 3 files changed, 28 insertions(+), 5 deletions(-) New commits: commit 4b3a648a2fd7d733674f95bb7f20670c57e99252 Author: Balazs Varga AuthorDate: Tue Sep 3 14:54:52 2019 +0200 Commit: László Németh CommitDate: Wed Sep 4 13:36:35 2019 +0200 tdf#127304 Chart: fix rotation of multilevel axis labels If the first level of horizontal category axis labels is rotated vertically, then the other levels should not be rotated. Regression from commit: 23c0b3e13f88d6d71d528777d4f86f50c0766672 (tdf#107074 uncommenting createLabels for the axis fixes the issue) Change-Id: Ia1978fdc345fa154cff2ea03d2a94475f73398a6 Reviewed-on: https://gerrit.libreoffice.org/78557 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 34faa8bdac79..4874f7f9575f 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -757,8 +757,8 @@ bool VCartesianAxis::createTextShapes( } } - // Stores an array of text label strings in case of a normal - // (non-complex) category axis. +// Stores an array of text label strings in case of a normal +// (non-complex) category axis. const uno::Sequence* pCategories = nullptr; if( m_bUseTextLabels && !m_aAxisProperties.m_bComplexCategories ) pCategories = _aTextLabels; @@ -1680,10 +1680,12 @@ void VCartesianAxis::createLabels() { aComplexProps.bLineBreakAllowed = true; aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0; -//Only the first level of complex vertical category axis labels orientation should be horizontal -if( nTextLevel > 0 && m_aAxisProperties.m_bSwapXAndY ) +if( nTextLevel > 0 ) { -aComplexProps.fRotationAngleDegree = 90.0; +if( m_aAxisProperties.m_bSwapXAndY ) +aComplexProps.fRotationAngleDegree = 90.0; +else +aComplexProps.fRotationAngleDegree = 0.0; } } AxisLabelProperties& rAxisLabelProperties = m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties; diff --git a/sw/qa/extras/layout/data/tdf127304.odt b/sw/qa/extras/layout/data/tdf127304.odt new file mode 100644 index ..e8a4d6e03b0a Binary files /dev/null and b/sw/qa/extras/layout/data/tdf127304.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 2a43db31486c..f5cae5aa8405 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2320,6 +2320,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf126244) "900"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127304) +{ +SwDoc* pDoc = createDoc("tdf127304.odt"); +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); +// Test the first level of horizontal category axis labels orientation. The first level orientation should be vertical. +assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[1]", "orientation", +"900"); +// Test the second level of horizontal category axis labels orientation. The second level orientation should be horizontal. +assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[5]", "orientation", +"0"); +// Test the third level of horizontal category axis labels orientation. The third level orientation should be horizontal. +assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[7]", "orientation", +"0"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) { SwDoc* pDoc = createDoc("tdf124796.odt"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/axes/VCartesianAxis.cxx | 13 ++--- sw/qa/extras/layout/data/tdf126244.docx|binary sw/qa/extras/layout/layout.cxx | 21 + 3 files changed, 31 insertions(+), 3 deletions(-) New commits: commit 0dab9b7c83099a192ec61486e7a9fd04aecd3686 Author: Balazs Varga AuthorDate: Wed Jul 31 15:58:09 2019 +0200 Commit: László Németh CommitDate: Thu Aug 1 10:48:06 2019 +0200 tdf#126244 Chart view: fix rotation of complex category labels The first level of vertical category axis labels orientation should be horizontal, other levels should be rotated to 90°. Also do not allow text break for complex vertical category axis labels. Change-Id: I01a6d9f753e767927fa71e2967dc3e6bad270565 Reviewed-on: https://gerrit.libreoffice.org/76754 Tested-by: Jenkins Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 483411c4c605..34faa8bdac79 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -527,10 +527,13 @@ bool VCartesianAxis::isBreakOfLabelsAllowed( rAxisLabelProperties.fRotationAngleDegree == 90.0 || rAxisLabelProperties.fRotationAngleDegree == 270.0 ) ) return false; -if ( !m_aAxisProperties.m_bSwapXAndY ) +//no break for complex vertical category axis +if( !m_aAxisProperties.m_bSwapXAndY ) return bIsHorizontalAxis; -else +else if( m_aAxisProperties.m_bSwapXAndY && !m_aAxisProperties.m_bComplexCategories ) return bIsVerticalAxis; +else +return false; } namespace{ @@ -1677,7 +1680,11 @@ void VCartesianAxis::createLabels() { aComplexProps.bLineBreakAllowed = true; aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0; - +//Only the first level of complex vertical category axis labels orientation should be horizontal +if( nTextLevel > 0 && m_aAxisProperties.m_bSwapXAndY ) +{ +aComplexProps.fRotationAngleDegree = 90.0; +} } AxisLabelProperties& rAxisLabelProperties = m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties; while (!createTextShapes(m_xTextTarget, *apTickIter, rAxisLabelProperties, diff --git a/sw/qa/extras/layout/data/tdf126244.docx b/sw/qa/extras/layout/data/tdf126244.docx new file mode 100644 index ..cf3b0d14a76c Binary files /dev/null and b/sw/qa/extras/layout/data/tdf126244.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 84728d8e2254..2f69230849e1 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2295,6 +2295,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122800) // This failed, if the textarray length of the first axis label not 22. } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf126244) +{ +SwDoc* pDoc = createDoc("tdf126244.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); +// Test the first level of vertical category axis labels orientation. The first level orientation should be horizontal. +assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[1]", "orientation", +"0"); +// Test the second level of vertical category axis labels orientation. The second level orientation should be vertical. +assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[5]", "orientation", +"900"); +// Test the third level of vertical category axis labels orientation. The third level orientation should be vertical. +assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[7]", "orientation", +"900"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) { SwDoc* pDoc = createDoc("tdf124796.odt"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/tools/UncachedDataSequence.cxx | 13 +++-- sw/qa/extras/layout/data/tdf75659.docx |binary sw/qa/extras/layout/layout.cxx | 25 + 3 files changed, 36 insertions(+), 2 deletions(-) New commits: commit 007bf60611e2ba5a65ffabe80dbb0e279fcb9f26 Author: Balazs Varga AuthorDate: Tue Jun 11 13:26:50 2019 +0200 Commit: László Németh CommitDate: Wed Jun 12 16:54:03 2019 +0200 tdf#75659 Chart: fix empty legend at not available legend names by using localized versions of "Unnamed Series 1" etc. Note: OOXML files don't contain the default or fallback legend names used by MSO in this case, so the original empty string replacement of the missing names resulted bad chart import. Change-Id: I2897c70d9003e1ab3241dd569de0d79821d896b1 Reviewed-on: https://gerrit.libreoffice.org/73817 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/source/tools/UncachedDataSequence.cxx b/chart2/source/tools/UncachedDataSequence.cxx index b9721490b7e7..ca3a9280c452 100644 --- a/chart2/source/tools/UncachedDataSequence.cxx +++ b/chart2/source/tools/UncachedDataSequence.cxx @@ -23,6 +23,8 @@ #include #include +#include +#include #include #include @@ -209,8 +211,15 @@ OUString SAL_CALL UncachedDataSequence::getSourceRangeRepresentation() Sequence< OUString > SAL_CALL UncachedDataSequence::generateLabel( chart2::data::LabelOrigin ) { -// auto-generated label is an empty string -return Sequence< OUString >(1); +// auto-generated label +sal_Int32 nSeries = m_aSourceRepresentation.toInt32() + 1; +OUString aResString(::chart::SchResId(STR_DATA_UNNAMED_SERIES_WITH_INDEX)); +const OUString aReplacementStr("%NUMBER"); +sal_Int32 nIndex = aResString.indexOf(aReplacementStr); +OUString aName; +if( nIndex != -1 ) +aName = aResString.replaceAt(nIndex, aReplacementStr.getLength(), OUString::number(nSeries)); +return Sequence< OUString >( , 1 ); } ::sal_Int32 SAL_CALL UncachedDataSequence::getNumberFormatKeyByIndex( ::sal_Int32 ) diff --git a/sw/qa/extras/layout/data/tdf75659.docx b/sw/qa/extras/layout/data/tdf75659.docx new file mode 100644 index ..a3cde330f8f5 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf75659.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 1175d25ef573..325c0ef49e64 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2327,6 +2327,31 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125335) // This failed, if the legend first label is not "Data3". The legend position is bottom. } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf75659) +{ +SwDoc* pDoc = createDoc("tdf75659.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[17]/text", + "Unnamed Series 1"); + +assertXPathContent(pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[18]/text", + "Unnamed Series 2"); + +assertXPathContent(pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[19]/text", + "Unnamed Series 3"); +// These failed, if the legend names are empty strings. +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf108021) { SwDoc* pDoc = createDoc("tdf108021.odt"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/charttypes/VSeriesPlotter.cxx |7 ++- sw/qa/extras/layout/data/tdf125335.odt |binary sw/qa/extras/layout/layout.cxx | 20 +++- 3 files changed, 25 insertions(+), 2 deletions(-) New commits: commit 729c8d135b6b958e6d2cd87ee72166ecdb0afbfc Author: Balazs Varga AuthorDate: Tue May 21 10:18:26 2019 +0200 Commit: László Németh CommitDate: Wed May 22 08:09:53 2019 +0200 tdf#125335 fix order of bar chart legend names in top-bottom positions by considering the axis direction. Note: Legend name order in left/right position was fixed in commit 40144617ce05d7eff86eeb8a412c6991fe0b819e Change-Id: Id5bd585a666c3bcf346af5317e9197e6460f932a Reviewed-on: https://gerrit.libreoffice.org/72670 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 17f044654535..350254c14764 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -2402,7 +2402,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( // 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 -// is the correct one +// is the correct one, unless the chart type is horizontal bar-chart. bool bReverse = false; if( eLegendExpansion != css::chart::ChartLegendExpansion_WIDE ) { @@ -2414,6 +2414,11 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( bReverse = !bReverse; } } +else if( bSwapXAndY ) +{ +StackingDirection eStackingDirection( pSeries->getStackingDirection() ); +bReverse = ( eStackingDirection != StackingDirection_Y_STACKING ); +} if (bReverse) aResult.insert( aResult.begin(), aSeriesEntries.begin(), aSeriesEntries.end() ); diff --git a/sw/qa/extras/layout/data/tdf125335.odt b/sw/qa/extras/layout/data/tdf125335.odt new file mode 100644 index ..992d93471001 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf125335.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 93cd45e1f429..1175d25ef573 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2306,7 +2306,25 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf114163) pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[12]/text", "Data3"); -// This failed, if the legend first label is not "Data3". +// This failed, if the legend first label is not "Data3". The legend position is right. +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125335) +{ +SwDoc* pDoc = createDoc("tdf125335.odt"); +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[3]/push[1]/push[1]/push[1]/textarray[12]/text", +"Data3"); +// This failed, if the legend first label is not "Data3". The legend position is bottom. } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf108021) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/axes/VCartesianAxis.cxx | 25 ++--- chart2/source/view/axes/VCartesianAxis.hxx |2 +- sw/qa/extras/layout/data/tdf125334.odt |binary sw/qa/extras/layout/layout.cxx | 20 +++- 4 files changed, 38 insertions(+), 9 deletions(-) New commits: commit 75ef0e41ea8a9096ac619356d2b837c5333b47e6 Author: Balazs Varga AuthorDate: Fri May 17 11:40:27 2019 +0200 Commit: László Németh CommitDate: Sat May 18 00:06:28 2019 +0200 tdf#125334 Chart: allow text break in bar chart axis labels Now vertical category axis labels support text breaking. Change-Id: I8b1c6eff921ea999bc4f745aa5f85bae278e735b Reviewed-on: https://gerrit.libreoffice.org/72457 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 234e1000140a..4fac1f83b72e 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -510,7 +510,7 @@ TickInfo* MaxLabelTickIter::nextInfo() } bool VCartesianAxis::isBreakOfLabelsAllowed( -const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis ) const +const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis) const { if( m_aTextLabels.getLength() > 100 ) return false; @@ -525,8 +525,10 @@ bool VCartesianAxis::isBreakOfLabelsAllowed( rAxisLabelProperties.fRotationAngleDegree == 90.0 || rAxisLabelProperties.fRotationAngleDegree == 270.0 ) ) return false; -//break only for horizontal axis -return bIsHorizontalAxis; +if ( !m_aAxisProperties.m_bSwapXAndY ) +return bIsHorizontalAxis; +else +return bIsVerticalAxis; } namespace{ @@ -702,7 +704,7 @@ bool VCartesianAxis::createTextShapes( const bool bIsHorizontalAxis = pTickFactory->isHorizontalAxis(); const bool bIsVerticalAxis = pTickFactory->isVerticalAxis(); -if (!isBreakOfLabelsAllowed(rAxisLabelProperties, bIsHorizontalAxis) && +if (!isBreakOfLabelsAllowed(rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis) && !isAutoStaggeringOfLabelsAllowed(rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis) && !rAxisLabelProperties.isStaggered()) return createTextShapesSimple(xTarget, rTickIter, rAxisLabelProperties, pTickFactory); @@ -714,7 +716,7 @@ bool VCartesianAxis::createTextShapes( B2DVector aTextToTickDistance = pTickFactory->getDistanceAxisTickToText(m_aAxisProperties, true); sal_Int32 nLimitedSpaceForText = -1; -if( isBreakOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis ) ) +if( isBreakOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis ) ) { nLimitedSpaceForText = nScreenDistanceBetweenTicks; if( bIsStaggered ) @@ -742,6 +744,12 @@ bool VCartesianAxis::createTextShapes( nLimitedSpaceForText = -1; } } + +// recalculate the nLimitedSpaceForText in case of vertical category axis if the text break is true +if ( m_aAxisProperties.m_bSwapXAndY && bIsVerticalAxis && rAxisLabelProperties.fRotationAngleDegree == 0.0 ) +{ +nLimitedSpaceForText = rAxisLabelProperties.m_aMaximumSpaceForLabels.X; +} } // Stores an array of text label strings in case of a normal @@ -750,8 +758,11 @@ bool VCartesianAxis::createTextShapes( if( m_bUseTextLabels && !m_aAxisProperties.m_bComplexCategories ) pCategories = _aTextLabels; -bool bLimitedHeight = fabs(aTextToTickDistance.getX()) > fabs(aTextToTickDistance.getY()); - +bool bLimitedHeight; +if( !m_aAxisProperties.m_bSwapXAndY ) +bLimitedHeight = fabs(aTextToTickDistance.getX()) > fabs(aTextToTickDistance.getY()); +else +bLimitedHeight = fabs(aTextToTickDistance.getX()) < fabs(aTextToTickDistance.getY()); //prepare properties for multipropertyset-interface of shape tNameSequence aPropNames; tAnySequence aPropValues; diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx index df15e4896198..1c020bc4174c 100644 --- a/chart2/source/view/axes/VCartesianAxis.hxx +++ b/chart2/source/view/axes/VCartesianAxis.hxx @@ -150,7 +150,7 @@ private: //methods * @return true if we can break a single line label text into multiple * lines for better fitting, otherwise false. */ -bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis ) const; +bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis ) const; ::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const; ScreenPosAndLogicPos getScreenPosAndLogicPos( double
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/main/ChartView.cxx | 18 -- sw/qa/extras/layout/data/tdf124796.odt |binary sw/qa/extras/layout/layout.cxx | 24 3 files changed, 40 insertions(+), 2 deletions(-) New commits: commit 2ec293ab590c440fe7e36f5b7fcbef4cbfe5133c Author: Balazs Varga AuthorDate: Thu Apr 25 15:00:55 2019 +0200 Commit: László Németh CommitDate: Fri Apr 26 08:50:10 2019 +0200 tdf#124796 Fix chart primary Y axis scaling Re-scale the primary Y axis if the secondary axis is deleted and the dataseries still attached to the secondary axis. Change-Id: I6e7958766d23a74569ce8529ddf1bdafa89f1870 Reviewed-on: https://gerrit.libreoffice.org/71302 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 8b0548f909ee..d165ccb05251 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -441,6 +441,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( bool bConnectBars = false; bool bGroupBarsPerAxis = true; bool bIncludeHiddenCells = true; +bool bSecondaryYaxisVisible = true; sal_Int32 nStartingAngle = 90; sal_Int32 n3DRelativeHeight = 100; try @@ -479,7 +480,19 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( { uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] ); VCoordinateSystem* pVCooSys = addCooSysToList(m_rVCooSysList,xCooSys,rChartModel); - +// Let's check whether the secondary Y axis is visible +try +{ +Reference< beans::XPropertySet > xAxisProp(xCooSys->getAxisByDimension(1, 1), uno::UNO_QUERY); +if (xAxisProp.is()) +{ +xAxisProp->getPropertyValue("Show") >>= bSecondaryYaxisVisible; +} +} +catch (const lang::IndexOutOfBoundsException& e) +{ +SAL_WARN("chart2", "Exception caught. " << e); +} //iterate through all chart types in the current coordinate system uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY ); OSL_ASSERT( xChartTypeContainer.is()); @@ -563,7 +576,8 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( //ignore secondary axis for charttypes that do not support them if( pSeries->getAttachedAxisIndex() != MAIN_AXIS_INDEX && -!ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount ) ) + ( !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount ) || +!bSecondaryYaxisVisible ) ) { pSeries->setAttachedAxisIndex(MAIN_AXIS_INDEX); } diff --git a/sw/qa/extras/layout/data/tdf124796.odt b/sw/qa/extras/layout/data/tdf124796.odt new file mode 100644 index ..2a8d2c816ad1 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf124796.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 91705c8e18d9..c17adf1bba92 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2340,6 +2340,30 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122800) // This failed, if the textarray length of the first axis label not 22. } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) +{ +SwDoc* pDoc = createDoc("tdf124796.odt"); +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 -10. +assertXPathContent( +pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[5]/text", +"-10"); + +// This failed, if the maximum value of Y axis is not 15. +assertXPathContent( +pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[10]/text", +"15"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116925) { SwDoc* pDoc = createDoc("tdf116925.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/axes/VCartesianAxis.cxx | 15 +++ sw/qa/extras/layout/data/tdf108021.odt |binary sw/qa/extras/layout/layout.cxx |2 +- 3 files changed, 16 insertions(+), 1 deletion(-) New commits: commit 40ffaa4f23fe59f979222facf1688d25c60651b6 Author: Balazs Varga AuthorDate: Mon Jan 7 16:17:16 2019 +0100 Commit: László Németh CommitDate: Tue Jan 22 15:35:15 2019 +0100 Related: tdf#108021 Fix text break of X axis labels Recalculate the nLimitedSpaceForText in case of 90 and 270 degree if the X axis label's text break is true. The first part of the fix: https://gerrit.libreoffice.org/65165 Change-Id: I5d78be6ed83dd195bbc34185d5f6b7e44f555d9b Reviewed-on: https://gerrit.libreoffice.org/65937 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 42b767ae42a9..e058101524df 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -727,6 +727,21 @@ bool VCartesianAxis::createTextShapes( nReduce = 1; nLimitedSpaceForText -= nReduce; } + +// recalculate the nLimitedSpaceForText in case of 90 and 270 degree if the text break is true +if ( rAxisLabelProperties.fRotationAngleDegree == 90.0 || rAxisLabelProperties.fRotationAngleDegree == 270.0 ) +{ +if ( rAxisLabelProperties.m_aFontReferenceSize.Height - rAxisLabelProperties.m_aMaximumSpaceForLabels.Height > 2 * rAxisLabelProperties.m_aMaximumSpaceForLabels.Y ) +{ +const sal_Int32 nFullHeight = rAxisLabelProperties.m_aFontReferenceSize.Height; +sal_Int32 nMaxLabelsHeight = nFullHeight - ( rAxisLabelProperties.m_aMaximumSpaceForLabels.Height + rAxisLabelProperties.m_aMaximumSpaceForLabels.Y ); +nLimitedSpaceForText = nMaxLabelsHeight; +} +else +{ +nLimitedSpaceForText = -1; +} +} } // Stores an array of text label strings in case of a normal diff --git a/sw/qa/extras/layout/data/tdf108021.odt b/sw/qa/extras/layout/data/tdf108021.odt index 39ef6df80d2f..a81fe9c9a40d 100644 Binary files a/sw/qa/extras/layout/data/tdf108021.odt and b/sw/qa/extras/layout/data/tdf108021.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 79b55c80f191..99ca36673c71 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2391,7 +2391,7 @@ void SwLayoutWriter::testTdf108021() assertXPath( pXmlDoc, - "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[@length='17']", + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[@length='22']", 8); // This failed, if the textarray length of the first axis label not 17. } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/axes/VCartesianAxis.cxx |7 +-- sw/qa/extras/layout/data/tdf122800.odt |binary sw/qa/extras/layout/layout.cxx | 20 3 files changed, 25 insertions(+), 2 deletions(-) New commits: commit 82913d296709ccf4d4f35d53835bcbf49286ba28 Author: Balazs Varga AuthorDate: Fri Jan 18 11:20:07 2019 +0100 Commit: László Németh CommitDate: Fri Jan 18 16:48:55 2019 +0100 tdf#122800 Chart view: Textbreak of X axis labels Do not break the word into individual letters below each other in the X axis labels. Keep the default 45 degree (even if the textbreak is true) rotation if there is no enough space for a single word between two tickmark. Change-Id: I6f11e55b7ee8373210c1c417e64d552a6cd89812 Reviewed-on: https://gerrit.libreoffice.org/66580 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index ed31fabbb215..42b767ae42a9 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -835,14 +835,17 @@ bool VCartesianAxis::createTextShapes( recordMaximumTextSize( pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree ); +// Label has multiple lines and the words are broken if( nLimitedSpaceForText>0 && !rAxisLabelProperties.bOverlapAllowed && rAxisLabelProperties.fRotationAngleDegree == 0.0 -&& m_aAxisProperties.m_bComplexCategories && lcl_hasWordBreak( pTickInfo->xTextShape ) ) { // Label has multiple lines and belongs to a complex category // axis. Rotate 90 degrees to try to avoid overlaps. -rAxisLabelProperties.fRotationAngleDegree = 90; +if ( m_aAxisProperties.m_bComplexCategories ) +{ +rAxisLabelProperties.fRotationAngleDegree = 90; +} rAxisLabelProperties.bLineBreakAllowed = false; m_aAxisLabelProperties.fRotationAngleDegree = rAxisLabelProperties.fRotationAngleDegree; removeTextShapesFromTicks(); diff --git a/sw/qa/extras/layout/data/tdf122800.odt b/sw/qa/extras/layout/data/tdf122800.odt new file mode 100755 index ..ff1e35cfb44b Binary files /dev/null and b/sw/qa/extras/layout/data/tdf122800.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 7ed24771c661..79b55c80f191 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -41,6 +41,7 @@ public: void testTdf116830(); void testTdf114163(); void testTdf108021(); +void testTdf122800(); void testTdf116925(); void testTdf117028(); void testTdf106390(); @@ -79,6 +80,7 @@ public: CPPUNIT_TEST(testTdf116830); CPPUNIT_TEST(testTdf114163); CPPUNIT_TEST(testTdf108021); +CPPUNIT_TEST(testTdf122800); CPPUNIT_TEST(testTdf116925); CPPUNIT_TEST(testTdf117028); CPPUNIT_TEST(testTdf106390); @@ -2394,6 +2396,24 @@ void SwLayoutWriter::testTdf108021() // This failed, if the textarray length of the first axis label not 17. } +void SwLayoutWriter::testTdf122800() +{ +SwDoc* pDoc = createDoc("tdf122800.odt"); +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); + +assertXPath( +pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[@length='22']", +9); +// This failed, if the textarray length of the first axis label not 22. +} + void SwLayoutWriter::testTdf116925() { SwDoc* pDoc = createDoc("tdf116925.docx"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source sw/qa
chart2/source/view/charttypes/VSeriesPlotter.cxx | 21 - chart2/source/view/inc/LegendEntryProvider.hxx |4 +++- chart2/source/view/inc/VSeriesPlotter.hxx|4 +++- chart2/source/view/main/VLegend.cxx |2 +- sw/qa/extras/layout/data/tdf114163.odt |binary sw/qa/extras/layout/layout.cxx | 20 6 files changed, 47 insertions(+), 4 deletions(-) New commits: commit 40144617ce05d7eff86eeb8a412c6991fe0b819e Author: Balazs Varga AuthorDate: Wed Dec 5 16:00:09 2018 +0100 Commit: Bartosz Kosiorek CommitDate: Fri Dec 7 13:39:22 2018 +0100 tdf#114163 Chart: fix order of legend names Respecting the axis direction in case of normal/stacked/percent stacked Bar chart and the legend names will be in the right order. Change-Id: If782393a33e48dae32f919d137e1d1148a85b0b0 Reviewed-on: https://gerrit.libreoffice.org/64632 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index ee76f7351d93..a79fadcc974b 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -40,6 +40,7 @@ #include #include #include +#include //only for creation: @todo remove if all plotter are uno components and instantiated via servicefactory #include "BarChart.hxx" @@ -66,6 +67,7 @@ #include #include #include +#include #include #include @@ -2188,12 +2190,26 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( , const Reference< drawing::XShapes >& xTarget , const Reference< lang::XMultiServiceFactory >& xShapeFactory , const Reference< uno::XComponentContext >& xContext +, ChartModel& rModel ) { std::vector< ViewLegendEntry > aResult; if( xTarget.is() ) { +uno::Reference< XCoordinateSystemContainer > xCooSysCnt( rModel.getFirstDiagram(), uno::UNO_QUERY ); +Reference< chart2::XCoordinateSystem > xCooSys(xCooSysCnt->getCoordinateSystems()[0]); +Reference< beans::XPropertySet > xProp( xCooSys, uno::UNO_QUERY ); +bool bSwapXAndY = false; + +if( xProp.is()) try +{ +xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY; +} +catch( const uno::Exception& ) +{ +} + //iterate through all series bool bBreak = false; bool bFirstSeries = true; @@ -2234,7 +2250,10 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( StackingDirection eStackingDirection( pSeries->getStackingDirection() ); bReverse = ( eStackingDirection == StackingDirection_Y_STACKING ); -//todo: respect direction of axis in future +if( bSwapXAndY ) +{ +bReverse = !bReverse; +} } if (bReverse) diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx b/chart2/source/view/inc/LegendEntryProvider.hxx index 3ad8a94b8832..aff7a5d84116 100644 --- a/chart2/source/view/inc/LegendEntryProvider.hxx +++ b/chart2/source/view/inc/LegendEntryProvider.hxx @@ -25,6 +25,7 @@ #include #include +namespace chart { class ChartModel; } namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } } namespace com { namespace sun { namespace star { namespace chart2 { class XFormattedString2; } } } } namespace com { namespace sun { namespace star { namespace drawing { class XShape; } } } } @@ -75,7 +76,8 @@ public: const css::uno::Reference< css::beans::XPropertySet >& xTextProperties, const css::uno::Reference< css::drawing::XShapes >& xTarget, const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory, -const css::uno::Reference< css::uno::XComponentContext >& xContext +const css::uno::Reference< css::uno::XComponentContext >& xContext, +ChartModel& rModel ) = 0; protected: diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index e181c7590a71..445411523359 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -33,6 +33,7 @@ namespace com { namespace sun { namespace star { namespace chart2 { class XChart namespace chart { class ExplicitCategoriesProvider; } namespace chart { struct ExplicitScaleData; } +namespace chart { class ChartModel; } namespace com { namespace sun { namespace star { namespace util { @@ -197,7 +198,8 @@ public: const css::uno::Reference< css::beans::XPropertySet >& xTextProperties, const