[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - chart2/qa chart2/source oox/inc oox/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Thu Nov 19 19:56:42 UTC 2020
chart2/qa/extras/chart2export.cxx | 11 +++++++++++
chart2/qa/extras/data/xlsx/tdf136267.xlsx |binary
chart2/source/tools/ExplicitCategoriesProvider.cxx | 1 +
oox/inc/drawingml/chart/typegroupmodel.hxx | 1 -
oox/source/drawingml/chart/axisconverter.cxx | 5 ++++-
oox/source/drawingml/chart/plotareaconverter.cxx | 2 --
oox/source/drawingml/chart/typegroupconverter.cxx | 4 ++--
oox/source/drawingml/chart/typegroupmodel.cxx | 3 +--
8 files changed, 19 insertions(+), 8 deletions(-)
New commits:
commit a360a150c8cdcbea4f6e8c40646795eb6a5f1dcc
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Fri Sep 11 14:14:13 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Nov 19 20:56:09 2020 +0100
tdf#136267 OOXML Chart Import: create main category axis labels once
because InternalDataProvider can not handle different category names
on the primary and secondary category axis.
Revert e0b0502516a10181bbd1737b93b38b2bba4c98e8 commit, except
the relevant unit test.
Regression from commit: e0b0502516a10181bbd1737b93b38b2bba4c98e8
(tdf#128016 Chart OOXML Import: fix duplicated category labels)
Also fix tdf#129994 (FILEOPEN - hang at import time), which is a
a regression from commit fa0a981af41a2606541eec1cb20a379a739691e0
(tdf#114166 DOCX chart import: fix missing complex categories)
Change-Id: I5d049e760eb1a647ea774be264349a2f16f15f5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102463
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103617
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106084
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 449ad70c0cb1..d0ed48c29902 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -153,6 +153,7 @@ public:
void testCustomLabelText();
void testTdf131979();
void testTdf132594();
+ void testTdf136267();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
@@ -269,6 +270,7 @@ public:
CPPUNIT_TEST(testCustomLabelText);
CPPUNIT_TEST(testTdf131979);
CPPUNIT_TEST(testTdf132594);
+ CPPUNIT_TEST(testTdf136267);
CPPUNIT_TEST_SUITE_END();
@@ -2484,6 +2486,15 @@ void Chart2ExportTest::testTdf132594()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:cat", 1);
}
+void Chart2ExportTest::testTdf136267()
+{
+ load("/chart2/qa/extras/data/xlsx/", "tdf136267.xlsx");
+ xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:cat/c:strRef/c:strCache/c:pt/c:v", "John");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/tdf136267.xlsx b/chart2/qa/extras/data/xlsx/tdf136267.xlsx
new file mode 100644
index 000000000000..741a33c429b9
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf136267.xlsx differ
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index b6652e25f11d..b9bc76d5b00d 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -53,6 +53,7 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2:
{
if( xCooSysModel.is() )
{
+ // TODO: handle different category names on the primary and secondary category axis.
uno::Reference< XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) );
if( xAxis.is() )
{
diff --git a/oox/inc/drawingml/chart/typegroupmodel.hxx b/oox/inc/drawingml/chart/typegroupmodel.hxx
index 0803bf4e7a82..031ecddf54aa 100644
--- a/oox/inc/drawingml/chart/typegroupmodel.hxx
+++ b/oox/inc/drawingml/chart/typegroupmodel.hxx
@@ -76,7 +76,6 @@ struct TypeGroupModel
bool mbSmooth; /// True = smooth lines in line charts.
bool mbVaryColors; /// True = different automatic colors for each point.
bool mbWireframe; /// True = wireframe surface chart, false = filled surface chart.
- bool mbCatAxisVisible; /// True = Category axis is visible.
explicit TypeGroupModel( sal_Int32 nTypeId, bool bMSO2007Doc );
~TypeGroupModel();
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index f0e65035dd7c..deb302b1a2ad 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -212,7 +212,10 @@ void AxisConverter::convertFromModel(
currently). */
aScaleData.AxisType = (bDateAxis && !mrModel.mbAuto) ? cssc2::AxisType::DATE : cssc2::AxisType::CATEGORY;
aScaleData.AutoDateAxis = mrModel.mbAuto;
- aScaleData.Categories = rTypeGroups.front()->createCategorySequence();
+ /* TODO: create main category axis labels once, while InternalDataProvider
+ can not handle different category names on the primary and secondary category axis. */
+ if( nAxesSetIdx == 0 )
+ aScaleData.Categories = rTypeGroups.front()->createCategorySequence();
/* set default ShiftedCategoryPosition values for some charttype,
because the XML can contain wrong CrossBetween value, if came from MSO */
if( rTypeGroups.front()->is3dChart() && (rTypeInfo.meTypeId == TYPEID_BAR || rTypeInfo.meTypeId == TYPEID_HORBAR || rTypeInfo.meTypeId == TYPEID_STOCK) )
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx
index af3139618824..b3c76915a5de 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -421,8 +421,6 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel )
for (auto const& axesSet : aAxesSets)
{
- if( !axesSet->maAxes.empty() && mrModel.maTypeGroups.size() > sal::static_int_cast<sal_uInt32>(nAxesSetIdx) )
- mrModel.maTypeGroups[nAxesSetIdx]->mbCatAxisVisible = !axesSet->maAxes[0]->mbDeleted;
AxesSetConverter aAxesSetConv(*this, *axesSet);
aAxesSetConv.convertFromModel( xDiagram, rView3DModel, nAxesSetIdx, bSupportsVaryColorsByPoint );
if(nAxesSetIdx == nStartAxesSetIdx)
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index 1b6b20865a48..ea02d5ca548b 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -272,7 +272,7 @@ Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence()
first series, even if it was empty. */
for (auto const& elem : mrModel.maSeries)
{
- if( elem->maSources.has( SeriesModel::CATEGORIES ) && mrModel.mbCatAxisVisible)
+ if( elem->maSources.has( SeriesModel::CATEGORIES ) )
{
SeriesConverter aSeriesConv(*this, *elem);
xLabeledSeq = aSeriesConv.createCategorySequence( "categories" );
@@ -287,7 +287,7 @@ Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence()
}
}
/* n#839727 Create Category Sequence when none are found */
- if( !xLabeledSeq.is() && !mrModel.maSeries.empty() && mrModel.mbCatAxisVisible) {
+ if( !xLabeledSeq.is() && !mrModel.maSeries.empty() ) {
if( nMaxValues < 0 )
nMaxValues = 2;
SeriesModel &aModel = *mrModel.maSeries.get(0);
diff --git a/oox/source/drawingml/chart/typegroupmodel.cxx b/oox/source/drawingml/chart/typegroupmodel.cxx
index 7353bafbecc7..f9a692c8a39b 100644
--- a/oox/source/drawingml/chart/typegroupmodel.cxx
+++ b/oox/source/drawingml/chart/typegroupmodel.cxx
@@ -56,8 +56,7 @@ TypeGroupModel::TypeGroupModel( sal_Int32 nTypeId, bool bMSO2007Doc ) :
mbShowNegBubbles( !bMSO2007Doc ),
mbSmooth( !bMSO2007Doc ),
mbVaryColors( !bMSO2007Doc ),
- mbWireframe( !bMSO2007Doc ),
- mbCatAxisVisible( true )
+ mbWireframe( !bMSO2007Doc )
{
}
More information about the Libreoffice-commits
mailing list