summaryrefslogtreecommitdiff
path: root/cui/source/tabpages/transfrm.cxx
diff options
context:
space:
mode:
authorMarco Cecchetti <mrcekets@gmail.com>2018-11-29 22:37:45 +0100
committerJan Holesovsky <kendy@collabora.com>2018-12-10 12:40:24 +0100
commite9164b9bc8bd39e02f99cf7c08e38ea0b1e1134a (patch)
tree5f4a3c037b9dc85d49c950ce40c4cf74e5ef77a9 /cui/source/tabpages/transfrm.cxx
parentdd89dc8df8d82ab43f34a0c8fcfa67f93aefcb99 (diff)
lok: shape scaling rework
Now shape scaling is handled through the transform dialog instead of simulating a drag and drop event in core. For Impress the unit used for length is '100th mm' instead of twips, so we need to transform positions and size from twips to '100th mm'. Anyway since we don't know in SetGeoAttrToMarked if the new data is due to a mouse event or by entering a new value in the transormation dialog or in the side pane, for Impress we need to convert the new values sent by the dialogs from '100th mm' to twips which are converted back in SetGeoAttrToMarked. For performing a uniform scaling when the shape/image is rotated we need to inform the client about the rotation angle for the selected graphic object that has been achieved but appending an angle argument to the graphic selection callback. Now it is also possible to reverse shapes/images through negative scaling. Change-Id: I8a32f3e4b28f36e884a59c59b7e1351e85ef4489 Reviewed-on: https://gerrit.libreoffice.org/64696 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'cui/source/tabpages/transfrm.cxx')
-rw-r--r--cui/source/tabpages/transfrm.cxx48
1 files changed, 46 insertions, 2 deletions
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 2b56a7a76ad0..1918f676a15d 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -41,6 +41,7 @@
#include <svl/rectitem.hxx>
#include <svl/aeitem.hxx>
#include <swpossizetabpage.hxx>
+#include <comphelper/lok.hxx>
// static ----------------------------------------------------------------
@@ -83,6 +84,28 @@ const sal_uInt16 SvxSlantTabPage::pSlantRanges[] =
0
};
+namespace {
+
+bool lcl_twipsNeeded(const SdrView* pView)
+{
+ const bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
+ if (bTiledRendering)
+ {
+ // We gets the position in twips
+ if (OutputDevice* pOutputDevice = pView->GetFirstOutputDevice())
+ {
+ if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+} // anonymouus ns
+
+
/*************************************************************************
|*
|* constructor of the tab dialog: adds the pages to the dialog
@@ -252,9 +275,18 @@ bool SvxAngleTabPage::FillItemSet(SfxItemSet* rSet)
const double fTmpX((GetCoreValue(*m_xMtrPosX, ePoolUnit) + maAnchor.getX()) * fUIScale);
const double fTmpY((GetCoreValue(*m_xMtrPosY, ePoolUnit) + maAnchor.getY()) * fUIScale);
+ long nRotateX = basegfx::fround(fTmpX);
+ long nRotateY = basegfx::fround(fTmpY);
+
+ if (lcl_twipsNeeded(pView))
+ {
+ nRotateX = OutputDevice::LogicToLogic(nRotateX, MapUnit::Map100thMM, MapUnit::MapTwip);
+ nRotateY = OutputDevice::LogicToLogic(nRotateY, MapUnit::Map100thMM, MapUnit::MapTwip);
+ }
+
rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ANGLE), m_aCtlAngle.GetRotation()));
- rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), basegfx::fround(fTmpX)));
- rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), basegfx::fround(fTmpY)));
+ rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), nRotateX));
+ rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), nRotateY));
bModified = true;
}
@@ -938,6 +970,12 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
// #101581# GetTopLeftPosition(...) needs coordinates after UI scaling, in real PagePositions
GetTopLeftPosition(fX, fY, maRange);
+ if (lcl_twipsNeeded(mpView))
+ {
+ fX = OutputDevice::LogicToLogic(fX, MapUnit::Map100thMM, MapUnit::MapTwip);
+ fY = OutputDevice::LogicToLogic(fY, MapUnit::Map100thMM, MapUnit::MapTwip);
+ }
+
rOutAttrs->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_X), basegfx::fround(fX)));
rOutAttrs->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_Y), basegfx::fround(fY)));
@@ -977,6 +1015,12 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
lHeight = OutputDevice::LogicToLogic( lHeight, MapUnit::Map100thMM, mePoolUnit );
lHeight = static_cast<long>(m_xMtrHeight->denormalize( lHeight ));
+ if (lcl_twipsNeeded(mpView))
+ {
+ lWidth = OutputDevice::LogicToLogic(lWidth, MapUnit::Map100thMM, MapUnit::MapTwip);
+ lHeight = OutputDevice::LogicToLogic(lHeight, MapUnit::Map100thMM, MapUnit::MapTwip);
+ }
+
// put Width & Height to itemset
rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), static_cast<sal_uInt32>(lWidth) ) );
rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), static_cast<sal_uInt32>(lHeight) ) );