diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-06-18 15:33:54 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-06-18 15:33:54 +0200 |
commit | 45d85c7599ea0521e5d83de41ec31207a54ead16 (patch) | |
tree | 27e06e94884af9a156e64152abdc4586cdf270e7 /toolkit | |
parent | 886532a78822b648c296d2862803fab38950e753 (diff) |
unoawt2: get rid of the ImageConsumer/Producer connection between image-rendering controls and their models - this channel doesn't correctly transport transparency. The connection via the 'Graphic' property works absolutely fine here.
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/pch/precompiled_toolkit.hxx | 2 | ||||
-rw-r--r-- | toolkit/inc/toolkit/awt/vclxwindows.hxx | 30 | ||||
-rw-r--r-- | toolkit/inc/toolkit/controls/roadmapcontrol.hxx | 21 | ||||
-rw-r--r-- | toolkit/inc/toolkit/controls/unocontrols.hxx | 91 | ||||
-rw-r--r-- | toolkit/inc/toolkit/helper/servicenames.hxx | 5 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 109 | ||||
-rw-r--r-- | toolkit/source/controls/roadmapcontrol.cxx | 91 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrols.cxx | 160 | ||||
-rw-r--r-- | toolkit/source/helper/servicenames.cxx | 1 | ||||
-rw-r--r-- | toolkit/source/layout/core/import.cxx | 11 |
10 files changed, 86 insertions, 435 deletions
diff --git a/toolkit/inc/pch/precompiled_toolkit.hxx b/toolkit/inc/pch/precompiled_toolkit.hxx index 386bd6803ca4..affcf376b071 100644 --- a/toolkit/inc/pch/precompiled_toolkit.hxx +++ b/toolkit/inc/pch/precompiled_toolkit.hxx @@ -107,8 +107,6 @@ #include "com/sun/star/awt/XFont.hpp" #include "com/sun/star/awt/XGraphics.hpp" #include "com/sun/star/awt/XImageButton.hpp" -#include "com/sun/star/awt/XImageConsumer.hpp" -#include "com/sun/star/awt/XImageProducer.hpp" #include "com/sun/star/awt/XInfoPrinter.hpp" #include "com/sun/star/awt/XItemEventBroadcaster.hpp" #include "com/sun/star/awt/XItemListener.hpp" diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx index ca3267bffb5e..75085020ca7b 100644 --- a/toolkit/inc/toolkit/awt/vclxwindows.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx @@ -82,7 +82,6 @@ #include <com/sun/star/awt/XDateField.hpp> #include <com/sun/star/awt/XComboBox.hpp> #include <com/sun/star/awt/XCheckBox.hpp> -#include <com/sun/star/awt/XImageConsumer.hpp> #include <com/sun/star/awt/XItemListListener.hpp> #include <cppuhelper/weak.hxx> #include <cppuhelper/implbase3.hxx> @@ -111,17 +110,14 @@ class VclSimpleEvent; class VclMenuEvent; // ---------------------------------------------------- -// class VCLXImageConsumer -// deriving from VCLXWindow and XImageConsumer +// class VCLXGraphicControl +// deriving from VCLXWindow, drawing the graphic which exists as "Graphic" at the model // ---------------------------------------------------- -typedef ::cppu::ImplInheritanceHelper1< VCLXWindow, ::com::sun::star::awt::XImageConsumer > VCLXImageConsumer_Base; -class TOOLKIT_DLLPUBLIC VCLXImageConsumer : public VCLXImageConsumer_Base +class TOOLKIT_DLLPUBLIC VCLXGraphicControl : public VCLXWindow { private: - /// implements our XImageConsumer functionality - ImageConsumer maImageConsumer; /// the image we currently display Image maImage; @@ -132,21 +128,11 @@ protected: // ::com::sun::star::awt::XWindow void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::awt::XImageConsumer - void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::awt::VclWindowPeer void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); protected: - void ImplUpdateImage( sal_Bool bGetNewImage ); - -protected: /** forward our bitmap to our window @precond our mutex is locked @@ -155,6 +141,7 @@ protected: @see GetBitmap */ virtual void ImplSetNewImage(); + public: static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } @@ -164,7 +151,7 @@ public: // ---------------------------------------------------- // class VCLXButton // ---------------------------------------------------- -typedef ::cppu::ImplInheritanceHelper2 < VCLXImageConsumer +typedef ::cppu::ImplInheritanceHelper2 < VCLXGraphicControl , ::com::sun::star::awt::XButton , ::com::sun::star::awt::XToggleButton > VCLXButton_Base; @@ -213,7 +200,7 @@ public: // ---------------------------------------------------- // class VCLXImageControl // ---------------------------------------------------- -class VCLXImageControl : public VCLXImageConsumer +class VCLXImageControl : public VCLXGraphicControl { public: VCLXImageControl(); @@ -230,6 +217,7 @@ public: static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } + protected: virtual void ImplSetNewImage(); }; @@ -239,7 +227,7 @@ protected: // ---------------------------------------------------- class VCLXCheckBox : public ::com::sun::star::awt::XCheckBox, public ::com::sun::star::awt::XButton, - public VCLXImageConsumer + public VCLXGraphicControl { private: ActionListenerMultiplexer maActionListeners; @@ -297,7 +285,7 @@ public: // ---------------------------------------------------- class VCLXRadioButton : public ::com::sun::star::awt::XRadioButton, public ::com::sun::star::awt::XButton, - public VCLXImageConsumer + public VCLXGraphicControl { private: ItemListenerMultiplexer maItemListeners; diff --git a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx index 46f31947b276..219231b02ad2 100644 --- a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx +++ b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx @@ -40,13 +40,9 @@ #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/awt/XItemListener.hpp> #include <com/sun/star/awt/XItemEventBroadcaster.hpp> -#include <com/sun/star/awt/XImageConsumer.hpp> -#include <com/sun/star/awt/XImageProducer.hpp> #include <cppuhelper/implbase2.hxx> - -#ifndef _CPPUHELPER_IMPLBASE5_HXX_ +#include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase4.hxx> -#endif @@ -55,10 +51,9 @@ typedef UnoControlModel UnoControlRoadmapModel_Base; -typedef ::cppu::ImplHelper4 < ::com::sun::star::lang::XSingleServiceFactory +typedef ::cppu::ImplHelper3 < ::com::sun::star::lang::XSingleServiceFactory , ::com::sun::star::container::XContainer , ::com::sun::star::container::XIndexContainer - , ::com::sun::star::awt::XImageProducer > UnoControlRoadmapModel_IBase; @@ -100,8 +95,6 @@ namespace toolkit{ typedef ::std::vector< Reference< XInterface > > RoadmapItemHolderList; - std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > maImageListeners; - ContainerListenerMultiplexer maContainerListeners; RoadmapItemHolderList maRoadmapItems; @@ -151,12 +144,6 @@ namespace toolkit{ void SAL_CALL release() throw() { UnoControlModel::release(); } - // ::com::sun::star::awt::XImageProducer - void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL startProduction( ) throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::beans::XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException); @@ -190,8 +177,6 @@ namespace toolkit{ sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException ); - void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException); void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException); void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException); @@ -204,8 +189,6 @@ namespace toolkit{ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException); - void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); - // XTypeProvider DECLARE_XTYPEPROVIDER( ) DECLARE_XINTERFACE() diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx index 88449418c70a..fd775cd568c1 100644 --- a/toolkit/inc/toolkit/controls/unocontrols.hxx +++ b/toolkit/inc/toolkit/controls/unocontrols.hxx @@ -35,8 +35,6 @@ #include <com/sun/star/awt/XTextLayoutConstrains.hpp> #include <com/sun/star/awt/XButton.hpp> #include <com/sun/star/awt/XToggleButton.hpp> -#include <com/sun/star/awt/XImageConsumer.hpp> -#include <com/sun/star/awt/XImageProducer.hpp> #include <com/sun/star/awt/XRadioButton.hpp> #include <com/sun/star/awt/XItemListener.hpp> #include <com/sun/star/awt/XCheckBox.hpp> @@ -217,31 +215,20 @@ public: }; // ---------------------------------------------------- -// class ImageProducerControlModel +// class GraphicControlModel // ---------------------------------------------------- -class ImageProducerControlModel : public ::com::sun::star::awt::XImageProducer, - public UnoControlModel +class GraphicControlModel : public UnoControlModel { private: - std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > maListeners; bool mbAdjustingImagePosition; bool mbAdjustingGraphic; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ); -protected: - ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } - ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } - - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw(); - void SAL_CALL release() throw(); - // ::com::sun::star::awt::XImageProducer - void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL startProduction( ) throw (::com::sun::star::uno::RuntimeException); +protected: + GraphicControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } + GraphicControlModel( const GraphicControlModel& _rSource ) : UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } // ::cppu::OPropertySetHelper void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); @@ -250,35 +237,13 @@ protected: ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; private: - ImageProducerControlModel& operator=( const ImageProducerControlModel& ); // never implemented -}; - -// ---------------------------------------------------- -// class ImageConsumerControl -// ---------------------------------------------------- -class ImageConsumerControl : public UnoControlBase -{ -protected: - ImageConsumerControl() { } - - void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); - - // XControl - sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException ); - - void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); - - void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); - -private: - ImageConsumerControl( const ImageConsumerControl& ); // never implemented - ImageConsumerControl& operator=( const ImageConsumerControl& ); // never implemented + GraphicControlModel& operator=( const GraphicControlModel& ); // never implemented }; // ---------------------------------------------------- // class UnoControlButtonModel // ---------------------------------------------------- -class UnoControlButtonModel : public ImageProducerControlModel +class UnoControlButtonModel : public GraphicControlModel { protected: ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; @@ -286,7 +251,7 @@ protected: public: UnoControlButtonModel(); - UnoControlButtonModel( const UnoControlButtonModel& rModel ) : ImageProducerControlModel( rModel ) {;} + UnoControlButtonModel( const UnoControlButtonModel& rModel ) : GraphicControlModel( rModel ) {;} UnoControlModel* Clone() const { return new UnoControlButtonModel( *this ); } @@ -297,13 +262,13 @@ public: ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoControlButtonModel, ImageProducerControlModel, szServiceName2_UnoControlButtonModel ) + DECLIMPL_SERVICEINFO_DERIVED( UnoControlButtonModel, GraphicControlModel, szServiceName2_UnoControlButtonModel ) }; // ---------------------------------------------------- // class UnoButtonControl // ---------------------------------------------------- -typedef ::cppu::AggImplInheritanceHelper4 < ImageConsumerControl +typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase , ::com::sun::star::awt::XButton , ::com::sun::star::awt::XToggleButton , ::com::sun::star::awt::XLayoutConstrains @@ -347,13 +312,13 @@ public: ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoButtonControl, ImageConsumerControl, szServiceName2_UnoControlButton ) + DECLIMPL_SERVICEINFO_DERIVED( UnoButtonControl, UnoControlBase, szServiceName2_UnoControlButton ) }; // ---------------------------------------------------- // class UnoControlImageControlModel // ---------------------------------------------------- -class UnoControlImageControlModel : public ImageProducerControlModel +class UnoControlImageControlModel : public GraphicControlModel { private: bool mbAdjustingImageScaleMode; @@ -364,7 +329,7 @@ protected: public: UnoControlImageControlModel(); - UnoControlImageControlModel( const UnoControlImageControlModel& rModel ) : ImageProducerControlModel( rModel ), mbAdjustingImageScaleMode( false ) { } + UnoControlImageControlModel( const UnoControlImageControlModel& rModel ) : GraphicControlModel( rModel ), mbAdjustingImageScaleMode( false ) { } UnoControlModel* Clone() const { return new UnoControlImageControlModel( *this ); } @@ -375,7 +340,7 @@ public: ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoControlImageControlModel, ImageProducerControlModel, szServiceName2_UnoControlImageControlModel ) + DECLIMPL_SERVICEINFO_DERIVED( UnoControlImageControlModel, GraphicControlModel, szServiceName2_UnoControlImageControlModel ) // ::cppu::OPropertySetHelper void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); @@ -384,7 +349,7 @@ public: // ---------------------------------------------------- // class UnoImageControlControl // ---------------------------------------------------- -typedef ::cppu::AggImplInheritanceHelper1 < ImageConsumerControl +typedef ::cppu::AggImplInheritanceHelper1 < UnoControlBase , ::com::sun::star::awt::XLayoutConstrains > UnoImageControlControl_Base; class UnoImageControlControl : public UnoImageControlControl_Base @@ -409,13 +374,13 @@ public: ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoImageControlControl, ImageConsumerControl, szServiceName2_UnoControlImageControl ) + DECLIMPL_SERVICEINFO_DERIVED( UnoImageControlControl, UnoControlBase, szServiceName2_UnoControlImageControl ) }; // ---------------------------------------------------- // class UnoControlRadioButtonModel // ---------------------------------------------------- -class UnoControlRadioButtonModel : public ImageProducerControlModel +class UnoControlRadioButtonModel : public GraphicControlModel { protected: @@ -424,7 +389,7 @@ protected: public: UnoControlRadioButtonModel(); - UnoControlRadioButtonModel( const UnoControlRadioButtonModel& rModel ) : ImageProducerControlModel( rModel ) {;} + UnoControlRadioButtonModel( const UnoControlRadioButtonModel& rModel ) : GraphicControlModel( rModel ) {;} UnoControlModel* Clone() const { return new UnoControlRadioButtonModel( *this ); } @@ -435,14 +400,14 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoControlRadioButtonModel, ImageProducerControlModel, szServiceName2_UnoControlRadioButtonModel ) + DECLIMPL_SERVICEINFO_DERIVED( UnoControlRadioButtonModel, GraphicControlModel, szServiceName2_UnoControlRadioButtonModel ) }; // ---------------------------------------------------- // class UnoRadioButtonControl // ---------------------------------------------------- -typedef ::cppu::AggImplInheritanceHelper4 < ImageConsumerControl +typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase , ::com::sun::star::awt::XButton , ::com::sun::star::awt::XRadioButton , ::com::sun::star::awt::XItemListener @@ -462,7 +427,7 @@ public: void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { ImageConsumerControl::disposing( Source ); } + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } // ::com::sun::star::awt::XControl sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); @@ -488,14 +453,14 @@ public: ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoRadioButtonControl, ImageConsumerControl, szServiceName2_UnoControlRadioButton ) + DECLIMPL_SERVICEINFO_DERIVED( UnoRadioButtonControl, UnoControlBase, szServiceName2_UnoControlRadioButton ) }; // ---------------------------------------------------- // class UnoControlCheckBoxModel // ---------------------------------------------------- -class UnoControlCheckBoxModel : public ImageProducerControlModel +class UnoControlCheckBoxModel : public GraphicControlModel { protected: ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; @@ -503,7 +468,7 @@ protected: public: UnoControlCheckBoxModel(); - UnoControlCheckBoxModel( const UnoControlCheckBoxModel& rModel ) : ImageProducerControlModel( rModel ) {;} + UnoControlCheckBoxModel( const UnoControlCheckBoxModel& rModel ) : GraphicControlModel( rModel ) {;} UnoControlModel* Clone() const { return new UnoControlCheckBoxModel( *this ); } @@ -514,13 +479,13 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoControlCheckBoxModel, ImageProducerControlModel, szServiceName2_UnoControlCheckBoxModel ) + DECLIMPL_SERVICEINFO_DERIVED( UnoControlCheckBoxModel, GraphicControlModel, szServiceName2_UnoControlCheckBoxModel ) }; // ---------------------------------------------------- // class UnoCheckBoxControl // ---------------------------------------------------- -typedef ::cppu::AggImplInheritanceHelper4 < ImageConsumerControl +typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase , ::com::sun::star::awt::XButton , ::com::sun::star::awt::XCheckBox , ::com::sun::star::awt::XItemListener @@ -541,7 +506,7 @@ public: void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { ImageConsumerControl::disposing( Source ); } + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } // ::com::sun::star::awt::XControl sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); @@ -569,7 +534,7 @@ public: ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoCheckBoxControl, ImageConsumerControl, szServiceName2_UnoControlCheckBox ) + DECLIMPL_SERVICEINFO_DERIVED( UnoCheckBoxControl, UnoControlBase, szServiceName2_UnoControlCheckBox ) }; diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx index 96d9d5810cc0..2d1df79b733b 100644 --- a/toolkit/inc/toolkit/helper/servicenames.hxx +++ b/toolkit/inc/toolkit/helper/servicenames.hxx @@ -104,10 +104,5 @@ extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceNa extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[], szServiceName2_UnoThrobberControlModel[]; extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[]; -// ExtUnoWrapper: -extern const char __FAR_DATA szServiceName_ImageProducer[], szServiceName2_ImageProducer[]; - - - #endif // _TOOLKIT_HELPER_SERVICENAMES_HXX_ diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 08e3ed286dd9..b79fee56e3d8 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -206,33 +206,22 @@ namespace toolkit } // ---------------------------------------------------- -// class VCLXImageConsumer +// class VCLXGraphicControl // ---------------------------------------------------- -void VCLXImageConsumer::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) +void VCLXGraphicControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { VCLXWindow::ImplGetPropertyIds( rIds ); } -void VCLXImageConsumer::ImplSetNewImage() +void VCLXGraphicControl::ImplSetNewImage() { - OSL_PRECOND( GetWindow(), "VCLXImageConsumer::ImplSetNewImage: window is required to be not-NULL!" ); + OSL_PRECOND( GetWindow(), "VCLXGraphicControl::ImplSetNewImage: window is required to be not-NULL!" ); Button* pButton = static_cast< Button* >( GetWindow() ); pButton->SetModeBitmap( GetBitmap() ); } -void VCLXImageConsumer::ImplUpdateImage( sal_Bool bGetNewImage ) -{ - if ( !GetWindow() ) - return; - - if ( bGetNewImage && !maImageConsumer.GetData( maImage ) ) - return; - - ImplSetNewImage(); -} - -void VCLXImageConsumer::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, short Flags ) throw(::com::sun::star::uno::RuntimeException) +void VCLXGraphicControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, short Flags ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -241,49 +230,11 @@ void VCLXImageConsumer::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, s Size aOldSize = GetWindow()->GetSizePixel(); VCLXWindow::setPosSize( X, Y, Width, Height, Flags ); if ( ( aOldSize.Width() != Width ) || ( aOldSize.Height() != Height ) ) - ImplUpdateImage( sal_False ); + ImplSetNewImage(); } } -void VCLXImageConsumer::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - maImageConsumer.Init( Width, Height ); -} - -void VCLXImageConsumer::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const sal_uInt32*) RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask ); -} - -void VCLXImageConsumer::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (sal_uInt8*)ProducerData.getConstArray(), Offset, Scansize ); - ImplUpdateImage( sal_True ); -} - -void VCLXImageConsumer::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const sal_uInt32*) ProducerData.getConstArray(), Offset, Scansize ); - ImplUpdateImage( sal_True ); -} - -void VCLXImageConsumer::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > & ) throw(::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - maImageConsumer.Completed( Status ); - ImplUpdateImage( sal_True ); -} - -void VCLXImageConsumer::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +void VCLXGraphicControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -336,7 +287,7 @@ void VCLXImageConsumer::setProperty( const ::rtl::OUString& PropertyName, const } } -::com::sun::star::uno::Any VCLXImageConsumer::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +::com::sun::star::uno::Any VCLXGraphicControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -418,7 +369,7 @@ void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_CONTEXT_WRITING_MODE, BASEPROPERTY_REFERENCE_DEVICE, 0); - VCLXImageConsumer::ImplGetPropertyIds( rIds ); + VCLXGraphicControl::ImplGetPropertyIds( rIds ); } VCLXButton::VCLXButton() @@ -444,7 +395,7 @@ void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException) aObj.Source = (::cppu::OWeakObject*)this; maActionListeners.disposeAndClear( aObj ); maItemListeners.disposeAndClear( aObj ); - VCLXImageConsumer::dispose(); + VCLXGraphicControl::dispose(); } void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException) @@ -573,7 +524,7 @@ void VCLXButton::setProperty( const ::rtl::OUString& PropertyName, const ::com:: break; default: { - VCLXImageConsumer::setProperty( PropertyName, Value ); + VCLXGraphicControl::setProperty( PropertyName, Value ); } } } @@ -613,7 +564,7 @@ void VCLXButton::setProperty( const ::rtl::OUString& PropertyName, const ::com:: break; default: { - aProp <<= VCLXImageConsumer::getProperty( PropertyName ); + aProp <<= VCLXGraphicControl::getProperty( PropertyName ); } } } @@ -664,7 +615,7 @@ void VCLXButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) break; default: - VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent ); + VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent ); break; } } @@ -693,7 +644,7 @@ void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, 0); - VCLXImageConsumer::ImplGetPropertyIds( rIds ); + VCLXGraphicControl::ImplGetPropertyIds( rIds ); } VCLXImageControl::VCLXImageControl() @@ -770,7 +721,7 @@ void VCLXImageControl::setProperty( const ::rtl::OUString& PropertyName, const : break; default: - VCLXImageConsumer::setProperty( PropertyName, Value ); + VCLXGraphicControl::setProperty( PropertyName, Value ); break; } } @@ -794,7 +745,7 @@ void VCLXImageControl::setProperty( const ::rtl::OUString& PropertyName, const : break; default: - aProp = VCLXImageConsumer::getProperty( PropertyName ); + aProp = VCLXGraphicControl::getProperty( PropertyName ); break; } return aProp; @@ -831,7 +782,7 @@ void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_CONTEXT_WRITING_MODE, BASEPROPERTY_REFERENCE_DEVICE, 0); - VCLXImageConsumer::ImplGetPropertyIds( rIds ); + VCLXGraphicControl::ImplGetPropertyIds( rIds ); } VCLXCheckBox::VCLXCheckBox() : maActionListeners( *this ), maItemListeners( *this ) @@ -844,14 +795,14 @@ VCLXCheckBox::VCLXCheckBox() : maActionListeners( *this ), maItemListeners( *th ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ), SAL_STATIC_CAST( ::com::sun::star::awt::XCheckBox*, this ) ); - return (aRet.hasValue() ? aRet : VCLXImageConsumer::queryInterface( rType )); + return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType )); } // ::com::sun::star::lang::XTypeProvider IMPL_XTYPEPROVIDER_START( VCLXCheckBox ) getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ), getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox>* ) NULL ), - VCLXImageConsumer::getTypes() + VCLXGraphicControl::getTypes() IMPL_XTYPEPROVIDER_END ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXCheckBox::CreateAccessibleContext() @@ -866,7 +817,7 @@ void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException) ::com::sun::star::lang::EventObject aObj; aObj.Source = (::cppu::OWeakObject*)this; maItemListeners.disposeAndClear( aObj ); - VCLXImageConsumer::dispose(); + VCLXGraphicControl::dispose(); } void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) @@ -1028,7 +979,7 @@ void VCLXCheckBox::setProperty( const ::rtl::OUString& PropertyName, const ::com break; default: { - VCLXImageConsumer::setProperty( PropertyName, Value ); + VCLXGraphicControl::setProperty( PropertyName, Value ); } } } @@ -1056,7 +1007,7 @@ void VCLXCheckBox::setProperty( const ::rtl::OUString& PropertyName, const ::com break; default: { - aProp <<= VCLXImageConsumer::getProperty( PropertyName ); + aProp <<= VCLXGraphicControl::getProperty( PropertyName ); } } } @@ -1098,7 +1049,7 @@ void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) break; default: - VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent ); + VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent ); break; } } @@ -1131,7 +1082,7 @@ void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_CONTEXT_WRITING_MODE, BASEPROPERTY_REFERENCE_DEVICE, 0); - VCLXImageConsumer::ImplGetPropertyIds( rIds ); + VCLXGraphicControl::ImplGetPropertyIds( rIds ); } @@ -1145,14 +1096,14 @@ VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton*, this ), SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ) ); - return (aRet.hasValue() ? aRet : VCLXImageConsumer::queryInterface( rType )); + return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType )); } // ::com::sun::star::lang::XTypeProvider IMPL_XTYPEPROVIDER_START( VCLXRadioButton ) getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ), getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ), - VCLXImageConsumer::getTypes() + VCLXGraphicControl::getTypes() IMPL_XTYPEPROVIDER_END ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXRadioButton::CreateAccessibleContext() @@ -1167,7 +1118,7 @@ void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException) ::com::sun::star::lang::EventObject aObj; aObj.Source = (::cppu::OWeakObject*)this; maItemListeners.disposeAndClear( aObj ); - VCLXImageConsumer::dispose(); + VCLXGraphicControl::dispose(); } void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) @@ -1206,7 +1157,7 @@ void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const :: break; default: { - VCLXImageConsumer::setProperty( PropertyName, Value ); + VCLXGraphicControl::setProperty( PropertyName, Value ); } } } @@ -1234,7 +1185,7 @@ void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const :: break; default: { - aProp <<= VCLXImageConsumer::getProperty( PropertyName ); + aProp <<= VCLXGraphicControl::getProperty( PropertyName ); } } } @@ -1366,7 +1317,7 @@ void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent break; default: - VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent ); + VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent ); break; } } diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx index acfbee0c5bb6..08e7898ac661 100644 --- a/toolkit/source/controls/roadmapcontrol.cxx +++ b/toolkit/source/controls/roadmapcontrol.cxx @@ -52,27 +52,6 @@ namespace toolkit // helper // ---------------------------------------------------- - static void lcl_knitImageComponents( const Reference< XControlModel >& _rxModel, - const Reference< XWindowPeer >& _rxPeer, - bool _bAdd ) - { - Reference< XImageProducer > xProducer( _rxModel, UNO_QUERY ); - if ( xProducer.is() ) - { - Reference< XImageConsumer > xConsumer( _rxPeer, UNO_QUERY ); - if ( xConsumer.is() ) - { - if ( _bAdd ) - { - xProducer->addConsumer( xConsumer ); - xProducer->startProduction(); - } - else - xProducer->removeConsumer( xConsumer ); - } - } - } - static void lcl_throwIllegalArgumentException( ) { // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this .... throw IllegalArgumentException(); @@ -384,40 +363,6 @@ static void lcl_throwIndexOutOfBoundsException( ) maContainerListeners.removeInterface( xListener ); } - - void UnoControlRoadmapModel::addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException) - { - maImageListeners.push_back( xConsumer ); - } - - - void UnoControlRoadmapModel::removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException) - { - maImageListeners.remove( xConsumer ); - } - - - void UnoControlRoadmapModel::startProduction( ) throw (::com::sun::star::uno::RuntimeException) - { - Sequence<Any> aArgs(1); - aArgs.getArray()[0] = getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) ); - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference< XImageProducer > xImageProducer( xMSF->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "com.sun.star.awt.ImageProducer" ), aArgs ), UNO_QUERY ); - if ( xImageProducer.is() ) - { - std::list< Reference< XImageConsumer > >::iterator aIter( maImageListeners.begin() ); - while ( aIter != maImageListeners.end() ) - { - xImageProducer->addConsumer( *aIter ); - aIter++; - } - xImageProducer->startProduction(); - } - } - - - - // =================================================================== // = UnoRoadmapControl // =================================================================== @@ -434,9 +379,6 @@ sal_Bool SAL_CALL UnoRoadmapControl::setModel(const Reference< XControlModel >& { - // remove the peer as image consumer from the model - lcl_knitImageComponents( getModel(), getPeer(), false ); - Reference< XContainer > xC( getModel(), UNO_QUERY ); if ( xC.is() ) xC->removeContainerListener( this ); @@ -447,9 +389,6 @@ sal_Bool SAL_CALL UnoRoadmapControl::setModel(const Reference< XControlModel >& if ( xC.is() ) xC->addContainerListener( this ); - // add the peer as image consumer to the model - lcl_knitImageComponents( getModel(), getPeer(), true ); - return bReturn; } @@ -462,18 +401,6 @@ sal_Bool SAL_CALL UnoRoadmapControl::setModel(const Reference< XControlModel >& - void SAL_CALL UnoRoadmapControl::createPeer( const Reference<XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException) - { - // remove the peer as image consumer from the model - lcl_knitImageComponents( getModel(), getPeer(), false ); - - UnoControl::createPeer( rxToolkit, rParentPeer ); - - lcl_knitImageComponents( getModel(), getPeer(), true ); - - } - - void UnoRoadmapControl::dispose() throw(RuntimeException) { EventObject aEvt; @@ -484,24 +411,6 @@ sal_Bool SAL_CALL UnoRoadmapControl::setModel(const Reference< XControlModel >& -void UnoRoadmapControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const Any& rVal ) -{ - sal_uInt16 nType = GetPropertyId( rPropName ); - if ( getPeer().is() && ( nType == BASEPROPERTY_IMAGEURL ) ) - { - Reference < XImageProducer > xImgProd( getModel(), UNO_QUERY ); - Reference < XImageConsumer > xImgCons( getPeer(), UNO_QUERY ); - - if ( xImgProd.is() && xImgCons.is() ) - { - xImgProd->startProduction(); - } - } - else - UnoControlBase::ImplSetPeerProperty( rPropName, rVal ); -} - - void UnoRoadmapControl::elementInserted( const ContainerEvent& rEvent )throw(RuntimeException) { Reference< XInterface > xRoadmapItem; diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index cfb71111e3dc..92a8a21a6c08 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -80,32 +80,6 @@ using ::com::sun::star::graphic::XGraphic; using ::com::sun::star::uno::Reference; using namespace ::toolkit; - -// ---------------------------------------------------- -// helper -// ---------------------------------------------------- - -static void lcl_knitImageComponents( const uno::Reference< awt::XControlModel >& _rxModel, - const uno::Reference< awt::XWindowPeer >& _rxPeer, - bool _bAdd ) -{ - uno::Reference< awt::XImageProducer > xProducer( _rxModel, uno::UNO_QUERY ); - if ( xProducer.is() ) - { - uno::Reference< awt::XImageConsumer > xConsumer( _rxPeer, uno::UNO_QUERY ); - if ( xConsumer.is() ) - { - if ( _bAdd ) - { - xProducer->addConsumer( xConsumer ); - xProducer->startProduction(); - } - else - xProducer->removeConsumer( xConsumer ); - } - } -} - // ---------------------------------------------------- // class UnoControlEditModel // ---------------------------------------------------- @@ -543,37 +517,16 @@ UnoFileControl::UnoFileControl() } // ---------------------------------------------------- -// class ImageProducerControlModel +// class GraphicControlModel // ---------------------------------------------------- -uno::Any SAL_CALL ImageProducerControlModel::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException) -{ - return UnoControlModel::queryInterface( rType ); -} - -uno::Any SAL_CALL ImageProducerControlModel::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException) -{ - uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XImageProducer*, this ) ); - return (aRet.hasValue() ? aRet : UnoControlModel::queryAggregation( rType )); -} - -void SAL_CALL ImageProducerControlModel::acquire() throw() -{ - UnoControlModel::acquire(); -} - -void SAL_CALL ImageProducerControlModel::release() throw() -{ - UnoControlModel::release(); -} - -uno::Any ImageProducerControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const { if ( nPropId == BASEPROPERTY_GRAPHIC ) return uno::makeAny( uno::Reference< graphic::XGraphic >() ); return UnoControlModel::ImplGetDefaultValue( nPropId ); } - uno::Reference< graphic::XGraphic > ImageProducerControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ) + uno::Reference< graphic::XGraphic > GraphicControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ) { uno::Reference< graphic::XGraphic > xGraphic; @@ -611,7 +564,7 @@ uno::Any ImageProducerControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) co return xGraphic; } -void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception) +void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception) { UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue ); @@ -665,90 +618,11 @@ void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_I } catch( const ::com::sun::star::uno::Exception& ) { - OSL_ENSURE( sal_False, "ImageProducerControlModel::setFastPropertyValue_NoBroadcast: caught an exception while aligning the ImagePosition/ImageAlign properties!" ); + OSL_ENSURE( sal_False, "GraphicControlModel::setFastPropertyValue_NoBroadcast: caught an exception while aligning the ImagePosition/ImageAlign properties!" ); mbAdjustingImagePosition = sal_False; } } -void ImageProducerControlModel::addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException) -{ - maListeners.push_back( xConsumer ); -} - -void ImageProducerControlModel::removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException) -{ - maListeners.remove( xConsumer ); -} - -void ImageProducerControlModel::startProduction( ) throw (::com::sun::star::uno::RuntimeException) -{ - uno::Sequence<uno::Any> aArgs(1); - aArgs.getArray()[0] = getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) ); - uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - uno::Reference< awt::XImageProducer > xImageProducer( xMSF->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "com.sun.star.awt.ImageProducer" ), aArgs ), uno::UNO_QUERY ); - if ( xImageProducer.is() ) - { - std::list< uno::Reference< awt::XImageConsumer > >::iterator aIter( maListeners.begin() ); - while ( aIter != maListeners.end() ) - { - xImageProducer->addConsumer( *aIter ); - aIter++; - } - xImageProducer->startProduction(); - } -} - -// ---------------------------------------------------- -// class ImageConsumerControl -// ---------------------------------------------------- - -sal_Bool SAL_CALL ImageConsumerControl::setModel(const uno::Reference< awt::XControlModel >& _rModel) throw ( uno::RuntimeException ) -{ - // remove the peer as image consumer from the model - lcl_knitImageComponents( getModel(), getPeer(), false ); - - sal_Bool bReturn = UnoControlBase::setModel( _rModel ); - - // add the peer as image consumer to the model - lcl_knitImageComponents( getModel(), getPeer(), true ); - - return bReturn; -} - -void SAL_CALL ImageConsumerControl::createPeer( const uno::Reference< awt::XToolkit >& rxToolkit, const uno::Reference< awt::XWindowPeer >& rParentPeer ) throw(uno::RuntimeException) -{ - // remove the peer as image consumer from the model - lcl_knitImageComponents( getModel(), getPeer(), false ); - - UnoControlBase::createPeer( rxToolkit, rParentPeer ); - - // add the peer as image consumer to the model - lcl_knitImageComponents( getModel(), getPeer(), true ); -} - -void SAL_CALL ImageConsumerControl::dispose( ) throw(::com::sun::star::uno::RuntimeException) -{ - // remove the peer as image consumer from the model - lcl_knitImageComponents( getModel(), getPeer(), false ); - - UnoControlBase::dispose(); -} - -void ImageConsumerControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal ) -{ - sal_uInt16 nType = GetPropertyId( rPropName ); - if ( nType == BASEPROPERTY_IMAGEURL ) - { - uno::Reference < awt::XImageProducer > xImgProd( getModel(), uno::UNO_QUERY ); - uno::Reference < awt::XImageConsumer > xImgCons( getPeer(), uno::UNO_QUERY ); - - if ( xImgProd.is() && xImgCons.is() ) - xImgProd->startProduction(); - } - else - UnoControlBase::ImplSetPeerProperty( rPropName, rVal ); -} - // ---------------------------------------------------- // class UnoControlButtonModel // ---------------------------------------------------- @@ -784,7 +658,7 @@ uno::Any UnoControlButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const return uno::makeAny( (sal_Bool)sal_True ); } - return ImageProducerControlModel::ImplGetDefaultValue( nPropId ); + return GraphicControlModel::ImplGetDefaultValue( nPropId ); } ::cppu::IPropertyArrayHelper& UnoControlButtonModel::getInfoHelper() @@ -847,12 +721,12 @@ void UnoButtonControl::dispose() throw(uno::RuntimeException) aEvt.Source = (::cppu::OWeakObject*)this; maActionListeners.disposeAndClear( aEvt ); maItemListeners.disposeAndClear( aEvt ); - ImageConsumerControl::dispose(); + UnoControlBase::dispose(); } void UnoButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException) { - ImageConsumerControl::createPeer( rxToolkit, rParentPeer ); + UnoControlBase::createPeer( rxToolkit, rParentPeer ); uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); xButton->setActionCommand( maActionCommand ); @@ -896,7 +770,7 @@ void UnoButtonControl::removeItemListener(const uno::Reference< awt::XItemListen void SAL_CALL UnoButtonControl::disposing( const lang::EventObject& Source ) throw (uno::RuntimeException) { - ImageConsumerControl::disposing( Source ); + UnoControlBase::disposing( Source ); } void SAL_CALL UnoButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw (uno::RuntimeException) @@ -966,7 +840,7 @@ uno::Any UnoControlImageControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) if ( nPropId == BASEPROPERTY_IMAGE_SCALE_MODE ) return makeAny( awt::ImageScaleMode::Anisotropic ); - return ImageProducerControlModel::ImplGetDefaultValue( nPropId ); + return GraphicControlModel::ImplGetDefaultValue( nPropId ); } ::cppu::IPropertyArrayHelper& UnoControlImageControlModel::getInfoHelper() @@ -989,7 +863,7 @@ uno::Reference< beans::XPropertySetInfo > UnoControlImageControlModel::getProper void SAL_CALL UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::Exception) { - ImageProducerControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue ); + GraphicControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue ); // ScaleImage is an older (and less powerful) version of ScaleMode, but keep both in sync as far as possible try @@ -1093,7 +967,7 @@ uno::Any UnoControlRadioButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) c return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D ); } - return ImageProducerControlModel::ImplGetDefaultValue( nPropId ); + return GraphicControlModel::ImplGetDefaultValue( nPropId ); } ::cppu::IPropertyArrayHelper& UnoControlRadioButtonModel::getInfoHelper() @@ -1136,7 +1010,7 @@ void UnoRadioButtonControl::dispose() throw(uno::RuntimeException) lang::EventObject aEvt; aEvt.Source = (::cppu::OWeakObject*)this; maItemListeners.disposeAndClear( aEvt ); - ImageConsumerControl::dispose(); + UnoControlBase::dispose(); } @@ -1147,7 +1021,7 @@ sal_Bool UnoRadioButtonControl::isTransparent() throw(uno::RuntimeException) void UnoRadioButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException) { - ImageConsumerControl::createPeer( rxToolkit, rParentPeer ); + UnoControlBase::createPeer( rxToolkit, rParentPeer ); uno::Reference < awt::XRadioButton > xRadioButton( getPeer(), uno::UNO_QUERY ); xRadioButton->addItemListener( this ); @@ -1300,7 +1174,7 @@ uno::Any UnoControlCheckBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) cons return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D ); } - return ImageProducerControlModel::ImplGetDefaultValue( nPropId ); + return GraphicControlModel::ImplGetDefaultValue( nPropId ); } ::cppu::IPropertyArrayHelper& UnoControlCheckBoxModel::getInfoHelper() @@ -1343,7 +1217,7 @@ void UnoCheckBoxControl::dispose() throw(uno::RuntimeException) lang::EventObject aEvt; aEvt.Source = (::cppu::OWeakObject*)this; maItemListeners.disposeAndClear( aEvt ); - ImageConsumerControl::dispose(); + UnoControlBase::dispose(); } sal_Bool UnoCheckBoxControl::isTransparent() throw(uno::RuntimeException) @@ -1353,7 +1227,7 @@ sal_Bool UnoCheckBoxControl::isTransparent() throw(uno::RuntimeException) void UnoCheckBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException) { - ImageConsumerControl::createPeer( rxToolkit, rParentPeer ); + UnoControlBase::createPeer( rxToolkit, rParentPeer ); uno::Reference < awt::XCheckBox > xCheckBox( getPeer(), uno::UNO_QUERY ); xCheckBox->addItemListener( this ); diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx index 6a376391f46d..f57f52f13e57 100644 --- a/toolkit/source/helper/servicenames.cxx +++ b/toolkit/source/helper/servicenames.cxx @@ -77,7 +77,6 @@ const sal_Char __FAR_DATA szServiceName_UnoControlPatternFieldModel[] = "stardiv const sal_Char __FAR_DATA szServiceName_UnoControlFormattedField[] = "stardiv.vcl.control.FormattedField", szServiceName2_UnoControlFormattedField[] = "com.sun.star.awt.UnoControlFormattedField"; const sal_Char __FAR_DATA szServiceName_UnoControlFormattedFieldModel[] = "stardiv.vcl.controlmodel.FormattedField", szServiceName2_UnoControlFormattedFieldModel[] = "com.sun.star.awt.UnoControlFormattedFieldModel"; const sal_Char __FAR_DATA szServiceName_MVCIntrospection[] = "stardiv.vcl.MVCIntrospection", szServiceName2_MVCIntrospection[] = "com.sun.star.awt.MVCIntrospection"; -const sal_Char __FAR_DATA szServiceName_ImageProducer[] = "stardiv.vcl.ImageProducer", szServiceName2_ImageProducer[] = "com.sun.star.awt.ImageProducer"; const sal_Char __FAR_DATA szServiceName_PrinterServer[] = "stardiv.vcl.PrinterServer", szServiceName2_PrinterServer[] = "com.sun.star.awt.PrinterServer"; const sal_Char __FAR_DATA szServiceName_UnoControlProgressBar[] = "stardiv.vcl.control.ProgressBar", szServiceName2_UnoControlProgressBar[] = "com.sun.star.awt.UnoControlProgressBar"; const sal_Char __FAR_DATA szServiceName_UnoControlProgressBarModel[] = "stardiv.vcl.controlmodel.ProgressBar", szServiceName2_UnoControlProgressBarModel[] = "com.sun.star.awt.UnoControlProgressBarModel"; diff --git a/toolkit/source/layout/core/import.cxx b/toolkit/source/layout/core/import.cxx index daaa8c239f50..6d161cf1b07e 100644 --- a/toolkit/source/layout/core/import.cxx +++ b/toolkit/source/layout/core/import.cxx @@ -109,17 +109,6 @@ SAL_THROW (()) DBG_ERROR( "Fatal error: top node isn't a dialog" ); } -#if 0 - // Hack moved to proplist.cxx - OUString aGraphic; - if ( findAndRemove( "graphic", aProps, aGraphic ) ) - //if ( layout::FixedImage *i = dynamic_cast<layout::FixedImage *> ( mpWidget->getPeer().get() ) ) - // FIXME: huh? XImageProducer::complete( XImageConsumer ) - //i->setImage( Image( loadGraphic( OUSTRING_CSTR( aGraphic ) ) ) ); - mpWidget->setProperty( OUString::createFromAscii( "graphic" ), - loadGraphic( OUSTRING_CSTR( aGraphic ) ) ); -#endif - OUString aOrdering; if ( findAndRemove( "ordering", aProps, aOrdering ) ) if ( DialogButtonHBox *b = dynamic_cast<DialogButtonHBox *> ( mpWidget->getPeer().get() ) ) |