[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Feb 12 06:04:32 UTC 2019


 sw/qa/extras/ooxmlexport/data/tdf116371.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   10 +++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   37 ++++++++++++++++-----------
 3 files changed, 33 insertions(+), 14 deletions(-)

New commits:
commit 641004969ffd053bde90bdd6c4ea629baea8d18e
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Jan 26 17:13:28 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Feb 12 07:04:08 2019 +0100

    tdf#116371: export rotation of SwGrfNode
    
    Change-Id: I42620da798a35dfada67d9a9fb23d554cc20b16f
    Reviewed-on: https://gerrit.libreoffice.org/66963
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/67670
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116371.odt b/sw/qa/extras/ooxmlexport/data/tdf116371.odt
new file mode 100644
index 000000000000..257696616e8c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116371.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 4163921e073f..d5e98bebfde0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -413,6 +413,16 @@ DECLARE_OOXMLEXPORT_TEST(testInputListExport, "tdf122186_input_list.odt")
     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[4]/w:t", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt")
+{
+    // Make sure the rotation is exported correctly, and size not distorted
+    auto xShape(getShape(1));
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(4700.0, getProperty<double>(xShape, "RotateAngle"), 10);
+    auto frameRect = getProperty<awt::Rectangle>(xShape, "FrameRect");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(24070), frameRect.Height);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(24188), frameRect.Width);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 04f491205700..a1629f0d7210 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4602,7 +4602,27 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
         CharGrabBag(*pGrabBag);
     }
 
-    m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, rSize);
+    rtl::Reference<sax_fastparser::FastAttributeList> xFrameAttributes(
+        FastSerializerHelper::createAttrList());
+    Size aSize = rSize;
+    if (pGrfNode)
+    {
+        const SwAttrSet& rSet = pGrfNode->GetSwAttrSet();
+        MirrorGraph eMirror = rSet.GetMirrorGrf().GetValue();
+        if (eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both)
+            // Mirror on the vertical axis is a horizontal flip.
+            xFrameAttributes->add(XML_flipH, "1");
+        // RES_GRFATR_ROTATION is sal_uInt16; use sal_uInt32 for multiplication later
+        if (sal_uInt32 nRot = rSet.GetRotationGrf().GetValue())
+        {
+            // RES_GRFATR_ROTATION is in 10ths of degree; convert to 100ths for macro
+            sal_uInt32 mOOXMLRot = OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRot*10);
+            xFrameAttributes->add(XML_rot, OString::number(mOOXMLRot));
+            aSize = pGrfNode->GetTwipSize();
+        }
+    }
+
+    m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, aSize);
 
     // picture description (used for pic:cNvPr later too)
     ::sax_fastparser::FastAttributeList* docPrattrList = FastSerializerHelper::createAttrList();
@@ -4709,25 +4729,14 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
             XML_bwMode, "auto",
             FSEND );
 
-    rtl::Reference<sax_fastparser::FastAttributeList> xFrameAttributes(
-        FastSerializerHelper::createAttrList());
-
-    if (pGrfNode)
-    {
-        MirrorGraph eMirror = pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue();
-        if (eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both)
-            // Mirror on the vertical axis is a horizontal flip.
-            xFrameAttributes->add(XML_flipH, "1");
-    }
-
     m_pSerializer->startElementNS(
         XML_a, XML_xfrm, uno::Reference<xml::sax::XFastAttributeList>(xFrameAttributes.get()));
 
     m_pSerializer->singleElementNS( XML_a, XML_off,
             XML_x, "0", XML_y, "0",
             FSEND );
-    OString aWidth( OString::number( TwipsToEMU( rSize.Width() ) ) );
-    OString aHeight( OString::number( TwipsToEMU( rSize.Height() ) ) );
+    OString aWidth( OString::number( TwipsToEMU( aSize.Width() ) ) );
+    OString aHeight( OString::number( TwipsToEMU( aSize.Height() ) ) );
     m_pSerializer->singleElementNS( XML_a, XML_ext,
             XML_cx, aWidth.getStr(),
             XML_cy, aHeight.getStr(),


More information about the Libreoffice-commits mailing list