Kaydet (Commit) c14911a8 authored tarafından Victor Mireyev's avatar Victor Mireyev Kaydeden (comit) Justin Luth

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/53902Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Tested-by: Jenkins
üst 2c856071
......@@ -28,6 +28,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8export2, \
utl \
sw \
tl \
svxcore \
))
$(eval $(call gb_CppunitTest_use_externals,sw_ww8export2,\
......
......@@ -26,6 +26,8 @@
#include <ftninfo.hxx>
#include <pagedesc.hxx>
#include <svx/svdpage.hxx>
#include <drawdoc.hxx>
#include <editeng/unoprnms.hxx>
class Test : public SwModelTestBase
......@@ -303,6 +305,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
......
......@@ -689,6 +689,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 );
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment