summaryrefslogtreecommitdiff
path: root/oox/source/export/chartexport.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/export/chartexport.cxx')
-rw-r--r--oox/source/export/chartexport.cxx29
1 files changed, 21 insertions, 8 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 2f0853b935a3..0889275c8443 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -89,6 +89,10 @@
#include <comphelper/random.hxx>
#include <xmloff/SchXMLSeriesHelper.hxx>
#include "ColorPropertySet.hxx"
+
+#include <svl/zforlist.hxx>
+#include <svl/numuno.hxx>
+
#include <set>
#include <unordered_set>
@@ -3747,17 +3751,26 @@ bool ChartExport::isDeep3dChart()
OUString ChartExport::getNumberFormatCode(sal_Int32 nKey) const
{
+ /* XXX if this was called more than one or two times per export the two
+ * SvNumberFormatter instances and NfKeywordTable should be member
+ * variables and initialized only once. */
+
+ OUString aCode("General"); // init with fallback
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);
+ SvNumberFormatsSupplierObj* pSupplierObj = SvNumberFormatsSupplierObj::getImplementation( xNumberFormatsSupplier);
+ if (!pSupplierObj)
+ return aCode;
+
+ SvNumberFormatter* pNumberFormatter = pSupplierObj->GetNumberFormatter();
+ if (!pNumberFormatter)
+ return aCode;
- if (!xNumberFormat.is())
- return OUString();
+ SvNumberFormatter aTempFormatter( comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US);
+ NfKeywordTable aKeywords;
+ aTempFormatter.FillKeywordTableForExcel( aKeywords);
+ aCode = pNumberFormatter->GetFormatStringForExcel( nKey, aKeywords, aTempFormatter);
- uno::Any aAny = xNumberFormat->getPropertyValue("FormatString");
- OUString aValue;
- aAny >>= aValue;
- return aValue;
+ return aCode;
}
}// drawingml