summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odgbin0 -> 9744 bytes
-rw-r--r--sd/qa/unit/misc-tests.cxx26
-rw-r--r--svx/source/engine3d/view3d.cxx16
3 files changed, 34 insertions, 8 deletions
diff --git a/sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg b/sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg
new file mode 100644
index 000000000000..f6cfc96e6b12
--- /dev/null
+++ b/sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg
Binary files differ
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 6871b2d432e3..3e23752aa477 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -81,6 +81,7 @@ public:
void testTdf120527();
void testTdf98839_ShearVFlipH();
void testTdf130988();
+ void testTdf131033();
CPPUNIT_TEST_SUITE(SdMiscTest);
CPPUNIT_TEST(testTdf96206);
@@ -100,6 +101,7 @@ public:
CPPUNIT_TEST(testTdf120527);
CPPUNIT_TEST(testTdf98839_ShearVFlipH);
CPPUNIT_TEST(testTdf130988);
+ CPPUNIT_TEST(testTdf131033);
CPPUNIT_TEST_SUITE_END();
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -828,6 +830,30 @@ void SdMiscTest::testTdf130988()
xDocShRef->DoClose();
}
+void SdMiscTest::testTdf131033()
+{
+ const OUString sURL("sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg");
+ sd::DrawDocShellRef xDocShRef = Load(m_directories.getURLFromSrc(sURL), ODG);
+
+ // The document contains a polygon, so that emulate command .uno:ConvertInto3DLathe
+ // by direct call of ConvertMarkedObjTo3D works.
+ // It produces a rotation around a vertical axis, which is far away from the
+ // generating shape.
+ sd::ViewShell* pViewShell = xDocShRef->GetViewShell();
+ E3dView* pView = dynamic_cast<E3dView*>(pViewShell->GetView());
+ pView->MarkNextObj();
+ pView->ConvertMarkedObjTo3D(false, basegfx::B2DPoint(11000.0, -5000.0), basegfx::B2DPoint(11000.0, -9000.0));
+ E3dScene* pObj = dynamic_cast<E3dScene*>(pView->GetMarkedObjectByIndex(0));
+ CPPUNIT_ASSERT(pObj);
+
+ // Error was, that the 2D representation of the scene did not contain the default 20°
+ // rotation of the new scene around x-axis and therefore was not high enough.
+ const double fSnapRectHeight = pObj->GetSnapRect().getHeight();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("2D height", 7096.0, fSnapRectHeight, 1.0);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index c756c90439c8..77d94ab1c581 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -50,6 +50,7 @@
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <svx/e3dsceneupdater.hxx>
using namespace com::sun::star;
@@ -969,23 +970,22 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1
MarkObj(pScene, pPV);
// Rotate Rotation body around the axis of rotation
- basegfx::B3DHomMatrix aRotate;
-
if(!bExtrude && fRot3D != 0.0)
{
+ basegfx::B3DHomMatrix aRotate;
aRotate.rotate(0.0, 0.0, fRot3D);
+ pScene->SetTransform(aRotate * pScene->GetTransform());
}
// Set default rotation
- aRotate.rotate(DEG2RAD(20.0), 0.0, 0.0);
-
- if(!aRotate.isIdentity())
{
+ basegfx::B3DHomMatrix aRotate;
+ aRotate.rotate(DEG2RAD(20.0), 0.0, 0.0);
+ // E3DModifySceneSnapRectUpdater updates the 2D representation of the scene.
+ // It prepares things in ctor and acts in dtor.
+ E3DModifySceneSnapRectUpdater aUpdater(pScene->getSdrObjectFromSdrObjList());
pScene->SetTransform(aRotate * pScene->GetTransform());
}
-
- // Invalid SnapRects of objects
- pScene->SetSnapRect(aRect);
}
else
{