[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sw/CppunitTest_sw_ww8export2.mk sw/qa sw/source
Victor Mireyev
victor at opennodecloud.com
Fri Jul 6 18:24:18 UTC 2018
sw/CppunitTest_sw_ww8export2.mk | 1 +
sw/qa/extras/ww8export/data/tdf70838.odt |binary
sw/qa/extras/ww8export/ww8export2.cxx | 11 +++++++++++
sw/source/filter/ww8/wrtw8esh.cxx | 10 ++++++++++
4 files changed, 22 insertions(+)
New commits:
commit 092a74cc8f74115e6978d76cbac7f126231a2f27
Author: Victor Mireyev <victor at opennodecloud.com>
Date: Sat Jun 2 16:08:59 2018 +0300
tdf#70838 ww8export: rotate shape vertically = swap width/height
During import, rotation past 45 degrees swaps height and width
in SvxMSDffManager::ImportShape, so exporting needs to do the same.
restored from abandonment and corrected by Justin
Import also adjusts TopLeft position, but position seems to
generally be set by other factors on export. Prefer to have
an example proof document and not just guess since it seems
that position is affected by many factors. Therefore, not
doing anything about the position in this commit.
Change-Id: I4d67ab0e0da296956190aed3468e0c98f29795b9
Reviewed-on: https://gerrit.libreoffice.org/53902
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: Justin Luth <justin_luth at sil.org>
Tested-by: Jenkins
(cherry picked from commit c14911a80e3b6e66439b1d569e7cd558c6010864)
Reviewed-on: https://gerrit.libreoffice.org/56858
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: Aron Budea <aron.budea at collabora.com>
diff --git a/sw/CppunitTest_sw_ww8export2.mk b/sw/CppunitTest_sw_ww8export2.mk
index 85f346d4881a..e1d3e194087e 100644
--- a/sw/CppunitTest_sw_ww8export2.mk
+++ b/sw/CppunitTest_sw_ww8export2.mk
@@ -28,6 +28,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8export2, \
utl \
sw \
tl \
+ svxcore \
))
$(eval $(call gb_CppunitTest_use_externals,sw_ww8export2,\
diff --git a/sw/qa/extras/ww8export/data/tdf70838.odt b/sw/qa/extras/ww8export/data/tdf70838.odt
new file mode 100644
index 000000000000..65d20ecb65f5
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf70838.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 0695c309951b..f7cf692a4860 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -25,6 +25,8 @@
#include <ftninfo.hxx>
#include <pagedesc.hxx>
+#include <svx/svdpage.hxx>
+#include <drawdoc.hxx>
#include <editeng/unoprnms.hxx>
class Test : public SwModelTestBase
@@ -291,6 +293,15 @@ DECLARE_WW8EXPORT_TEST(testTdf111480, "tdf111480.doc")
CPPUNIT_ASSERT(xText->getSize().Width > 11000);
}
+DECLARE_WW8EXPORT_TEST(testTdf70838, "tdf70838.odt")
+{
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+ SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ tools::Rectangle aRect = pPage->GetObj(0)->GetSnapRect();
+ CPPUNIT_ASSERT( aRect.GetHeight() > aRect.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 5b9bd76c471b..dd74436c6bf6 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -688,6 +688,16 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
if (pObj)
{
aRect = pObj->GetLogicRect();
+
+ // 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 long nWidth = aRect.getWidth();
+ const long nHeight = aRect.getHeight();
+ aRect.setWidth( nHeight );
+ aRect.setHeight( nWidth );
+ }
}
}
More information about the Libreoffice-commits
mailing list