Kaydet (Commit) fb745ece authored tarafından Markus Mohrhard's avatar Markus Mohrhard

export axis number format to OOXML

Change-Id: I1dcea725686f8224bda03913d0b0da9f743a5fb7
üst 7bb87abc
...@@ -181,6 +181,8 @@ private: ...@@ -181,6 +181,8 @@ private:
void exportMissingValueTreatment(com::sun::star::uno::Reference< void exportMissingValueTreatment(com::sun::star::uno::Reference<
com::sun::star::beans::XPropertySet> xPropSet); com::sun::star::beans::XPropertySet> xPropSet);
OUString getNumberFormatCode(sal_Int32 nKey) const;
public: 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 ); 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 );
......
...@@ -2379,6 +2379,24 @@ void ChartExport::_exportAxis( ...@@ -2379,6 +2379,24 @@ void ChartExport::_exportAxis(
if( xAxisTitle.is() ) if( xAxisTitle.is() )
exportTitle( xAxisTitle ); 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 // majorTickMark
sal_Int32 nValue = 0; sal_Int32 nValue = 0;
if(GetProperty( xAxisProp, "Marks" ) ) if(GetProperty( xAxisProp, "Marks" ) )
...@@ -3382,6 +3400,21 @@ bool ChartExport::isDeep3dChart() ...@@ -3382,6 +3400,21 @@ bool ChartExport::isDeep3dChart()
return isDeep; 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 }// drawingml
}// oox }// oox
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment