summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-06-28 14:54:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-06-28 18:53:37 +0200
commitebbf3ccf693d5b6813746e72719e04e1c7cd438d (patch)
treedec62947fdf5c2c087a462588a4d14f5a6b7329e
parenttdf#149754 correct gradient paint for outside definition range (diff)
downloadcore-ebbf3ccf693d5b6813746e72719e04e1c7cd438d.tar.gz
core-ebbf3ccf693d5b6813746e72719e04e1c7cd438d.zip
tdf#117539 Assert after cut and paste operation of a chart stick
Change-Id: I314d263dc37a7af3969ba9eb32ac00997457003d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136574 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx26
1 files changed, 21 insertions, 5 deletions
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 40da1941e643..2d67c5ce0a33 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -367,14 +367,30 @@ void ChartController::impl_PasteGraphic(
xGraphicShape->SvxShape::setPropertyValue( "Graphic", uno::Any( xGraphic ));
awt::Size aGraphicSize( 1000, 1000 );
+ bool bGotGraphicSize = false;
+ try
+ {
+ bGotGraphicSize = xGraphicShape->SvxShape::getPropertyValue( "Size100thMM") >>= aGraphicSize;
+ }
+ catch (css::beans::UnknownPropertyException& )
+ {}
auto pChartWindow(GetChartWindow());
// first try size in 100th mm, then pixel size
- if( ! ( xGraphicShape->SvxShape::getPropertyValue( "Size100thMM") >>= aGraphicSize ) &&
- ( ( xGraphicShape->SvxShape::getPropertyValue( "SizePixel") >>= aGraphicSize ) && pChartWindow ))
+ if( !bGotGraphicSize )
{
- ::Size aVCLSize( pChartWindow->PixelToLogic( Size( aGraphicSize.Width, aGraphicSize.Height )));
- aGraphicSize.Width = aVCLSize.getWidth();
- aGraphicSize.Height = aVCLSize.getHeight();
+ bool bGotSizePixel = false;
+ try
+ {
+ bGotSizePixel = xGraphicShape->SvxShape::getPropertyValue( "SizePixel") >>= aGraphicSize;
+ }
+ catch (css::beans::UnknownPropertyException& )
+ {}
+ if ( bGotSizePixel && pChartWindow )
+ {
+ ::Size aVCLSize( pChartWindow->PixelToLogic( Size( aGraphicSize.Width, aGraphicSize.Height )));
+ aGraphicSize.Width = aVCLSize.getWidth();
+ aGraphicSize.Height = aVCLSize.getHeight();
+ }
}
xGraphicShape->setSize( aGraphicSize );
xGraphicShape->setPosition( awt::Point( 0, 0 ) );