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

Justin Luth justin_luth at sil.org
Sat Jun 30 00:43:30 UTC 2018


 sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt |binary
 sw/qa/extras/ww8export/ww8export2.cxx                      |   12 ++++++++++++
 sw/source/filter/ww8/wrtw8esh.cxx                          |    3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 8d1fecd51fbce7d4bb0013e59589a88f7b29f5db
Author: Justin Luth <justin_luth at sil.org>
Date:   Thu Jun 28 15:48:40 2018 +0300

    tdf#118421 ww8export: rotate vertically: not Lines or groups
    
    Lines and Groups often are exceptions.
    Normally, the import code swaps vertical rotations also. In the case
    of lines (from the tests that I observed) lines don't have a rotation
    value at that point during import, so no correction is made.
    Grouping always messes things up.
    
    Change-Id: I344c5a29f887294b751ffc87c01b30e472cfb4c2
    Reviewed-on: https://gerrit.libreoffice.org/56595
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Tested-by: Justin Luth <justin_luth at sil.org>
    (cherry picked from commit 1cedd88d40a26a55ce433f8b742215aea83a5382)
    Reviewed-on: https://gerrit.libreoffice.org/56655
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>

diff --git a/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt
new file mode 100644
index 000000000000..556f2564c7a2
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index e02b0c15b709..f2c8ffdf3998 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -144,6 +144,18 @@ DECLARE_WW8EXPORT_TEST(testTdf70838, "tdf70838.odt")
     CPPUNIT_ASSERT( aRect.GetHeight() > aRect.GetWidth() );
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf70838b_verticalRotation, "tdf70838b_verticalRotation.odt")
+{
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+    SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+    SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+    Rectangle aGroupShape = pPage->GetObj(0)->GetSnapRect();
+    Rectangle aLine = pPage->GetObj(2)->GetSnapRect();
+
+    CPPUNIT_ASSERT_MESSAGE("Smiley faces are round", aGroupShape.GetHeight() > aGroupShape.GetWidth());
+    CPPUNIT_ASSERT_MESSAGE("Line is taller, not wider", aLine.GetHeight() > aLine.GetWidth());
+}
+
 DECLARE_WW8EXPORT_TEST( testActiveXCheckbox, "checkbox_control.odt" )
 {
     // First check box anchored as a floating object
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 091f5300faae..519c11604425 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -694,7 +694,8 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
 
                     // rotating to vertical means swapping height and width as seen in SvxMSDffManager::ImportShape
                     const long nAngle = NormAngle360( pObj->GetRotateAngle() );
-                    if ( ( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 22500 && nAngle <= 31500 ) )
+                    const bool bAllowSwap = pObj->GetObjIdentifier() != OBJ_LINE && pObj->GetObjIdentifier() != OBJ_GRUP;
+                    if ( bAllowSwap && (( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 22500 && nAngle <= 31500 )) )
                     {
                         const long nWidth  = aRect.getWidth();
                         const long nHeight = aRect.getHeight();


More information about the Libreoffice-commits mailing list