summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2019-04-10 21:04:51 +0200
committerMichael Meeks <michael.meeks@collabora.com>2019-08-05 21:06:49 -0400
commit3d705b98ca7f40a44f632f5565407274322ffde3 (patch)
treee753ddef2f9b7705e40702e01a0c772ffd395bbe /chart2
parent76f7424bf53858739af65e1d89e93a24673e11bf (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')
-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
-rw-r--r--chart2/source/inc/ObjectIdentifier.hxx4
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx4
7 files changed, 42 insertions, 10 deletions
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index 19500d034afa..22469e396480 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -319,6 +319,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 625c41c9617f..b1d26f3425ab 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -571,6 +571,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 8a4d92b95c6b..1d058138aa49 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1669,6 +1669,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 7a7f08c58f3b..a0171bf04706 100644
--- a/chart2/source/controller/main/SelectionHelper.cxx
+++ b/chart2/source/controller/main/SelectionHelper.cxx
@@ -288,7 +288,7 @@ void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper
}
}
-bool Selection::isResizeableObjectSelected()
+bool Selection::isResizeableObjectSelected() const
{
ObjectType eObjectType = m_aSelectedOID.getObjectType();
switch( eObjectType )
@@ -303,12 +303,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();
}
diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx
index 79fb15232c81..87fb5723e3fc 100644
--- a/chart2/source/inc/ObjectIdentifier.hxx
+++ b/chart2/source/inc/ObjectIdentifier.hxx
@@ -164,7 +164,7 @@ public:
static OUString getDragMethodServiceName( const OUString& rClassifiedIdentifier );
static OUString getDragParameterString( const OUString& rCID );
static bool isDragableObject( const OUString& rClassifiedIdentifier );
- bool isDragableObject();
+ bool isDragableObject() const;
static bool isRotateableObject( const OUString& rClassifiedIdentifier );
static bool isMultiClickObject( const OUString& rClassifiedIdentifier );
static bool areSiblings( const OUString& rCID1, const OUString& rCID2 );//identical object is no sibling
@@ -172,7 +172,7 @@ public:
static OUString getStringForType( ObjectType eObjectType );
static ObjectType getObjectType( const OUString& rCID );
- ObjectType getObjectType();
+ ObjectType getObjectType() const;
static OUString createSeriesSubObjectStub( ObjectType eSubObjectType
, const OUString& rSeriesParticle
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index 98e61ba1c60c..a6c6530b0886 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -818,7 +818,7 @@ bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier )
return bReturn;
}
-bool ObjectIdentifier::isDragableObject()
+bool ObjectIdentifier::isDragableObject() const
{
bool bReturn = false;
if ( isAutoGeneratedObject() )
@@ -1063,7 +1063,7 @@ ObjectType ObjectIdentifier::getObjectType( const OUString& rCID )
return eRet;
}
-ObjectType ObjectIdentifier::getObjectType()
+ObjectType ObjectIdentifier::getObjectType() const
{
ObjectType eObjectType( OBJECTTYPE_UNKNOWN );
if ( isAutoGeneratedObject() )