diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2019-04-10 21:04:51 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2019-05-20 10:34:48 +0200 |
commit | e9e57c61a747f0f5859b579ff4f2bcaa53eacd79 (patch) | |
tree | a5b7e35f877db21308806ac030edd4a92dbbcd71 /chart2/source | |
parent | f6727831d56afe6360a2489a1bc251990fe26c19 (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')
-rw-r--r-- | chart2/source/controller/inc/ChartController.hxx | 4 | ||||
-rw-r--r-- | chart2/source/controller/inc/SelectionHelper.hxx | 6 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Tools.cxx | 17 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 11 | ||||
-rw-r--r-- | chart2/source/controller/main/SelectionHelper.cxx | 6 | ||||
-rw-r--r-- | chart2/source/inc/ObjectIdentifier.hxx | 4 | ||||
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 4 |
7 files changed, 42 insertions, 10 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(); } 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 40c7380d3c23..0b29437546dd 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -811,7 +811,7 @@ bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier ) return bReturn; } -bool ObjectIdentifier::isDragableObject() +bool ObjectIdentifier::isDragableObject() const { bool bReturn = false; if ( isAutoGeneratedObject() ) @@ -1056,7 +1056,7 @@ ObjectType ObjectIdentifier::getObjectType( const OUString& rCID ) return eRet; } -ObjectType ObjectIdentifier::getObjectType() +ObjectType ObjectIdentifier::getObjectType() const { ObjectType eObjectType( OBJECTTYPE_UNKNOWN ); if ( isAutoGeneratedObject() ) |