LCOV - code coverage report
Current view: top level - chart2/source/view/axes - Tickmarks.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 4 75.0 %
Date: 2012-08-25 Functions: 4 6 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

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

Generated by: LCOV version 1.10