[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

Miklos Vajna vmiklos at suse.cz
Tue Feb 5 13:47:24 PST 2013


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit f5b7e504324f3284ccb118c0006c716685746710
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Feb 5 18:16:12 2013 +0100

    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 at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3ef92ac..db8a06d 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


More information about the Libreoffice-commits mailing list