LCOV - code coverage report
Current view: top level - chart2/inc - ChartView.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 2 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_VIEW_MAIN_CHARTVIEW_HXX
      20             : #define INCLUDED_CHART2_SOURCE_VIEW_MAIN_CHARTVIEW_HXX
      21             : 
      22             : #include "ChartModel.hxx"
      23             : #include "chartview/ExplicitValueProvider.hxx"
      24             : #include "ServiceMacros.hxx"
      25             : #include <cppuhelper/implbase10.hxx>
      26             : #include <cppuhelper/interfacecontainer.hxx>
      27             : 
      28             : // header for class SfxListener
      29             : #include <svl/lstner.hxx>
      30             : #include <com/sun/star/datatransfer/XTransferable.hpp>
      31             : #include <com/sun/star/drawing/XDrawPage.hpp>
      32             : #include <com/sun/star/frame/XModel.hpp>
      33             : #include <com/sun/star/io/XOutputStream.hpp>
      34             : #include <com/sun/star/lang/XInitialization.hpp>
      35             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      36             : #include <com/sun/star/lang/XServiceInfo.hpp>
      37             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      38             : #include <com/sun/star/uno/XComponentContext.hpp>
      39             : #include <com/sun/star/util/XModifyListener.hpp>
      40             : #include <com/sun/star/util/XModeChangeBroadcaster.hpp>
      41             : #include <com/sun/star/util/XUpdatable.hpp>
      42             : #include <com/sun/star/qa/XDumper.hpp>
      43             : 
      44             : #include <vector>
      45             : #include <boost/shared_ptr.hpp>
      46             : #include <boost/ptr_container/ptr_vector.hpp>
      47             : 
      48             : #include <vcl/timer.hxx>
      49             : 
      50             : class SdrPage;
      51             : 
      52             : namespace chart {
      53             : 
      54             : class VCoordinateSystem;
      55             : class DrawModelWrapper;
      56             : class SeriesPlotterContainer;
      57             : class VDataSeries;
      58             : 
      59             : enum TimeBasedMode
      60             : {
      61             :     MANUAL,
      62             :     AUTOMATIC,
      63             :     AUTOMATIC_WRAP
      64             : };
      65             : 
      66           0 : struct TimeBasedInfo
      67             : {
      68           0 :     TimeBasedInfo():
      69             :         bTimeBased(false),
      70             :         nFrame(0),
      71           0 :         eMode(AUTOMATIC) {}
      72             : 
      73             :     bool bTimeBased;
      74             :     size_t nFrame;
      75             :     TimeBasedMode eMode;
      76             :     Timer maTimer;
      77             : 
      78             :     // only valid when we are in the time based mode
      79             :     ::std::vector< std::vector< VDataSeries* > > m_aDataSeriesList;
      80             : };
      81             : 
      82             : /**
      83             :  * The ChartView is responsible to manage the generation of Drawing Objects
      84             :  * for visualization on a given OutputDevice. The ChartModel is responsible
      85             :  * to notify changes to the view. The view than changes to state dirty. The
      86             :  * view can be updated with call 'update'.
      87             :  *
      88             :  * The View is not responsible to handle single user events (that is instead
      89             :  * done by the ChartWindow).
      90             :  */
      91             : class ChartView : public ::cppu::WeakImplHelper10<
      92             :     ::com::sun::star::lang::XInitialization
      93             :         ,::com::sun::star::lang::XServiceInfo
      94             :         ,::com::sun::star::datatransfer::XTransferable
      95             :         ,::com::sun::star::lang::XUnoTunnel
      96             :         ,::com::sun::star::util::XModifyListener
      97             :         ,::com::sun::star::util::XModeChangeBroadcaster
      98             :         ,::com::sun::star::util::XUpdatable
      99             :         ,::com::sun::star::beans::XPropertySet
     100             :         ,::com::sun::star::lang::XMultiServiceFactory
     101             :         ,::com::sun::star::qa::XDumper
     102             :         >
     103             :         , public ExplicitValueProvider
     104             :         , private SfxListener
     105             : {
     106             : private:
     107             :     void init();
     108             : 
     109             : public:
     110             :     ChartView(::com::sun::star::uno::Reference<
     111             :                ::com::sun::star::uno::XComponentContext > const & xContext,
     112             :                ChartModel& rModel);
     113             : 
     114             :     virtual ~ChartView();
     115             : 
     116             :     // ___lang::XServiceInfo___
     117             :     APPHELPER_XSERVICEINFO_DECL()
     118             : 
     119             :     // ___lang::XInitialization___
     120             :     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
     121             :                 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             : 
     123             :     // ___ExplicitValueProvider___
     124             :     virtual sal_Bool getExplicitValuesForAxis(
     125             :         ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > xAxis
     126             :         , ExplicitScaleData&  rExplicitScale
     127             :         , ExplicitIncrementData& rExplicitIncrement ) SAL_OVERRIDE;
     128             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     129             :         getShapeForCID( const OUString& rObjectCID ) SAL_OVERRIDE;
     130             : 
     131             :     virtual ::com::sun::star::awt::Rectangle getRectangleOfObject( const OUString& rObjectCID, bool bSnapRect=false ) SAL_OVERRIDE;
     132             : 
     133             :     virtual ::com::sun::star::awt::Rectangle getDiagramRectangleExcludingAxes() SAL_OVERRIDE;
     134             : 
     135             :     ::boost::shared_ptr< DrawModelWrapper > getDrawModelWrapper() SAL_OVERRIDE;
     136             : 
     137             :     // ___XTransferable___
     138             :     virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
     139             :                 throw (::com::sun::star::datatransfer::UnsupportedFlavorException
     140             :                      , ::com::sun::star::io::IOException
     141             :                      , ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     142             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors(  )
     143             :                 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     144             :     virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
     145             :                 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     146             : 
     147             :     // ::com::sun::star::util::XEventListener (base of XCloseListener and XModifyListener)
     148             :     virtual void SAL_CALL
     149             :         disposing( const ::com::sun::star::lang::EventObject& Source )
     150             :                             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     151             : 
     152             :     // ::com::sun::star::util::XModifyListener
     153             :     virtual void SAL_CALL modified(
     154             :         const ::com::sun::star::lang::EventObject& aEvent )
     155             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     156             : 
     157             :     //SfxListener
     158             :     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     159             : 
     160             :     // ::com::sun::star::util::XModeChangeBroadcaster
     161             : 
     162             :     virtual void SAL_CALL addModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     163             :     virtual void SAL_CALL removeModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             :     virtual void SAL_CALL addModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     165             :     virtual void SAL_CALL removeModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     166             : 
     167             :     // ::com::sun::star::util::XUpdatable
     168             :     virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     169             : 
     170             :     // ::com::sun::star::beans::XPropertySet
     171             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     172             :     virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     173             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     174             :     virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     175             :     virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     176             :     virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     177             :     virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     178             : 
     179             :     // ::com::sun::star::lang::XMultiServiceFactory
     180             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier )
     181             :         throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     182             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(
     183             :         const OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments )
     184             :         throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     185             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     186             : 
     187             :     // for ExplicitValueProvider
     188             :     // ____ XUnoTunnel ___
     189             :     virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier )
     190             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     191             : 
     192             :     // XDumper
     193             :     virtual OUString SAL_CALL dump()
     194             :             throw(::com::sun::star::uno::RuntimeException,
     195             :                   std::exception) SAL_OVERRIDE;
     196             : 
     197             :     void setViewDirty();
     198             : 
     199             : private: //methods
     200             :     ChartView();
     201             : 
     202             :     void createShapes();
     203             :     void createShapes3D();
     204             :     bool isReal3DChart();
     205             :     void getMetaFile( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream
     206             :                       , bool bUseHighContrast );
     207             :     SdrPage* getSdrPage();
     208             : 
     209             :     void impl_deleteCoordinateSystems();
     210             :     void impl_notifyModeChangeListener( const OUString& rNewMode );
     211             : 
     212             :     void impl_refreshAddIn();
     213             :     bool impl_AddInDrawsAllByItself();
     214             : 
     215             :     void impl_updateView();
     216             : 
     217             :     ::com::sun::star::awt::Rectangle impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
     218             :         , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes>& xDiagramPlusAxes_Shapes
     219             :         , const ::com::sun::star::awt::Point& rAvailablePos
     220             :         , const ::com::sun::star::awt::Size& rAvailableSize
     221             :         , const ::com::sun::star::awt::Size& rPageSize
     222             :         , bool bUseFixedInnerSize
     223             :         , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& xDiagram_MarkHandles );
     224             : 
     225             :     DECL_LINK( UpdateTimeBased, void* );
     226             : 
     227             : private: //member
     228             :     ::osl::Mutex m_aMutex;
     229             : 
     230             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>
     231             :             m_xCC;
     232             : 
     233             :     chart::ChartModel& mrChartModel;
     234             : 
     235             :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
     236             :             m_xShapeFactory;
     237             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage>
     238             :             m_xDrawPage;
     239             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
     240             :             mxRootShape;
     241             : 
     242             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xDashTable;
     243             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xGradientTable;
     244             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xHatchTable;
     245             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xBitmapTable;
     246             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xTransGradientTable;
     247             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xMarkerTable;
     248             : 
     249             :     ::boost::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
     250             : 
     251             :     std::vector< VCoordinateSystem* > m_aVCooSysList;
     252             : 
     253             :     ::cppu::OMultiTypeInterfaceContainerHelper
     254             :                         m_aListenerContainer;
     255             : 
     256             :     bool volatile       m_bViewDirty; //states whether the view needs to be rebuild
     257             :     bool volatile       m_bInViewUpdate;
     258             :     bool volatile       m_bViewUpdatePending;
     259             :     bool volatile       m_bRefreshAddIn;
     260             : 
     261             :     //better performance for big data
     262             :     ::com::sun::star::awt::Size m_aPageResolution;
     263             :     bool m_bPointsWereSkipped;
     264             : 
     265             :     //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
     266             :     sal_Int32 m_nScaleXNumerator;
     267             :     sal_Int32 m_nScaleXDenominator;
     268             :     sal_Int32 m_nScaleYNumerator;
     269             :     sal_Int32 m_nScaleYDenominator;
     270             : 
     271             :     sal_Bool m_bSdrViewIsInEditMode;
     272             : 
     273             :     ::com::sun::star::awt::Rectangle m_aResultingDiagramRectangleExcludingAxes;
     274             : 
     275             :     TimeBasedInfo maTimeBased;
     276             :     osl::Mutex maTimeMutex;
     277             : };
     278             : 
     279             : }
     280             : 
     281             : #endif
     282             : 
     283             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10