summaryrefslogtreecommitdiff
path: root/xmloff/source/table/XMLTableExport.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/table/XMLTableExport.cxx')
-rw-r--r--xmloff/source/table/XMLTableExport.cxx48
1 files changed, 46 insertions, 2 deletions
diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx
index 1703542d0cf0..42d482a1c8a5 100644
--- a/xmloff/source/table/XMLTableExport.cxx
+++ b/xmloff/source/table/XMLTableExport.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/table/XColumnRowRange.hpp>
#include <com/sun/star/table/XMergeableCell.hpp>
#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -138,6 +139,23 @@ sal_Int32 StringStatisticHelper::getModeString( OUString& rStyleName )
return nMax;
}
+namespace {
+
+class XMLCellExportPropertyMapper : public SvXMLExportPropertyMapper
+{
+public:
+ using SvXMLExportPropertyMapper::SvXMLExportPropertyMapper;
+ /** this method is called for every item that has the
+ MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
+ virtual void handleSpecialItem(SvXMLAttributeList&, const XMLPropertyState&, const SvXMLUnitConverter&,
+ const SvXMLNamespaceMap&, const std::vector<XMLPropertyState>*, sal_uInt32) const override
+ {
+ // the SpecialItem NumberFormat must not be handled by this method
+ }
+};
+
+}
+
// class XMLTableExport
XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xExportPropertyMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef )
@@ -165,7 +183,7 @@ XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExp
if (mbWriter)
{
- mxCellExportPropertySetMapper = new SvXMLExportPropertyMapper(new XMLTextPropertySetMapper(TextPropMap::CELL, true));
+ mxCellExportPropertySetMapper = new XMLCellExportPropertyMapper(new XMLTextPropertySetMapper(TextPropMap::CELL, true));
}
else
{
@@ -468,7 +486,7 @@ void XMLTableExport::exportTableStyles()
if (mbWriter)
{
sCellStyleName = "CellStyles";
- aStEx.set(new XMLStyleExport(mrExport));
+ aStEx.set(new XMLCellStyleExport(mrExport));
}
else
{
@@ -659,4 +677,30 @@ void XMLTableExport::exportTableTemplates()
}
}
+void XMLCellStyleExport::exportStyleContent(const Reference<XStyle>& /*rStyle*/)
+{
+}
+
+void XMLCellStyleExport::exportStyleAttributes(const Reference<XStyle>& rStyle)
+{
+ Reference<XPropertySet> xPropSet(rStyle, UNO_QUERY);
+ if (xPropSet.is())
+ {
+ Reference<XPropertySetInfo> xPropSetInfo(xPropSet->getPropertySetInfo());
+ const OUString sNumberFormat("NumberFormat");
+ if (xPropSetInfo->hasPropertyByName(sNumberFormat))
+ {
+ Reference<XPropertyState> xPropState(xPropSet, UNO_QUERY);
+ if (xPropState.is() && (PropertyState_DIRECT_VALUE ==
+ xPropState->getPropertyState(sNumberFormat)))
+ {
+ sal_Int32 nNumberFormat = 0;
+ if (xPropSet->getPropertyValue(sNumberFormat) >>= nNumberFormat)
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME,
+ GetExport().getDataStyleName(nNumberFormat));
+ }
+ }
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */