[Libreoffice-commits] core.git: chart2/qa oox/source
Gabor Kelemen (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 13 08:55:17 UTC 2020
chart2/qa/extras/chart2import.cxx | 13 ++++++++++
chart2/qa/extras/data/xlsx/tdf119138-missing-autotitledeleted.xlsx |binary
oox/source/drawingml/chart/chartspaceconverter.cxx | 5 +++
3 files changed, 17 insertions(+), 1 deletion(-)
New commits:
commit 176e06c116db09cae5781522461390da87632953
Author: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
AuthorDate: Thu Feb 6 23:54:26 2020 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Thu Feb 13 09:54:40 2020 +0100
tdf#119138 Show custom chart title if autoTitleDeleted is missing
autoTitleDeleted might be omitted by generators other than Excel
while providing custom title. mbAutoTitleDel is set only based on the attribute value
and the default also varies on whether MSO 2007 or newer is the generator, see tdf#78080
ECMA-376 Part 1 at 21.2.2.7 says:
A value of 1 or true specifies that the property is applied.
This is the default value for this attribute, and is implied
when the parent element is present, but this attribute is omitted.
Change-Id: If3457fe850e13ae8af207bb9beceecc9e887b797
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88151
Tested-by: Jenkins
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 054b04209db2..93be02e70160 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -154,6 +154,7 @@ public:
void testTdf125444PercentageCustomLabel();
void testDataPointLabelCustomPos();
void testTdf130032();
+ void testTdf119138MissingAutoTitleDeleted();
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
@@ -256,6 +257,7 @@ public:
CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
CPPUNIT_TEST(testDataPointLabelCustomPos);
CPPUNIT_TEST(testTdf130032);
+ CPPUNIT_TEST(testTdf119138MissingAutoTitleDeleted);
CPPUNIT_TEST_SUITE_END();
@@ -2397,6 +2399,17 @@ void Chart2ImportTest::testTdf130032()
CPPUNIT_ASSERT_EQUAL(chart::DataLabelPlacement::RIGHT, aPlacement);
}
+void Chart2ImportTest::testTdf119138MissingAutoTitleDeleted()
+{
+ load("/chart2/qa/extras/data/xlsx/", "tdf119138-missing-autotitledeleted.xlsx");
+ Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+ Reference<chart2::XTitled> xTitled(xChartDoc, uno::UNO_QUERY_THROW);
+ uno::Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
+ CPPUNIT_ASSERT_MESSAGE("Missing autoTitleDeleted is implied to be True if title text is present", xTitle.is());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/tdf119138-missing-autotitledeleted.xlsx b/chart2/qa/extras/data/xlsx/tdf119138-missing-autotitledeleted.xlsx
new file mode 100644
index 000000000000..a20aa0bb1bf7
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf119138-missing-autotitledeleted.xlsx differ
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx
index ade046ef08e8..9ea5d8a6c97f 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -176,7 +176,10 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern
}
// chart title
- if( !mrModel.mbAutoTitleDel ) try
+ /* tdf#119138 autoTitleDeleted might be omitted by generators other than Excel
+ while providing custom title. mbAutoTitleDel is set only based on the attribute value
+ and the default also varies on whether MSO 2007 or newer is the generator, see tdf#78080 */
+ if( !mrModel.mbAutoTitleDel || mrModel.mxTitle.is() ) try
{
/* If the title model is missing, but the chart shows exactly one
series, the series title is shown as chart title. */
More information about the Libreoffice-commits
mailing list