summaryrefslogtreecommitdiff
path: root/chart2/source/controller
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 /chart2/source/controller
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 'chart2/source/controller')
-rw-r--r--chart2/source/controller/inc/ChartController.hxx4
-rw-r--r--chart2/source/controller/inc/SelectionHelper.hxx6
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx17
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx11
-rw-r--r--chart2/source/controller/main/SelectionHelper.cxx6
5 files changed, 38 insertions, 6 deletions
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index a14224e24c73..98225c96dd49 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -320,6 +320,10 @@ public:
static bool isObjectDeleteable( const css::uno::Any& rSelection );
+ bool isSelectedObjectDraggable() const;
+ bool isSelectedObjectResizable() const;
+ bool isSelectedObjectRotatable() const;
+
void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; }
bool isShapeContext() const;
diff --git a/chart2/source/controller/inc/SelectionHelper.hxx b/chart2/source/controller/inc/SelectionHelper.hxx
index b9fe3fc20377..19a40c9a5af2 100644
--- a/chart2/source/controller/inc/SelectionHelper.hxx
+++ b/chart2/source/controller/inc/SelectionHelper.hxx
@@ -38,9 +38,9 @@ public: //methods
css::uno::Reference< css::drawing::XShape > const & getSelectedAdditionalShape();
const ObjectIdentifier& getSelectedOID() const { return m_aSelectedOID;}
- bool isResizeableObjectSelected();
- bool isRotateableObjectSelected( const css::uno::Reference< css::frame::XModel >& xChartModel );
- bool isDragableObjectSelected();
+ bool isResizeableObjectSelected() const;
+ bool isRotateableObjectSelected( const css::uno::Reference< css::frame::XModel >& xChartModel ) const;
+ bool isDragableObjectSelected() const;
bool isAdditionalShapeSelected() const;
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index c55d0a004134..799b4b6b48f7 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -565,6 +565,23 @@ bool ChartController::isObjectDeleteable( const uno::Any& rSelection )
return false;
}
+bool ChartController::isSelectedObjectDraggable() const
+{
+ return m_aSelection.isDragableObjectSelected();
+}
+
+bool ChartController::isSelectedObjectResizable() const
+{
+ return m_aSelection.isResizeableObjectSelected();
+}
+
+bool ChartController::isSelectedObjectRotatable() const
+{
+ const ChartController* pThis = this;
+ const uno::Reference< frame::XModel >& xChartModel = const_cast<ChartController*>(pThis)->getModel();
+ return m_aSelection.isRotateableObjectSelected(xChartModel);
+}
+
bool ChartController::isShapeContext() const
{
return m_aSelection.isAdditionalShapeSelected() ||
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index c928be0e3a17..8907ed5ca203 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1670,6 +1670,17 @@ uno::Any SAL_CALL ChartController::getSelection()
OUString aCID( m_aSelection.getSelectedCID() );
if ( !aCID.isEmpty() )
{
+ if ( comphelper::LibreOfficeKit::isActive() )
+ {
+ sal_Int32 nPos = aCID.lastIndexOf('/');
+ OUString sFirst = aCID.copy(0, nPos);
+ OUString sSecond = aCID.copy(nPos);
+ aCID = sFirst;
+ aCID += "/Draggable=" + OUString::number(static_cast<int>(isSelectedObjectDraggable()));
+ aCID += ":Resizable=" + OUString::number(static_cast<int>(isSelectedObjectResizable()));
+ aCID += ":Rotatable=" + OUString::number(static_cast<int>(isSelectedObjectRotatable()));
+ aCID += sSecond;
+ }
aReturn <<= aCID;
}
else
diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx
index 11370bb480a7..e950f292d238 100644
--- a/chart2/source/controller/main/SelectionHelper.cxx
+++ b/chart2/source/controller/main/SelectionHelper.cxx
@@ -286,7 +286,7 @@ void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper
}
}
-bool Selection::isResizeableObjectSelected()
+bool Selection::isResizeableObjectSelected() const
{
ObjectType eObjectType = m_aSelectedOID.getObjectType();
switch( eObjectType )
@@ -301,12 +301,12 @@ bool Selection::isResizeableObjectSelected()
}
}
-bool Selection::isRotateableObjectSelected( const uno::Reference< frame::XModel >& xChartModel )
+bool Selection::isRotateableObjectSelected( const uno::Reference< frame::XModel >& xChartModel ) const
{
return SelectionHelper::isRotateableObject( m_aSelectedOID.getObjectCID(), xChartModel );
}
-bool Selection::isDragableObjectSelected()
+bool Selection::isDragableObjectSelected() const
{
return m_aSelectedOID.isDragableObject();
}