[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - chart2/qa oox/inc oox/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 16 10:30:48 UTC 2019
chart2/qa/extras/chart2import.cxx | 29 +++++++++++++++++
chart2/qa/extras/data/docx/testSimpleCategoryAxis.docx |binary
oox/inc/drawingml/chart/typegroupmodel.hxx | 1
oox/source/drawingml/chart/plotareaconverter.cxx | 2 +
oox/source/drawingml/chart/typegroupconverter.cxx | 4 +-
oox/source/drawingml/chart/typegroupmodel.cxx | 3 +
6 files changed, 36 insertions(+), 3 deletions(-)
New commits:
commit 1ae3be79982b1d239fcdae235e3d6e7be185144c
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Oct 8 13:29:12 2019 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Oct 16 12:30:12 2019 +0200
tdf#128016 Chart OOXML Import: fix duplicated category labels
Do not create category labels if the category axis is deleted.
Regression from commit: fa0a981af41a2606541eec1cb20a379a739691e0
(tdf#114166 DOCX chart import: fix missing complex categories)
Cherry picked from commit: e0b0502516a10181bbd1737b93b38b2bba4c98e8
(tdf#128016 Chart OOXML Import: fix duplicated category labels)
Change-Id: If357b95956fccbbc6142879f22ebe1b6d715e850
Reviewed-on: https://gerrit.libreoffice.org/80443
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
Reviewed-on: https://gerrit.libreoffice.org/80821
Reviewed-by: Balazs Varga <balazs.varga991 at gmail.com>
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index e0333c7811e2..da62dfd5e87d 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -129,6 +129,7 @@ public:
void testDataPointInheritedColorDOCX();
void testExternalStrRefsXLSX();
void testSourceNumberFormatComplexCategoriesXLS();
+ void testSimpleCategoryAxis();
void testXaxisValues();
void testTdf123504();
void testTdf122765();
@@ -213,6 +214,7 @@ public:
CPPUNIT_TEST(testDataPointInheritedColorDOCX);
CPPUNIT_TEST(testExternalStrRefsXLSX);
CPPUNIT_TEST(testSourceNumberFormatComplexCategoriesXLS);
+ CPPUNIT_TEST(testSimpleCategoryAxis);
CPPUNIT_TEST(testXaxisValues);
CPPUNIT_TEST(testTdf123504);
CPPUNIT_TEST(testTdf122765);
@@ -1894,6 +1896,33 @@ void Chart2ImportTest::testSourceNumberFormatComplexCategoriesXLS()
CPPUNIT_ASSERT(nNumberFormat != 0);
}
+void Chart2ImportTest::testSimpleCategoryAxis()
+{
+ load("/chart2/qa/extras/data/docx/", "testSimpleCategoryAxis.docx");
+ uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ // Test the internal data.
+ CPPUNIT_ASSERT(xChartDoc->hasInternalDataProvider());
+
+ Reference<chart2::XInternalDataProvider> xInternalProvider(xChartDoc->getDataProvider(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xInternalProvider.is());
+
+ Reference<chart::XComplexDescriptionAccess> xDescAccess(xInternalProvider, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xDescAccess.is());
+
+ // Get the category labels.
+ Sequence<Sequence<OUString> > aCategories = xDescAccess->getComplexRowDescriptions();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aCategories[0].getLength());
+ CPPUNIT_ASSERT(aCategories[0][0].endsWith("ria 1"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aCategories[1].getLength());
+ CPPUNIT_ASSERT(aCategories[1][0].endsWith("ria 2"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aCategories[2].getLength());
+ CPPUNIT_ASSERT(aCategories[2][0].endsWith("ria 3"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aCategories[3].getLength());
+ CPPUNIT_ASSERT(aCategories[3][0].endsWith("ria 4"));
+}
+
void Chart2ImportTest::testXaxisValues()
{
load("/chart2/qa/extras/data/docx/", "tdf124083.docx");
diff --git a/chart2/qa/extras/data/docx/testSimpleCategoryAxis.docx b/chart2/qa/extras/data/docx/testSimpleCategoryAxis.docx
new file mode 100644
index 000000000000..de511664a5ba
Binary files /dev/null and b/chart2/qa/extras/data/docx/testSimpleCategoryAxis.docx differ
diff --git a/oox/inc/drawingml/chart/typegroupmodel.hxx b/oox/inc/drawingml/chart/typegroupmodel.hxx
index 031ecddf54aa..0803bf4e7a82 100644
--- a/oox/inc/drawingml/chart/typegroupmodel.hxx
+++ b/oox/inc/drawingml/chart/typegroupmodel.hxx
@@ -76,6 +76,7 @@ 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/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx
index 8afdfda365ea..24ab5f0bfd3e 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -420,6 +420,8 @@ 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 35bb23a2ccf0..22197524b534 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 ) )
+ if( elem->maSources.has( SeriesModel::CATEGORIES ) && mrModel.mbCatAxisVisible)
{
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() ) {
+ if( !xLabeledSeq.is() && !mrModel.maSeries.empty() && mrModel.mbCatAxisVisible) {
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 f9a692c8a39b..aae01ed0f58e 100644
--- a/oox/source/drawingml/chart/typegroupmodel.cxx
+++ b/oox/source/drawingml/chart/typegroupmodel.cxx
@@ -56,7 +56,8 @@ TypeGroupModel::TypeGroupModel( sal_Int32 nTypeId, bool bMSO2007Doc ) :
mbShowNegBubbles( !bMSO2007Doc ),
mbSmooth( !bMSO2007Doc ),
mbVaryColors( !bMSO2007Doc ),
- mbWireframe( !bMSO2007Doc )
+ mbWireframe( !bMSO2007Doc ),
+ mbCatAxisVisible( !bMSO2007Doc )
{
}
More information about the Libreoffice-commits
mailing list