LCOV - code coverage report
Current view: top level - chart2/source/inc - ExplicitCategoriesProvider.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 8 8 100.0 %
Date: 2015-06-13 12:38:46 Functions: 7 7 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_INC_EXPLICITCATEGORIESPROVIDER_HXX
      20             : #define INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX
      21             : 
      22             : #include <cppuhelper/implbase1.hxx>
      23             : #include <cppuhelper/weakref.hxx>
      24             : #include <com/sun/star/chart2/XCoordinateSystem.hpp>
      25             : #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
      26             : #include "charttoolsdllapi.hxx"
      27             : #include "ChartModel.hxx"
      28             : 
      29             : #include <vector>
      30             : 
      31             : namespace chart
      32             : {
      33             : 
      34       19252 : struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory
      35             : {
      36             :     OUString Text;
      37             :     sal_Int32 Count;
      38             : 
      39        1552 :     ComplexCategory( const OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount)
      40        1552 :     {}
      41             : };
      42             : 
      43         287 : class OOO_DLLPUBLIC_CHARTTOOLS SplitCategoriesProvider
      44             : {
      45             : public:
      46             :     virtual ~SplitCategoriesProvider();
      47             : 
      48             :     virtual sal_Int32 getLevelCount() const = 0;
      49             :     virtual ::com::sun::star::uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0;
      50             : };
      51             : 
      52             : struct DatePlusIndex
      53             : {
      54             :     DatePlusIndex()
      55             :         : fValue(1.0)
      56             :         , nIndex( -1 )
      57             :     {
      58             :     }
      59             : 
      60       11234 :     DatePlusIndex( const double& _fValue, sal_Int32 _nIndex )
      61             :         : fValue(_fValue)
      62       11234 :         , nIndex( _nIndex )
      63             :     {
      64       11234 :     }
      65             : 
      66             :     double fValue;
      67             :     sal_Int32 nIndex;
      68             : };
      69             : 
      70             : class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider
      71             : {
      72             : public:
      73             :     ExplicitCategoriesProvider( const ::com::sun::star::uno::Reference<
      74             :                         ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
      75             :                        , ChartModel& rChartModel
      76             :                        );
      77             :     virtual ~ExplicitCategoriesProvider();
      78             : 
      79             :     void init();
      80             : 
      81             :     ::com::sun::star::uno::Reference<
      82             :         ::com::sun::star::chart2::data::XDataSequence > getOriginalCategories();
      83             : 
      84             :     ::com::sun::star::uno::Sequence< OUString > getSimpleCategories();
      85             :     const std::vector<ComplexCategory>* getCategoriesByLevel( sal_Int32 nLevel );
      86             : 
      87             :     static OUString getCategoryByIndex(
      88             :           const ::com::sun::star::uno::Reference<
      89             :             ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
      90             :         , ChartModel& rModel
      91             :         , sal_Int32 nIndex );
      92             : 
      93             :     static ::com::sun::star::uno::Sequence< OUString > getExplicitSimpleCategories(
      94             :             const SplitCategoriesProvider& rSplitCategoriesProvider );
      95             : 
      96             :     static void convertCategoryAnysToText( ::com::sun::star::uno::Sequence< OUString >& rOutTexts
      97             :         , const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rInAnys
      98             :         , ChartModel& rModel );
      99             : 
     100             :     bool hasComplexCategories() const;
     101             :     sal_Int32 getCategoryLevelCount() const;
     102             : 
     103             :     const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
     104          27 :         ::com::sun::star::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList() { return m_aSplitCategoriesList;}
     105             : 
     106             :     bool isDateAxis();
     107             :     const std::vector< DatePlusIndex >&  getDateCategories();
     108             : 
     109             : private: //member
     110             :     bool volatile m_bDirty;
     111             :     ::com::sun::star::uno::WeakReference<
     112             :         ::com::sun::star::chart2::XCoordinateSystem >   m_xCooSysModel;
     113             :     ChartModel& mrModel;
     114             :     ::com::sun::star::uno::Reference<
     115             :         ::com::sun::star::chart2::data::XLabeledDataSequence> m_xOriginalCategories;
     116             : 
     117             :     bool m_bIsExplicitCategoriesInited;
     118             :     ::com::sun::star::uno::Sequence< OUString >  m_aExplicitCategories;
     119             :     ::std::vector< ::std::vector< ComplexCategory > >   m_aComplexCats;
     120             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
     121             :         ::com::sun::star::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
     122             : 
     123             :     bool m_bIsDateAxis;
     124             :     bool m_bIsAutoDate;
     125             :     std::vector< DatePlusIndex >  m_aDateCategories;
     126             : };
     127             : 
     128             : } //  namespace chart
     129             : 
     130             : // INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX
     131             : #endif
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11