summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-08-15 10:40:35 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-08-15 17:09:11 +0200
commit26d9efd36a16d2095d8fb885290c6816082ec814 (patch)
treefb5dd9394bd1e96e974dd91b0d4951d2492de7ab /writerfilter
parent69fd51d606619d90f291059b1cd82ec65a2c91e5 (diff)
DOCX import: handle w:leftFromText and w:rightFromText for floating tables
Left margin wasn't implemented, that's simple. Right margin of the table was set to the cell margin in commit 53d27a30ce5f2c9f7d37a4089286116854c16215, which turns out to be wrong: it's true that the right margin should be >0, but not because of the cell margin but because of the table margin. The new behavior matches what the binary import always did. Change-Id: Ifc24e4f086c49d5d575defdfca1d27e497fa03dc
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/TablePositionHandler.cxx20
-rw-r--r--writerfilter/source/dmapper/TablePositionHandler.hxx3
-rw-r--r--writerfilter/source/ooxml/model.xml6
3 files changed, 18 insertions, 11 deletions
diff --git a/writerfilter/source/dmapper/TablePositionHandler.cxx b/writerfilter/source/dmapper/TablePositionHandler.cxx
index 19613a0d6489..1ecf6c6d9344 100644
--- a/writerfilter/source/dmapper/TablePositionHandler.cxx
+++ b/writerfilter/source/dmapper/TablePositionHandler.cxx
@@ -30,10 +30,11 @@ TablePositionHandler::TablePositionHandler() :
m_aXSpec( ),
m_nY( 0 ),
m_nX( 0 ),
+ m_nLeftFromText(0),
+ m_nRightFromText(0),
m_nTopFromText(0),
m_nBottomFromText(0),
- m_nLeftBorderDistance(DEF_BORDER_DIST),
- m_nRightBorderDistance(DEF_BORDER_DIST)
+ m_nLeftBorderDistance(DEF_BORDER_DIST)
{
}
@@ -64,6 +65,12 @@ void TablePositionHandler::lcl_attribute(Id rName, Value& rVal)
case NS_ooxml::LN_CT_TblPPr_tblpX:
m_nX = rVal.getInt();
break;
+ case NS_ooxml::LN_CT_TblPPr_leftFromText:
+ m_nLeftFromText = rVal.getInt();
+ break;
+ case NS_ooxml::LN_CT_TblPPr_rightFromText:
+ m_nRightFromText = rVal.getInt();
+ break;
case NS_ooxml::LN_CT_TblPPr_topFromText:
m_nTopFromText = rVal.getInt();
break;
@@ -86,7 +93,7 @@ void TablePositionHandler::lcl_sprm(Sprm& /*rSprm*/)
uno::Sequence<beans::PropertyValue> TablePositionHandler::getTablePosition() const
{
- uno::Sequence< beans::PropertyValue > aFrameProperties(19);
+ uno::Sequence< beans::PropertyValue > aFrameProperties(18);
beans::PropertyValue* pFrameProperties = aFrameProperties.getArray();
pFrameProperties[0].Name = "LeftBorderDistance";
@@ -99,9 +106,9 @@ uno::Sequence<beans::PropertyValue> TablePositionHandler::getTablePosition() con
pFrameProperties[3].Value <<= sal_Int32(0);
pFrameProperties[4].Name = "LeftMargin";
- pFrameProperties[4].Value <<= sal_Int32(0);
+ pFrameProperties[4].Value <<= ConversionHelper::convertTwipToMM100(m_nLeftFromText);
pFrameProperties[5].Name = "RightMargin";
- pFrameProperties[5].Value <<= sal_Int32(0);
+ pFrameProperties[5].Value <<= ConversionHelper::convertTwipToMM100(m_nRightFromText);
pFrameProperties[6].Name = "TopMargin";
pFrameProperties[6].Value <<= ConversionHelper::convertTwipToMM100(m_nTopFromText);
pFrameProperties[7].Name = "BottomMargin";
@@ -172,9 +179,6 @@ uno::Sequence<beans::PropertyValue> TablePositionHandler::getTablePosition() con
pFrameProperties[17].Name = "VertOrientPosition";
pFrameProperties[17].Value <<= m_nY;
- pFrameProperties[18].Name = "RightMargin";
- pFrameProperties[18].Value <<= m_nRightBorderDistance;
-
return aFrameProperties;
}
diff --git a/writerfilter/source/dmapper/TablePositionHandler.hxx b/writerfilter/source/dmapper/TablePositionHandler.hxx
index 366a6e438303..d68800c51e9a 100644
--- a/writerfilter/source/dmapper/TablePositionHandler.hxx
+++ b/writerfilter/source/dmapper/TablePositionHandler.hxx
@@ -27,10 +27,11 @@ namespace writerfilter {
OUString m_aXSpec;
sal_Int32 m_nY;
sal_Int32 m_nX;
+ sal_Int32 m_nLeftFromText;
+ sal_Int32 m_nRightFromText;
sal_Int32 m_nTopFromText;
sal_Int32 m_nBottomFromText;
sal_Int32 m_nLeftBorderDistance;
- sal_Int32 m_nRightBorderDistance;
// Properties
virtual void lcl_attribute(Id Name, Value & val);
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 402323fc1ff6..ea8f082c4d9c 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -17985,11 +17985,11 @@
</define>
<define name="CT_TblPPr">
<attribute name="leftFromText">
- <text/>
+ <ref name="ST_SignedTwipsMeasure"/>
<xs:documentation>Distance From Left of Table to Text</xs:documentation>
</attribute>
<attribute name="rightFromText">
- <text/>
+ <ref name="ST_SignedTwipsMeasure"/>
<xs:documentation>(Distance From Right of Table to Text</xs:documentation>
</attribute>
<attribute name="topFromText">
@@ -22913,6 +22913,8 @@
<attribute name="tblpXSpec" tokenid="ooxml:CT_TblPPr_tblpXSpec"/>
<attribute name="tblpY" tokenid="ooxml:CT_TblPPr_tblpY"/>
<attribute name="tblpX" tokenid="ooxml:CT_TblPPr_tblpX"/>
+ <attribute name="leftFromText" tokenid="ooxml:CT_TblPPr_leftFromText"/>
+ <attribute name="rightFromText" tokenid="ooxml:CT_TblPPr_rightFromText"/>
<attribute name="topFromText" tokenid="ooxml:CT_TblPPr_topFromText"/>
<attribute name="bottomFromText" tokenid="ooxml:CT_TblPPr_bottomFromText"/>
</resource>