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

Generated by: LCOV version 1.10