LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/chart2/source/inc - ExplicitCategoriesProvider.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2013-07-09 Functions: 6 6 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 CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX
      20             : #define CHART2_VIEW_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 <com/sun/star/frame/XModel.hpp>
      28             : #include "charttoolsdllapi.hxx"
      29             : 
      30             : #include <vector>
      31             : 
      32             : namespace chart
      33             : {
      34             : 
      35        1055 : struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory
      36             : {
      37             :     OUString Text;
      38             :     sal_Int32 Count;
      39             : 
      40          87 :     ComplexCategory( const OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount)
      41          87 :     {}
      42             : };
      43             : 
      44          15 : 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        6030 :     DatePlusIndex( const double& _fValue, sal_Int32 _nIndex )
      62             :         : fValue(_fValue)
      63        6030 :         , nIndex( _nIndex )
      64             :     {
      65        6030 :     }
      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             :                        , const ::com::sun::star::uno::Reference<
      77             :                         ::com::sun::star::frame::XModel >& xChartModel
      78             :                        );
      79             :     virtual ~ExplicitCategoriesProvider();
      80             : 
      81             :     void init();
      82             : 
      83             :     ::com::sun::star::uno::Reference<
      84             :         ::com::sun::star::chart2::data::XDataSequence > getOriginalCategories();
      85             : 
      86             :     ::com::sun::star::uno::Sequence< OUString > getSimpleCategories();
      87             :     const std::vector<ComplexCategory>* getCategoriesByLevel( sal_Int32 nLevel );
      88             : 
      89             :     static OUString getCategoryByIndex(
      90             :           const ::com::sun::star::uno::Reference<
      91             :             ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
      92             :         , const ::com::sun::star::uno::Reference<
      93             :             ::com::sun::star::frame::XModel >& xChartModel
      94             :         , sal_Int32 nIndex );
      95             : 
      96             :     static ::com::sun::star::uno::Sequence< OUString > getExplicitSimpleCategories(
      97             :             const SplitCategoriesProvider& rSplitCategoriesProvider );
      98             : 
      99             :     static void convertCategoryAnysToText( ::com::sun::star::uno::Sequence< OUString >& rOutTexts
     100             :         , const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rInAnys
     101             :         , ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xChartModel );
     102             : 
     103             :     bool hasComplexCategories() const;
     104             :     sal_Int32 getCategoryLevelCount() const;
     105             : 
     106             :     const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
     107             :         ::com::sun::star::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList();
     108             : 
     109             :     bool isDateAxis();
     110             :     const std::vector< DatePlusIndex >&  getDateCategories();
     111             : 
     112             : private: //member
     113             :     bool volatile m_bDirty;
     114             :     ::com::sun::star::uno::WeakReference<
     115             :         ::com::sun::star::chart2::XCoordinateSystem >   m_xCooSysModel;
     116             :     ::com::sun::star::uno::WeakReference<
     117             :         ::com::sun::star::frame::XModel >               m_xChartModel;
     118             :     ::com::sun::star::uno::Reference<
     119             :         ::com::sun::star::chart2::data::XLabeledDataSequence> m_xOriginalCategories;
     120             : 
     121             :     bool m_bIsExplicitCategoriesInited;
     122             :     ::com::sun::star::uno::Sequence< OUString >  m_aExplicitCategories;
     123             :     ::std::vector< ::std::vector< ComplexCategory > >   m_aComplexCats;
     124             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
     125             :         ::com::sun::star::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
     126             : 
     127             :     bool m_bIsDateAxis;
     128             :     bool m_bIsAutoDate;
     129             :     std::vector< DatePlusIndex >  m_aDateCategories;
     130             : };
     131             : 
     132             : } //  namespace chart
     133             : 
     134             : // CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX
     135             : #endif
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10