summaryrefslogtreecommitdiff
path: root/desktop/source/lib
diff options
context:
space:
mode:
authorMarco Cecchetti <mrcekets@gmail.com>2019-03-11 16:31:20 +0100
committerJan Holesovsky <kendy@collabora.com>2019-04-30 12:05:50 +0200
commit05157f967b23a7b35e988d7fe136e8869feaeb35 (patch)
tree9d0c0522a201a4c17388cfdbb8ab02110c2d4444 /desktop/source/lib
parent3fb298f673db169a38c1258d66ec24821386eb40 (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
Diffstat (limited to 'desktop/source/lib')
-rw-r--r--desktop/source/lib/init.cxx45
1 files changed, 43 insertions, 2 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8c4fdb7b4494..3443fe4d4b9c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -963,7 +963,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)
@@ -3059,13 +3066,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;
@@ -3082,8 +3096,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;
}
}