LCOV - code coverage report
Current view: top level - chart2/source/view/axes - Tickmarks.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 6 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_TICKMARKS_HXX
      20             : #define INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_HXX
      21             : 
      22             : #include "TickmarkProperties.hxx"
      23             : #include "VAxisProperties.hxx"
      24             : #include "chartview/ExplicitScaleValues.hxx"
      25             : #include <basegfx/vector/b2dvector.hxx>
      26             : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      27             : #include <com/sun/star/drawing/XShape.hpp>
      28             : #include <com/sun/star/uno/Sequence.h>
      29             : 
      30             : #include <vector>
      31             : 
      32             : namespace chart
      33             : {
      34             : 
      35           0 : struct TickInfo
      36             : {
      37             :     double      fScaledTickValue;
      38             :     ::com::sun::star::uno::Reference<
      39             :                     ::com::sun::star::chart2::XScaling > xInverseScaling;
      40             : 
      41             :     ::basegfx::B2DVector  aTickScreenPosition;
      42             :     bool        bPaintIt;
      43             : 
      44             :     ::com::sun::star::uno::Reference<
      45             :         ::com::sun::star::drawing::XShape > xTextShape;
      46             : 
      47             :     OUString aText;//used only for complex categories so far
      48             :     sal_Int32 nFactorForLimitedTextWidth;//categories in higher levels of complex categories can have more place than a single simple category
      49             : 
      50             : //methods:
      51             :     TickInfo( const ::com::sun::star::uno::Reference<
      52             :                     ::com::sun::star::chart2::XScaling >& xInverseScaling );
      53             : 
      54             :     double getUnscaledTickValue() const;
      55             :     sal_Int32 getScreenDistanceBetweenTicks( const TickInfo& rOherTickInfo ) const;
      56             : private:
      57             :     TickInfo();
      58             : };
      59           0 : class TickIter
      60             : {
      61             : public:
      62           0 :     virtual ~TickIter(){};
      63             :     virtual TickInfo* firstInfo()=0;
      64             :     virtual TickInfo* nextInfo()=0;
      65             : };
      66             : 
      67             : class PureTickIter : public TickIter
      68             : {
      69             : public:
      70             :     PureTickIter( ::std::vector< TickInfo >& rTickInfoVector );
      71             :     virtual ~PureTickIter();
      72             :     virtual TickInfo* firstInfo() SAL_OVERRIDE;
      73             :     virtual TickInfo* nextInfo() SAL_OVERRIDE;
      74             : 
      75             : private:
      76             :     ::std::vector< TickInfo >& m_rTickVector;
      77             :     ::std::vector< TickInfo >::iterator m_aTickIter;
      78             : };
      79             : 
      80             : class TickFactory
      81             : {
      82             : public:
      83             :     TickFactory(
      84             :          const ExplicitScaleData& rScale
      85             :         , const ExplicitIncrementData& rIncrement );
      86             :     virtual ~TickFactory();
      87             : 
      88             :     void getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
      89             :     void getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
      90           0 :     virtual void updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& /*rAllTickInfos*/ ) const {}
      91             : 
      92             : private: //methods
      93             :     bool        isDateAxis() const;
      94             : 
      95             : protected: //member
      96             :     ExplicitScaleData     m_rScale;
      97             :     ExplicitIncrementData m_rIncrement;
      98             :     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >
      99             :                                                 m_xInverseScaling;
     100             : 
     101             :     //minimum and maximum of the visible range after scaling
     102             :     double    m_fScaledVisibleMin;
     103             :     double    m_fScaledVisibleMax;
     104             : };
     105             : 
     106             : class TickFactory_2D : public TickFactory
     107             : {
     108             : public:
     109             :     TickFactory_2D(
     110             :         const ExplicitScaleData& rScale
     111             :         , const ExplicitIncrementData& rIncrement
     112             :         , const ::basegfx::B2DVector& rStartScreenPos, const ::basegfx::B2DVector& rEndScreenPos
     113             :         , const ::basegfx::B2DVector& rAxisLineToLabelLineShift );
     114             :         //, double fStrech_SceneToScreen, double fOffset_SceneToScreen );
     115             :     virtual ~TickFactory_2D();
     116             : 
     117             :     static sal_Int32    getTickScreenDistance( TickIter& rIter );
     118             : 
     119             :     void createPointSequenceForAxisMainLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints ) const;
     120             :     void addPointSequenceForTickLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints
     121             :                             , sal_Int32 nSequenceIndex
     122             :                             , double fScaledLogicTickValue, double fInnerDirectionSign
     123             :                             , const TickmarkProperties& rTickmarkProperties, bool bPlaceAtLabels ) const;
     124             :     ::basegfx::B2DVector  getDistanceAxisTickToText( const AxisProperties& rAxisProperties
     125             :         , bool bIncludeFarAwayDistanceIfSo = false
     126             :         , bool bIncludeSpaceBetweenTickAndText = true ) const;
     127             : 
     128             :     virtual void        updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const SAL_OVERRIDE;
     129             : 
     130             :     bool  isHorizontalAxis() const;
     131             :     bool  isVerticalAxis() const;
     132             : 
     133             : protected: //methods
     134             :     ::basegfx::B2DVector     getTickScreenPosition2D( double fScaledLogicTickValue ) const;
     135             : 
     136             : private: //member
     137             :     ::basegfx::B2DVector    m_aAxisStartScreenPosition2D;
     138             :     ::basegfx::B2DVector    m_aAxisEndScreenPosition2D;
     139             : 
     140             :     //labels might be posioned high or low on the border of the diagram far away from the axis
     141             :     //add this vector to go from the axis line to the label line (border of the diagram)
     142             :     ::basegfx::B2DVector    m_aAxisLineToLabelLineShift;
     143             : 
     144             :     double      m_fStrech_LogicToScreen;
     145             :     double      m_fOffset_LogicToScreen;
     146             : };
     147             : 
     148             : } //namespace chart
     149             : #endif
     150             : 
     151             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10