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

Generated by: LCOV version 1.10