diff options
Diffstat (limited to 'chart2/source/view/inc/VSeriesPlotter.hxx')
-rw-r--r-- | chart2/source/view/inc/VSeriesPlotter.hxx | 134 |
1 files changed, 72 insertions, 62 deletions
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 17215faae4b5..45676830b538 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VSERIESPLOTTER_HXX -#define INCLUDED_CHART2_SOURCE_VIEW_INC_VSERIESPLOTTER_HXX +#pragma once #include <memory> #include "PlotterBase.hxx" @@ -25,7 +24,10 @@ #include "LabelAlignment.hxx" #include "MinimumAndMaximumSupplier.hxx" #include "LegendEntryProvider.hxx" +#include <basegfx/range/b2irectangle.hxx> #include <com/sun/star/drawing/Direction3D.hpp> +#include <rtl/ref.hxx> +#include <svx/unoshape.hxx> namespace com::sun::star::awt { struct Point; } namespace com::sun::star::chart2 { class XChartType; } @@ -47,6 +49,7 @@ namespace com::sun::star { namespace chart { +class ChartType; class NumberFormatterWrapper; class AxesNumberFormats @@ -83,12 +86,12 @@ public: sal_Int32 getPointCount() const; sal_Int32 getAttachedAxisIndexForFirstSeries() const; - void getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const; - void getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const; + void getMinimumAndMaximumX( double& rfMinimum, double& rfMaximum ) const; + void getMinimumAndMaximumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const; void calculateYMinAndMaxForCategory( sal_Int32 nCategoryIndex , bool bSeparateStackingForDifferentSigns - , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex ); + , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex ) const; void calculateYMinAndMaxForCategoryRange( sal_Int32 nStartCategoryIndex, sal_Int32 nEndCategoryIndex , bool bSeparateStackingForDifferentSigns , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex ); @@ -171,11 +174,11 @@ public: virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex ) override; virtual bool isSeparateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) override; - virtual long calculateTimeResolutionOnXAxis() override; - virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate ) override; + virtual tools::Long calculateTimeResolutionOnXAxis() override; + virtual void setTimeResolutionOnXAxis( tools::Long nTimeResolution, const Date& rNullDate ) override; - void getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const; - void getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const; + void getMinimumAndMaximumX( double& rfMinimum, double& rfMaximum ) const; + void getMinimumAndMaximumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const; // Methods for handling legends and legend entries. @@ -184,8 +187,7 @@ public: const css::awt::Size& rEntryKeyAspectRatio, css::chart2::LegendPosition eLegendPosition, const css::uno::Reference< css::beans::XPropertySet >& xTextProperties, - const css::uno::Reference< css::drawing::XShapes >& xTarget, - const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory, + const rtl::Reference<SvxShapeGroupAnyD>& xTarget, const css::uno::Reference< css::uno::XComponentContext >& xContext, ChartModel& rModel ) override; @@ -195,32 +197,41 @@ public: virtual css::uno::Any getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex/*-1 for series symbol*/ ); - css::uno::Reference< css::drawing::XShape > createLegendSymbolForSeries( + rtl::Reference<SvxShapeGroup> createLegendSymbolForSeries( const css::awt::Size& rEntryKeyAspectRatio , const VDataSeries& rSeries - , const css::uno::Reference< css::drawing::XShapes >& xTarget - , const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory ); + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget ); - css::uno::Reference< css::drawing::XShape > createLegendSymbolForPoint( + rtl::Reference< SvxShapeGroup > createLegendSymbolForPoint( const css::awt::Size& rEntryKeyAspectRatio , const VDataSeries& rSeries , sal_Int32 nPointIndex - , const css::uno::Reference< css::drawing::XShapes >& xTarget - , const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory ); + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget ); std::vector< ViewLegendEntry > createLegendEntriesForSeries( const css::awt::Size& rEntryKeyAspectRatio, const VDataSeries& rSeries, const css::uno::Reference< css::beans::XPropertySet >& xTextProperties, - const css::uno::Reference< css::drawing::XShapes >& xTarget, - const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory, + const rtl::Reference<SvxShapeGroupAnyD>& xTarget, const css::uno::Reference< css::uno::XComponentContext >& xContext ); - std::vector< VDataSeries* > getAllSeries(); + std::vector<ViewLegendSymbol> createSymbols( + const css::awt::Size& rEntryKeyAspectRatio + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget + , const css::uno::Reference<css::uno::XComponentContext>& xContext); + + std::vector<ViewLegendSymbol> createSymbolsForSeries( + const css::awt::Size& rEntryKeyAspectRatio + , const VDataSeries& rSeries + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget + , const css::uno::Reference<css::uno::XComponentContext>& xContext); + + std::vector<VDataSeries*> getAllSeries(); + std::vector<VDataSeries const*> getAllSeries() const; // This method creates a series plotter of the requested type; e.g. : return new PieChart... - static VSeriesPlotter* createSeriesPlotter( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + static VSeriesPlotter* createSeriesPlotter( const rtl::Reference< ::chart::ChartType >& xChartTypeModel , sal_Int32 nDimensionCount , bool bExcludingPositioning /*for pie and donut charts labels and exploded segments are excluded from the given size*/); @@ -234,14 +245,20 @@ public: void setExplicitCategoriesProvider( ExplicitCategoriesProvider* pExplicitCategoriesProvider ); + ExplicitCategoriesProvider* getExplicitCategoriesProvider() { return m_pExplicitCategoriesProvider; } + //get series names for the z axis labels - css::uno::Sequence< OUString > getSeriesNames() const; + css::uno::Sequence<OUString> getSeriesNames() const; + + //get all series names + css::uno::Sequence<OUString> getAllSeriesNames() const; void setPageReferenceSize( const css::awt::Size & rPageRefSize ); //better performance for big data void setCoordinateSystemResolution( const css::uno::Sequence< sal_Int32 >& rCoordinateSystemResolution ); bool PointsWereSkipped() const { return m_bPointsWereSkipped;} void setPieLabelsAllowToMove( bool bIsPieOrDonut ) { m_bPieLabelsAllowToMove = bIsPieOrDonut; }; + void setAvailableOuterRect( const basegfx::B2IRectangle& aAvailableOuterRect ) { m_aAvailableOuterRect = aAvailableOuterRect; }; //return the depth for a logic 1 double getTransformedDepth() const; @@ -253,37 +270,44 @@ public: bool WantToPlotInFrontOfAxisLine(); virtual bool shouldSnapRectToUsedArea(); + /// This method returns a text string representation of the passed numeric + /// value by exploiting a NumberFormatterWrapper object. + OUString getLabelTextForValue(VDataSeries const & rDataSeries, sal_Int32 nPointIndex, + double fValue, bool bAsPercentage); + + sal_Int32 getRenderOrder() const; + protected: - VSeriesPlotter( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + VSeriesPlotter( rtl::Reference< ::chart::ChartType > xChartTypeModel , sal_Int32 nDimensionCount , bool bCategoryXAxis=true ); // Methods for group shapes. - css::uno::Reference< css::drawing::XShapes > + rtl::Reference<SvxShapeGroupAnyD> getSeriesGroupShape( VDataSeries* pDataSeries - , const css:: uno::Reference< css::drawing::XShapes >& xTarget ); + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget ); //the following group shapes will be created as children of SeriesGroupShape on demand //they can be used to assure that some parts of a series shape are always in front of others (e.g. symbols in front of lines) //parameter xTarget will be used as parent for the series group shape - css::uno::Reference< css::drawing::XShapes > + rtl::Reference<SvxShapeGroupAnyD> getSeriesGroupShapeFrontChild( VDataSeries* pDataSeries - , const css:: uno::Reference< css::drawing::XShapes >& xTarget ); - css::uno::Reference< css::drawing::XShapes > + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget ); + rtl::Reference<SvxShapeGroupAnyD> getSeriesGroupShapeBackChild( VDataSeries* pDataSeries - , const css:: uno::Reference< css::drawing::XShapes >& xTarget ); + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget ); /// This method creates a 2D group shape for containing all text shapes /// needed for this series; the group is added to the text target; - css::uno::Reference< css::drawing::XShapes > + static rtl::Reference<SvxShapeGroup> getLabelsGroupShape( VDataSeries& rDataSeries - , const css:: uno::Reference< css::drawing::XShapes >& xTarget ); + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget ); - css::uno::Reference< css::drawing::XShapes > + rtl::Reference<SvxShapeGroupAnyD> getErrorBarsGroupShape( VDataSeries& rDataSeries - , const css:: uno::Reference< css::drawing::XShapes >& xTarget, bool bYError ); + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget, bool bYError ); /** This method creates a text shape for a label related to a data point * and append it to the root text shape group (xTarget). @@ -310,8 +334,8 @@ protected: * @return * a reference to the created text shape. */ - css::uno::Reference< css::drawing::XShape > - createDataLabel( const css::uno::Reference< css::drawing::XShapes >& xTarget + rtl::Reference<SvxShapeText> + createDataLabel( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , VDataSeries& rDataSeries , sal_Int32 nPointIndex , double fValue @@ -321,13 +345,6 @@ protected: , sal_Int32 nOffset=0 , sal_Int32 nTextWidth = 0 ); - /// This method returns a text string representation of the passed numeric - /// value by exploiting a NumberFormatterWrapper object. - OUString getLabelTextForValue( VDataSeries const & rDataSeries - , sal_Int32 nPointIndex - , double fValue - , bool bAsPercentage ); - /** creates two T-shaped error bars in both directions (up/down or left/right depending on the bVertical parameter) @@ -346,7 +363,7 @@ protected: for y-error bars this is true, for x-error-bars it is false. */ void createErrorBar( - const css::uno::Reference< css::drawing::XShapes >& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const css::drawing::Position3D & rPos , const css::uno::Reference< css::beans::XPropertySet > & xErrorBarProperties , const VDataSeries& rVDataSeries @@ -359,43 +376,37 @@ protected: const css::drawing::Position3D& rUnscaledLogicPosition , VDataSeries& rVDataSeries , sal_Int32 nIndex - , const css::uno::Reference< css::drawing::XShapes >& rTarget + , const rtl::Reference<SvxShapeGroupAnyD>& rTarget , bool bUseXErrorData , bool bUseYErrorData ); - void addErrorBorder( + static void addErrorBorder( const css::drawing::Position3D& rPos0 , const css::drawing::Position3D& rPos1 - , const css::uno::Reference< css::drawing::XShapes >& rTarget + , const rtl::Reference<SvxShapeGroupAnyD>& rTarget , const css::uno::Reference< css::beans::XPropertySet >& rErrorBorderProp ); void createErrorBar_X( const css::drawing::Position3D& rUnscaledLogicPosition , VDataSeries& rVDataSeries, sal_Int32 nPointIndex - , const css::uno::Reference< css::drawing::XShapes >& xTarget ); + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget ); void createErrorBar_Y( const css::drawing::Position3D& rUnscaledLogicPosition , VDataSeries& rVDataSeries, sal_Int32 nPointIndex - , const css::uno::Reference< css::drawing::XShapes >& xTarget + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget , double const * pfScaledLogicX ); void createRegressionCurvesShapes( VDataSeries const & rVDataSeries - , const css::uno::Reference< css::drawing::XShapes >& xTarget - , const css::uno::Reference< css::drawing::XShapes >& xEquationTarget + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget + , const rtl::Reference<SvxShapeGroupAnyD>& xEquationTarget , bool bMaySkipPointsInRegressionCalculation ); void createRegressionCurveEquationShapes( const OUString & rEquationCID , const css::uno::Reference< css::beans::XPropertySet > & xEquationProperties - , const css::uno::Reference< css::drawing::XShapes >& xEquationTarget + , const rtl::Reference<SvxShapeGroupAnyD>& xEquationTarget , const css::uno::Reference< css::chart2::XRegressionCurveCalculator > & xRegressionCurveCalculator , css::awt::Point aDefaultPos ); - static void setMappedProperties( - const css::uno::Reference< css::drawing::XShape >& xTarget - , const css::uno::Reference< css::beans::XPropertySet >& xSource - , const tPropertyNameMap& rMap - , tPropertyNameValueMap const * pOverwriteMap=nullptr ); - virtual PlottingPositionHelper& getPlottingPositionHelper( sal_Int32 nAxisIndex ) const;//nAxisIndex indicates whether the position belongs to the main axis ( nAxisIndex==0 ) or secondary axis ( nAxisIndex==1 ) VDataSeries* getFirstSeries() const; @@ -405,13 +416,12 @@ protected: protected: PlottingPositionHelper* m_pMainPosHelper; - css::uno::Reference< css::chart2::XChartType > m_xChartTypeModel; - css::uno::Reference< css::beans::XPropertySet > m_xChartTypeModelProps; + rtl::Reference< ::chart::ChartType > m_xChartTypeModel; std::vector< std::vector< VDataSeriesGroup > > m_aZSlots; bool m_bCategoryXAxis;//true->xvalues are indices (this would not be necessary if series for category chart wouldn't have x-values) - long m_nTimeResolution; + tools::Long m_nTimeResolution; Date m_aNullDate; std::unique_ptr< NumberFormatterWrapper > m_apNumberFormatterWrapper; @@ -424,6 +434,8 @@ protected: css::uno::Sequence< sal_Int32 > m_aCoordinateSystemResolution; bool m_bPointsWereSkipped; bool m_bPieLabelsAllowToMove; + basegfx::B2IRectangle m_aAvailableOuterRect; + css::awt::Size m_aPageReferenceSize; private: typedef std::map< sal_Int32 , ExplicitScaleData > tSecondaryValueScales; @@ -431,10 +443,8 @@ private: typedef std::map< sal_Int32 , std::unique_ptr<PlottingPositionHelper> > tSecondaryPosHelperMap; mutable tSecondaryPosHelperMap m_aSecondaryPosHelperMap; - css::awt::Size m_aPageReferenceSize; }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |