LCOV - code coverage report
Current view: top level - chart2/source/view/axes - VCartesianAxis.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 1 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 5 0.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             : #ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VCARTESIANAXIS_HXX
      20             : #define INCLUDED_CHART2_SOURCE_VIEW_AXES_VCARTESIANAXIS_HXX
      21             : 
      22             : #include "VAxisBase.hxx"
      23             : #include <basegfx/vector/b2dvector.hxx>
      24             : 
      25             : namespace chart
      26             : {
      27             : 
      28             : class VCartesianAxis : public VAxisBase
      29             : {
      30             :     // public methods
      31             : public:
      32             :     VCartesianAxis( const AxisProperties& rAxisProperties
      33             :            , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
      34             :            , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
      35             :            , PlottingPositionHelper* pPosHelper = NULL //takes ownership
      36             :            );
      37             : 
      38             :     virtual ~VCartesianAxis();
      39             : 
      40             :     virtual void createMaximumLabels() SAL_OVERRIDE;
      41             :     virtual void createLabels() SAL_OVERRIDE;
      42             :     virtual void updatePositions() SAL_OVERRIDE;
      43             : 
      44             :     virtual void createShapes() SAL_OVERRIDE;
      45             : 
      46             :     virtual sal_Int32 estimateMaximumAutoMainIncrementCount() SAL_OVERRIDE;
      47             :     virtual void createAllTickInfos( TickInfoArraysType& rAllTickInfos ) SAL_OVERRIDE;
      48             :     void createAllTickInfosFromComplexCategories( TickInfoArraysType& rAllTickInfos, bool bShiftedPosition );
      49             : 
      50             :     TickIter* createLabelTickIterator( sal_Int32 nTextLevel );
      51             :     TickIter* createMaximumLabelTickIterator( sal_Int32 nTextLevel );
      52             :     sal_Int32 getTextLevelCount() const;
      53             : 
      54             :     virtual TickFactory* createTickFactory() SAL_OVERRIDE;
      55             : 
      56             :     /**
      57             :      * Get the value at which the other axis crosses.
      58             :      */
      59             :     double getAxisIntersectionValue() const;
      60             : 
      61             :     /**
      62             :      * Get the value at which label line crosses the other axis.
      63             :      */
      64             :     double getLabelLineIntersectionValue() const;
      65             : 
      66             :     /**
      67             :      * Get the value at which extra line crosses the other axis.
      68             :      *
      69             :      * @return a NaN if the line doesn't cross the other axis, a non-NaN value
      70             :      *         otherwise.
      71             :      */
      72             :     double getExtraLineIntersectionValue() const;
      73             : 
      74             :     void get2DAxisMainLine(
      75             :         basegfx::B2DVector& rStart, basegfx::B2DVector& rEnd, AxisLabelAlignment& rLabelAlignment,
      76             :         double fCrossesOtherAxis ) const;
      77             : 
      78             :     //Layout interface for cartesian axes:
      79             : 
      80             :     //the returned value describes the minimum size that is necessary
      81             :     //for the text labels in the direction orthogonal to the axis
      82             :     //(for an y-axis a width is returned; in case of an x-axis the value describes a height)
      83             :     //the return value is measured in screen dimension
      84             :     //As an example the MinimumOrthogonalSize of an x-axis equals the
      85             :     //Font Height if the label properties allow for labels parallel to the axis.
      86             : //    sal_Int32 calculateMinimumOrthogonalSize( /*... parallel...*/ );
      87             :     //Minimum->Preferred
      88             : 
      89             :     //returns true if the MinimumOrthogonalSize can be calculated
      90             :     //with the creation of at most one text shape
      91             :     //(this is e.g. true if the parameters allow for labels parallel to the axis.)
      92             : //    sal_bool  canQuicklyCalculateMinimumOrthogonalSize();
      93             : 
      94           0 :     struct ScreenPosAndLogicPos
      95             :     {
      96             :         double fLogicX;
      97             :         double fLogicY;
      98             :         double fLogicZ;
      99             : 
     100             :         ::basegfx::B2DVector aScreenPos;
     101             :     };
     102             : 
     103             : private: //methods
     104             :     /**
     105             :      * Go through all tick label positions and decide which labels to display
     106             :      * based on the text shape geometry, overlap setting, tick interval,
     107             :      * auto-stagger setting etc.
     108             :      *
     109             :      * When the auto-stagger setting is on, try to avoid overlaps by
     110             :      * staggering labels or set the labels at an angle.  This method may
     111             :      * change the axis label properties especially when the auto staggering is
     112             :      * performed.  But the screen label positions will not be shifted in this
     113             :      * method; it will be done in the doStaggeringOfLabels method.
     114             :      *
     115             :      * @return true if the text shapes have been successfully created,
     116             :      *         otherwise false.  Returning false means the AxisLabelProperties
     117             :      *         have changed during the call, and the caller needs to call this
     118             :      *         method once again to get the text shapes created.
     119             :      */
     120             :     bool createTextShapes(
     121             :         const css::uno::Reference<css::drawing::XShapes >& xTarget,
     122             :         TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
     123             :         TickFactory2D* pTickFactory, sal_Int32 nScreenDistanceBetweenTicks );
     124             : 
     125             :     /**
     126             :      * Variant of createTextShapes where none of auto-staggering and
     127             :      * link-breaking are allowed in case of overlaps.  Overlaps of text shapes
     128             :      * are to be resolved only by adjusting the label tick interval.
     129             :      */
     130             :     bool createTextShapesSimple(
     131             :         const css::uno::Reference<css::drawing::XShapes >& xTarget,
     132             :         TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
     133             :         TickFactory2D* pTickFactory );
     134             : 
     135             :     void createTickMarkLineShapes( TickInfoArrayType& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickFactory2D& rTickFactory2D, bool bOnlyAtLabels );
     136             : 
     137             :     TickFactory2D* createTickFactory2D();
     138             :     void hideIdenticalScreenValues( TickInfoArraysType& rTickInfos ) const;
     139             : 
     140             :     /**
     141             :      * Shift the screen positions of the tick labels according to the stagger
     142             :      * settings.  Final stagger setting is decided during the createTextShapes
     143             :      * call, but this method does the physical shifting of the label
     144             :      * positions based on the final stagger setting.
     145             :      */
     146             :     void    doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties
     147             :                             , TickFactory2D* pTickFactory2D );
     148             : 
     149             :     /**
     150             :      * @return true if we can try to stagger labels in order to avoid
     151             :      *         overlaps, otherwise false.
     152             :      */
     153             :     static bool isAutoStaggeringOfLabelsAllowed(
     154             :         const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis );
     155             : 
     156             :     /**
     157             :      * @return true if we can break a single line label text into multiple
     158             :      *         lines for better fitting, otherwise false.
     159             :      */
     160             :     bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis ) const;
     161             : 
     162             :     ::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const;
     163             :     ScreenPosAndLogicPos getScreenPosAndLogicPos( double fLogicX, double fLogicY, double fLogicZ ) const;
     164             : };
     165             : 
     166             : } //namespace chart
     167             : #endif
     168             : 
     169             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11