summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-01-02 11:11:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-02 14:33:17 +0100
commit594c422851c991e17ad051b880457d66b404dfdb (patch)
treea14de4e43255dc03b711a0de8a1bb2396dbb4c4b /chart2/source
parent00be6e6767869aec015807e6e1f52a2b9fac351b (diff)
use more SvxShape in chart2
Change-Id: I97f57652d2ce17efc9b69e07bbca78c318451f1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127858 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/inc/chartview/DrawModelWrapper.hxx1
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx4
-rw-r--r--chart2/source/view/charttypes/PieChart.hxx2
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx12
-rw-r--r--chart2/source/view/inc/LegendEntryProvider.hxx4
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx3
-rw-r--r--chart2/source/view/main/ChartView.cxx16
-rw-r--r--chart2/source/view/main/DrawModelWrapper.cxx11
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx14
-rw-r--r--chart2/source/view/main/VLegend.cxx14
-rw-r--r--chart2/source/view/main/VLegendSymbolFactory.cxx14
11 files changed, 51 insertions, 44 deletions
diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx
index 72fad0e29eea..fcf684eedfa4 100644
--- a/chart2/source/inc/chartview/DrawModelWrapper.hxx
+++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx
@@ -83,6 +83,7 @@ public:
static SdrObject* getNamedSdrObject( const OUString& rName, SdrObjList const * pObjList );
static bool removeShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ static bool removeShape( SvxShape& rShape );
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index 89250699e95c..61ba53079ccc 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -247,7 +247,7 @@ bool PieChart::shouldSnapRectToUsedArea()
return true;
}
-uno::Reference< drawing::XShape > PieChart::createDataPoint(
+rtl::Reference<SvxShape> PieChart::createDataPoint(
const uno::Reference<drawing::XShapes>& xTarget,
const uno::Reference<beans::XPropertySet>& xObjectProperties,
tPropertyNameValueMap const * pOverwritePropertiesMap,
@@ -265,7 +265,7 @@ uno::Reference< drawing::XShape > PieChart::createDataPoint(
}
//create point
- uno::Reference< drawing::XShape > xShape;
+ rtl::Reference<SvxShape> xShape;
if(m_nDimension==3)
{
xShape = ShapeFactory::createPieSegment( xTarget
diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx
index a7bb35827f77..43725639e1e2 100644
--- a/chart2/source/view/charttypes/PieChart.hxx
+++ b/chart2/source/view/charttypes/PieChart.hxx
@@ -63,7 +63,7 @@ public:
virtual bool isSeparateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) override;
private: //methods
- css::uno::Reference<css::drawing::XShape>
+ rtl::Reference<SvxShape>
createDataPoint(
const css::uno::Reference<css::drawing::XShapes>& xTarget,
const css::uno::Reference<css::beans::XPropertySet>& xObjectProperties,
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 4e70d803df4f..48094a6d63b7 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2710,7 +2710,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
continue;
// symbol
- uno::Reference< drawing::XShapes > xSymbolGroup(ShapeFactory::createGroup2D( xTarget ));
+ rtl::Reference< SvxShapeGroup > xSymbolGroup(ShapeFactory::createGroup2D( xTarget ));
// create the symbol
rtl::Reference< SvxShapeGroup > xShape = createLegendSymbolForPoint( rEntryKeyAspectRatio,
@@ -2719,7 +2719,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
// set CID to symbol for selection
if( xShape.is() )
{
- aEntry.aSymbol.set( xSymbolGroup, uno::UNO_QUERY );
+ aEntry.xSymbol = xSymbolGroup;
OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_DATA_POINT, nIdx ) );
aChildParticle = ObjectIdentifier::addChildParticle( aChildParticle, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) );
@@ -2739,7 +2739,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
else
{
// symbol
- uno::Reference< drawing::XShapes > xSymbolGroup(ShapeFactory::createGroup2D( xTarget ));
+ rtl::Reference< SvxShapeGroup > xSymbolGroup(ShapeFactory::createGroup2D( xTarget ));
// create the symbol
rtl::Reference<SvxShapeGroup> xShape = createLegendSymbolForSeries(
@@ -2748,7 +2748,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
// set CID to symbol for selection
if( xShape.is())
{
- aEntry.aSymbol.set( xSymbolGroup, uno::UNO_QUERY );
+ aEntry.xSymbol = xSymbolGroup;
OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) );
OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle );
@@ -2782,7 +2782,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aResStr, xTextProperties );
// symbol
- uno::Reference< drawing::XShapes > xSymbolGroup(ShapeFactory::createGroup2D( xTarget ));
+ rtl::Reference<SvxShapeGroup> xSymbolGroup(ShapeFactory::createGroup2D( xTarget ));
// create the symbol
rtl::Reference<SvxShapeGroup> xShape = VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
@@ -2793,7 +2793,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
// set CID to symbol for selection
if( xShape.is())
{
- aEntry.aSymbol.set( xSymbolGroup, uno::UNO_QUERY );
+ aEntry.xSymbol = xSymbolGroup;
bool bAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[i] );
ObjectType eObjectType = bAverageLine ? OBJECTTYPE_DATA_AVERAGE_LINE : OBJECTTYPE_DATA_CURVE;
diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx b/chart2/source/view/inc/LegendEntryProvider.hxx
index 1eea73aeeb86..8a4efd602605 100644
--- a/chart2/source/view/inc/LegendEntryProvider.hxx
+++ b/chart2/source/view/inc/LegendEntryProvider.hxx
@@ -22,6 +22,8 @@
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
#include <vector>
namespace chart { class ChartModel; }
@@ -56,7 +58,7 @@ struct ViewLegendEntry
/** The legend symbol that represents a data series or other
information contained in the legend
*/
- css::uno::Reference< css::drawing::XShape > aSymbol;
+ rtl::Reference< SvxShapeGroup > xSymbol;
/** The descriptive text for a legend entry.
*/
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 7d5ce5091871..4d5b258b65e6 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -266,8 +266,7 @@ public:
, const css::awt::Size& rTargetAreaSize
, const css::awt::Size& rObjectSize );
- static ::basegfx::B2IRectangle getRectangleOfShape(
- const css::uno::Reference< css::drawing::XShape >& xShape );
+ static ::basegfx::B2IRectangle getRectangleOfShape( SvxShape& xShape );
static css::awt::Size getSizeAfterRotation(
const css::uno::Reference< css::drawing::XShape >& xShape, double fRotationAngleDegree );
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index a8948ca7c1b6..85e4e5fcb7f1 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1017,7 +1017,7 @@ struct CreateShapeParam2D
rtl::Reference<SvxShapeRect> mxMarkHandles;
rtl::Reference<SvxShapeRect> mxPlotAreaWithAxes;
- css::uno::Reference<css::drawing::XShapes> mxDiagramWithAxesShapes;
+ rtl::Reference<SvxShapeGroup> mxDiagramWithAxesShapes;
bool mbAutoPosTitleX;
bool mbAutoPosTitleY;
@@ -1455,7 +1455,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
aVDiagram.reduceToMinimumSize();
}
- uno::Reference< drawing::XShapes > xTextTargetShapes =
+ rtl::Reference<SvxShapeGroup> xTextTargetShapes =
ShapeFactory::createGroup2D(rParam.mxDiagramWithAxesShapes);
// - create axis and grids for all coordinate systems
@@ -1474,7 +1474,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
//calculate resulting size respecting axis label layout and fontscaling
- uno::Reference< drawing::XShape > xBoundingShape(rParam.mxDiagramWithAxesShapes, uno::UNO_QUERY);
+ rtl::Reference<SvxShapeGroup> xBoundingShape(rParam.mxDiagramWithAxesShapes);
::basegfx::B2IRectangle aConsumedOuterRect;
//use first coosys only so far; todo: calculate for more than one coosys if we have more in future
@@ -1485,7 +1485,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
VCoordinateSystem* pVCooSys = rVCooSysList[0].get();
pVCooSys->createMaximumAxesLabels();
- aConsumedOuterRect = ShapeFactory::getRectangleOfShape(xBoundingShape);
+ aConsumedOuterRect = ShapeFactory::getRectangleOfShape(*xBoundingShape);
::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
if (!rParam.mbUseFixedInnerSize)
aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
@@ -1502,7 +1502,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
bool bLessSpaceConsumedThanExpected = false;
{
- aConsumedOuterRect = ShapeFactory::getRectangleOfShape(xBoundingShape);
+ aConsumedOuterRect = ShapeFactory::getRectangleOfShape(*xBoundingShape);
if( aConsumedOuterRect.getMinX() > aAvailableOuterRect.getMinX()
|| aConsumedOuterRect.getMaxX() < aAvailableOuterRect.getMaxX()
|| aConsumedOuterRect.getMinY() > aAvailableOuterRect.getMinY()
@@ -1571,7 +1571,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
{
m_bPointsWereSkipped = false;
- aConsumedOuterRect = ShapeFactory::getRectangleOfShape(xBoundingShape);
+ aConsumedOuterRect = ShapeFactory::getRectangleOfShape(*xBoundingShape);
::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
if (!rParam.mbUseFixedInnerSize)
aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
@@ -2901,8 +2901,8 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
bHasRelativeSize = true;
OUString aDiagramCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) ) );//todo: other index if more than one diagram is possible
- uno::Reference< drawing::XShapes > xDiagramPlusAxesPlusMarkHandlesGroup_Shapes(
- ShapeFactory::createGroup2D(mxRootShape,aDiagramCID) );
+ rtl::Reference<SvxShapeGroup> xDiagramPlusAxesPlusMarkHandlesGroup_Shapes =
+ ShapeFactory::createGroup2D(mxRootShape,aDiagramCID);
aParam.mxMarkHandles = ShapeFactory::createInvisibleRectangle(
xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0));
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx
index d1aa44b21363..5bc5c9e87e13 100644
--- a/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -302,6 +302,17 @@ bool DrawModelWrapper::removeShape( const uno::Reference< drawing::XShape >& xSh
return false;
}
+bool DrawModelWrapper::removeShape( SvxShape& rShape )
+{
+ uno::Reference<drawing::XShapes> xShapes( rShape.getParent(), uno::UNO_QUERY );
+ if( xShapes.is() )
+ {
+ xShapes->remove(&rShape);
+ return true;
+ }
+ return false;
+}
+
void DrawModelWrapper::dumpAsXml(xmlTextWriterPtr pWriter) const
{
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("DrawModelWrapper"));
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 28775a7ae880..a9666084e530 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -2494,19 +2494,15 @@ awt::Point ShapeFactory::calculateTopLeftPositionToCenterObject(
return aNewPosition;
}
-::basegfx::B2IRectangle ShapeFactory::getRectangleOfShape(
- const uno::Reference< drawing::XShape >& xShape )
+::basegfx::B2IRectangle ShapeFactory::getRectangleOfShape( SvxShape& rShape )
{
::basegfx::B2IRectangle aRet;
- if( xShape.is() )
- {
- awt::Point aPos = xShape->getPosition();
- awt::Size aSize = xShape->getSize();
- aRet = BaseGFXHelper::makeRectangle(aPos,aSize);
- }
- return aRet;
+ awt::Point aPos = rShape.getPosition();
+ awt::Size aSize = rShape.getSize();
+ aRet = BaseGFXHelper::makeRectangle(aPos,aSize);
+ return aRet;
}
awt::Size ShapeFactory::getSizeAfterRotation(
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index b9d9baa6d209..370093d636e7 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -326,7 +326,7 @@ awt::Size lcl_placeLegendEntries(
sal_Int32 nMaxColumnCount=-1;
for( sal_Int32 nN=0; nN<static_cast<sal_Int32>(aTextShapes.size()); nN++ )
{
- Reference< drawing::XShape > xShape( aTextShapes[nN] );
+ rtl::Reference<SvxShapeText> xShape( aTextShapes[nN] );
if( !xShape.is() )
continue;
awt::Size aSize( xShape->getSize() );
@@ -407,7 +407,7 @@ awt::Size lcl_placeLegendEntries(
}
if( nEntry < nNumberOfEntries && ( nEntry != 0 || nNumberOfColumns != 1 ) )
{
- DrawModelWrapper::removeShape( rEntries[ nEntry ].aSymbol );
+ DrawModelWrapper::removeShape( *rEntries[ nEntry ].xSymbol );
rEntries.pop_back();
nNumberOfEntries--;
}
@@ -441,7 +441,7 @@ awt::Size lcl_placeLegendEntries(
}
if (aTextShapes.size() == 0)
{
- DrawModelWrapper::removeShape(rEntries[0].aSymbol);
+ DrawModelWrapper::removeShape(*rEntries[0].xSymbol);
rEntries.pop_back();
nNumberOfEntries--;
aRowHeights.pop_back();
@@ -576,7 +576,7 @@ awt::Size lcl_placeLegendEntries(
break;
// text shape
- Reference< drawing::XShape > xTextShape( aTextShapes[nEntry] );
+ rtl::Reference<SvxShapeText> xTextShape( aTextShapes[nEntry] );
if( xTextShape.is() )
{
awt::Size aTextSize( xTextShape->getSize() );
@@ -587,7 +587,7 @@ awt::Size lcl_placeLegendEntries(
}
// symbol
- Reference< drawing::XShape > xSymbol( rEntries[ nEntry ].aSymbol );
+ rtl::Reference<SvxShapeGroup> & xSymbol( rEntries[ nEntry ].xSymbol );
if( xSymbol.is() )
{
awt::Size aSymbolSize( rMaxSymbolExtent );
@@ -635,11 +635,11 @@ awt::Size lcl_placeLegendEntries(
awt::Point aPos(0,0);
for( sal_Int32 nEntry=0; nEntry<nNumberOfEntries; nEntry++ )
{
- Reference< drawing::XShape > xSymbol( rEntries[ nEntry ].aSymbol );
+ rtl::Reference<SvxShapeGroup> & xSymbol( rEntries[ nEntry ].xSymbol );
aPos = xSymbol->getPosition();
aPos.X += nLegendWidth;
xSymbol->setPosition( aPos );
- Reference< drawing::XShape > xText( aTextShapes[ nEntry ] );
+ rtl::Reference<SvxShapeText> & xText( aTextShapes[ nEntry ] );
aPos = xText->getPosition();
aPos.X += nLegendWidth;
xText->setPosition( aPos );
diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx
index 02138aac1103..91415f66d008 100644
--- a/chart2/source/view/main/VLegendSymbolFactory.cxx
+++ b/chart2/source/view/main/VLegendSymbolFactory.cxx
@@ -73,7 +73,7 @@ void getPropNamesAndValues( const Reference< beans::XPropertySet >& xProp,
void lcl_setPropertiesToShape(
const Reference< beans::XPropertySet > & xProp,
- const Reference< drawing::XShape > & xShape,
+ const rtl::Reference< SvxShape > & xShape,
::chart::VLegendSymbolFactory::PropertyType ePropertyType,
const awt::Size& aMaxSymbolExtent)
{
@@ -82,8 +82,7 @@ void lcl_setPropertiesToShape(
getPropNamesAndValues( xProp, aPropNames, aPropValues,
ePropertyType, aMaxSymbolExtent );
- Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
- ::chart::PropertyMapper::setMultiProperties( aPropNames, aPropValues, xShapeProp );
+ ::chart::PropertyMapper::setMultiProperties( aPropNames, aPropValues, xShape );
}
} // anonymous namespace
@@ -123,7 +122,6 @@ rtl::Reference< SvxShapeGroup > VLegendSymbolFactory::createSymbol(
awt::Point( 0, rEntryKeyAspectRatio.Height/2 ));
lcl_setPropertiesToShape( xLegendEntryProperties, xLine, ePropertyType, rEntryKeyAspectRatio );
- Reference< drawing::XShape > xSymbol;
const sal_Int32 nSize = std::min(rEntryKeyAspectRatio.Width,rEntryKeyAspectRatio.Height);
chart2::Symbol aSymbol;
if( rExplicitSymbol >>= aSymbol )
@@ -137,21 +135,21 @@ rtl::Reference< SvxShapeGroup > VLegendSymbolFactory::createSymbol(
// border of symbols always same as fill color
aSymbol.BorderColor = aSymbol.FillColor;
- xSymbol.set( ShapeFactory::createSymbol2D(
+ ShapeFactory::createSymbol2D(
xResultGroup,
aPos,
aSymbolSize,
aSymbol.StandardSymbol,
aSymbol.BorderColor,
- aSymbol.FillColor ));
+ aSymbol.FillColor );
}
else if( aSymbol.Style == chart2::SymbolStyle_GRAPHIC )
{
- xSymbol.set( ShapeFactory::createGraphic2D(
+ ShapeFactory::createGraphic2D(
xResultGroup,
aPos,
aSymbolSize,
- aSymbol.Graphic ));
+ aSymbol.Graphic );
}
else if( aSymbol.Style == chart2::SymbolStyle_AUTO )
{