summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/qa/extras/chart2export.cxx14
-rw-r--r--chart2/qa/extras/data/ods/tdf123774.odsbin0 -> 16140 bytes
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx1
-rw-r--r--chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx1
-rw-r--r--oox/source/export/chartexport.cxx14
5 files changed, 28 insertions, 2 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 694e814250bd..8d42c8ac93ac 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -99,6 +99,7 @@ public:
void testMarkerColorXLSX();
void testRoundedCornersXLSX();
void testAxisNumberFormatXLSX();
+ void testDataPointLabelNumberFormatXLSX();
void testDataLabelDefaultValuesXLSX();
void testTitleOverlayXLSX();
void testInvertIfNegativeXLSX();
@@ -210,6 +211,7 @@ public:
CPPUNIT_TEST(testMarkerColorXLSX);
CPPUNIT_TEST(testRoundedCornersXLSX);
CPPUNIT_TEST(testAxisNumberFormatXLSX);
+ CPPUNIT_TEST(testDataPointLabelNumberFormatXLSX);
CPPUNIT_TEST(testDataLabelDefaultValuesXLSX);
CPPUNIT_TEST(testTitleOverlayXLSX);
CPPUNIT_TEST(testInvertIfNegativeXLSX);
@@ -1584,6 +1586,18 @@ void Chart2ExportTest::testAxisNumberFormatXLSX()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:numFmt", "sourceLinked", "1");
}
+void Chart2ExportTest::testDataPointLabelNumberFormatXLSX()
+{
+ load("/chart2/qa/extras/data/ods/", "tdf123774.ods");
+ xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+ CPPUNIT_ASSERT(pXmlDoc);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", "formatCode", "[$-40E]0.00%");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", "sourceLinked", "0");
+
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:numFmt", "formatCode", "[$-40E]0.00%");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:numFmt", "sourceLinked", "0");
+}
+
void Chart2ExportTest::testDataLabelDefaultValuesXLSX()
{
load("/chart2/qa/extras/data/xlsx/", "data_label.xlsx");
diff --git a/chart2/qa/extras/data/ods/tdf123774.ods b/chart2/qa/extras/data/ods/tdf123774.ods
new file mode 100644
index 000000000000..5c422b58c357
--- /dev/null
+++ b/chart2/qa/extras/data/ods/tdf123774.ods
Binary files differ
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 39babb82a09c..0d592f4733a8 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -153,6 +153,7 @@ bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxIte
uno::Any aNewValue;
bool bUseSourceFormat = static_cast< const SfxBoolItem & >(
rItemSet.Get( nWhichId )).GetValue();
+ xPropertySet->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::Any(bUseSourceFormat));
if( !bUseSourceFormat )
{
SfxItemState aState = rItemSet.GetItemState( nFormatWhich );
diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
index 86f5891bbad9..81c7c8fcd9a0 100644
--- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
@@ -150,6 +150,7 @@ bool useSourceFormatFromItemToPropertySet(
uno::Any aNewValue;
bool bUseSourceFormat = static_cast<const SfxBoolItem&>(
rItemSet.Get(nWhichId)).GetValue();
+ xPropertySet->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::Any(bUseSourceFormat));
if (!bUseSourceFormat)
{
SfxItemState aState = rItemSet.GetItemState(nFormatWhich);
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index aeb2c8012674..7f0f948a4d85 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3264,7 +3264,12 @@ void ChartExport::exportDataLabels(
if (GetProperty(xPropSet, "LinkNumberFormatToSource"))
mAny >>= bLinkedNumFmt;
- if (GetProperty(xPropSet, "NumberFormat") || GetProperty(xPropSet, "PercentageNumberFormat"))
+ chart2::DataPointLabel aLabel;
+ bool bLabelIsNumberFormat = true;
+ if( xPropSet->getPropertyValue("Label") >>= aLabel )
+ bLabelIsNumberFormat = aLabel.ShowNumber;
+
+ if (GetProperty(xPropSet, bLabelIsNumberFormat ? OUString("NumberFormat") : OUString("PercentageNumberFormat")))
{
sal_Int32 nKey = 0;
mAny >>= nKey;
@@ -3337,7 +3342,12 @@ void ChartExport::exportDataLabels(
pFS->startElement(FSNS(XML_c, XML_dLbl));
pFS->singleElement(FSNS(XML_c, XML_idx), XML_val, OString::number(nIdx));
- if (GetProperty(xLabelPropSet, "NumberFormat") || GetProperty(xLabelPropSet, "PercentageNumberFormat"))
+ if( xLabelPropSet->getPropertyValue("Label") >>= aLabel )
+ bLabelIsNumberFormat = aLabel.ShowNumber;
+ else
+ bLabelIsNumberFormat = true;
+
+ if (GetProperty(xLabelPropSet, bLabelIsNumberFormat ? OUString("NumberFormat") : OUString("PercentageNumberFormat")))
{
sal_Int32 nKey = 0;
mAny >>= nKey;