diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-10-05 01:50:11 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-11-19 13:47:33 +0100 |
commit | ee5ef16d352bdcb2eb8fe1f4530b7f5c43bed911 (patch) | |
tree | 8825e9036147ec627a0c434d071d2dfdd16e451f | |
parent | 5c0a5503b692fa29b167e1b9a317fc77ef1baaf0 (diff) |
make it possible to switch between different ShapeFactories
Change-Id: I49f6b16182c25ead486a15ab86f722902b36933e
25 files changed, 134 insertions, 109 deletions
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index b022fdf2fa39..be3922b2572c 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -21,7 +21,7 @@ #include "VCartesianAxis.hxx" #include "PlottingPositionHelper.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "CommonConverters.hxx" #include "macros.hxx" #include "ViewDefines.hxx" @@ -93,11 +93,11 @@ Reference< drawing::XShape > createSingleLabel( // #i78696# use mathematically correct rotation now const double fRotationAnglePi(rAxisLabelProperties.fRotationAngleDegree * (F_PI / -180.0)); - uno::Any aATransformation = ShapeFactory::makeTransformation( rAnchorScreenPosition2D, fRotationAnglePi ); - OUString aLabel = ShapeFactory::getStackedString( rLabel, rAxisLabelProperties.bStackCharacters ); + uno::Any aATransformation = AbstractShapeFactory::makeTransformation( rAnchorScreenPosition2D, fRotationAnglePi ); + OUString aLabel = AbstractShapeFactory::getStackedString( rLabel, rAxisLabelProperties.bStackCharacters ); - Reference< drawing::XShape > xShape2DText = ShapeFactory(xShapeFactory) - .createText( xTarget, aLabel, rPropNames, rPropValues, aATransformation ); + Reference< drawing::XShape > xShape2DText = AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory) + ->createText( xTarget, aLabel, rPropNames, rPropValues, aATransformation ); LabelPositionHelper::correctPositionForRotation( xShape2DText , rAxisProperties.m_aLabelAlignment, rAxisLabelProperties.fRotationAngleDegree, rAxisProperties.m_bComplexCategories ); @@ -113,7 +113,7 @@ bool lcl_doesShapeOverlapWithTickmark( const Reference< drawing::XShape >& xShap if(!xShape.is()) return false; - ::basegfx::B2IRectangle aShapeRect = BaseGFXHelper::makeRectangle(xShape->getPosition(),ShapeFactory::getSizeAfterRotation( xShape, fRotationAngleDegree )); + ::basegfx::B2IRectangle aShapeRect = BaseGFXHelper::makeRectangle(xShape->getPosition(),AbstractShapeFactory::getSizeAfterRotation( xShape, fRotationAngleDegree )); if( bIsVerticalAxis ) { @@ -293,7 +293,7 @@ B2DVector lcl_getLabelsDistance( TickIter& rIter, const B2DVector& rDistanceTick xShape2DText = pTickInfo->xTextShape; if( xShape2DText.is() ) { - awt::Size aSize = ShapeFactory::getSizeAfterRotation( xShape2DText, fRotationAngleDegree ); + awt::Size aSize = AbstractShapeFactory::getSizeAfterRotation( xShape2DText, fRotationAngleDegree ); if(fabs(aStaggerDirection.getX())>fabs(aStaggerDirection.getY())) nDistance = ::std::max(nDistance,aSize.Width); else @@ -1525,7 +1525,7 @@ void VCartesianAxis::updatePositions() // #i78696# use mathematically correct rotation now const double fRotationAnglePi(fRotationAngleDegree * (F_PI / -180.0)); - uno::Any aATransformation = ShapeFactory::makeTransformation(aAnchorScreenPosition2D, fRotationAnglePi); + uno::Any aATransformation = AbstractShapeFactory::makeTransformation(aAnchorScreenPosition2D, fRotationAnglePi); //set new position uno::Reference< beans::XPropertySet > xProp( xShape2DText, uno::UNO_QUERY ); diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index 521e58aab737..3124f0c9209e 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -22,7 +22,7 @@ #include "VPolarCoordinateSystem.hxx" #include "ScaleAutomatism.hxx" #include "VSeriesPlotter.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "servicenames_coosystems.hxx" #include "macros.hxx" #include "AxisIndexDefines.hxx" @@ -104,20 +104,20 @@ void VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes sal_Int32 nDimensionCount = m_xCooSysModel->getDimension(); //create group shape for grids first thus axes are always painted above grids - ShapeFactory aShapeFactory(xShapeFactory); + AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory); if(nDimensionCount==2) { //create and add to target - m_xLogicTargetForGrids = aShapeFactory.createGroup2D( xLogicTarget ); - xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup2D( xLogicTarget ); - m_xLogicTargetForAxes = aShapeFactory.createGroup2D( xLogicTarget ); + m_xLogicTargetForGrids = pShapeFactory->createGroup2D( xLogicTarget ); + xLogicTargetForSeriesBehindAxis = pShapeFactory->createGroup2D( xLogicTarget ); + m_xLogicTargetForAxes = pShapeFactory->createGroup2D( xLogicTarget ); } else { //create and added to target - m_xLogicTargetForGrids = aShapeFactory.createGroup3D( xLogicTarget ); - xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup3D( xLogicTarget ); - m_xLogicTargetForAxes = aShapeFactory.createGroup3D( xLogicTarget ); + m_xLogicTargetForGrids = pShapeFactory->createGroup3D( xLogicTarget ); + xLogicTargetForSeriesBehindAxis = pShapeFactory->createGroup3D( xLogicTarget ); + m_xLogicTargetForAxes = pShapeFactory->createGroup3D( xLogicTarget ); } m_xFinalTarget = xFinalTarget; m_xShapeFactory = xShapeFactory; diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx index fb89a0b9967a..9d24c5ceeec1 100644 --- a/chart2/source/view/axes/VPolarAngleAxis.cxx +++ b/chart2/source/view/axes/VPolarAngleAxis.cxx @@ -21,7 +21,7 @@ #include "VPolarAngleAxis.hxx" #include "VPolarGrid.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "macros.hxx" #include "NumberFormatterWrapper.hxx" #include "PolarLabelPositionHelper.hxx" @@ -56,7 +56,7 @@ bool VPolarAngleAxis::createTextShapes_ForAngleAxis( , double fLogicZ ) { sal_Int32 nDimensionCount = 2; - ShapeFactory aShapeFactory(m_xShapeFactory); + AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory); FixedNumberFormatter aFixedNumberFormatter( m_xNumberFormatsSupplier, rAxisLabelProperties.nNumberFormatKey ); @@ -118,7 +118,7 @@ bool VPolarAngleAxis::createTextShapes_ForAngleAxis( double fLogicAngle = pTickInfo->getUnscaledTickValue(); LabelAlignment eLabelAlignment(LABEL_ALIGN_CENTER); - PolarLabelPositionHelper aPolarLabelPositionHelper(m_pPosHelper,nDimensionCount,xTarget,&aShapeFactory); + PolarLabelPositionHelper aPolarLabelPositionHelper(m_pPosHelper,nDimensionCount,xTarget, pShapeFactory); sal_Int32 nScreenValueOffsetInRadiusDirection = m_aAxisLabelProperties.m_aMaximumSpaceForLabels.Height/15; awt::Point aAnchorScreenPosition2D( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues( eLabelAlignment, fLogicAngle, fLogicRadius, fLogicZ, nScreenValueOffsetInRadiusDirection )); @@ -127,10 +127,10 @@ bool VPolarAngleAxis::createTextShapes_ForAngleAxis( // #i78696# use mathematically correct rotation now const double fRotationAnglePi(rAxisLabelProperties.fRotationAngleDegree * (F_PI / -180.0)); - uno::Any aATransformation = ShapeFactory::makeTransformation( aAnchorScreenPosition2D, fRotationAnglePi ); - OUString aStackedLabel = ShapeFactory::getStackedString( aLabel, rAxisLabelProperties.bStackCharacters ); + uno::Any aATransformation = AbstractShapeFactory::makeTransformation( aAnchorScreenPosition2D, fRotationAnglePi ); + OUString aStackedLabel = AbstractShapeFactory::getStackedString( aLabel, rAxisLabelProperties.bStackCharacters ); - pTickInfo->xTextShape = aShapeFactory.createText( xTarget, aStackedLabel, aPropNames, aPropValues, aATransformation ); + pTickInfo->xTextShape = pShapeFactory->createText( xTarget, aStackedLabel, aPropNames, aPropValues, aATransformation ); } //if NO OVERLAP -> remove overlapping shapes diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 1fc5ab19726c..a534b8152692 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -19,7 +19,7 @@ #include "AreaChart.hxx" #include "PlottingPositionHelper.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "CommonConverters.hxx" #include "macros.hxx" #include "ViewDefines.hxx" @@ -442,7 +442,7 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries { // default to creating a straight line SAL_WARN_IF(CurveStyle_LINES != m_eCurveStyle, "chart2.areachart", "Unknown curve style"); bool bIsClipped = false; - if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) ) + if( m_bConnectLastToFirstPoint && !AbstractShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) ) { // do NOT connect last and first point, if one is NAN, and NAN handling is NAN_AS_GAP double fFirstY = pSeries->getYValue( 0 ); @@ -465,7 +465,7 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries Clipping::clipPolygonAtRectangle( *pSeriesPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly ); } - if(!ShapeFactory::hasPolygonAnyLines(aPoly)) + if(!AbstractShapeFactory::hasPolygonAnyLines(aPoly)) return false; //transformation 3) -> 4) @@ -524,7 +524,7 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries drawing::PolyPolygonShape3D aPoly( *pSeriesPoly ); //add second part to the polygon (grounding points or previous series points) - if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) ) + if( m_bConnectLastToFirstPoint && !AbstractShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) ) { if( pPreviousSeriesPoly ) addPolygon( aPoly, *pPreviousSeriesPoly ); @@ -556,17 +556,17 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries { appendPoly( aPoly, *pPreviousSeriesPoly ); } - ShapeFactory::closePolygon(aPoly); + AbstractShapeFactory::closePolygon(aPoly); //apply clipping { drawing::PolyPolygonShape3D aClippedPoly; Clipping::clipPolygonAtRectangle( aPoly, pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly, false ); - ShapeFactory::closePolygon(aClippedPoly); //again necessary after clipping + AbstractShapeFactory::closePolygon(aClippedPoly); //again necessary after clipping aPoly = aClippedPoly; } - if(!ShapeFactory::hasPolygonAnyLines(aPoly)) + if(!AbstractShapeFactory::hasPolygonAnyLines(aPoly)) return false; //transformation 3) -> 4) diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index 4c61887591ea..fd6306d58586 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -19,7 +19,7 @@ #include "BubbleChart.hxx" #include "PlottingPositionHelper.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "CommonConverters.hxx" #include "macros.hxx" #include "ViewDefines.hxx" diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 48a97f14a362..1e7c1af87c02 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -19,7 +19,7 @@ #include "PieChart.hxx" #include "PlottingPositionHelper.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "PolarLabelPositionHelper.hxx" #include "macros.hxx" #include "CommonConverters.hxx" @@ -494,7 +494,7 @@ void PieChart::createShapes() if(!bDoExplode) { - ShapeFactory::setShapeName( xPointShape + AbstractShapeFactory::setShapeName( xPointShape , ObjectIdentifier::createPointCID( pSeries->getPointCID_Stub(), nPointIndex ) ); } else try @@ -521,7 +521,7 @@ void PieChart::createShapes() nOffsetPercent, aMinimumPosition, aMaximumPosition ) ) ); - ShapeFactory::setShapeName( xPointShape + AbstractShapeFactory::setShapeName( xPointShape , ObjectIdentifier::createPointCID( aPointCIDStub, nPointIndex ) ); } catch( const uno::Exception& e ) diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index e78806edf3af..be9af9f707c7 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -18,7 +18,7 @@ */ #include "VSeriesPlotter.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "chartview/ExplicitValueProvider.hxx" #include "CommonConverters.hxx" @@ -543,9 +543,9 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re LabelPositionHelper::changeTextAdjustment( *pPropValues, *pPropNames, eAlignment ); //create text shape - xTextShape = ShapeFactory(m_xShapeFactory). + xTextShape = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)-> createText( xTarget_, aText.makeStringAndClear() - , *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) ); + , *pPropNames, *pPropValues, AbstractShapeFactory::makeTransformation( aScreenPosition2D ) ); if( !xTextShape.is() ) return xTextShape; @@ -556,7 +556,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re const double fDegreesPi( fRotationDegrees * ( F_PI / -180.0 ) ); uno::Reference< beans::XPropertySet > xProp( xTextShape, uno::UNO_QUERY ); if( xProp.is() ) - xProp->setPropertyValue( "Transformation", ShapeFactory::makeTransformation( aScreenPosition2D, fDegreesPi ) ); + xProp->setPropertyValue( "Transformation", AbstractShapeFactory::makeTransformation( aScreenPosition2D, fDegreesPi ) ); LabelPositionHelper::correctPositionForRotation( xTextShape, eAlignment, fRotationDegrees, true /*bRotateAroundCenter*/ ); } @@ -1086,7 +1086,7 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries& rVDataSeries, createGroupShape( xTarget, rVDataSeries.getDataCurveCID( nN, bAverageLine ) ); uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D( xRegressionGroupShapes, PolyToPointSequence( aRegressionPoly ), &aVLineProperties ); - m_pShapeFactory->setShapeName( xShape, "MarkHandles" ); + AbstractShapeFactory::setShapeName( xShape, "MarkHandles" ); aDefaultPos = xShape->getPosition(); } @@ -1189,12 +1189,12 @@ void VSeriesPlotter::createRegressionCurveEquationShapes( uno::Reference< drawing::XShape > xTextShape = m_pShapeFactory->createText( xEquationTarget, aFormula.makeStringAndClear(), - aNames, aValues, ShapeFactory::makeTransformation( aScreenPosition2D )); + aNames, aValues, AbstractShapeFactory::makeTransformation( aScreenPosition2D )); OSL_ASSERT( xTextShape.is()); if( xTextShape.is()) { - ShapeFactory::setShapeName( xTextShape, rEquationCID ); + AbstractShapeFactory::setShapeName( xTextShape, rEquationCID ); awt::Size aSize( xTextShape->getSize() ); awt::Point aPos( RelativePositionHelper::getUpperLeftCornerOfAnchoredObject( aScreenPosition2D, aSize, aRelativePosition.Anchor ) ); @@ -2306,7 +2306,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( for( sal_Int32 nIdx=0; nIdx<aCategoryNames.getLength(); ++nIdx ) { // symbol - uno::Reference< drawing::XShapes > xSymbolGroup( ShapeFactory(xShapeFactory).createGroup2D( xTarget )); + uno::Reference< drawing::XShapes > xSymbolGroup( AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory)->createGroup2D( xTarget )); // create the symbol Reference< drawing::XShape > xShape( this->createLegendSymbolForPoint( rEntryKeyAspectRatio, @@ -2320,7 +2320,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_DATA_POINT, nIdx ) ); aChildParticle = ObjectIdentifier::addChildParticle( aChildParticle, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) ); OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle ); - ShapeFactory::setShapeName( xShape, aCID ); + AbstractShapeFactory::setShapeName( xShape, aCID ); } // label @@ -2335,7 +2335,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( else { // symbol - uno::Reference< drawing::XShapes > xSymbolGroup( ShapeFactory(xShapeFactory).createGroup2D( xTarget )); + uno::Reference< drawing::XShapes > xSymbolGroup( AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory)->createGroup2D( xTarget )); // create the symbol Reference< drawing::XShape > xShape( this->createLegendSymbolForSeries( @@ -2348,7 +2348,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) ); OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle ); - ShapeFactory::setShapeName( xShape, aCID ); + AbstractShapeFactory::setShapeName( xShape, aCID ); } // label @@ -2378,7 +2378,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aResStr, xTextProperties ); // symbol - uno::Reference< drawing::XShapes > xSymbolGroup( ShapeFactory(xShapeFactory).createGroup2D( xTarget )); + uno::Reference< drawing::XShapes > xSymbolGroup( AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory)->createGroup2D( xTarget )); // create the symbol Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio, @@ -2396,7 +2396,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( eObjectType, i ) ); aChildParticle = ObjectIdentifier::addChildParticle( aChildParticle, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) ); OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle ); - ShapeFactory::setShapeName( xShape, aCID ); + AbstractShapeFactory::setShapeName( xShape, aCID ); } aResult.push_back(aEntry); diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx index 58bb49f0d21e..36b0d20b3815 100644 --- a/chart2/source/view/diagram/VDiagram.cxx +++ b/chart2/source/view/diagram/VDiagram.cxx @@ -95,7 +95,7 @@ void VDiagram::init( m_xTarget = xTarget; m_xShapeFactory = xFactory; - m_pShapeFactory = new ShapeFactory(xFactory); + m_pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(xFactory); } void VDiagram::createShapes( const awt::Point& rPos, const awt::Size& rSize ) @@ -132,10 +132,10 @@ void VDiagram::createShapes( const awt::Point& rPos, const awt::Size& rSize ) //do not change aspect ratio awt::Size aAspectRatio( static_cast<sal_Int32>(m_aPreferredAspectRatio.DirectionX*FIXED_SIZE_FOR_3D_CHART_VOLUME), static_cast<sal_Int32>(m_aPreferredAspectRatio.DirectionY*FIXED_SIZE_FOR_3D_CHART_VOLUME )); - m_aCurrentSizeWithoutAxes = awt::Size( ShapeFactory::calculateNewSizeRespectingAspectRatio( + m_aCurrentSizeWithoutAxes = awt::Size( AbstractShapeFactory::calculateNewSizeRespectingAspectRatio( rAvailableSize, aAspectRatio ) ); //center diagram position - m_aCurrentPosWithoutAxes = awt::Point( ShapeFactory::calculateTopLeftPositionToCenterObject( + m_aCurrentPosWithoutAxes = awt::Point( AbstractShapeFactory::calculateTopLeftPositionToCenterObject( rPos, rAvailableSize, m_aCurrentSizeWithoutAxes ) ); } @@ -192,7 +192,7 @@ void VDiagram::createShapes_2d() { //we always need this object as dummy object for correct scene dimensions //but it should not be visible in this case: - ShapeFactory::makeShapeInvisible( m_xWall2D ); + AbstractShapeFactory::makeShapeInvisible( m_xWall2D ); } else { @@ -458,12 +458,12 @@ void VDiagram::adjustAspectRatio3d( const awt::Size& rAvailableSize ) adjustAspectRatio3d( rAvailableSize ); //do not change aspect ratio of 3D scene with 2D bound rect - m_aCurrentSizeWithoutAxes = ShapeFactory::calculateNewSizeRespectingAspectRatio( + m_aCurrentSizeWithoutAxes = AbstractShapeFactory::calculateNewSizeRespectingAspectRatio( rAvailableSize, m_xOuterGroupShape->getSize() ); m_xOuterGroupShape->setSize( m_aCurrentSizeWithoutAxes ); //center diagram position - m_aCurrentPosWithoutAxes= ShapeFactory::calculateTopLeftPositionToCenterObject( + m_aCurrentPosWithoutAxes= AbstractShapeFactory::calculateTopLeftPositionToCenterObject( rPos, rAvailableSize, m_aCurrentSizeWithoutAxes ); m_xOuterGroupShape->setPosition(m_aCurrentPosWithoutAxes); @@ -480,7 +480,7 @@ void VDiagram::createShapes_3d() m_xOuterGroupShape = uno::Reference< drawing::XShape >( m_xShapeFactory->createInstance( "com.sun.star.drawing.Shape3DSceneObject" ), uno::UNO_QUERY ); - ShapeFactory::setShapeName( m_xOuterGroupShape, "PlotAreaExcludingAxes" ); + AbstractShapeFactory::setShapeName( m_xOuterGroupShape, "PlotAreaExcludingAxes" ); m_xTarget->add(m_xOuterGroupShape); uno::Reference< drawing::XShapes > xOuterGroup_Shapes = @@ -535,7 +535,7 @@ void VDiagram::createShapes_3d() { //we always need this object as dummy object for correct scene dimensions //but it should not be visible in this case: - ShapeFactory::makeShapeInvisible( xShape ); + AbstractShapeFactory::makeShapeInvisible( xShape ); } } //add back wall @@ -563,7 +563,7 @@ void VDiagram::createShapes_3d() { //we always need this object as dummy object for correct scene dimensions //but it should not be visible in this case: - ShapeFactory::makeShapeInvisible( xShape ); + AbstractShapeFactory::makeShapeInvisible( xShape ); } } } @@ -639,12 +639,12 @@ void VDiagram::createShapes_3d() { //we always need this object as dummy object for correct scene dimensions //but it should not be visible in this case: - ShapeFactory::makeShapeInvisible( xShape ); + AbstractShapeFactory::makeShapeInvisible( xShape ); } else { OUString aFloorCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_FLOOR, OUString() ) );//@todo read CID from model - ShapeFactory::setShapeName( xShape, aFloorCID ); + AbstractShapeFactory::setShapeName( xShape, aFloorCID ); } } diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx index b4a3b75e6c9a..163bfa30b468 100644 --- a/chart2/source/view/inc/AbstractShapeFactory.hxx +++ b/chart2/source/view/inc/AbstractShapeFactory.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> namespace chart { @@ -52,6 +53,8 @@ class AbstractShapeFactory { public: + static AbstractShapeFactory* getOrCreateShapeFactory(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xFactory); + virtual ~AbstractShapeFactory() {}; virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > diff --git a/chart2/source/view/inc/LabelPositionHelper.hxx b/chart2/source/view/inc/LabelPositionHelper.hxx index 9e7d901f6a9f..dc4659c0a091 100644 --- a/chart2/source/view/inc/LabelPositionHelper.hxx +++ b/chart2/source/view/inc/LabelPositionHelper.hxx @@ -32,7 +32,7 @@ namespace chart /** */ class PlottingPositionHelper; -class ShapeFactory; +class AbstractShapeFactory; class LabelPositionHelper { @@ -41,7 +41,7 @@ public: PlottingPositionHelper* pPosHelper , sal_Int32 nDimensionCount , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xLogicTarget - , ShapeFactory* pShapeFactory ); + , AbstractShapeFactory* pShapeFactory ); virtual ~LabelPositionHelper(); ::com::sun::star::awt::Point transformSceneToScreenPosition( @@ -66,7 +66,7 @@ private: //these members are only necessary for transformation from 3D to 2D ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xLogicTarget; - ShapeFactory* m_pShapeFactory; + AbstractShapeFactory* m_pShapeFactory; }; } //namespace chart diff --git a/chart2/source/view/inc/PlotterBase.hxx b/chart2/source/view/inc/PlotterBase.hxx index 00699135e929..686d32bba92c 100644 --- a/chart2/source/view/inc/PlotterBase.hxx +++ b/chart2/source/view/inc/PlotterBase.hxx @@ -35,7 +35,7 @@ namespace chart { -class ShapeFactory; +class AbstractShapeFactory; class PlottingPositionHelper; class PlotterBase @@ -79,7 +79,7 @@ protected: //member ::com::sun::star::drawing::XShapes > m_xFinalTarget; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory; - ShapeFactory* m_pShapeFactory; + AbstractShapeFactory* m_pShapeFactory; OUString m_aCID; sal_Int32 m_nDimension; diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx b/chart2/source/view/inc/PlottingPositionHelper.hxx index 384043549c6f..5e90b6550001 100644 --- a/chart2/source/view/inc/PlottingPositionHelper.hxx +++ b/chart2/source/view/inc/PlottingPositionHelper.hxx @@ -35,7 +35,7 @@ namespace chart { -class ShapeFactory; +class AbstractShapeFactory; class PlottingPositionHelper { @@ -81,7 +81,7 @@ public: static com::sun::star::awt::Point transformSceneToScreenPosition( const com::sun::star::drawing::Position3D& rScenePosition3D , const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& xSceneTarget - , ShapeFactory* pShapeFactory, sal_Int32 nDimensionCount ); + , AbstractShapeFactory* pShapeFactory, sal_Int32 nDimensionCount ); inline double getLogicMinX() const; inline double getLogicMinY() const; diff --git a/chart2/source/view/inc/PolarLabelPositionHelper.hxx b/chart2/source/view/inc/PolarLabelPositionHelper.hxx index 8a21b7493b14..5b9b1d4487e8 100644 --- a/chart2/source/view/inc/PolarLabelPositionHelper.hxx +++ b/chart2/source/view/inc/PolarLabelPositionHelper.hxx @@ -38,7 +38,7 @@ public: PolarPlottingPositionHelper* pPosHelper , sal_Int32 nDimensionCount , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xLogicTarget - , ShapeFactory* pShapeFactory ); + , AbstractShapeFactory* pShapeFactory ); virtual ~PolarLabelPositionHelper(); ::com::sun::star::awt::Point getLabelScreenPositionAndAlignmentForLogicValues( diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index 6d14c4851509..42017415aa4a 100644 --- a/chart2/source/view/inc/ShapeFactory.hxx +++ b/chart2/source/view/inc/ShapeFactory.hxx @@ -27,10 +27,12 @@ namespace chart class ShapeFactory : public AbstractShapeFactory { -public: + friend AbstractShapeFactory; + ShapeFactory(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xFactory) {m_xShapeFactory = xFactory;} +public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > createGroup2D( const ::com::sun::star::uno::Reference< diff --git a/chart2/source/view/inc/VDiagram.hxx b/chart2/source/view/inc/VDiagram.hxx index 8ee91f4285c8..8baa33754922 100644 --- a/chart2/source/view/inc/VDiagram.hxx +++ b/chart2/source/view/inc/VDiagram.hxx @@ -22,13 +22,13 @@ #include <com/sun/star/drawing/HomogenMatrix.hpp> #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/chart2/XDiagram.hpp> -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include <basegfx/range/b2irectangle.hxx> namespace chart { -class ShapeFactory; +class AbstractShapeFactory; /** The VDiagram is responsible to generate the visible parts of the Diagram that is wall, floor, axes and data series. @@ -81,7 +81,7 @@ private: //members ::com::sun::star::drawing::XShapes > m_xTarget; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory; - ShapeFactory* m_pShapeFactory; + AbstractShapeFactory* m_pShapeFactory; // this is the surrounding shape which contains floor, wall and coordinate ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xOuterGroupShape; diff --git a/chart2/source/view/main/AbstractShapeFactory.cxx b/chart2/source/view/main/AbstractShapeFactory.cxx index 6a8f7a88421a..77f9d5930b52 100644 --- a/chart2/source/view/main/AbstractShapeFactory.cxx +++ b/chart2/source/view/main/AbstractShapeFactory.cxx @@ -38,11 +38,29 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b3dhommatrix.hxx> +#include "DummyShapeFactory.hxx" +#include "ShapeFactory.hxx" + using namespace com::sun::star; using ::com::sun::star::uno::Reference; namespace chart { +AbstractShapeFactory* AbstractShapeFactory::getOrCreateShapeFactory(uno::Reference< lang::XMultiServiceFactory> xFactory) +{ + static AbstractShapeFactory* pShapeFactory = NULL; + + if(pShapeFactory) + return pShapeFactory; + + if(getenv("CHART_DUMMY_FACTORY")) + pShapeFactory = new dummy::DummyShapeFactory(); + else + pShapeFactory = new ShapeFactory(xFactory); + + return pShapeFactory; +} + sal_Int32 AbstractShapeFactory::getSymbolCount() { return Symbol_COUNT; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 1332ce446374..c9198beda0cf 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -23,7 +23,7 @@ #include "ViewDefines.hxx" #include "VDiagram.hxx" #include "VTitle.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "VCoordinateSystem.hxx" #include "VSeriesPlotter.hxx" #include "CommonConverters.hxx" @@ -1404,7 +1404,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& aVDiagram.reduceToMimimumSize(); } - uno::Reference< drawing::XShapes > xTextTargetShapes( ShapeFactory(m_xShapeFactory).createGroup2D(xDiagramPlusAxes_Shapes) ); + uno::Reference< drawing::XShapes > xTextTargetShapes( AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)->createGroup2D(xDiagramPlusAxes_Shapes) ); // - create axis and grids for all coordinate systems @@ -1432,7 +1432,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& VCoordinateSystem* pVCooSys = rVCooSysList[0]; pVCooSys->createMaximumAxesLabels(); - aConsumedOuterRect = ::basegfx::B2IRectangle( ShapeFactory::getRectangleOfShape(xBoundingShape) ); + aConsumedOuterRect = ::basegfx::B2IRectangle( AbstractShapeFactory::getRectangleOfShape(xBoundingShape) ); ::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() ); if( !bUseFixedInnerSize ) aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect ); @@ -1449,7 +1449,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& bool bLessSpaceConsumedThanExpected = false; { - aConsumedOuterRect = ShapeFactory::getRectangleOfShape(xBoundingShape); + aConsumedOuterRect = AbstractShapeFactory::getRectangleOfShape(xBoundingShape); if( aConsumedOuterRect.getMinX() > aAvailableOuterRect.getMinX() || aConsumedOuterRect.getMaxX() < aAvailableOuterRect.getMaxX() || aConsumedOuterRect.getMinY() > aAvailableOuterRect.getMinY() @@ -1516,7 +1516,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& { m_bPointsWereSkipped = false; - aConsumedOuterRect = ::basegfx::B2IRectangle( ShapeFactory::getRectangleOfShape(xBoundingShape) ); + aConsumedOuterRect = ::basegfx::B2IRectangle( AbstractShapeFactory::getRectangleOfShape(xBoundingShape) ); ::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() ); if( !bUseFixedInnerSize ) aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect ); @@ -1528,9 +1528,9 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& } //clear and recreate - ShapeFactory::removeSubShapes( xSeriesTargetInFrontOfAxis ); //xSeriesTargetBehindAxis is a sub shape of xSeriesTargetInFrontOfAxis and will be removed here + AbstractShapeFactory::removeSubShapes( xSeriesTargetInFrontOfAxis ); //xSeriesTargetBehindAxis is a sub shape of xSeriesTargetInFrontOfAxis and will be removed here xSeriesTargetBehindAxis.clear(); - ShapeFactory::removeSubShapes( xTextTargetShapes ); + AbstractShapeFactory::removeSubShapes( xTextTargetShapes ); //set new transformation for( nC=0; nC < rVCooSysList.size(); nC++) @@ -2428,8 +2428,9 @@ void ChartView::createShapes() awt::Size aPageSize = ChartModelHelper::getPageSize( m_xChartModel ); - uno::Reference<drawing::XShapes> xPageShapes( ShapeFactory(m_xShapeFactory) - .getOrCreateChartRootShape( m_xDrawPage ) ); + AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory); + uno::Reference<drawing::XShapes> xPageShapes( + pShapeFactory->getOrCreateChartRootShape( m_xDrawPage ) ); SdrPage* pPage = ChartView::getSdrPage(); if(pPage) //it is necessary to use the implementation here as the uno page does not provide a propertyset @@ -2452,17 +2453,18 @@ void ChartView::createShapes() //create the group shape for diagram and axes first to have title and legends on top of it uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) ); 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(m_xShapeFactory).createGroup2D(xPageShapes,aDiagramCID) ); + uno::Reference< drawing::XShapes > xDiagramPlusAxesPlusMarkHandlesGroup_Shapes( + pShapeFactory->createGroup2D(xPageShapes,aDiagramCID) ); - uno::Reference< drawing::XShape > xDiagram_MarkHandles( ShapeFactory(m_xShapeFactory).createInvisibleRectangle( + uno::Reference< drawing::XShape > xDiagram_MarkHandles( pShapeFactory->createInvisibleRectangle( xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) ); - ShapeFactory::setShapeName( xDiagram_MarkHandles, "MarkHandles" ); + AbstractShapeFactory::setShapeName( xDiagram_MarkHandles, "MarkHandles" ); - uno::Reference< drawing::XShape > xDiagram_OuterRect( ShapeFactory(m_xShapeFactory).createInvisibleRectangle( + uno::Reference< drawing::XShape > xDiagram_OuterRect( pShapeFactory->createInvisibleRectangle( xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) ); - ShapeFactory::setShapeName( xDiagram_OuterRect, "PlotAreaIncludingAxes" ); + AbstractShapeFactory::setShapeName( xDiagram_OuterRect, "PlotAreaIncludingAxes" ); - uno::Reference< drawing::XShapes > xDiagramPlusAxes_Shapes( ShapeFactory(m_xShapeFactory).createGroup2D(xDiagramPlusAxesPlusMarkHandlesGroup_Shapes ) ); + uno::Reference< drawing::XShapes > xDiagramPlusAxes_Shapes( pShapeFactory->createGroup2D(xDiagramPlusAxesPlusMarkHandlesGroup_Shapes ) ); bool bAutoPositionDummy = true; @@ -2979,8 +2981,8 @@ uno::Sequence< OUString > ChartView::getAvailableServiceNames() throw (uno::Runt OUString ChartView::dump() throw (uno::RuntimeException) { impl_updateView(); - uno::Reference<drawing::XShapes> xPageShapes( ShapeFactory(m_xShapeFactory) - .getOrCreateChartRootShape( m_xDrawPage ) ); + uno::Reference<drawing::XShapes> xPageShapes( AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory) + ->getOrCreateChartRootShape( m_xDrawPage ) ); if (!xPageShapes.is()) return OUString(); diff --git a/chart2/source/view/main/DataPointSymbolSupplier.cxx b/chart2/source/view/main/DataPointSymbolSupplier.cxx index 5ce3f65f9932..af87754a82a1 100644 --- a/chart2/source/view/main/DataPointSymbolSupplier.cxx +++ b/chart2/source/view/main/DataPointSymbolSupplier.cxx @@ -18,7 +18,7 @@ */ #include "chartview/DataPointSymbolSupplier.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "macros.hxx" namespace chart @@ -38,11 +38,11 @@ uno::Reference< drawing::XShapes > DataPointSymbolSupplier::create2DSymbolList( uno::Reference< drawing::XShapes > xGroupShapes = uno::Reference<drawing::XShapes>( xGroup, uno::UNO_QUERY ); - ShapeFactory aShapeFactory(xShapeFactory); + AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory); drawing::Position3D aPos(0,0,0); - for(sal_Int32 nS=0;nS<ShapeFactory::getSymbolCount();nS++) + for(sal_Int32 nS=0;nS<AbstractShapeFactory::getSymbolCount();nS++) { - aShapeFactory.createSymbol2D( xGroupShapes, aPos, rSize, nS ); + pShapeFactory->createSymbol2D( xGroupShapes, aPos, rSize, nS ); } return xGroupShapes; } diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index d99d46bbcf7b..dedf65e1a413 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -19,7 +19,7 @@ #include "chartview/DrawModelWrapper.hxx" #include "macros.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "ChartItemPool.hxx" #include "ObjectIdentifier.hxx" #include <svx/unomodel.hxx> @@ -235,7 +235,7 @@ uno::Reference< drawing::XDrawPage > DrawModelWrapper::getMainDrawPage() } } //ensure that additional shapes are in front of the chart objects so create the chart root before - ShapeFactory(this->getShapeFactory()).getOrCreateChartRootShape( m_xMainDrawPage ); + AbstractShapeFactory::getOrCreateShapeFactory(this->getShapeFactory())->getOrCreateChartRootShape( m_xMainDrawPage ); return m_xMainDrawPage; } uno::Reference< drawing::XDrawPage > DrawModelWrapper::getHiddenDrawPage() @@ -265,7 +265,7 @@ uno::Reference< drawing::XDrawPage > DrawModelWrapper::getHiddenDrawPage() void DrawModelWrapper::clearMainDrawPage() { //uno::Reference<drawing::XShapes> xChartRoot( m_xMainDrawPage, uno::UNO_QUERY ); - uno::Reference<drawing::XShapes> xChartRoot( ShapeFactory::getChartRootShape( m_xMainDrawPage ) ); + uno::Reference<drawing::XShapes> xChartRoot( AbstractShapeFactory::getChartRootShape( m_xMainDrawPage ) ); if( xChartRoot.is() ) { sal_Int32 nSubCount = xChartRoot->getCount(); @@ -281,7 +281,7 @@ void DrawModelWrapper::clearMainDrawPage() uno::Reference< drawing::XShapes > DrawModelWrapper::getChartRootShape( const uno::Reference< drawing::XDrawPage>& xDrawPage ) { - return ShapeFactory::getChartRootShape( xDrawPage ); + return AbstractShapeFactory::getChartRootShape( xDrawPage ); } void DrawModelWrapper::lockControllers() diff --git a/chart2/source/view/main/LabelPositionHelper.cxx b/chart2/source/view/main/LabelPositionHelper.cxx index fd2c9b4add9a..cfa023f8d6f6 100644 --- a/chart2/source/view/main/LabelPositionHelper.cxx +++ b/chart2/source/view/main/LabelPositionHelper.cxx @@ -21,7 +21,7 @@ #include "PlottingPositionHelper.hxx" #include "CommonConverters.hxx" #include "PropertyMapper.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "macros.hxx" #include "RelativeSizeHelper.hxx" #include <com/sun/star/drawing/TextVerticalAdjust.hpp> @@ -36,7 +36,7 @@ LabelPositionHelper::LabelPositionHelper( PlottingPositionHelper* pPosHelper , sal_Int32 nDimensionCount , const uno::Reference< drawing::XShapes >& xLogicTarget - , ShapeFactory* pShapeFactory ) + , AbstractShapeFactory* pShapeFactory ) : m_pPosHelper(pPosHelper) , m_nDimensionCount(nDimensionCount) , m_xLogicTarget(xLogicTarget) diff --git a/chart2/source/view/main/PlotterBase.cxx b/chart2/source/view/main/PlotterBase.cxx index f079d90da7fe..a81b04138395 100644 --- a/chart2/source/view/main/PlotterBase.cxx +++ b/chart2/source/view/main/PlotterBase.cxx @@ -19,7 +19,7 @@ #include "PlotterBase.hxx" #include "PlottingPositionHelper.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include <rtl/math.hxx> #include <com/sun/star/chart2/DataPointLabel.hpp> @@ -50,7 +50,7 @@ void PlotterBase::initPlotter( const uno::Reference< drawing::XShapes >& xLogic m_xLogicTarget = xLogicTarget; m_xFinalTarget = xFinalTarget; m_xShapeFactory = xShapeFactory; - m_pShapeFactory = new ShapeFactory(xShapeFactory); + m_pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory); m_aCID = rCID; } diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx index 1269536bb43a..cfc496a39b0f 100644 --- a/chart2/source/view/main/PlottingPositionHelper.cxx +++ b/chart2/source/view/main/PlottingPositionHelper.cxx @@ -22,7 +22,7 @@ #include "ViewDefines.hxx" #include "Linear3DTransformation.hxx" #include "VPolarTransformation.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "PropertyMapper.hxx" #include "DateHelper.hxx" #include "defines.hxx" @@ -203,7 +203,7 @@ drawing::Position3D PlottingPositionHelper::transformScaledLogicToScene( awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const drawing::Position3D& rScenePosition3D , const uno::Reference< drawing::XShapes >& xSceneTarget - , ShapeFactory* pShapeFactory + , AbstractShapeFactory* pShapeFactory , sal_Int32 nDimensionCount ) { //@todo would like to have a cheaper method to do this transformation diff --git a/chart2/source/view/main/PolarLabelPositionHelper.cxx b/chart2/source/view/main/PolarLabelPositionHelper.cxx index f620f18da0bf..d1fbee7b2486 100644 --- a/chart2/source/view/main/PolarLabelPositionHelper.cxx +++ b/chart2/source/view/main/PolarLabelPositionHelper.cxx @@ -34,7 +34,7 @@ PolarLabelPositionHelper::PolarLabelPositionHelper( PolarPlottingPositionHelper* pPosHelper , sal_Int32 nDimensionCount , const uno::Reference< drawing::XShapes >& xLogicTarget - , ShapeFactory* pShapeFactory ) + , AbstractShapeFactory* pShapeFactory ) : LabelPositionHelper( pPosHelper, nDimensionCount, xLogicTarget, pShapeFactory ) , m_pPosHelper(pPosHelper) { diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index b4b17382a6be..5efb74ad54a2 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -23,7 +23,7 @@ #include "CommonConverters.hxx" #include "ObjectIdentifier.hxx" #include "RelativePositionHelper.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "RelativeSizeHelper.hxx" #include "LegendEntryProvider.hxx" #include "chartview/DrawModelWrapper.hxx" @@ -847,7 +847,7 @@ void VLegend::createShapes( // set name to enable selection { OUString aLegendParticle( ObjectIdentifier::createParticleForLegend( m_xLegend, m_xModel ) ); - ShapeFactory::setShapeName( m_xShape, ObjectIdentifier::createClassifiedIdentifierForParticle( aLegendParticle ) ); + AbstractShapeFactory::setShapeName( m_xShape, ObjectIdentifier::createClassifiedIdentifierForParticle( aLegendParticle ) ); } // create and insert sub-shapes @@ -894,7 +894,7 @@ void VLegend::createShapes( Reference< beans::XPropertySet >( xBorder, uno::UNO_QUERY )); //because of this name this border will be used for marking the legend - ShapeFactory(m_xShapeFactory).setShapeName( xBorder, "MarkHandles" ); + AbstractShapeFactory::setShapeName( xBorder, "MarkHandles" ); } // create entries diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx index b3b1a1580cd0..45882738af53 100644 --- a/chart2/source/view/main/VLegendSymbolFactory.cxx +++ b/chart2/source/view/main/VLegendSymbolFactory.cxx @@ -20,7 +20,7 @@ #include "VLegendSymbolFactory.hxx" #include "macros.hxx" #include "PropertyMapper.hxx" -#include "ShapeFactory.hxx" +#include "AbstractShapeFactory.hxx" #include "ObjectIdentifier.hxx" #include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/chart2/Symbol.hpp> @@ -110,7 +110,7 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( return xResult; // add an invisible square box to maintain aspect ratio - Reference< drawing::XShape > xBound( ShapeFactory(xShapeFactory).createInvisibleRectangle( + Reference< drawing::XShape > xBound( AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory)->createInvisibleRectangle( xResultGroup, rEntryKeyAspectRatio )); // create symbol @@ -136,7 +136,7 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( { drawing::Direction3D aSymbolSize( nSize, nSize, 0 ); drawing::Position3D aPos( rEntryKeyAspectRatio.Width/2, rEntryKeyAspectRatio.Height/2, 0 ); - ShapeFactory aFactory( xShapeFactory ); + AbstractShapeFactory* pFactory = AbstractShapeFactory::getOrCreateShapeFactory( xShapeFactory ); if( aSymbol.Style == chart2::SymbolStyle_STANDARD ) { // take series color as fill color @@ -144,7 +144,7 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( // border of symbols always same as fill color aSymbol.BorderColor = aSymbol.FillColor; - xSymbol.set( aFactory.createSymbol2D( + xSymbol.set( pFactory->createSymbol2D( xResultGroup, aPos, aSymbolSize, @@ -154,7 +154,7 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( } else if( aSymbol.Style == chart2::SymbolStyle_GRAPHIC ) { - xSymbol.set( aFactory.createGraphic2D( + xSymbol.set( pFactory->createGraphic2D( xResultGroup, aPos, aSymbolSize, |