LCOV - code coverage report
Current view: top level - chart2/source/view/inc - VCoordinateSystem.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 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_INC_VCOORDINATESYSTEM_HXX
      20             : #define INCLUDED_CHART2_SOURCE_VIEW_INC_VCOORDINATESYSTEM_HXX
      21             : 
      22             : #include "MinimumAndMaximumSupplier.hxx"
      23             : #include "ScaleAutomatism.hxx"
      24             : #include "ThreeDHelper.hxx"
      25             : #include "ExplicitCategoriesProvider.hxx"
      26             : #include "chartview/ExplicitScaleValues.hxx"
      27             : 
      28             : #include <com/sun/star/chart2/XCoordinateSystem.hpp>
      29             : #include <com/sun/star/awt/Rectangle.hpp>
      30             : #include <com/sun/star/drawing/HomogenMatrix.hpp>
      31             : #include <com/sun/star/drawing/XShapes.hpp>
      32             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      33             : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      34             : 
      35             : #include <map>
      36             : #include <vector>
      37             : #include <boost/shared_ptr.hpp>
      38             : #include <boost/scoped_ptr.hpp>
      39             : 
      40             : namespace chart
      41             : {
      42             : 
      43             : /**
      44             : */
      45             : class VAxisBase;
      46             : class VCoordinateSystem
      47             : {
      48             : public:
      49             :     virtual ~VCoordinateSystem();
      50             : 
      51             :     static VCoordinateSystem* createCoordinateSystem( const ::com::sun::star::uno::Reference<
      52             :                                 ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel );
      53             : 
      54             :     void initPlottingTargets(
      55             :                   const ::com::sun::star::uno::Reference<
      56             :                         ::com::sun::star::drawing::XShapes >& xLogicTarget
      57             :                 , const ::com::sun::star::uno::Reference<
      58             :                         ::com::sun::star::drawing::XShapes >& xFinalTarget
      59             :                 , const ::com::sun::star::uno::Reference<
      60             :                         ::com::sun::star::lang::XMultiServiceFactory >& xFactory
      61             :                 , ::com::sun::star::uno::Reference<
      62             :                         ::com::sun::star::drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
      63             :                         throw (::com::sun::star::uno::RuntimeException);
      64             : 
      65             :     void setParticle( const OUString& rCooSysParticle );
      66             : 
      67             :     void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
      68        1050 :     ::com::sun::star::drawing::HomogenMatrix getTransformationSceneToScreen() { return m_aMatrixSceneToScreen;}
      69             : 
      70             :     //better performance for big data
      71             :     virtual ::com::sun::star::uno::Sequence< sal_Int32 > getCoordinateSystemResolution( const ::com::sun::star::awt::Size& rPageSize
      72             :                                     , const ::com::sun::star::awt::Size& rPageResolution );
      73             : 
      74             :     ExplicitScaleData getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
      75             :     ExplicitIncrementData getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
      76             : 
      77             :     void setExplicitCategoriesProvider( ExplicitCategoriesProvider* /*takes ownership*/ );
      78             :     ExplicitCategoriesProvider* getExplicitCategoriesProvider();
      79             : 
      80             :     // returns a coplete scale set for a given dimension and index; for example if nDimensionIndex==1 and nAxisIndex==2 you get returned the secondary x axis, main y axis and main z axis
      81             :     ::std::vector< ExplicitScaleData > getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
      82             :     // returns a coplete increment set for a given dimension and index; for example if nDimensionIndex==1 and nAxisIndex==2 you get returned the secondary x axis, main y axis and main z axis
      83             :     ::std::vector< ExplicitIncrementData > getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
      84             : 
      85             :     void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
      86             :     bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
      87             :     void clearMinimumAndMaximumSupplierList();
      88             : 
      89             :     /**
      90             :      * It sets the scaling parameters for the passed `ScaleAutomatism` object.
      91             :      * Especially it sets the `m_fValueMinimum` and the `m_fValueMaximum`
      92             :      * parameters (see `ScaleAutomatism::expandValueRange`).
      93             :      * The value to be assigned to these two parameters is retrieved by
      94             :      * invoking the `getMinimum` and `getMaximum` methods of the minimum-maximum
      95             :      * supplier object that belongs to the given coordinate system.
      96             :      * The minimum-maximum supplier object is set in the
      97             :      * `SeriesPlotterContainer::initializeCooSysAndSeriesPlotter` method to the
      98             :      * series plotter which is based on the coordinate system (see notes for
      99             :      * the method). For instance for a pie chart the `m_fValueMinimum` and the
     100             :      * `m_fValueMaximum` parameters are initialized by the `PieChart::getMinimum`
     101             :      * and `PieChart::getMaximum` methods.
     102             :      */
     103             :     void prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex );
     104             : 
     105             :     void setExplicitScaleAndIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
     106             :         , const ExplicitScaleData& rExplicitScale
     107             :         , const ExplicitIncrementData& rExplicitIncrement );
     108             : 
     109             :     void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos );
     110             : 
     111             :     ::com::sun::star::uno::Reference<
     112             :         ::com::sun::star::chart2::XCoordinateSystem >
     113       18790 :         getModel() const { return m_xCooSysModel;}
     114             : 
     115             :     /**
     116             :      * Create "view" axis obejcts 'VAxis' from the coordinate system model.
     117             :      */
     118             :     virtual void createVAxisList(
     119             :             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument> & xChartDoc
     120             :             , const ::com::sun::star::awt::Size& rFontReferenceSize
     121             :             , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
     122             : 
     123             :     virtual void initVAxisInList();
     124             :     virtual void updateScalesAndIncrementsOnAxes();
     125             : 
     126             :     void createMaximumAxesLabels();
     127             :     void createAxesLabels();
     128             :     void updatePositions();
     129             :     void createAxesShapes();
     130             : 
     131             :     virtual void createGridShapes();
     132             : 
     133             :     bool getPropertySwapXAndYAxis() const;
     134             : 
     135             :     sal_Int32 getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const;
     136             : 
     137             :     bool needSeriesNamesForAxis() const;
     138             :     void setSeriesNamesForAxis( const ::com::sun::star::uno::Sequence< OUString >& rSeriesNames );
     139             : 
     140             : protected: //methods
     141             :     VCoordinateSystem( const ::com::sun::star::uno::Reference<
     142             :         ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
     143             : 
     144             :     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >
     145             :         getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex  ) const;
     146             :     static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > >
     147             :         getGridListFromAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
     148             : 
     149             :     VAxisBase* getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
     150             : 
     151             :     OUString createCIDForAxis( const ::com::sun::star::uno::Reference<
     152             :                     ::com::sun::star::chart2::XAxis >& xAxis
     153             :                     , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
     154             :     OUString createCIDForGrid( const ::com::sun::star::uno::Reference<
     155             :                     ::com::sun::star::chart2::XAxis >& xAxis
     156             :                     , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
     157             : 
     158             :     sal_Int32 getNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference<
     159             :                      ::com::sun::star::chart2::XAxis >& xAxis
     160             :                      , const ::com::sun::star::uno::Reference<
     161             :                      ::com::sun::star::chart2::XChartDocument>& xChartDoc);
     162             : 
     163             : private: //methods
     164             :     static void impl_adjustDimension( sal_Int32& rDimensionIndex );
     165             :     void impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const;
     166             : 
     167             : protected: //member
     168             :     ::com::sun::star::uno::Reference<
     169             :         ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
     170             : 
     171             :     OUString m_aCooSysParticle;
     172             : 
     173             :     typedef std::pair< sal_Int32, sal_Int32 > tFullAxisIndex; //first index is the dimension, second index is the axis index that indicates whether this is a main or secondary axis
     174             : 
     175             :     ::com::sun::star::uno::Reference<
     176             :                     ::com::sun::star::drawing::XShapes >                m_xLogicTargetForGrids;
     177             :     ::com::sun::star::uno::Reference<
     178             :                     ::com::sun::star::drawing::XShapes >                m_xLogicTargetForAxes;
     179             :     ::com::sun::star::uno::Reference<
     180             :                     ::com::sun::star::drawing::XShapes >                m_xFinalTarget;
     181             :     ::com::sun::star::uno::Reference<
     182             :                     ::com::sun::star::lang::XMultiServiceFactory>       m_xShapeFactory;
     183             :     ::com::sun::star::drawing::HomogenMatrix                            m_aMatrixSceneToScreen;
     184             : 
     185             :     CuboidPlanePosition m_eLeftWallPos;
     186             :     CuboidPlanePosition m_eBackWallPos;
     187             :     CuboidPlanePosition m_eBottomPos;
     188             : 
     189             :     /**
     190             :      * Collection of min-max suppliers which are basically different chart
     191             :      * types present in the same coordinate system.  This is used only for
     192             :      * auto-scaling purposes.
     193             :      */
     194             :     MergedMinimumAndMaximumSupplier m_aMergedMinMaxSupplier;
     195             : 
     196             :     ::com::sun::star::uno::Sequence< OUString > m_aSeriesNamesForZAxis;
     197             : 
     198             :     typedef std::map< tFullAxisIndex, ::boost::shared_ptr< VAxisBase > > tVAxisMap;
     199             : 
     200             :     tVAxisMap m_aAxisMap;
     201             : 
     202             : private:
     203             :     std::vector< ExplicitScaleData >     m_aExplicitScales;
     204             :     std::vector< ExplicitIncrementData > m_aExplicitIncrements;
     205             : 
     206             :     typedef std::map< tFullAxisIndex, ExplicitScaleData > tFullExplicitScaleMap;
     207             :     typedef std::map< tFullAxisIndex, ExplicitIncrementData > tFullExplicitIncrementMap;
     208             : 
     209             :     tFullExplicitScaleMap       m_aSecondaryExplicitScales;
     210             :     tFullExplicitIncrementMap   m_aSecondaryExplicitIncrements;
     211             : 
     212             :     boost::scoped_ptr< ExplicitCategoriesProvider > m_apExplicitCategoriesProvider;
     213             : };
     214             : 
     215             : } //namespace chart
     216             : #endif
     217             : 
     218             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11