chart2/inc/ChartView.hxx | 1 chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx | 2 chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx | 6 chart2/source/inc/AxisHelper.hxx | 2 chart2/source/inc/chartview/ExplicitValueProvider.hxx | 2 chart2/source/inc/macros.hxx | 1 chart2/source/tools/AxisHelper.cxx | 6 chart2/source/tools/ExplicitCategoriesProvider.cxx | 2 chart2/source/view/axes/Tickmarks.cxx | 29 -- chart2/source/view/axes/Tickmarks.hxx | 8 chart2/source/view/axes/VAxisBase.cxx | 25 -- chart2/source/view/axes/VAxisBase.hxx | 9 chart2/source/view/axes/VCartesianAxis.cxx | 118 ++-------- chart2/source/view/axes/VCartesianAxis.hxx | 10 chart2/source/view/axes/VCartesianCoordinateSystem.cxx | 22 - chart2/source/view/axes/VCartesianCoordinateSystem.hxx | 2 chart2/source/view/axes/VCoordinateSystem.cxx | 41 --- chart2/source/view/axes/VPolarCoordinateSystem.cxx | 9 chart2/source/view/axes/VPolarCoordinateSystem.hxx | 2 chart2/source/view/inc/VCoordinateSystem.hxx | 9 chart2/source/view/main/ChartView.cxx | 70 ++--- 21 files changed, 101 insertions(+), 275 deletions(-)
New commits: commit 31375f662517d864e90c0dcc040606d7ca8776c0 Author: Michael Stahl <[email protected]> Date: Mon Oct 20 14:56:32 2014 +0200 chart2: fix memory leak due to cyclic reference in VAxisBase The VAxisBase::m_xNumberFormatsSupplier refers to the ChartModel itself, and apparently that is a cyclic reference. Naively using the ChartModel's m_xNumberFormatsSupplier in ChartView::impl_createDiagramAndContent() because it will later be passed to AxisHelper::getExplicitNumberFormatKeyForAxis(), which expects to be able to convert it to a ChartModel. Since passing around the ChartModel as an XNumberFormattingSupplier is sort of un-intuitive anyway, refactor some methods to use XChartDocument instead, and only create the VPolarAxis / VCartesianAxis with the ChartModel's m_xNumberFormatsSupplier. The drawback is that if ChartModel::attachNumberFormatsSupplier() is called after ChartView::update() has created the axes, it may not have an effect on them; not sure if that is a real or hypothetical problem. Change-Id: Ib5f0d5882b85adaf44f80e086f19178b3e64882f diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx index 1588a2f..afdebd1 100644 --- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx +++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx @@ -158,7 +158,7 @@ sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForAxis( xAxis, ChartModelHelper::findDiagram( m_xChartModel ) ) ); return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( xAxis, xCooSys - , Reference< util::XNumberFormatsSupplier >( m_xChartModel.get(), uno::UNO_QUERY ) ); + , getChart2Document()); } sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForSeries( diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index e2cd620..76f7d68 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -363,7 +363,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) ); sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( - xCrossingMainAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) ); + xCrossingMainAxis, xCooSys, m_xChartDoc); rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey )); } @@ -407,7 +407,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) ); sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( - m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) ); + m_xAxis, xCooSys, m_xChartDoc); rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey )); } @@ -948,7 +948,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) ); sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( - m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) ); + m_xAxis, xCooSys, m_xChartDoc); aValue <<= nFormatKey; } diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx index 3aff9dd..803532c 100644 --- a/chart2/source/inc/AxisHelper.hxx +++ b/chart2/source/inc/AxisHelper.hxx @@ -57,7 +57,7 @@ public: static sal_Int32 getExplicitNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCorrespondingCoordinateSystem - , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument>& xChartDoc , bool bSearchForParallelAxisIfNothingIsFound ); static ::com::sun::star::uno::Reference< diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx index b18381c..934f22f 100644 --- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx +++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx @@ -86,7 +86,7 @@ public: static sal_Int32 getExplicitNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem - , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument>& xChartDoc); static sal_Int32 getExplicitNumberFormatKeyForDataLabel( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index acc7570..d60b031 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -132,7 +132,7 @@ void AxisHelper::checkDateAxis( chart2::ScaleData& rScale, ExplicitCategoriesPro sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( const Reference< chart2::XAxis >& xAxis , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem - , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const Reference<chart2::XChartDocument>& xChartDoc , bool bSearchForParallelAxisIfNothingIsFound ) { sal_Int32 nNumberFormatKey(0); @@ -140,7 +140,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( sal_Int32 nAxisIndex = 0; sal_Int32 nDimensionIndex = 1; AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex ); - Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY ); + Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier(xChartDoc, uno::UNO_QUERY); Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY ); if (!xProp.is()) @@ -321,7 +321,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( { sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1; Reference< XAxis > xParallelAxis( AxisHelper::getAxis( 1, nParallelAxisIndex, xCorrespondingCoordinateSystem ) ); - nNumberFormatKey = AxisHelper::getExplicitNumberFormatKeyForAxis( xParallelAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier, false ); + nNumberFormatKey = AxisHelper::getExplicitNumberFormatKeyForAxis(xParallelAxis, xCorrespondingCoordinateSystem, xChartDoc, false); } } } diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 51ee17e..a576071 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -183,7 +183,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr { Reference< chart2::XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) ); nAxisNumberFormat = AxisHelper::getExplicitNumberFormatKeyForAxis( - xAxis, xCooSysModel, uno::Reference< util::XNumberFormatsSupplier> (static_cast< ::cppu::OWeakObject* >( &rModel ), uno::UNO_QUERY), false ); + xAxis, xCooSysModel, uno::Reference<chart2::XChartDocument>(static_cast< ::cppu::OWeakObject* >(&rModel), uno::UNO_QUERY), false ); } sal_Int32 nLabelColor; diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx index 79005bf..9ca6286 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -94,11 +94,16 @@ void VCartesianCoordinateSystem::createGridShapes() } void VCartesianCoordinateSystem::createVAxisList( - const uno::Reference< util::XNumberFormatsSupplier > & xNumberFormatsSupplier + const uno::Reference<chart2::XChartDocument> & xChartDoc , const awt::Size& rFontReferenceSize , const awt::Rectangle& rMaximumSpaceForLabels ) { + // note: using xChartDoc itself as XNumberFormatsSupplier would cause + // a leak from VCartesianAxis due to cyclic reference + uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( + dynamic_cast<ChartModel*>(xChartDoc.get())->getNumberFormatsSupplier()); + m_aAxisMap.clear(); sal_Int32 nDimensionCount = m_xCooSysModel->getDimension(); @@ -144,7 +149,7 @@ void VCartesianCoordinateSystem::createVAxisList( } aAxisProperties.init(true); if(aAxisProperties.m_bDisplayLabels) - aAxisProperties.m_nNumberFormatKey = this->getNumberFormatKeyForAxis( xAxis, xNumberFormatsSupplier ); + aAxisProperties.m_nNumberFormatKey = this->getNumberFormatKeyForAxis(xAxis, xChartDoc); ::boost::shared_ptr< VAxisBase > apVAxis( new VCartesianAxis(aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount) ); tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex ); diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx index 71bdbf4..b5a5cc4 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx @@ -34,7 +34,7 @@ public: virtual ~VCartesianCoordinateSystem(); virtual void createVAxisList( - const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument> &ChartDoc , const ::com::sun::star::awt::Size& rFontReferenceSize , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels ) SAL_OVERRIDE; diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index 7e88097..3e8dd8b 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -342,7 +342,7 @@ sal_Int32 VCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensio } void VCoordinateSystem::createVAxisList( - const uno::Reference< util::XNumberFormatsSupplier > & /* xNumberFormatsSupplier */ + const uno::Reference<chart2::XChartDocument> & /* xChartDoc */ , const awt::Size& /* rFontReferenceSize */ , const awt::Rectangle& /* rMaximumSpaceForLabels */ ) @@ -573,10 +573,10 @@ void VCoordinateSystem::setSeriesNamesForAxis( const Sequence< OUString >& rSeri sal_Int32 VCoordinateSystem::getNumberFormatKeyForAxis( const Reference< chart2::XAxis >& xAxis - , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) + , const Reference<chart2::XChartDocument>& xChartDoc) { return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( - xAxis, m_xCooSysModel, xNumberFormatsSupplier ); + xAxis, m_xCooSysModel, xChartDoc); } } //namespace chart diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx index 50a8ce5..fe5caa4 100644 --- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx +++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx @@ -62,11 +62,16 @@ uno::Sequence< sal_Int32 > VPolarCoordinateSystem::getCoordinateSystemResolution } void VPolarCoordinateSystem::createVAxisList( - const uno::Reference< util::XNumberFormatsSupplier > & xNumberFormatsSupplier + const uno::Reference<chart2::XChartDocument> & xChartDoc , const awt::Size& rFontReferenceSize , const awt::Rectangle& rMaximumSpaceForLabels ) { + // note: using xChartDoc itself as XNumberFormatsSupplier would cause + // a leak from VPolarAxis due to cyclic reference + uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( + dynamic_cast<ChartModel*>(xChartDoc.get())->getNumberFormatsSupplier()); + m_aAxisMap.clear(); sal_Int32 nDimensionCount = m_xCooSysModel->getDimension(); sal_Int32 nDimensionIndex = 0; @@ -83,7 +88,7 @@ void VPolarCoordinateSystem::createVAxisList( AxisProperties aAxisProperties(xAxis,this->getExplicitCategoriesProvider()); aAxisProperties.init(); if(aAxisProperties.m_bDisplayLabels) - aAxisProperties.m_nNumberFormatKey = this->getNumberFormatKeyForAxis( xAxis, xNumberFormatsSupplier ); + aAxisProperties.m_nNumberFormatKey = this->getNumberFormatKeyForAxis(xAxis, xChartDoc); ::boost::shared_ptr< VAxisBase > apVAxis( VPolarAxis::createAxis( aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount) ); tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex ); diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.hxx b/chart2/source/view/axes/VPolarCoordinateSystem.hxx index b5c5b85..135c3c1 100644 --- a/chart2/source/view/axes/VPolarCoordinateSystem.hxx +++ b/chart2/source/view/axes/VPolarCoordinateSystem.hxx @@ -38,7 +38,7 @@ public: , const ::com::sun::star::awt::Size& rPageResolution ) SAL_OVERRIDE; virtual void createVAxisList( - const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument> & xChartDoc , const ::com::sun::star::awt::Size& rFontReferenceSize , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels ) SAL_OVERRIDE; diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx index 1420c9c..97fa85a 100644 --- a/chart2/source/view/inc/VCoordinateSystem.hxx +++ b/chart2/source/view/inc/VCoordinateSystem.hxx @@ -105,7 +105,7 @@ public: * Create "view" axis obejcts 'VAxis' from the coordinate system model. */ virtual void createVAxisList( - const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument> & xChartDoc , const ::com::sun::star::awt::Size& rFontReferenceSize , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels ); @@ -145,7 +145,7 @@ protected: //methods sal_Int32 getNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis , const ::com::sun::star::uno::Reference< - ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + ::com::sun::star::chart2::XChartDocument>& xChartDoc); private: //methods void impl_adjustDimension( sal_Int32& rDimensionIndex ) const; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 2f8abb3..769c007 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1528,7 +1528,9 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D SeriesPlottersType& rSeriesPlotterList = rParam.mpSeriesPlotterContainer->getSeriesPlotterList(); //create VAxis, so they can give necessary information for automatic scaling - uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( static_cast< ::cppu::OWeakObject* >( &mrChartModel ), uno::UNO_QUERY ); + uno::Reference<chart2::XChartDocument> const xChartDoc(&mrChartModel); + uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( + mrChartModel.getNumberFormatsSupplier()); size_t nC = 0; for( nC=0; nC < m_aVCooSysList.size(); nC++) { @@ -1542,7 +1544,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D pVCooSys->set3DWallPositions( eLeftWallPos, eBackWallPos, eBottomPos ); } - pVCooSys->createVAxisList(xNumberFormatsSupplier, rPageSize, rParam.maRemainingSpace); + pVCooSys->createVAxisList(xChartDoc, rPageSize, rParam.maRemainingSpace); } // - prepare list of all axis and how they are used @@ -1959,9 +1961,9 @@ bool lcl_getPropertySwapXAndYAxis( const uno::Reference< XDiagram >& xDiagram ) sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( const Reference< chart2::XAxis >& xAxis , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem - , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) + , const Reference<chart2::XChartDocument>& xChartDoc) { - return AxisHelper::getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier + return AxisHelper::getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, xChartDoc , true /*bSearchForParallelAxisIfNothingIsFound*/ ); } commit 2cd354e47df13de857c3f676034066e9a7e5077c Author: Kohei Yoshida <[email protected]> Date: Mon Oct 20 18:35:17 2014 -0400 Mark these methods const. Change-Id: Idf53b85d962406caf9ca1df636fffd8b3459baf5 diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index be13e64..e40c433 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -428,8 +428,8 @@ TickInfo* MaxLabelTickIter::nextInfo() return 0; } -bool VCartesianAxis::isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties - , bool bIsHorizontalAxis ) +bool VCartesianAxis::isBreakOfLabelsAllowed( + const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis ) const { if( m_aTextLabels.getLength() > 100 ) return false; @@ -446,8 +446,8 @@ bool VCartesianAxis::isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLab return bIsHorizontalAxis; } -bool VCartesianAxis::isAutoStaggeringOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties - , bool bIsHorizontalAxis, bool bIsVerticalAxis ) +bool VCartesianAxis::isAutoStaggeringOfLabelsAllowed( + const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis ) const { if( rAxisLabelProperties.eStaggering != STAGGER_AUTO ) return false; diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx index e3f26a8..574bc2f 100644 --- a/chart2/source/view/axes/VCartesianAxis.hxx +++ b/chart2/source/view/axes/VCartesianAxis.hxx @@ -121,9 +121,9 @@ protected: //methods void doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties , TickFactory2D* pTickFactory2D ); - bool isAutoStaggeringOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties - , bool bIsHorizontalAxis, bool bIsVerticalAxis ); - bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis ); + bool isAutoStaggeringOfLabelsAllowed( + const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis ) const; + bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis ) const; ::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const; ScreenPosAndLogicPos getScreenPosAndLogicPos( double fLogicX, double fLogicY, double fLogicZ ) const; commit 7171216653ef5647a58238f8d01b3d90a24d9b01 Author: Kohei Yoshida <[email protected]> Date: Mon Oct 20 18:04:01 2014 -0400 Revert "Reset VCoordinateSystem instances rather than deleting and creating them." This reverts commit 154f2a77e726cf04014e9c8548da7f8aad6ef01b. diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index 7b6e02b..7e88097 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -89,38 +89,10 @@ VCoordinateSystem::VCoordinateSystem( const Reference< XCoordinateSystem >& xCoo m_aExplicitScales[2].Orientation = AxisOrientation_MATHEMATICAL; } } - VCoordinateSystem::~VCoordinateSystem() { } -void VCoordinateSystem::reset() -{ - m_xLogicTargetForGrids.clear(); - m_xLogicTargetForAxes.clear(); - m_xFinalTarget.clear(); - m_xShapeFactory.clear(); - m_aMatrixSceneToScreen = drawing::HomogenMatrix(); - m_eLeftWallPos = CuboidPlanePosition_Left; - m_eBackWallPos = CuboidPlanePosition_Back; - m_eBottomPos = CuboidPlanePosition_Bottom; - m_aMergedMinMaxSupplier.clearMinimumAndMaximumSupplierList(); - m_aSeriesNamesForZAxis.realloc(0); - - m_aExplicitScales.clear(); - m_aExplicitScales.resize(3); - - m_aExplicitIncrements.clear(); - m_aExplicitIncrements.resize(3); - - m_aSecondaryExplicitScales.clear(); - m_aSecondaryExplicitIncrements.clear(); - - m_apExplicitCategoriesProvider.reset(); - - m_aAxisMap.clear(); // TODO : switch to reset() later. -} - void VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget , const Reference< drawing::XShapes >& xFinalTarget , const Reference< lang::XMultiServiceFactory >& xShapeFactory diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx index f94beba..1420c9c 100644 --- a/chart2/source/view/inc/VCoordinateSystem.hxx +++ b/chart2/source/view/inc/VCoordinateSystem.hxx @@ -51,8 +51,6 @@ public: static VCoordinateSystem* createCoordinateSystem( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel ); - void reset(); - virtual void initPlottingTargets( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xLogicTarget diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 439d1f6..2f8abb3 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -356,36 +356,35 @@ VCoordinateSystem* addCooSysToList( std::vector< VCoordinateSystem* >& rVCooSysL , const uno::Reference< XCoordinateSystem >& xCooSys , ChartModel& rChartModel ) { - VCoordinateSystem* pVCooSys = findInCooSysList(rVCooSysList, xCooSys); - if (!pVCooSys) + VCoordinateSystem* pVCooSys = findInCooSysList( rVCooSysList, xCooSys ); + if( !pVCooSys ) { - // First time being created. Add it to the list and generate CID for it. - pVCooSys = VCoordinateSystem::createCoordinateSystem(xCooSys); - rVCooSysList.push_back(pVCooSys); - - OUString aCooSysParticle = - ObjectIdentifier::createParticleForCoordinateSystem(xCooSys, rChartModel); + pVCooSys = VCoordinateSystem::createCoordinateSystem(xCooSys ); + if(pVCooSys) + { + OUString aCooSysParticle( ObjectIdentifier::createParticleForCoordinateSystem( xCooSys, rChartModel ) ); + pVCooSys->setParticle(aCooSysParticle); - pVCooSys->setParticle(aCooSysParticle); - } + pVCooSys->setExplicitCategoriesProvider( new ExplicitCategoriesProvider(xCooSys, rChartModel) ); - if (pVCooSys) - { - pVCooSys->setExplicitCategoriesProvider( - new ExplicitCategoriesProvider(xCooSys, rChartModel)); + rVCooSysList.push_back( pVCooSys ); + } } - return pVCooSys; } void SeriesPlotterContainer::resetCoordinateSystems() { - std::vector<VCoordinateSystem*>::iterator it = m_rVCooSysList.begin(), itEnd = m_rVCooSysList.end(); - for (; it != itEnd; ++it) + //delete all coordinate systems + ::std::vector< VCoordinateSystem* > aVectorToDeleteObjects; + ::std::swap( aVectorToDeleteObjects, m_rVCooSysList );//#i109770# + ::std::vector< VCoordinateSystem* >::const_iterator aIter = aVectorToDeleteObjects.begin(); + const ::std::vector< VCoordinateSystem* >::const_iterator aEnd = aVectorToDeleteObjects.end(); + for( ; aIter != aEnd; ++aIter ) { - VCoordinateSystem* p = *it; - p->reset(); + delete *aIter; } + aVectorToDeleteObjects.clear(); } void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( commit f9351e78438ca2a6bb3b12552849af1f9fe1cf72 Author: Kohei Yoshida <[email protected]> Date: Mon Oct 20 18:03:03 2014 -0400 Revert "Add macro to enable/disable axis shape caching." This reverts commit 7d0df998f7eb9e3a6f65f3a44c26d94e1a1ced7e. diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 4308dbe..d155c45 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -211,6 +211,7 @@ private: //methods , bool bUseHighContrast ); SdrPage* getSdrPage(); + void impl_deleteCoordinateSystems(); void impl_notifyModeChangeListener( const OUString& rNewMode ); void impl_refreshAddIn(); diff --git a/chart2/source/inc/macros.hxx b/chart2/source/inc/macros.hxx index 9e620f5..2319afe 100644 --- a/chart2/source/inc/macros.hxx +++ b/chart2/source/inc/macros.hxx @@ -31,7 +31,6 @@ ex.Message ) #define ENABLE_GL3D_BARCHART 1 -#define ENABLE_AXIS_SHAPE_CACHE 0 #endif diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index 25b7149..7b6e02b 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -94,7 +94,6 @@ VCoordinateSystem::~VCoordinateSystem() { } -#if ENABLE_AXIS_SHAPE_CACHE void VCoordinateSystem::reset() { m_xLogicTargetForGrids.clear(); @@ -121,7 +120,6 @@ void VCoordinateSystem::reset() m_aAxisMap.clear(); // TODO : switch to reset() later. } -#endif void VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget , const Reference< drawing::XShapes >& xFinalTarget diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx index 482fdc5..f94beba 100644 --- a/chart2/source/view/inc/VCoordinateSystem.hxx +++ b/chart2/source/view/inc/VCoordinateSystem.hxx @@ -24,7 +24,6 @@ #include "ThreeDHelper.hxx" #include "ExplicitCategoriesProvider.hxx" #include "chartview/ExplicitScaleValues.hxx" -#include <macros.hxx> #include <com/sun/star/chart2/XCoordinateSystem.hpp> #include <com/sun/star/awt/Rectangle.hpp> @@ -52,9 +51,7 @@ public: static VCoordinateSystem* createCoordinateSystem( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel ); -#if ENABLE_AXIS_SHAPE_CACHE void reset(); -#endif virtual void initPlottingTargets( const ::com::sun::star::uno::Reference< diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 9774a29..439d1f6 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -378,31 +378,14 @@ VCoordinateSystem* addCooSysToList( std::vector< VCoordinateSystem* >& rVCooSysL return pVCooSys; } -void deleteCoordinateSystems( std::vector<VCoordinateSystem*>& rVCooSysList ) -{ - ::std::vector< VCoordinateSystem* > aVectorToDeleteObjects; - aVectorToDeleteObjects.swap(rVCooSysList); //#i109770# - ::std::vector< VCoordinateSystem* >::const_iterator aIter = aVectorToDeleteObjects.begin(); - const ::std::vector< VCoordinateSystem* >::const_iterator aEnd = aVectorToDeleteObjects.end(); - for( ; aIter != aEnd; ++aIter ) - { - delete *aIter; - } - aVectorToDeleteObjects.clear(); -} - void SeriesPlotterContainer::resetCoordinateSystems() { -#if ENABLE_AXIS_SHAPE_CACHE std::vector<VCoordinateSystem*>::iterator it = m_rVCooSysList.begin(), itEnd = m_rVCooSysList.end(); for (; it != itEnd; ++it) { VCoordinateSystem* p = *it; p->reset(); } -#else - deleteCoordinateSystems(m_rVCooSysList); -#endif } void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( @@ -1201,7 +1184,21 @@ ChartView::~ChartView() m_pDrawModelWrapper.reset(); } m_xDrawPage = NULL; - deleteCoordinateSystems(m_aVCooSysList); + impl_deleteCoordinateSystems(); +} + +void ChartView::impl_deleteCoordinateSystems() +{ + //delete all coordinate systems + ::std::vector< VCoordinateSystem* > aVectorToDeleteObjects; + ::std::swap( aVectorToDeleteObjects, m_aVCooSysList );//#i109770# + ::std::vector< VCoordinateSystem* >::const_iterator aIter = aVectorToDeleteObjects.begin(); + const ::std::vector< VCoordinateSystem* >::const_iterator aEnd = aVectorToDeleteObjects.end(); + for( ; aIter != aEnd; ++aIter ) + { + delete *aIter; + } + aVectorToDeleteObjects.clear(); } // datatransfer::XTransferable commit 9641605ccdede68d1a5fcdcdd1da3b4519a84cde Author: Kohei Yoshida <[email protected]> Date: Mon Oct 20 18:02:47 2014 -0400 Revert "More on caching axis label text shapes. Still disabled." This reverts commit b83a034b6977bd83057e14f06eb044659f9ca82e. diff --git a/chart2/source/view/axes/Tickmarks.cxx b/chart2/source/view/axes/Tickmarks.cxx index 78fe7be..a8cd9a5 100644 --- a/chart2/source/view/axes/Tickmarks.cxx +++ b/chart2/source/view/axes/Tickmarks.cxx @@ -58,18 +58,11 @@ sal_Int32 TickInfo::getScreenDistanceBetweenTicks( const TickInfo& rOherTickInfo return nRet; } -uno::Reference<drawing::XShape> TickIter::getTextShape() +PureTickIter::PureTickIter( TickInfoArrayType& rTickInfoVector ) + : m_rTickVector(rTickInfoVector) + , m_aTickIter(m_rTickVector.begin()) { - return uno::Reference<drawing::XShape>(); } - -PureTickIter::PureTickIter( TickInfoArrayType& rTickInfoVector, const TickLabelArrayType* pLabels ) : - m_rTickVector(rTickInfoVector), - mpLabels(pLabels), - m_aTickIter(m_rTickVector.begin()) -{ -} - PureTickIter::~PureTickIter() { } @@ -91,22 +84,6 @@ TickInfo* PureTickIter::nextInfo() return 0; } -uno::Reference<drawing::XShape> PureTickIter::getTextShape() -{ - uno::Reference<drawing::XShape> xShape; - if (!mpLabels) - return xShape; - - if (m_aTickIter == m_rTickVector.end()) - return xShape; - - size_t nPos = std::distance(m_rTickVector.begin(), m_aTickIter); - if (nPos >= mpLabels->size()) - return xShape; - - return (*mpLabels)[nPos]; -} - TickFactory::TickFactory( const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement ) : m_rScale( rScale ) diff --git a/chart2/source/view/axes/Tickmarks.hxx b/chart2/source/view/axes/Tickmarks.hxx index 352ef2a..15e83eb 100644 --- a/chart2/source/view/axes/Tickmarks.hxx +++ b/chart2/source/view/axes/Tickmarks.hxx @@ -56,30 +56,24 @@ private: typedef std::vector<TickInfo> TickInfoArrayType; typedef std::vector<TickInfoArrayType> TickInfoArraysType; -typedef std::vector<css::uno::Reference<css::drawing::XShape> > TickLabelArrayType; -typedef std::vector<TickLabelArrayType> TickLabelArraysType; - class TickIter { public: virtual ~TickIter() {} virtual TickInfo* firstInfo() = 0; virtual TickInfo* nextInfo() = 0; - virtual css::uno::Reference<css::drawing::XShape> getTextShape(); }; class PureTickIter : public TickIter { public: - PureTickIter( TickInfoArrayType& rTickInfoVector, const TickLabelArrayType* pLabels ); + PureTickIter( TickInfoArrayType& rTickInfoVector ); virtual ~PureTickIter(); virtual TickInfo* firstInfo() SAL_OVERRIDE; virtual TickInfo* nextInfo() SAL_OVERRIDE; - virtual css::uno::Reference<css::drawing::XShape> getTextShape() SAL_OVERRIDE; private: TickInfoArrayType& m_rTickVector; - const TickLabelArrayType* mpLabels; TickInfoArrayType::iterator m_aTickIter; }; diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx index 1524e77..c391382 100644 --- a/chart2/source/view/axes/VAxisBase.cxx +++ b/chart2/source/view/axes/VAxisBase.cxx @@ -49,31 +49,6 @@ VAxisBase::~VAxisBase() { } -#if ENABLE_AXIS_SHAPE_CACHE -void VAxisBase::reset() -{ -} - -void VAxisBase::copyShapes( const VAxisBase& r ) -{ - TickLabelArraysType aNewTickLabels; - TickInfoArraysType::const_iterator it = r.m_aAllTickInfos.begin(), itEnd = r.m_aAllTickInfos.end(); - for (; it != itEnd; ++it) - { - aNewTickLabels.push_back(TickLabelArrayType()); - TickLabelArrayType& rLabelArray = aNewTickLabels.back(); - TickInfoArrayType::const_iterator it2 = it->begin(), it2End = it->end(); - for (; it2 != it2End; ++it2) - { - const TickInfo& rOldTick = *it2; - rLabelArray.push_back(rOldTick.xTextShape); - } - } - - m_aAllTickLabels.swap(aNewTickLabels); -} -#endif - void VAxisBase::initAxisLabelProperties( const ::com::sun::star::awt::Size& rFontReferenceSize , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels ) { diff --git a/chart2/source/view/axes/VAxisBase.hxx b/chart2/source/view/axes/VAxisBase.hxx index 980c170..d43ef58 100644 --- a/chart2/source/view/axes/VAxisBase.hxx +++ b/chart2/source/view/axes/VAxisBase.hxx @@ -22,8 +22,6 @@ #include "VAxisOrGridBase.hxx" #include "VAxisProperties.hxx" #include "Tickmarks.hxx" -#include <macros.hxx> - #include <com/sun/star/util/XNumberFormatsSupplier.hpp> namespace chart @@ -41,11 +39,6 @@ public: ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); virtual ~VAxisBase(); -#if ENABLE_AXIS_SHAPE_CACHE - void reset(); - void copyShapes( const VAxisBase& r ); -#endif - /** * Return the number of dimensions the diagram has. 2 for x and y, and 3 * for x, y, and z. @@ -104,8 +97,6 @@ protected: //member * which has multi-level axis labels. */ TickInfoArraysType m_aAllTickInfos; - TickLabelArraysType m_aAllTickLabels; - bool m_bReCreateAllTickInfos; bool m_bRecordMaximumTextSize; diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 968770d..be13e64 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -218,7 +218,7 @@ private: //member LabelIterator::LabelIterator( TickInfoArrayType& rTickInfoVector , const AxisLabelStaggering eAxisLabelStaggering , bool bInnerLine ) - : m_aPureTickIter(rTickInfoVector, NULL) + : m_aPureTickIter( rTickInfoVector ) , m_eAxisLabelStaggering(eAxisLabelStaggering) , m_bInnerLine(bInnerLine) { @@ -375,25 +375,23 @@ bool lcl_hasWordBreak( const Reference< drawing::XShape >& rxShape ) class MaxLabelTickIter : public TickIter { public: - MaxLabelTickIter( TickInfoArrayType& rTickInfoVector, sal_Int32 nLongestLabelIndex, const TickLabelArrayType* pLabels ); + MaxLabelTickIter( TickInfoArrayType& rTickInfoVector + , sal_Int32 nLongestLabelIndex ); virtual ~MaxLabelTickIter(); virtual TickInfo* firstInfo() SAL_OVERRIDE; virtual TickInfo* nextInfo() SAL_OVERRIDE; - virtual uno::Reference<drawing::XShape> getTextShape() SAL_OVERRIDE; private: TickInfoArrayType& m_rTickInfoVector; - const TickLabelArrayType* mpTickLabels; ::std::vector< sal_Int32 > m_aValidIndices; - size_t m_nCurrentIndex; + sal_Int32 m_nCurrentIndex; }; -MaxLabelTickIter::MaxLabelTickIter( - TickInfoArrayType& rTickInfoVector, sal_Int32 nLongestLabelIndex, const TickLabelArrayType* pLabels ) : - m_rTickInfoVector(rTickInfoVector), - mpTickLabels(pLabels), - m_nCurrentIndex(0) +MaxLabelTickIter::MaxLabelTickIter( TickInfoArrayType& rTickInfoVector + , sal_Int32 nLongestLabelIndex ) + : m_rTickInfoVector(rTickInfoVector) + , m_nCurrentIndex(0) { sal_Int32 nMaxIndex = m_rTickInfoVector.size()-1; if( nLongestLabelIndex<0 || nLongestLabelIndex>=nMaxIndex-1 ) @@ -417,7 +415,7 @@ MaxLabelTickIter::~MaxLabelTickIter() TickInfo* MaxLabelTickIter::firstInfo() { m_nCurrentIndex = 0; - if (m_nCurrentIndex < m_aValidIndices.size()) + if( m_nCurrentIndex < static_cast<sal_Int32>(m_aValidIndices.size()) ) return &m_rTickInfoVector[m_aValidIndices[m_nCurrentIndex]]; return 0; } @@ -425,23 +423,11 @@ TickInfo* MaxLabelTickIter::firstInfo() TickInfo* MaxLabelTickIter::nextInfo() { m_nCurrentIndex++; - if (m_nCurrentIndex < m_aValidIndices.size()) + if( m_nCurrentIndex>=0 && m_nCurrentIndex<static_cast<sal_Int32>(m_aValidIndices.size()) ) return &m_rTickInfoVector[m_aValidIndices[m_nCurrentIndex]]; return 0; } -uno::Reference<drawing::XShape> MaxLabelTickIter::getTextShape() -{ - uno::Reference<drawing::XShape> xShape; - if (!mpTickLabels) - return xShape; - - if (m_nCurrentIndex >= mpTickLabels->size()) - return xShape; - - return (*mpTickLabels)[m_nCurrentIndex]; -} - bool VCartesianAxis::isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties , bool bIsHorizontalAxis ) { @@ -580,19 +566,14 @@ void VCartesianAxis::createAllTickInfos( TickInfoArraysType& rAllTickInfos ) VAxisBase::createAllTickInfos(rAllTickInfos); } -TickIter* VCartesianAxis::createLabelTickIterator( size_t nTextLevel ) +TickIter* VCartesianAxis::createLabelTickIterator( sal_Int32 nTextLevel ) { - if (nTextLevel >= m_aAllTickInfos.size()) - return NULL; - - const TickLabelArrayType* pLabels = NULL; - if (nTextLevel < m_aAllTickLabels.size()) - pLabels = &m_aAllTickLabels[nTextLevel]; - - return new PureTickIter(m_aAllTickInfos[nTextLevel], pLabels); + if( nTextLevel>=0 && nTextLevel < static_cast< sal_Int32 >(m_aAllTickInfos.size()) ) + return new PureTickIter( m_aAllTickInfos[nTextLevel] ); + return NULL; } -TickIter* VCartesianAxis::createMaximumLabelTickIterator( size_t nTextLevel ) +TickIter* VCartesianAxis::createMaximumLabelTickIterator( sal_Int32 nTextLevel ) { if( isComplexCategoryAxis() || isDateAxis() ) { @@ -605,8 +586,7 @@ TickIter* VCartesianAxis::createMaximumLabelTickIterator( size_t nTextLevel ) if( !m_aAllTickInfos.empty() ) { sal_Int32 nLongestLabelIndex = m_bUseTextLabels ? this->getIndexOfLongestLabel( m_aTextLabels ) : 0; - const TickLabelArrayType* pLabels = m_aAllTickLabels.empty() ? NULL : &m_aAllTickLabels[0]; - return new MaxLabelTickIter( m_aAllTickInfos[0], nLongestLabelIndex, pLabels ); + return new MaxLabelTickIter( m_aAllTickInfos[0], nLongestLabelIndex ); } } } @@ -759,21 +739,10 @@ bool VCartesianAxis::createTextShapes( //create single label if(!pTickInfo->xTextShape.is()) - { - uno::Reference<drawing::XShape> xCached = rTickIter.getTextShape(); - if (xCached.is()) - { - xTarget->add(xCached); - pTickInfo->xTextShape = xCached; - } - else - { - pTickInfo->xTextShape = createSingleLabel( - m_xShapeFactory, xTarget, aAnchorScreenPosition2D, aLabel, - rAxisLabelProperties, m_aAxisProperties, aPropNames, aPropValues); - } - } - + pTickInfo->xTextShape = createSingleLabel( m_xShapeFactory, xTarget + , aAnchorScreenPosition2D, aLabel + , rAxisLabelProperties, m_aAxisProperties + , aPropNames, aPropValues ); if(!pTickInfo->xTextShape.is()) continue; @@ -1312,7 +1281,7 @@ void VCartesianAxis::hideIdenticalScreenValues( TickInfoArraysType& rTickInfos ) sal_Int32 nCount = rTickInfos.size(); for( sal_Int32 nN=0; nN<nCount; nN++ ) { - PureTickIter aTickIter(rTickInfos[nN], NULL); + PureTickIter aTickIter( rTickInfos[nN] ); lcl_hideIdenticalScreenValues( aTickIter ); } } diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx index ad94f76..e3f26a8 100644 --- a/chart2/source/view/axes/VCartesianAxis.hxx +++ b/chart2/source/view/axes/VCartesianAxis.hxx @@ -47,8 +47,8 @@ public: virtual void createAllTickInfos( TickInfoArraysType& rAllTickInfos ) SAL_OVERRIDE; void createAllTickInfosFromComplexCategories( TickInfoArraysType& rAllTickInfos, bool bShiftedPosition ); - TickIter* createLabelTickIterator( size_t nTextLevel ); - TickIter* createMaximumLabelTickIterator( size_t nTextLevel ); + TickIter* createLabelTickIterator( sal_Int32 nTextLevel ); + TickIter* createMaximumLabelTickIterator( sal_Int32 nTextLevel ); sal_Int32 getTextLevelCount() const; virtual TickFactory* createTickFactory() SAL_OVERRIDE; diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx index 15730a7..79005bf 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -99,8 +99,7 @@ void VCartesianCoordinateSystem::createVAxisList( , const awt::Rectangle& rMaximumSpaceForLabels ) { - tVAxisMap aOldAxisMap; - aOldAxisMap.swap(m_aAxisMap); + m_aAxisMap.clear(); sal_Int32 nDimensionCount = m_xCooSysModel->getDimension(); bool bSwapXAndY = this->getPropertySwapXAndYAxis(); @@ -149,16 +148,6 @@ void VCartesianCoordinateSystem::createVAxisList( ::boost::shared_ptr< VAxisBase > apVAxis( new VCartesianAxis(aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount) ); tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex ); - -#if ENABLE_AXIS_SHAPE_CACHE - tVAxisMap::iterator it = aOldAxisMap.find(aFullAxisIndex); - if (it != aOldAxisMap.end()) - { - // Copy the text objects over. - apVAxis->copyShapes(*it->second); - } -#endif - m_aAxisMap[aFullAxisIndex] = apVAxis; apVAxis->set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, m_eBottomPos ); diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index 690dde3..25b7149 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -119,12 +119,7 @@ void VCoordinateSystem::reset() m_apExplicitCategoriesProvider.reset(); - tVAxisMap::iterator it = m_aAxisMap.begin(), itEnd = m_aAxisMap.end(); - for (; it != itEnd; ++it) - { - VAxisBase& rAxis = *it->second; - rAxis.reset(); - } + m_aAxisMap.clear(); // TODO : switch to reset() later. } #endif commit d6dfabc3ed6622d90562a7d4d150e41a95fc8370 Author: Kohei Yoshida <[email protected]> Date: Mon Oct 20 18:02:33 2014 -0400 Revert "Adjust text properties after adding a cached text object..." This reverts commit 859cb431f1208142529af8f7166347d84e4f4e75. diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 6914ee0..968770d 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -103,39 +103,6 @@ Reference< drawing::XShape > createSingleLabel( return xShape2DText; } -void adjustSingleLabel( - const Reference<drawing::XShape>& xShape, const awt::Point& rAnchorPos, - const AxisLabelProperties& rAxisLabelProps, const AxisProperties& rAxisProps, - const tNameSequence& rPropNames, const tAnySequence& rPropValues ) -{ - if (!xShape.is()) - return; - - uno::Reference<beans::XPropertySet> xProp(xShape, uno::UNO_QUERY); - if (xProp.is()) - { - //set properties - PropertyMapper::setMultiProperties(rPropNames, rPropValues, xProp); - - //set position matrix - //the matrix needs to be set at the end behind autogrow and such position influencing properties - double fRotationAnglePi = rAxisLabelProps.fRotationAngleDegree * (F_PI / -180.0); - uno::Any aATransformation = AbstractShapeFactory::makeTransformation(rAnchorPos, fRotationAnglePi); - try - { - xProp->setPropertyValue("Transformation", aATransformation); - } - catch( const uno::Exception& e ) - { - ASSERT_EXCEPTION( e ); - } - } - - LabelPositionHelper::correctPositionForRotation( - xShape, rAxisProps.maLabelAlignment.meAlignment, - rAxisLabelProps.fRotationAngleDegree, rAxisProps.m_bComplexCategories); -} - bool lcl_doesShapeOverlapWithTickmark( const Reference< drawing::XShape >& xShape , double fRotationAngleDegree , const basegfx::B2DVector& rTickScreenPosition @@ -796,12 +763,8 @@ bool VCartesianAxis::createTextShapes( uno::Reference<drawing::XShape> xCached = rTickIter.getTextShape(); if (xCached.is()) { - pTickInfo->xTextShape = xCached; xTarget->add(xCached); - adjustSingleLabel( - pTickInfo->xTextShape, aAnchorScreenPosition2D, - rAxisLabelProperties, m_aAxisProperties, - aPropNames, aPropValues); + pTickInfo->xTextShape = xCached; } else { _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
