LCOV - code coverage report
Current view: top level - chart2/source/view/axes - VAxisProperties.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 2 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             : #ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VAXISPROPERTIES_HXX
      20             : #define INCLUDED_CHART2_SOURCE_VIEW_AXES_VAXISPROPERTIES_HXX
      21             : 
      22             : #include "TickmarkProperties.hxx"
      23             : #include "PlottingPositionHelper.hxx"
      24             : #include "LabelAlignment.hxx"
      25             : #include "ExplicitCategoriesProvider.hxx"
      26             : 
      27             : #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
      28             : #include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
      29             : #include <com/sun/star/chart/ChartAxisPosition.hpp>
      30             : #include <com/sun/star/chart2/XAxis.hpp>
      31             : #include <com/sun/star/chart2/AxisType.hpp>
      32             : #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
      33             : #include <com/sun/star/awt/Rectangle.hpp>
      34             : #include <com/sun/star/awt/Size.hpp>
      35             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      36             : #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
      37             : #include <com/sun/star/lang/Locale.hpp>
      38             : 
      39             : #include <vector>
      40             : #include <boost/optional.hpp>
      41             : 
      42             : namespace chart
      43             : {
      44             : 
      45             : /**
      46             : */
      47             : 
      48             : //These properties describe how a couple of labels are arranged one to another.
      49             : //The couple can contain all labels for all tickmark depth or just the labels for one single depth or
      50             : //the labels from an coherent range of tick depths (e.g. the major and first minor tickmarks should be handled together).
      51             : //... only allow side by side for different tick depth
      52             : enum AxisLabelStaggering
      53             : {
      54             :       SIDE_BY_SIDE
      55             :     , STAGGER_EVEN
      56             :     , STAGGER_ODD
      57             :     , STAGGER_AUTO
      58             : };
      59             : 
      60             : struct AxisLabelProperties SAL_FINAL
      61             : {
      62             :     AxisLabelProperties();
      63             : 
      64             :     ::com::sun::star::awt::Size         m_aFontReferenceSize;//reference size to calculate the font height
      65             :     ::com::sun::star::awt::Rectangle    m_aMaximumSpaceForLabels;//Labels need to be clipped in order to fit into this rectangle
      66             : 
      67             :     sal_Int32            nNumberFormatKey;
      68             : 
      69             :     AxisLabelStaggering  eStaggering;
      70             : 
      71             :     bool                 bLineBreakAllowed;
      72             :     bool                 bOverlapAllowed;
      73             : 
      74             :     bool                 bStackCharacters;
      75             :     double               fRotationAngleDegree;
      76             : 
      77             :     sal_Int32   nRhythm; //show only each nth label with n==nRhythm
      78             :     bool        bRhythmIsFix; //states whether the given rhythm is fix or may be changed
      79             : 
      80             :     //methods:
      81             :     void init( const ::com::sun::star::uno::Reference<
      82             :                 ::com::sun::star::chart2::XAxis >&  xAxisModel );
      83             : 
      84             :     bool getIsStaggered() const;
      85             : };
      86             : 
      87             : struct AxisLabelAlignment
      88             : {
      89             :     double mfLabelDirection; /// which direction the labels are to be drawn.
      90             :     double mfInnerTickDirection; /// which direction the inner tickmarks are to be drawn.
      91             : 
      92             :     LabelAlignment meAlignment;
      93             : 
      94             :     AxisLabelAlignment();
      95             : };
      96             : 
      97        2142 : struct AxisProperties SAL_FINAL
      98             : {
      99             :     css::uno::Reference<css::chart2::XAxis> m_xAxisModel;
     100             : 
     101             :     sal_Int32   m_nDimensionIndex;
     102             :     bool        m_bIsMainAxis;//not secondary axis
     103             :     bool        m_bSwapXAndY;
     104             : 
     105             :     css::chart::ChartAxisPosition      m_eCrossoverType;
     106             :     css::chart::ChartAxisLabelPosition m_eLabelPos;
     107             :     css::chart::ChartAxisMarkPosition  m_eTickmarkPos;
     108             : 
     109             :     boost::optional<double> m_pfMainLinePositionAtOtherAxis;
     110             :     boost::optional<double> m_pfExrtaLinePositionAtOtherAxis;
     111             : 
     112             :     bool        m_bCrossingAxisHasReverseDirection;
     113             :     bool        m_bCrossingAxisIsCategoryAxes;
     114             : 
     115             :     AxisLabelAlignment maLabelAlignment;
     116             : 
     117             :     bool            m_bDisplayLabels;
     118             : 
     119             :     sal_Int32       m_nNumberFormatKey;
     120             : 
     121             :     /*
     122             :     0: no tickmarks         1: inner tickmarks
     123             :     2: outer tickmarks      3: inner and outer tickmarks
     124             :     */
     125             :     sal_Int32                           m_nMajorTickmarks;
     126             :     sal_Int32                           m_nMinorTickmarks;
     127             :     ::std::vector<TickmarkProperties>   m_aTickmarkPropertiesList;
     128             : 
     129             :     VLineProperties                     m_aLineProperties;
     130             : 
     131             :     //for category axes ->
     132             :     sal_Int32                           m_nAxisType;//REALNUMBER, CATEGORY etc. type ::com::sun::star::chart2::AxisType
     133             :     bool                                m_bComplexCategories;
     134             :     ExplicitCategoriesProvider* m_pExplicitCategoriesProvider;/*no ownership here*/
     135             :     css::uno::Reference<css::chart2::data::XTextualDataSequence> m_xAxisTextProvider; //for categories or series names
     136             :     //<- category axes
     137             : 
     138             :     //methods:
     139             : 
     140             :     AxisProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxisModel
     141             :                   , ExplicitCategoriesProvider* pExplicitCategoriesProvider );
     142             :     AxisProperties( const AxisProperties& rAxisProperties );
     143             : 
     144             :     void init(bool bCartesian=false);//init from model data (m_xAxisModel)
     145             : 
     146             :     void initAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp );
     147             : 
     148             :     static TickmarkProperties getBiggestTickmarkProperties();
     149             :     TickmarkProperties makeTickmarkPropertiesForComplexCategories( sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis, sal_Int32 nTextLevel ) const;
     150             : 
     151             : private:
     152             :     AxisProperties();
     153             : 
     154             :     TickmarkProperties  makeTickmarkProperties( sal_Int32 nDepth ) const;
     155             :     //@todo get this from somewhere; maybe for each subincrement
     156             :     //so far the model does not offer different settings for each tick depth
     157        1138 :     VLineProperties      makeLinePropertiesForDepth( sal_Int32 /*nDepth*/ ) const { return m_aLineProperties; }
     158             : };
     159             : 
     160             : } //namespace chart
     161             : #endif
     162             : 
     163             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10