summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarco Cecchetti <mrcekets@gmail.com>2019-03-26 13:17:08 +0100
committerMichael Meeks <michael.meeks@collabora.com>2019-08-05 21:06:40 -0400
commitc7dce3151323105158e3c4d10b5256a0af09ab3d (patch)
tree847e336aabf5db215253731c2db49ad23eeb9e43 /chart2
parent0f21e91722844c18baaf23f4ea8c85956d19303a (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')
-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 4165fcf3f38e..19500d034afa 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -496,6 +496,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 e8c177b9d940..27cb93cabdd7 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1093,7 +1093,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 18894177ecf2..625c41c9617f 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -951,6 +951,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 a884afea02df..98e61ba1c60c 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
{