summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-08-06 16:31:29 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-08-06 16:57:26 +0200
commitb755df14a431543f1b70246a5e58830a0a480602 (patch)
treec774c6d693e259763857e0b7651ff168ddf2ccb5 /writerfilter
parent7b4bdab8252200e89a05294bdcdebef2ab9feb81 (diff)
fdo#47440 import RTF_SHPBX/YPAGE for Writer pictures, too
Previously this was only handled for drawinglayer shapes. Change-Id: I7ce440a27ebe44fc867b8a7f4ee62217076677f0
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx21
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx6
2 files changed, 18 insertions, 9 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1ca8f179909d..49fe9649a718 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -836,17 +836,20 @@ int RTFDocumentImpl::resolvePict(bool bInline)
if (aAnchorWrapAttributes.size())
aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue);
- // See OOXMLFastContextHandler::positionOffset(), we can't just put values in an RTFValue.
+ // See OOXMLFastContextHandler::positionOffset(), we can't just put offset values in an RTFValue.
+ RTFSprms aPoshSprms;
+ if (m_aStates.top().aShape.nHoriOrientRelationToken > 0)
+ aPoshSprms.set(NS_ooxml::LN_CT_PosH_relativeFrom, RTFValue::Pointer_t(new RTFValue(m_aStates.top().aShape.nHoriOrientRelationToken)));
if (m_aStates.top().aShape.nLeft > 0)
- {
writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nLeft)), false);
- aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, RTFValue::Pointer_t(new RTFValue(RTFSprms())));
- }
+ aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, RTFValue::Pointer_t(new RTFValue(aPoshSprms)));
+
+ RTFSprms aPosvSprms;
+ if (m_aStates.top().aShape.nVertOrientRelationToken > 0)
+ aPosvSprms.set(NS_ooxml::LN_CT_PosV_relativeFrom, RTFValue::Pointer_t(new RTFValue(m_aStates.top().aShape.nVertOrientRelationToken)));
if (m_aStates.top().aShape.nTop > 0)
- {
writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nTop)), true);
- aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, RTFValue::Pointer_t(new RTFValue(RTFSprms())));
- }
+ aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, RTFValue::Pointer_t(new RTFValue(aPosvSprms)));
aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue);
aAnchorSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue);
@@ -2684,9 +2687,11 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
break;
case RTF_SHPBXPAGE:
m_aStates.top().aShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME;
+ m_aStates.top().aShape.nHoriOrientRelationToken = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page;
break;
case RTF_SHPBYPAGE:
m_aStates.top().aShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME;
+ m_aStates.top().aShape.nVertOrientRelationToken = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page;
break;
case RTF_DPLINEHOLLOW:
m_aStates.top().aDrawingObject.nFLine = 0;
@@ -4855,6 +4860,8 @@ RTFShape::RTFShape()
nBottom(0),
nHoriOrientRelation(0),
nVertOrientRelation(0),
+ nHoriOrientRelationToken(0),
+ nVertOrientRelationToken(0),
nWrap(-1)
{
}
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 86b6912f4df3..0f5e9d8ed059 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -100,8 +100,10 @@ namespace writerfilter {
sal_Int32 nRight;
sal_Int32 nBottom;
boost::optional<sal_Int32> oZ; ///< Z-Order of the shape.
- sal_Int16 nHoriOrientRelation;
- sal_Int16 nVertOrientRelation;
+ sal_Int16 nHoriOrientRelation; ///< Horizontal text::RelOrientation for drawinglayer shapes.
+ sal_Int16 nVertOrientRelation; ///< Vertical text::RelOrientation for drawinglayer shapes.
+ sal_uInt32 nHoriOrientRelationToken; ///< Horizontal dmapper token for Writer pictures.
+ sal_uInt32 nVertOrientRelationToken; ///< Vertical dmapper token for Writer pictures.
int nWrap;
};