LCOV - code coverage report
Current view: top level - chart2/source/view/charttypes - PieChart.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_PIECHART_HXX
      21             : #define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_PIECHART_HXX
      22             : 
      23             : #include "VSeriesPlotter.hxx"
      24             : #include <basegfx/vector/b2dvector.hxx>
      25             : #include <basegfx/range/b2irectangle.hxx>
      26             : 
      27             : namespace chart
      28             : {
      29             : class PiePositionHelper;
      30             : 
      31             : class PieChart : public VSeriesPlotter
      32             : {
      33             :     struct ShapeParam;
      34             : 
      35             : public:
      36             :     PieChart( const ::com::sun::star::uno::Reference<
      37             :             ::com::sun::star::chart2::XChartType >& xChartTypeModel
      38             :             , sal_Int32 nDimensionCount, bool bExcludingPositioning );
      39             :     virtual ~PieChart();
      40             : 
      41             :     virtual void createShapes() SAL_OVERRIDE;
      42             :     virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize ) SAL_OVERRIDE;
      43             : 
      44             :     virtual void setScales( const ::std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis ) SAL_OVERRIDE;
      45             :     virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 ) SAL_OVERRIDE;
      46             : 
      47             :     virtual ::com::sun::star::drawing::Direction3D  getPreferredDiagramAspectRatio() const SAL_OVERRIDE;
      48             :     virtual bool keepAspectRatio() const SAL_OVERRIDE;
      49             :     virtual bool shouldSnapRectToUsedArea() SAL_OVERRIDE;
      50             : 
      51             :     //MinimumAndMaximumSupplier
      52             :     virtual double getMinimumX() SAL_OVERRIDE;
      53             :     virtual double getMaximumX() SAL_OVERRIDE;
      54             :     virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ) SAL_OVERRIDE;
      55             :     virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ) SAL_OVERRIDE;
      56             : 
      57             :     virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex ) SAL_OVERRIDE;
      58             :     virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex ) SAL_OVERRIDE;
      59             :     virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex ) SAL_OVERRIDE;
      60             :     virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex ) SAL_OVERRIDE;
      61             :     virtual bool isSeparateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) SAL_OVERRIDE;
      62             : 
      63             : private: //methods
      64             :     //no default constructor
      65             :     PieChart();
      66             : 
      67             :     css::uno::Reference<css::drawing::XShape>
      68             :         createDataPoint(
      69             :             const css::uno::Reference<css::drawing::XShapes>& xTarget,
      70             :             const css::uno::Reference<css::beans::XPropertySet>& xObjectProperties,
      71             :             tPropertyNameValueMap* pOverWritePropertiesMap,
      72             :             const ShapeParam& rParam );
      73             : 
      74             :     void createTextLabelShape(
      75             :         const css::uno::Reference<css::drawing::XShapes>& xTextTarget,
      76             :         VDataSeries& rSeries, sal_Int32 nPointIndex, ShapeParam& rParam );
      77             : 
      78             :     double              getMaxOffset();
      79             :     bool                detectLabelOverlapsAndMove(const ::com::sun::star::awt::Size& rPageSize);//returns true when there might be more to do
      80             :     void                resetLabelPositionsToPreviousState();
      81             : struct PieLabelInfo;
      82             :     bool                tryMoveLabels( PieLabelInfo* pFirstBorder, PieLabelInfo* pSecondBorder
      83             :                                 , PieLabelInfo* pCenter, bool bSingleCenter, bool& rbAlternativeMoveDirection
      84             :                                 , const ::com::sun::star::awt::Size& rPageSize );
      85             : 
      86             : private: //member
      87             :     PiePositionHelper*    m_pPosHelper;
      88             :     bool                  m_bUseRings;
      89             :     bool                  m_bSizeExcludesLabelsAndExplodedSegments;
      90             : 
      91         108 :     struct PieLabelInfo
      92             :     {
      93             :         PieLabelInfo();
      94             :         bool moveAwayFrom( const PieLabelInfo* pFix, const ::com::sun::star::awt::Size& rPageSize
      95             :             , bool bMoveHalfWay, bool bMoveClockwise, bool bAlternativeMoveDirection );
      96             : 
      97             :         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xTextShape;
      98             :         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xLabelGroupShape;
      99             :         ::basegfx::B2IVector aFirstPosition;
     100             :         ::basegfx::B2IVector aOrigin;
     101             :         double fValue;
     102             :         bool bMovementAllowed;
     103             :         bool bMoved;
     104             :         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > xTextTarget;
     105             :         PieLabelInfo* pPrevious;
     106             :         PieLabelInfo* pNext;
     107             :         ::com::sun::star::awt::Point aPreviousPosition;
     108             :     };
     109             : 
     110             :     ::std::vector< PieLabelInfo > m_aLabelInfoList;
     111             : 
     112             :     double m_fMaxOffset;    /// cached max offset value (init'ed to NaN)
     113             : };
     114             : } //namespace chart
     115             : #endif
     116             : 
     117             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10