LCOV - code coverage report
Current view: top level - chart2/source/inc - CachedDataSequence.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 1 0.0 %
Date: 2014-11-03 Functions: 0 1 0.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_CACHEDDATASEQUENCE_HXX
      20             : #define INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX
      21             : 
      22             : // helper classes
      23             : #include <cppuhelper/compbase7.hxx>
      24             : #include <comphelper/uno3.hxx>
      25             : #include <comphelper/broadcasthelper.hxx>
      26             : #include <comphelper/propertycontainer.hxx>
      27             : #include <comphelper/proparrhlp.hxx>
      28             : #include "ServiceMacros.hxx"
      29             : 
      30             : // interfaces and types
      31             : #include <com/sun/star/lang/XServiceInfo.hpp>
      32             : #include <com/sun/star/lang/XInitialization.hpp>
      33             : #include <com/sun/star/beans/XPropertySet.hpp>
      34             : #include <com/sun/star/uno/XComponentContext.hpp>
      35             : #include <com/sun/star/chart2/data/XDataSequence.hpp>
      36             : #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
      37             : #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
      38             : #include <com/sun/star/util/XCloneable.hpp>
      39             : #include <com/sun/star/util/XModifyBroadcaster.hpp>
      40             : 
      41             : #include <vector>
      42             : 
      43             : namespace chart
      44             : {
      45             : 
      46             : namespace impl
      47             : {
      48             : typedef ::cppu::WeakComponentImplHelper7<
      49             :     ::com::sun::star::chart2::data::XDataSequence,
      50             :     ::com::sun::star::chart2::data::XNumericalDataSequence,
      51             :     ::com::sun::star::chart2::data::XTextualDataSequence,
      52             :     ::com::sun::star::util::XCloneable,
      53             :     ::com::sun::star::util::XModifyBroadcaster,
      54             :     ::com::sun::star::lang::XInitialization,
      55             :     ::com::sun::star::lang::XServiceInfo >
      56             :     CachedDataSequence_Base;
      57             : }
      58             : 
      59             : /**
      60             :  * This sequence object does store actual values within, hence "cached".
      61             :  */
      62             : class CachedDataSequence :
      63             :         public ::comphelper::OMutexAndBroadcastHelper,
      64             :         public ::comphelper::OPropertyContainer,
      65             :         public ::comphelper::OPropertyArrayUsageHelper< CachedDataSequence >,
      66             :         public impl::CachedDataSequence_Base
      67             : {
      68             : public:
      69             :     /** constructs an empty sequence
      70             :      */
      71             :     CachedDataSequence();
      72             : 
      73             :     explicit CachedDataSequence(
      74             :         const ::com::sun::star::uno::Reference<
      75             :             ::com::sun::star::uno::XComponentContext > & xContext );
      76             : 
      77             :     /** creates a sequence and initializes it with the given string.  This is
      78             :         especially useful for labels, which only have one element.
      79             :      */
      80             :     explicit CachedDataSequence( const OUString & rSingleText );
      81             : 
      82             :     /// Copy CTOR
      83             :     explicit CachedDataSequence( const CachedDataSequence & rSource );
      84             : 
      85             :     virtual ~CachedDataSequence();
      86             : 
      87             :     /// establish methods for factory instatiation
      88           0 :     APPHELPER_SERVICE_FACTORY_HELPER( CachedDataSequence )
      89             :     /// declare XServiceInfo methods
      90             :     APPHELPER_XSERVICEINFO_DECL()
      91             : 
      92             :     /// merge XInterface implementations
      93             :     DECLARE_XINTERFACE()
      94             :     /// merge XTypeProvider implementations
      95             :     DECLARE_XTYPEPROVIDER()
      96             : 
      97             : protected:
      98             :     // ____ XPropertySet ____
      99             :     /// @see ::com::sun::star::beans::XPropertySet
     100             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
     101             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             :     /// @see ::comphelper::OPropertySetHelper
     103             :     virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
     104             :     /// @see ::comphelper::OPropertyArrayUsageHelper
     105             :     virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const SAL_OVERRIDE;
     106             : 
     107             :     // ____ XDataSequence ____
     108             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData()
     109             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     110             :     virtual OUString SAL_CALL getSourceRangeRepresentation()
     111             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     112             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL generateLabel(
     113             :         ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin )
     114             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             :     virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex )
     116             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     117             :                ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     118             : 
     119             :     // ____ XNumericalDataSequence ____
     120             :     /// @see ::com::sun::star::chart::data::XNumericalDataSequence
     121             :     virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             : 
     123             :     // ____ XTextualDataSequence ____
     124             :     /// @see ::com::sun::star::chart::data::XTextualDataSequence
     125             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getTextualData() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             : 
     127             :     // ____ XCloneable ____
     128             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
     129             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     130             : 
     131             :     // ____ XModifyBroadcaster ____
     132             :     virtual void SAL_CALL addModifyListener(
     133             :         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
     134             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     135             :     virtual void SAL_CALL removeModifyListener(
     136             :         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
     137             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     138             : 
     139             :     // ::com::sun::star::lang::XInitialization:
     140             :     virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
     141             :         throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     142             : 
     143             :     // <properties>
     144             :     sal_Int32                                       m_nNumberFormatKey;
     145             :     OUString                                 m_sRole;
     146             :     // </properties>
     147             : 
     148             :     enum DataType
     149             :     {
     150             :         NUMERICAL,
     151             :         TEXTUAL,
     152             :         MIXED
     153             :     };
     154             : 
     155             :     /** This method registers all properties.  It should be called by all
     156             :         constructors.
     157             :      */
     158             :     void registerProperties();
     159             : 
     160             : private:
     161             :     /** is used by interface method getNumericalData().
     162             :      */
     163             :     ::com::sun::star::uno::Sequence< double > Impl_getNumericalData() const;
     164             :     /** is used by interface method getTextualData().
     165             :      */
     166             :     ::com::sun::star::uno::Sequence< OUString > Impl_getTextualData() const;
     167             :     /** is used by interface method getData().
     168             :      */
     169             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > Impl_getMixedData() const;
     170             : 
     171             : private:
     172             :     enum DataType                                       m_eCurrentDataType;
     173             : 
     174             :     ::com::sun::star::uno::Sequence< double >           m_aNumericalSequence;
     175             :     ::com::sun::star::uno::Sequence< OUString >  m_aTextualSequence;
     176             :     ::com::sun::star::uno::Sequence<
     177             :         ::com::sun::star::uno::Any >                    m_aMixedSequence;
     178             :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >
     179             :         m_xModifyEventForwarder;
     180             : };
     181             : 
     182             : }  // namespace chart
     183             : 
     184             : // INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX
     185             : #endif
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10