LCOV - code coverage report
Current view: top level - reportdesign/inc - RptObject.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 9 0.0 %
Date: 2014-04-11 Functions: 0 7 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 _REPORT_RPTUIOBJ_HXX
      20             : #define _REPORT_RPTUIOBJ_HXX
      21             : 
      22             : #include "dllapi.h"
      23             : #include <svx/svdoole2.hxx>
      24             : #include <svx/svdouno.hxx>
      25             : 
      26             : 
      27             : #include <comphelper/processfactory.hxx>
      28             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      29             : #include <com/sun/star/container/XContainerListener.hpp>
      30             : #include <com/sun/star/report/XReportComponent.hpp>
      31             : #include <com/sun/star/report/XSection.hpp>
      32             : #include <svx/svdocirc.hxx>
      33             : #include <svx/svdogrp.hxx>
      34             : #include <svx/svdoashp.hxx>
      35             : #include <comphelper/implementationreference.hxx>
      36             : 
      37             : 
      38             : namespace rptui
      39             : {
      40             : typedef ::std::multimap< sal_Int16, OUString, ::std::less< sal_Int16 > > IndexToNameMap;
      41             :     enum DlgEdHintKind
      42             :     {
      43             :         RPTUI_HINT_UNKNOWN,
      44             :         RPTUI_HINT_WINDOWSCROLLED,
      45             :         RPTUI_HINT_LAYERCHANGED,
      46             :         RPTUI_HINT_OBJORDERCHANGED,
      47             :         RPTUI_HINT_SELECTIONCHANGED
      48             :     };
      49             : 
      50             :     class OUnoObject;
      51             :     class REPORTDESIGN_DLLPUBLIC DlgEdHint: public SfxHint
      52             :     {
      53             :     private:
      54             :         DlgEdHintKind   eHintKind;
      55             :         OUnoObject*     pDlgEdObj;
      56             : 
      57             :         DlgEdHint(DlgEdHint&);
      58             :         void operator =(DlgEdHint&);
      59             :     public:
      60             :         TYPEINFO_OVERRIDE();
      61             :         DlgEdHint( DlgEdHintKind eHint );
      62             :         virtual ~DlgEdHint();
      63             : 
      64           0 :         inline DlgEdHintKind    GetKind() const { return eHintKind; }
      65             :         inline OUnoObject*      GetObject() const { return pDlgEdObj; }
      66             :     };
      67             : 
      68             : 
      69             : class OReportPage;
      70             : class OPropertyMediator;
      71             : 
      72             : class REPORTDESIGN_DLLPUBLIC OObjectBase
      73             : {
      74             : public:
      75             :     typedef ::comphelper::ImplementationReference<OPropertyMediator,::com::sun::star::beans::XPropertyChangeListener> TMediator;
      76             : 
      77             : protected:
      78             :     mutable TMediator                                                                           m_xMediator;
      79             :     mutable ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener> m_xPropertyChangeListener;
      80             :     //mutable ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener>
      81             :     mutable ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>       m_xReportComponent;
      82             :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener>          m_xContainerListener;
      83             :     ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>                       m_xSection;
      84             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >                       m_xKeepShapeAlive;
      85             :     OUString m_sComponentName;
      86             :     sal_Bool        m_bIsListening;
      87             : 
      88             :     OObjectBase(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
      89             :     OObjectBase(const OUString& _sComponentName);
      90             : 
      91             :     virtual ~OObjectBase();
      92             : 
      93           0 :     inline sal_Bool isListening() const { return m_bIsListening; }
      94             : 
      95             :     void SetPropsFromRect(const Rectangle& _rRect);
      96             : 
      97             :     virtual void SetSnapRectImpl(const Rectangle& _rRect) = 0;
      98             :     virtual SdrPage* GetImplPage() const = 0;
      99             :     virtual void SetObjectItemHelper(const SfxPoolItem& rItem);
     100             : 
     101             :     /** called by instances of derived classes to implement their overloading of getUnoShape
     102             :     */
     103             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
     104             :             getUnoShapeOf( SdrObject& _rSdrObject );
     105             : 
     106             : private:
     107             :     static void    ensureSdrObjectOwnership(
     108             :                     const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxShape );
     109             : 
     110             : public:
     111             :     void StartListening();
     112             :     void EndListening(sal_Bool bRemoveListener = sal_True);
     113             :     // PropertyChangeListener
     114             :     virtual void _propertyChange( const  ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
     115           0 :     virtual void initializeOle() {}
     116             : 
     117             :     sal_Bool        supportsService( const OUString& _sServiceName ) const;
     118             : 
     119             :     ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> getReportComponent() const;
     120             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent();
     121             :     inline void setOldParent(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) { m_xSection = _xSection; }
     122             :     inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> getOldParent() const { return m_xSection;}
     123             :     ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> getSection() const;
     124           0 :     inline const OUString getServiceName() const { return m_sComponentName; }
     125             : 
     126             :     /** releases the reference to our UNO shape (m_xKeepShapeAlive)
     127             :     */
     128           0 :     void    releaseUnoShape() { m_xKeepShapeAlive.clear(); }
     129             : 
     130             :     static SdrObject* createObject(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
     131             :     static sal_uInt16 getObjectType(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
     132             : };
     133             : 
     134             : // OCustomShape
     135             : 
     136             : class REPORTDESIGN_DLLPUBLIC OCustomShape: public SdrObjCustomShape , public OObjectBase
     137             : {
     138             :     friend class OReportPage;
     139             :     friend class DlgEdFactory;
     140             : 
     141             : public:
     142           0 :     static OCustomShape* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent )
     143             :     {
     144           0 :         return new OCustomShape( _xComponent );
     145             :     }
     146             : 
     147             : protected:
     148             :     OCustomShape(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
     149             :     OCustomShape(const OUString& _sComponentName);
     150             : 
     151             :     virtual void NbcMove( const Size& rSize ) SAL_OVERRIDE;
     152             :     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
     153             :     virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
     154             :     virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
     155             : 
     156             :     virtual void SetSnapRectImpl(const Rectangle& _rRect) SAL_OVERRIDE;
     157             :     virtual SdrPage* GetImplPage() const SAL_OVERRIDE;
     158             :     void SetObjectItemHelper(const SfxPoolItem& rItem) SAL_OVERRIDE;
     159             : 
     160             : public:
     161             :     TYPEINFO_OVERRIDE();
     162             : 
     163             :     virtual ~OCustomShape();
     164             : 
     165             :     virtual sal_Int32   GetStep() const;
     166             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent() SAL_OVERRIDE;
     167             : 
     168             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape() SAL_OVERRIDE;
     169             :     virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
     170             :     virtual sal_uInt32 GetObjInventor() const SAL_OVERRIDE;
     171             : 
     172             : private:
     173             :     virtual void impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxUnoShape ) SAL_OVERRIDE;
     174             : };
     175             : 
     176             : 
     177             : // OOle2Obj
     178             : 
     179             : class REPORTDESIGN_DLLPUBLIC OOle2Obj: public SdrOle2Obj , public OObjectBase
     180             : {
     181             :     friend class OReportPage;
     182             :     friend class DlgEdFactory;
     183             : 
     184             :     sal_uInt16 m_nType;
     185             :     bool    m_bOnlyOnce;
     186             :     void impl_createDataProvider_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel);
     187             :     virtual void impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxUnoShape ) SAL_OVERRIDE;
     188             : 
     189             : public:
     190           0 :     static OOle2Obj* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent,sal_uInt16 _nType )
     191             :     {
     192           0 :         return new OOle2Obj( _xComponent,_nType );
     193             :     }
     194             : protected:
     195             :     OOle2Obj(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent,sal_uInt16 _nType);
     196             :     OOle2Obj(const OUString& _sComponentName,sal_uInt16 _nType);
     197             : 
     198             : 
     199             :     virtual void NbcMove( const Size& rSize ) SAL_OVERRIDE;
     200             :     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
     201             :     virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
     202             :     virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
     203             : 
     204             :     virtual void SetSnapRectImpl(const Rectangle& _rRect) SAL_OVERRIDE;
     205             :     virtual SdrPage* GetImplPage() const SAL_OVERRIDE;
     206             : 
     207             : public:
     208             :     TYPEINFO_OVERRIDE();
     209             : 
     210             :     virtual ~OOle2Obj();
     211             : 
     212             :     virtual sal_Int32   GetStep() const;
     213             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent() SAL_OVERRIDE;
     214             : 
     215             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape() SAL_OVERRIDE;
     216             :     virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
     217             :     virtual sal_uInt32 GetObjInventor() const SAL_OVERRIDE;
     218             :     // Clone() soll eine komplette Kopie des Objektes erzeugen.
     219             :     virtual OOle2Obj* Clone() const SAL_OVERRIDE;
     220             :     virtual void initializeOle() SAL_OVERRIDE;
     221             : 
     222             :     OOle2Obj& operator=(const OOle2Obj& rObj);
     223             : 
     224             :     void initializeChart( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel);
     225             : };
     226             : 
     227             : 
     228             : // OUnoObject
     229             : 
     230             : class REPORTDESIGN_DLLPUBLIC OUnoObject: public SdrUnoObj , public OObjectBase
     231             : {
     232             :     friend class OReportPage;
     233             :     friend class OObjectBase;
     234             :     friend class DlgEdFactory;
     235             : 
     236             :     sal_uInt16   m_nObjectType;
     237             : protected:
     238             :     OUnoObject(const OUString& _sComponentName
     239             :                 ,const OUString& rModelName
     240             :                 ,sal_uInt16   _nObjectType);
     241             :     OUnoObject(  const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent
     242             :                 ,const OUString& rModelName
     243             :                 ,sal_uInt16   _nObjectType);
     244             : 
     245             :     virtual ~OUnoObject();
     246             : 
     247             :     virtual void NbcMove( const Size& rSize ) SAL_OVERRIDE;
     248             :     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
     249             :     virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
     250             :     virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
     251             : 
     252             :     virtual void SetSnapRectImpl(const Rectangle& _rRect) SAL_OVERRIDE;
     253             :     virtual SdrPage* GetImplPage() const SAL_OVERRIDE;
     254             : 
     255             : public:
     256             :     TYPEINFO_OVERRIDE();
     257             : 
     258             :     virtual sal_Int32   GetStep() const;
     259             :     virtual void _propertyChange( const  ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     260             : 
     261             :     /** creates the m_xMediator when it doesn't already exist.
     262             :         @param  _bReverse   when set to <TRUE/> then the properties from the uno control will be copied into report control
     263             :     */
     264             :     void CreateMediator(sal_Bool _bReverse = sal_False);
     265             : 
     266             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent() SAL_OVERRIDE;
     267             : 
     268             :     static OUString GetDefaultName(const OUnoObject* _pObj);
     269             : 
     270             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape() SAL_OVERRIDE;
     271             :     virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
     272             :     virtual sal_uInt32 GetObjInventor() const SAL_OVERRIDE;
     273             :     virtual OUnoObject* Clone() const SAL_OVERRIDE;
     274             : 
     275             :     OUnoObject& operator=(const OUnoObject& rObj);
     276             : 
     277             : private:
     278             :     virtual void impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxUnoShape ) SAL_OVERRIDE;
     279             :     void    impl_setReportComponent_nothrow();
     280             :     void    impl_initializeModel_nothrow();
     281             : };
     282             : 
     283             : 
     284             : } // rptui
     285             : 
     286             : #endif // _REPORT_RPTUIOBJ_HXX
     287             : 
     288             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10