summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-04-18 18:27:23 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-04-19 03:03:23 +0200
commitfb745ece0be4e1042c940bae2df8420296fea1ee (patch)
treea4e49b99ccd3f4f9c573f1168bcbca090cfc6400
parent7bb87abc0cc7bf17af62117b65e18bc007573e6e (diff)
export axis number format to OOXML
Change-Id: I1dcea725686f8224bda03913d0b0da9f743a5fb7
-rw-r--r--include/oox/export/chartexport.hxx2
-rw-r--r--oox/source/export/chartexport.cxx33
2 files changed, 35 insertions, 0 deletions
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index ddc60871f521..8ac7fe649fc4 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -181,6 +181,8 @@ private:
void exportMissingValueTreatment(com::sun::star::uno::Reference<
com::sun::star::beans::XPropertySet> xPropSet);
+ OUString getNumberFormatCode(sal_Int32 nKey) const;
+
public:
ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 05f751838c27..92340a40d4fe 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2379,6 +2379,24 @@ void ChartExport::_exportAxis(
if( xAxisTitle.is() )
exportTitle( xAxisTitle );
+ bool bLinkedNumFmt = true;
+ if (GetProperty(xAxisProp, "LinkNumberFormatToSource"))
+ mAny >>= bLinkedNumFmt;
+
+ OUString aNumberFormatString("General");
+ if (GetProperty(xAxisProp, "NumberFormat"))
+ {
+ sal_Int32 nKey = 0;
+ mAny >>= nKey;
+ aNumberFormatString = getNumberFormatCode(nKey);
+ }
+
+ OString sNumberFormatString = OUStringToOString(aNumberFormatString, RTL_TEXTENCODING_UTF8);
+ pFS->singleElement(FSNS(XML_c, XML_numFmt),
+ XML_formatCode, sNumberFormatString.getStr(),
+ XML_sourceLinked, bLinkedNumFmt ? "1" : "0",
+ FSEND);
+
// majorTickMark
sal_Int32 nValue = 0;
if(GetProperty( xAxisProp, "Marks" ) )
@@ -3382,6 +3400,21 @@ bool ChartExport::isDeep3dChart()
return isDeep;
}
+OUString ChartExport::getNumberFormatCode(sal_Int32 nKey) const
+{
+ uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(mxChartModel, uno::UNO_QUERY_THROW);
+ uno::Reference<util::XNumberFormats> xNumberFormats = xNumberFormatsSupplier->getNumberFormats();
+ uno::Reference<beans::XPropertySet> xNumberFormat = xNumberFormats->getByKey(nKey);
+
+ if (!xNumberFormat.is())
+ return OUString();
+
+ uno::Any aAny = xNumberFormat->getPropertyValue("FormatString");
+ OUString aValue;
+ aAny >>= aValue;
+ return aValue;
+}
+
}// drawingml
}// oox