Kaydet (Commit) 5a50bb17 authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: implement MeasureHandler::getInteropGrabBag()

This allows e.g. storing a table style's w:tblPr -> w:tblInd -> w:type.

Change-Id: I653edc8912ce4e61c703bfffc6e3dcf322295b6f
üst 10b12c96
......@@ -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
......
......@@ -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;
......
......@@ -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);
......
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