summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorMarco Cecchetti <mrcekets@gmail.com>2019-03-26 13:17:08 +0100
committerMarco Cecchetti <mrcekets@gmail.com>2019-05-20 10:35:49 +0200
commit4a7a37f942b932eb14cd0c5e9e72669f3a04e6a4 (patch)
treeac8a23d703f20583a2c3ef3db1f39c08db40ed64 /chart2/source
parente9e57c61a747f0f5859b579ff4f2bcaa53eacd79 (diff)
lok: chart: constrained dragging of pie segments
The extra information for the graphic selection is now formatted according to JSON syntax so that is easier to parse. Information for allowing the client to performa constrained dragging of a pie segment is appended when needed to the graphic selection message. A polygon approximation of the pie segment in svg format is attached too to the graphic selection message. Core now is able to handle a specific msg from the client with data about the new pie segment offset computed by the client on drag end. This information is dispatched by the chart controller to a specific method: executeDispatch_LOKPieSegmentDragging. Change-Id: I42e7742508fa3a453383bf7b95e47df169f24834 Reviewed-on: https://gerrit.libreoffice.org/70568 Reviewed-by: Marco Cecchetti <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/inc/ChartController.hxx1
-rw-r--r--chart2/source/controller/main/ChartController.cxx20
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx20
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx2
4 files changed, 41 insertions, 2 deletions
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index 98225c96dd49..2b21e171d949 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -501,6 +501,7 @@ private:
void executeDispatch_ToggleGridVertical();
void executeDispatch_LOKSetTextSelection(int nType, int nX, int nY);
+ void executeDispatch_LOKPieSegmentDragging(int nOffset);
void sendPopupRequest(OUString const & rCID, tools::Rectangle aRectangle);
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 5540d67a0e90..6b8746603797 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1087,7 +1087,25 @@ void SAL_CALL ChartController::dispatch(
}
else if (aCommand == "LOKTransform")
{
- this->executeDispatch_PositionAndSize(&rArgs);
+ if (rArgs[0].Name == "Action")
+ {
+ OUString sAction;
+ if ((rArgs[0].Value >>= sAction) && sAction == "PieSegmentDragging")
+ {
+ if (rArgs[1].Name == "Offset")
+ {
+ sal_Int32 nOffset;
+ if (rArgs[1].Value >>= nOffset)
+ {
+ this->executeDispatch_LOKPieSegmentDragging(nOffset);
+ }
+ }
+ }
+ }
+ else
+ {
+ this->executeDispatch_PositionAndSize(&rArgs);
+ }
}
else if(aCommand == "Paste")
this->executeDispatch_Paste();
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 799b4b6b48f7..938c4a777f97 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -962,6 +962,26 @@ void ChartController::executeDispatch_LOKSetTextSelection(int nType, int nX, int
}
}
+void ChartController::executeDispatch_LOKPieSegmentDragging( int nOffset )
+{
+ try
+ {
+ OUString aCID( m_aSelection.getSelectedCID() );
+ const uno::Reference< frame::XModel >& xChartModel = getModel();
+ if( xChartModel.is() )
+ {
+ Reference< beans::XPropertySet > xPointProperties(
+ ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) );
+ if( xPointProperties.is() )
+ xPointProperties->setPropertyValue( "Offset", uno::Any( nOffset / 100.0 ) );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ SAL_WARN( "chart2", "Exception caught. " << ex );
+ }
+}
+
void ChartController::impl_ShapeControllerDispatch( const util::URL& rURL, const Sequence< beans::PropertyValue >& rArgs )
{
Reference< frame::XDispatch > xDispatch( m_aDispatchContainer.getShapeController() );
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index 0b29437546dd..7e0064e411cd 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -56,7 +56,7 @@ static const char m_aMultiClick[] = "MultiClick";
static const char m_aDragMethodEquals[] = "DragMethod=";
static const char m_aDragParameterEquals[] = "DragParameter=";
static const char m_aProtocol[] = "CID/";
-static const OUString m_aPieSegmentDragMethodServiceName("PieSegmentDraging");
+static const OUString m_aPieSegmentDragMethodServiceName("PieSegmentDragging");
namespace
{