summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-10-24 13:05:21 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-10-24 13:08:45 +0200
commit5a50bb1701b44c6c765acd80aa38dc13e7ab9eed (patch)
tree2556c5bbeaea6d56c3f83d69142b9648cf098a6b /writerfilter
parent10b12c965d29a91a4fda7b684caaf1ec738daa91 (diff)
writerfilter: implement MeasureHandler::getInteropGrabBag()
This allows e.g. storing a table style's w:tblPr -> w:tblInd -> w:type. Change-Id: I653edc8912ce4e61c703bfffc6e3dcf322295b6f
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/MeasureHandler.cxx35
-rw-r--r--writerfilter/source/dmapper/MeasureHandler.hxx6
-rw-r--r--writerfilter/source/dmapper/TablePropertiesHandler.cxx8
3 files changed, 44 insertions, 5 deletions
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<beans::PropertyValue> aSeq(m_aInteropGrabBag.size());
+ beans::PropertyValue* pSeq = aSeq.getArray();
+ for (std::vector<beans::PropertyValue>::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 <WriterFilterDllApi.hxx>
#include <resourcemodel/LoggedResources.hxx>
#include <boost/shared_ptr.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
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<beans::PropertyValue> 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);