summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2019-04-10 21:04:51 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2019-05-20 10:34:48 +0200
commite9e57c61a747f0f5859b579ff4f2bcaa53eacd79 (patch)
treea5b7e35f877db21308806ac030edd4a92dbbcd71 /svx
parentf6727831d56afe6360a2489a1bc251990fe26c19 (diff)
lok: chart: informing the client about selection handling properties
We hijack the chart CID protocol (CID:/classification/ObjectID) by inserting information about selection handling properties (draggable, resizable, rotatable) btw the classification section and the ObjectID section. This new section has the form: /Draggable=?:Resizable=?:Rotatable=? where in place of '?' there is 0 or 1. The hijacking occurs at the ChartController.getSelection method which is available through the XSelectionSupplier interface. Change-Id: Iaf920fe68e59c2595000e43d3fc1f976632cef18 Reviewed-on: https://gerrit.libreoffice.org/70567 Tested-by: Jenkins Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdmrkv.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 3bbf3b4a72ed..8a41e521d480 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -30,6 +30,7 @@
#include <svdibrow.hxx>
#endif
+#include <osl/thread.h>
#include <svx/svdoole2.hxx>
#include <svx/xgrad.hxx>
#include <svx/xflgrit.hxx>
@@ -56,8 +57,11 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
#include <sfx2/lokhelper.hxx>
+#include <sfx2/lokcharthelper.hxx>
#include <sfx2/viewsh.hxx>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
using namespace com::sun::star;
// Migrate Marking of Objects, Points and GluePoints
@@ -734,6 +738,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
tools::Rectangle aRect(GetMarkedObjRect());
tools::Rectangle aSelection(aRect);
+ bool bIsChart = false;
if (bTiledRendering && !aRect.IsEmpty())
{
sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
@@ -742,6 +747,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
if (pWin && pWin->IsChart())
{
+ bIsChart = true;
const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
{
@@ -799,6 +805,34 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
{
sProperties = "{ WriterGraphic=true }";
}
+ else if (bIsChart)
+ {
+ LokChartHelper aChartHelper(pViewShell);
+ css::uno::Reference<css::frame::XController>& xChartController = aChartHelper.GetXController();
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier( xChartController, uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ {
+ uno::Any aSel = xSelectionSupplier->getSelection();
+ OUString aValue;
+ if (aSel >>= aValue)
+ {
+ OString aObjectCID(aValue.getStr(), aValue.getLength(), osl_getThreadTextEncoding());
+ sProperties += "{ ";
+ const std::vector<OString> aProps{"Draggable=", "Resizable=", "Rotatable="};
+ for (const auto& rProp: aProps)
+ {
+ sal_Int32 nPos = aObjectCID.indexOf(rProp);
+ if (nPos == -1) continue;
+ nPos += rProp.getLength();
+ if (sProperties.getLength() > 2)
+ sProperties += ", ";
+ sProperties += rProp;
+ sProperties += OString::boolean(aObjectCID[nPos] == '1');
+ }
+ sProperties += " }";
+ }
+ }
+ }
if (!sProperties.isEmpty())
{