summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-02-05 18:16:12 +0100
committerMichael Stahl <mstahl@redhat.com>2013-02-05 21:47:05 +0000
commitf5b7e504324f3284ccb118c0006c716685746710 (patch)
treee6aa4072e87deeb77d433ae4c67d2144bae0970b
parente24463c6330b0c11e3ff31c6fd373e3b32e6fc7c (diff)
fdo#58076 import RTF_SHPLEFT/TOP of ESCHER_ShpInst_PictureFrame
(cherry picked from commit bd52275bf311f4ea2f94aec4336deb7ee14a3ba4) Change-Id: Ia655743710778ea7d48a9b2221f22f55a4ccce32 Reviewed-on: https://gerrit.libreoffice.org/2005 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3ef92ac2e1f4..db8a06daa441 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -63,6 +63,7 @@
#include <ooxml/OOXMLFastTokens.hxx> // ooxml namespace
#include <oox/token/namespaces.hxx> // oox namespace
#include <oox/token/tokens.hxx>
+#include <dmapper/GraphicHelpers.hxx>
#include <rtfsdrimport.hxx>
#include <rtftokenizer.hxx>
@@ -72,6 +73,7 @@
#include <rtffly.hxx>
#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+#define MM100_TO_EMU(MM100) (MM100 * 360)
#define M_TOKEN(token) OOX_TOKEN(officeMath, token)
#define OPEN_M_TOKEN( rtftok, ooxtok ) \
case RTF_M##rtftok: \
@@ -807,6 +809,19 @@ int RTFDocumentImpl::resolvePict(bool bInline)
aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue);
if (aAnchorWrapAttributes.size())
aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue);
+
+ // See OOXMLFastContextHandler::positionOffset(), we can't just put values in an RTFValue.
+ 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())));
+ }
+ 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_docPr, pDocprValue);
aAnchorSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue);
// anchor sprm