diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2019-04-10 15:49:12 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2019-05-20 10:34:29 +0200 |
commit | f6727831d56afe6360a2489a1bc251990fe26c19 (patch) | |
tree | de5430a13601264817a26aac7013a1f482832e82 /desktop/source | |
parent | c2e30949e0fb7c6a73742450f646e0d8d59d5e4f (diff) |
lok: dragging and resizing chart elements
This patch make possible to set the new position or size of a chart
object through setting directly the property value instead of sending
mouse events to the core.
Change-Id: Ifc06dac6bdad78081d63e0ea0db55563a1ae57bc
Reviewed-on: https://gerrit.libreoffice.org/70566
Tested-by: Jenkins
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/lib/init.cxx | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index f747a5391a77..5710c268fec9 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -991,7 +991,14 @@ void CallbackFlushHandler::queue(const int type, const char* data) } #endif - if (m_bPartTilePainting) + bool bIsChartActive = false; + if (type == LOK_CALLBACK_GRAPHIC_SELECTION) + { + LokChartHelper aChartHelper(SfxViewShell::Current()); + bIsChartActive = aChartHelper.GetWindow() != nullptr; + } + + if (m_bPartTilePainting && !bIsChartActive) { // We drop notifications when this is set, except for important ones. // When we issue a complex command (such as .uno:InsertAnnotation) @@ -3038,13 +3045,20 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma { bool bNeedConversion = false; SfxViewShell* pViewShell = SfxViewShell::Current(); - if (const SdrView* pView = pViewShell->GetDrawView()) + LokChartHelper aChartHelper(pViewShell); + + if (aChartHelper.GetWindow() ) + { + bNeedConversion = true; + } + else if (const SdrView* pView = pViewShell->GetDrawView()) { if (OutputDevice* pOutputDevice = pView->GetFirstOutputDevice()) { bNeedConversion = (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM); } } + if (bNeedConversion) { sal_Int32 value; @@ -3061,8 +3075,35 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma value = OutputDevice::LogicToLogic(value, MapUnit::MapTwip, MapUnit::Map100thMM); rPropValue.Value <<= value; } + } + } + + if (aChartHelper.GetWindow()) + { + tools::Rectangle aChartBB = aChartHelper.GetChartBoundingBox(); + int nLeft = OutputDevice::LogicToLogic(aChartBB.Left(), MapUnit::MapTwip, MapUnit::Map100thMM); + int nTop = OutputDevice::LogicToLogic(aChartBB.Top(), MapUnit::MapTwip, MapUnit::Map100thMM); + sal_Int32 value; + for (beans::PropertyValue& rPropValue: aPropertyValuesVector) + { + if (rPropValue.Name == "TransformPosX" || rPropValue.Name == "TransformRotationX") + { + rPropValue.Value >>= value; + rPropValue.Value <<= value - nLeft; + } + else if (rPropValue.Name == "TransformPosY" || rPropValue.Name == "TransformRotationY") + { + rPropValue.Value >>= value; + rPropValue.Value <<= value - nTop; + } } + + util::URL aCommandURL; + aCommandURL.Path = "LOKTransform"; + css::uno::Reference<css::frame::XDispatch>& aChartDispatcher = aChartHelper.GetXDispatcher(); + aChartDispatcher->dispatch(aCommandURL, comphelper::containerToSequence(aPropertyValuesVector)); + return; } } |