From 5a50bb1701b44c6c765acd80aa38dc13e7ab9eed Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 24 Oct 2013 13:05:21 +0200 Subject: writerfilter: implement MeasureHandler::getInteropGrabBag() This allows e.g. storing a table style's w:tblPr -> w:tblInd -> w:type. Change-Id: I653edc8912ce4e61c703bfffc6e3dcf322295b6f --- writerfilter/source/dmapper/MeasureHandler.cxx | 35 ++++++++++++++++++++++ writerfilter/source/dmapper/MeasureHandler.hxx | 6 ++++ .../source/dmapper/TablePropertiesHandler.cxx | 8 ++--- 3 files changed, 44 insertions(+), 5 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/dmapper/MeasureHandler.cxx b/writerfilter/source/dmapper/MeasureHandler.cxx index 783ebdcc0de1..57ffec52cc3a 100644 --- a/writerfilter/source/dmapper/MeasureHandler.cxx +++ b/writerfilter/source/dmapper/MeasureHandler.cxx @@ -53,9 +53,25 @@ void MeasureHandler::lcl_attribute(Id rName, Value & rVal) { case NS_rtf::LN_unit: case NS_ooxml::LN_CT_TblWidth_type:// = 90668; + { //can be: NS_ooxml::LN_Value_ST_TblWidth_nil, NS_ooxml::LN_Value_ST_TblWidth_pct, // NS_ooxml::LN_Value_ST_TblWidth_dxa, NS_ooxml::LN_Value_ST_TblWidth_auto; m_nUnit = nIntValue; + + if (!m_aInteropGrabBagName.isEmpty()) + { + beans::PropertyValue aValue; + aValue.Name = "type"; + switch (nIntValue) + { + case NS_ooxml::LN_Value_ST_TblWidth_nil: aValue.Value = uno::makeAny(OUString("nil")); break; + case NS_ooxml::LN_Value_ST_TblWidth_pct: aValue.Value = uno::makeAny(OUString("pct")); break; + case NS_ooxml::LN_Value_ST_TblWidth_dxa: aValue.Value = uno::makeAny(OUString("dxa")); break; + case NS_ooxml::LN_Value_ST_TblWidth_auto: aValue.Value = uno::makeAny(OUString("auto")); break; + } + m_aInteropGrabBag.push_back(aValue); + } + } break; case NS_ooxml::LN_CT_Height_hRule: // 90666; { @@ -105,6 +121,25 @@ sal_Int32 MeasureHandler::getMeasureValue() const return nRet; } +void MeasureHandler::enableInteropGrabBag(OUString aName) +{ + m_aInteropGrabBagName = aName; +} + +beans::PropertyValue MeasureHandler::getInteropGrabBag() +{ + beans::PropertyValue aRet; + aRet.Name = m_aInteropGrabBagName; + + uno::Sequence aSeq(m_aInteropGrabBag.size()); + beans::PropertyValue* pSeq = aSeq.getArray(); + for (std::vector::iterator i = m_aInteropGrabBag.begin(); i != m_aInteropGrabBag.end(); ++i) + *pSeq++ = *i; + + aRet.Value = uno::makeAny(aSeq); + return aRet; +} + } //namespace dmapper } //namespace writerfilter diff --git a/writerfilter/source/dmapper/MeasureHandler.hxx b/writerfilter/source/dmapper/MeasureHandler.hxx index 01556145c332..b1e7c57a0edd 100644 --- a/writerfilter/source/dmapper/MeasureHandler.hxx +++ b/writerfilter/source/dmapper/MeasureHandler.hxx @@ -22,6 +22,7 @@ #include #include #include +#include namespace writerfilter { namespace dmapper @@ -36,6 +37,9 @@ class WRITERFILTER_DLLPRIVATE MeasureHandler : public LoggedProperties sal_Int32 m_nUnit; sal_Int16 m_nRowHeightSizeType; //table row height type + OUString m_aInteropGrabBagName; + std::vector m_aInteropGrabBag; + // Properties virtual void lcl_attribute(Id Name, Value & val); virtual void lcl_sprm(Sprm & sprm); @@ -50,6 +54,8 @@ public: sal_Int32 getUnit() const { return m_nUnit; } sal_Int16 GetRowHeightSizeType() const { return m_nRowHeightSizeType;} + void enableInteropGrabBag(OUString aName); + beans::PropertyValue getInteropGrabBag(); }; typedef boost::shared_ptr < MeasureHandler > MeasureHandlerPtr; diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx index 9168fa6e1e3e..cf3a15a8f888 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx @@ -262,13 +262,11 @@ namespace dmapper { if (pProperties.get()) { MeasureHandlerPtr pHandler(new MeasureHandler); + if (m_pCurrentInteropGrabBag) + pHandler->enableInteropGrabBag("tblInd"); pProperties->resolve( *pHandler ); if (m_pCurrentInteropGrabBag) - { - beans::PropertyValue aValue; - aValue.Name = "tblInd"; - m_pCurrentInteropGrabBag->push_back(aValue); - } + m_pCurrentInteropGrabBag->push_back(pHandler->getInteropGrabBag()); TablePropertyMapPtr pTblIndMap(new TablePropertyMap); sal_uInt32 nTblInd = pHandler->getMeasureValue(); pTblIndMap->setValue( TablePropertyMap::LEFT_MARGIN, nTblInd); -- cgit