LCOV - code coverage report
Current view: top level - chart2/source/inc - InternalDataProvider.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2 0.0 %

           Branch data     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_INTERNALDATAPROVIDER_HXX
      20                 :            : #define CHART2_INTERNALDATAPROVIDER_HXX
      21                 :            : 
      22                 :            : #include "InternalData.hxx"
      23                 :            : 
      24                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      25                 :            : #include <com/sun/star/chart/XDateCategories.hpp>
      26                 :            : #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
      27                 :            : #include <com/sun/star/chart2/data/XDataProvider.hpp>
      28                 :            : #include <com/sun/star/chart2/XInternalDataProvider.hpp>
      29                 :            : #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
      30                 :            : #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
      31                 :            : #include <com/sun/star/chart2/XChartDocument.hpp>
      32                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      33                 :            : #include <com/sun/star/util/XCloneable.hpp>
      34                 :            : #include <cppuhelper/implbase7.hxx>
      35                 :            : #include "ServiceMacros.hxx"
      36                 :            : 
      37                 :            : #include "CachedDataSequence.hxx"
      38                 :            : 
      39                 :            : #include <map>
      40                 :            : #include <memory>
      41                 :            : 
      42                 :            : namespace chart
      43                 :            : {
      44                 :            : 
      45                 :            : namespace impl
      46                 :            : {
      47                 :            : 
      48                 :            : typedef ::cppu::WeakImplHelper7<
      49                 :            :         ::com::sun::star::chart2::XInternalDataProvider,
      50                 :            :         ::com::sun::star::chart2::data::XRangeXMLConversion,
      51                 :            :         ::com::sun::star::chart2::XAnyDescriptionAccess,
      52                 :            :         ::com::sun::star::chart::XDateCategories,
      53                 :            :         ::com::sun::star::util::XCloneable,
      54                 :            :         ::com::sun::star::lang::XInitialization,
      55                 :            :         ::com::sun::star::lang::XServiceInfo >
      56                 :            :     InternalDataProvider_Base;
      57                 :            : }
      58                 :            : 
      59                 :            : /** Data provider that handles data internally.  This is used for charts with
      60                 :            :     their own data.
      61                 :            : 
      62                 :            :     <p>The format for single ranges is "categories|label n|n" where n is a
      63                 :            :     non-negative number. Meaning return all categories, the label of sequence n,
      64                 :            :     or the data of sequence n.</p>
      65                 :            : 
      66                 :            :     <p>The format for a complete range is "all". (Do we need more than
      67                 :            :     that?)</p>
      68                 :            :  */
      69                 :            : class InternalDataProvider :
      70                 :            :         public impl::InternalDataProvider_Base
      71                 :            : {
      72                 :            : public:
      73                 :            :     explicit InternalDataProvider(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _xContext);
      74                 :            :     explicit InternalDataProvider( const ::com::sun::star::uno::Reference<
      75                 :            :                                        ::com::sun::star::chart2::XChartDocument > & xChartDoc, bool bConnectToModel );
      76                 :            :     explicit InternalDataProvider( const InternalDataProvider & rOther );
      77                 :            :     virtual ~InternalDataProvider();
      78                 :            : 
      79                 :            :     void createDefaultData();
      80                 :            : 
      81                 :            :     /// declare XServiceInfo methods
      82                 :            :     APPHELPER_XSERVICEINFO_DECL()
      83         [ #  # ]:          0 :     APPHELPER_SERVICE_FACTORY_HELPER(InternalDataProvider)
      84                 :            : 
      85                 :            :     // ____ XInternalDataProvider ____
      86                 :            :     virtual ::sal_Bool SAL_CALL hasDataByRangeRepresentation( const ::rtl::OUString& aRange )
      87                 :            :         throw (::com::sun::star::uno::RuntimeException);
      88                 :            :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
      89                 :            :         getDataByRangeRepresentation( const ::rtl::OUString& aRange )
      90                 :            :         throw (::com::sun::star::uno::RuntimeException);
      91                 :            :     virtual void SAL_CALL setDataByRangeRepresentation(
      92                 :            :         const ::rtl::OUString& aRange,
      93                 :            :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aNewData )
      94                 :            :         throw (::com::sun::star::uno::RuntimeException);
      95                 :            :     virtual void SAL_CALL insertSequence( ::sal_Int32 nAfterIndex )
      96                 :            :         throw (::com::sun::star::uno::RuntimeException);
      97                 :            :     virtual void SAL_CALL deleteSequence( ::sal_Int32 nAtIndex )
      98                 :            :         throw (::com::sun::star::uno::RuntimeException);
      99                 :            :     virtual void SAL_CALL appendSequence()
     100                 :            :         throw (::com::sun::star::uno::RuntimeException);
     101                 :            :     virtual void SAL_CALL insertComplexCategoryLevel( ::sal_Int32 nLevel )
     102                 :            :         throw (::com::sun::star::uno::RuntimeException);
     103                 :            :     virtual void SAL_CALL deleteComplexCategoryLevel( ::sal_Int32 nLevel )
     104                 :            :         throw (::com::sun::star::uno::RuntimeException);
     105                 :            :     virtual void SAL_CALL insertDataPointForAllSequences( ::sal_Int32 nAfterIndex )
     106                 :            :         throw (::com::sun::star::uno::RuntimeException);
     107                 :            :     virtual void SAL_CALL deleteDataPointForAllSequences( ::sal_Int32 nAtIndex )
     108                 :            :         throw (::com::sun::star::uno::RuntimeException);
     109                 :            :     virtual void SAL_CALL swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex )
     110                 :            :         throw (::com::sun::star::uno::RuntimeException);
     111                 :            :     virtual void SAL_CALL registerDataSequenceForChanges(
     112                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSeq )
     113                 :            :         throw (::com::sun::star::uno::RuntimeException);
     114                 :            : 
     115                 :            :     // ____ XDataProvider (base of XInternalDataProvider) ____
     116                 :            :     virtual ::sal_Bool SAL_CALL createDataSourcePossible(
     117                 :            :         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
     118                 :            :         throw (::com::sun::star::uno::RuntimeException);
     119                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > SAL_CALL createDataSource(
     120                 :            :         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
     121                 :            :         throw (::com::sun::star::lang::IllegalArgumentException,
     122                 :            :                ::com::sun::star::uno::RuntimeException);
     123                 :            :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments(
     124                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource )
     125                 :            :         throw (::com::sun::star::uno::RuntimeException);
     126                 :            :     virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(
     127                 :            :         const ::rtl::OUString& aRangeRepresentation )
     128                 :            :         throw (::com::sun::star::uno::RuntimeException);
     129                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(
     130                 :            :         const ::rtl::OUString& aRangeRepresentation )
     131                 :            :         throw (::com::sun::star::lang::IllegalArgumentException,
     132                 :            :                ::com::sun::star::uno::RuntimeException);
     133                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection()
     134                 :            :         throw (::com::sun::star::uno::RuntimeException);
     135                 :            : 
     136                 :            :     // ____ XRangeXMLConversion ____
     137                 :            :     virtual ::rtl::OUString SAL_CALL convertRangeToXML(
     138                 :            :         const ::rtl::OUString& aRangeRepresentation )
     139                 :            :         throw (::com::sun::star::lang::IllegalArgumentException,
     140                 :            :                ::com::sun::star::uno::RuntimeException);
     141                 :            :     virtual ::rtl::OUString SAL_CALL convertRangeFromXML(
     142                 :            :         const ::rtl::OUString& aXMLRange )
     143                 :            :         throw (::com::sun::star::lang::IllegalArgumentException,
     144                 :            :                ::com::sun::star::uno::RuntimeException);
     145                 :            : 
     146                 :            :     // ____ XDateCategories ____
     147                 :            :     virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getDateCategories() throw (::com::sun::star::uno::RuntimeException);
     148                 :            :     virtual void SAL_CALL setDateCategories( const ::com::sun::star::uno::Sequence< double >& rDates ) throw (::com::sun::star::uno::RuntimeException);
     149                 :            : 
     150                 :            :     // ____ XAnyDescriptionAccess ____
     151                 :            :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL
     152                 :            :         getAnyRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
     153                 :            :     virtual void SAL_CALL setAnyRowDescriptions(
     154                 :            :         const ::com::sun::star::uno::Sequence<
     155                 :            :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aRowDescriptions )
     156                 :            :         throw (::com::sun::star::uno::RuntimeException);
     157                 :            :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL
     158                 :            :         getAnyColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
     159                 :            :     virtual void SAL_CALL setAnyColumnDescriptions(
     160                 :            :         const ::com::sun::star::uno::Sequence<
     161                 :            :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aColumnDescriptions )
     162                 :            :         throw (::com::sun::star::uno::RuntimeException);
     163                 :            : 
     164                 :            :     // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____
     165                 :            :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
     166                 :            :         getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
     167                 :            :     virtual void SAL_CALL setComplexRowDescriptions(
     168                 :            :         const ::com::sun::star::uno::Sequence<
     169                 :            :         ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aRowDescriptions )
     170                 :            :         throw (::com::sun::star::uno::RuntimeException);
     171                 :            :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
     172                 :            :         getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
     173                 :            :     virtual void SAL_CALL setComplexColumnDescriptions(
     174                 :            :         const ::com::sun::star::uno::Sequence<
     175                 :            :         ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aColumnDescriptions )
     176                 :            :         throw (::com::sun::star::uno::RuntimeException);
     177                 :            : 
     178                 :            :     // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
     179                 :            :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData()
     180                 :            :         throw (::com::sun::star::uno::RuntimeException);
     181                 :            :     virtual void SAL_CALL setData(
     182                 :            :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& aData )
     183                 :            :         throw (::com::sun::star::uno::RuntimeException);
     184                 :            :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowDescriptions()
     185                 :            :         throw (::com::sun::star::uno::RuntimeException);
     186                 :            :     virtual void SAL_CALL setRowDescriptions(
     187                 :            :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRowDescriptions )
     188                 :            :         throw (::com::sun::star::uno::RuntimeException);
     189                 :            :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getColumnDescriptions()
     190                 :            :         throw (::com::sun::star::uno::RuntimeException);
     191                 :            :     virtual void SAL_CALL setColumnDescriptions(
     192                 :            :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aColumnDescriptions )
     193                 :            :         throw (::com::sun::star::uno::RuntimeException);
     194                 :            : 
     195                 :            :     // ____ XChartData (base of XChartDataArray) ____
     196                 :            :     virtual void SAL_CALL addChartDataChangeEventListener(
     197                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
     198                 :            :         throw (::com::sun::star::uno::RuntimeException);
     199                 :            :     virtual void SAL_CALL removeChartDataChangeEventListener(
     200                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
     201                 :            :         throw (::com::sun::star::uno::RuntimeException);
     202                 :            :     virtual double SAL_CALL getNotANumber()
     203                 :            :         throw (::com::sun::star::uno::RuntimeException);
     204                 :            :     virtual ::sal_Bool SAL_CALL isNotANumber(
     205                 :            :         double nNumber )
     206                 :            :         throw (::com::sun::star::uno::RuntimeException);
     207                 :            : 
     208                 :            :     // ____ XCloneable ____
     209                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
     210                 :            :         throw (::com::sun::star::uno::RuntimeException);
     211                 :            :     // ::com::sun::star::lang::XInitialization:
     212                 :            :     virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
     213                 :            :         throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception);
     214                 :            : 
     215                 :            : private:
     216                 :            :     void lcl_addDataSequenceToMap(
     217                 :            :         const ::rtl::OUString & rRangeRepresentation,
     218                 :            :         const ::com::sun::star::uno::Reference<
     219                 :            :             ::com::sun::star::chart2::data::XDataSequence > & xSequence );
     220                 :            : 
     221                 :            :     ::com::sun::star::uno::Reference<
     222                 :            :             ::com::sun::star::chart2::data::XDataSequence >
     223                 :            :         lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation,
     224                 :            :                                        const ::rtl::OUString & rRole );
     225                 :            :     ::com::sun::star::uno::Reference<
     226                 :            :             ::com::sun::star::chart2::data::XDataSequence >
     227                 :            :         lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation );
     228                 :            : 
     229                 :            :     void lcl_deleteMapReferences( const ::rtl::OUString & rRangeRepresentation );
     230                 :            : 
     231                 :            :     void lcl_adaptMapReferences(
     232                 :            :         const ::rtl::OUString & rOldRangeRepresentation,
     233                 :            :         const ::rtl::OUString & rNewRangeRepresentation );
     234                 :            : 
     235                 :            :     void lcl_increaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
     236                 :            :     void lcl_decreaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
     237                 :            : 
     238                 :            :     typedef ::std::multimap< ::rtl::OUString,
     239                 :            :             ::com::sun::star::uno::WeakReference< ::com::sun::star::chart2::data::XDataSequence > >
     240                 :            :         tSequenceMap;
     241                 :            :     typedef ::std::pair< tSequenceMap::iterator, tSequenceMap::iterator > tSequenceMapRange;
     242                 :            :     typedef ::std::pair< tSequenceMap::const_iterator, tSequenceMap::const_iterator > tConstSequenceMapRange;
     243                 :            : 
     244                 :            :     /** cache for all sequences that have been returned.
     245                 :            : 
     246                 :            :         If the range-representation of a sequence changes and it is still
     247                 :            :         referred to by some component (weak reference is valid), the range will
     248                 :            :         be adapted.
     249                 :            :      */
     250                 :            :     tSequenceMap m_aSequenceMap;
     251                 :            :     InternalData m_aInternalData;
     252                 :            :     bool m_bDataInColumns;
     253                 :            : };
     254                 :            : 
     255                 :            : } //  namespace chart
     256                 :            : 
     257                 :            : // CHART2_INTERNALDATAPROVIDER_HXX
     258                 :            : #endif
     259                 :            : 
     260                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10