LCOV - code coverage report
Current view: top level - forms/source/component - ImageControl.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 6 0.0 %
Date: 2014-04-14 Functions: 0 11 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             : 
      20             : #ifndef INCLUDED_FORMS_SOURCE_COMPONENT_IMAGECONTROL_HXX
      21             : #define INCLUDED_FORMS_SOURCE_COMPONENT_IMAGECONTROL_HXX
      22             : 
      23             : #include "FormComponent.hxx"
      24             : #include "imgprod.hxx"
      25             : #include <com/sun/star/form/XImageProducerSupplier.hpp>
      26             : #include <com/sun/star/awt/XMouseListener.hpp>
      27             : #include <com/sun/star/util/XModifyBroadcaster.hpp>
      28             : #include <com/sun/star/graphic/XGraphicObject.hpp>
      29             : #include <comphelper/propmultiplex.hxx>
      30             : #include <comphelper/implementationreference.hxx>
      31             : #include <cppuhelper/implbase2.hxx>
      32             : 
      33             : using namespace comphelper;
      34             : 
      35             : 
      36             : namespace frm
      37             : {
      38             : 
      39             : 
      40             : 
      41             : // OImageControlModel
      42             : 
      43             : typedef ::cppu::ImplHelper2 <   ::com::sun::star::form::XImageProducerSupplier
      44             :                             ,   ::com::sun::star::awt::XImageProducer
      45             :                             >   OImageControlModel_Base;
      46             : 
      47             : class OImageControlModel
      48             :                 :public OImageControlModel_Base
      49             :                 ,public OBoundControlModel
      50             : {
      51             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer>    m_xImageProducer;
      52             :     ImageProducer*                                  m_pImageProducer;
      53             :     bool                                            m_bExternalGraphic;
      54             :     sal_Bool                                        m_bReadOnly;
      55             :     OUString                                 m_sImageURL;
      56             :     ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject >
      57             :                                                     m_xGraphicObject;
      58             :     OUString                                 m_sDocumentURL;
      59             : 
      60             : protected:
      61             :     // UNO Anbindung
      62             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes() SAL_OVERRIDE;
      63             : 
      64           0 :     inline ImageProducer* GetImageProducer() { return m_pImageProducer; }
      65             : 
      66             : public:
      67             :     DECLARE_DEFAULT_LEAF_XTOR( OImageControlModel );
      68             : 
      69             :     virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
      70             :     virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
      71             : 
      72             :     virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
      73             :         throw(::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
      74             : 
      75             :     // UNO Anbindung
      76           0 :     DECLARE_UNO3_AGG_DEFAULTS(OImageControlModel, OBoundControlModel)
      77             :     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      78             : 
      79             :     // XServiceInfo
      80           0 :     IMPLEMENTATION_NAME(OImageControlModel);
      81             :     virtual StringSequence SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
      82             : 
      83             :     // OComponentHelper
      84             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
      85             : 
      86             :     // XPersistObject
      87             :     virtual OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      88             :     virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      89             :     virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      90             : 
      91             :     // XImageProducerSupplier
      92             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer> SAL_CALL getImageProducer() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             : 
      94             :     // XImageProducer
      95             :     virtual void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             :     virtual void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             :     virtual void SAL_CALL startProduction(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             : 
      99             :     // OControlModel's property handling
     100             :     virtual void describeAggregateProperties(
     101             :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
     102             :     ) const SAL_OVERRIDE;
     103             :     virtual void describeFixedProperties(
     104             :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
     105             :     ) const SAL_OVERRIDE;
     106             : 
     107             :     // prevent method hiding
     108             :     using OBoundControlModel::disposing;
     109             :     using OBoundControlModel::getFastPropertyValue;
     110             : 
     111             : protected:
     112             :     // OBoundControlModel overridables
     113             :     virtual void            onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ) SAL_OVERRIDE;
     114             :     virtual void            onDisconnectedDbColumn() SAL_OVERRIDE;
     115             :     virtual ::com::sun::star::uno::Any
     116             :                             translateDbColumnToControlValue( ) SAL_OVERRIDE;
     117             :     virtual sal_Bool        commitControlValueToDbColumn( bool _bPostReset ) SAL_OVERRIDE;
     118             : 
     119             :     virtual ::com::sun::star::uno::Any
     120             :                             getControlValue( ) const SAL_OVERRIDE;
     121             :     virtual void            doSetControlValue( const ::com::sun::star::uno::Any& _rValue ) SAL_OVERRIDE;
     122             : 
     123             :     virtual sal_Bool        approveDbColumnType(sal_Int32 _nColumnType) SAL_OVERRIDE;
     124             : 
     125             :     virtual void            resetNoBroadcast() SAL_OVERRIDE;
     126             : 
     127             : protected:
     128             :     DECLARE_XCLONEABLE();
     129             : 
     130             :     void implConstruct();
     131             : 
     132             :     /** displays the image described by the given URL
     133             :         @precond
     134             :             our own mutex is locked
     135             :     */
     136             :     sal_Bool    impl_handleNewImageURL_lck( ValueChangeInstigator _eInstigator );
     137             : 
     138             :     /** updates the binary stream, created from loading the file which the given URL points to, into our
     139             :         bound field, or the control itself if there is no bound field
     140             :     */
     141             :     sal_Bool    impl_updateStreamForURL_lck( const OUString& _rURL, ValueChangeInstigator _eInstigator );
     142             : 
     143             :     DECL_LINK( OnImageImportDone, ::Graphic* );
     144             : };
     145             : 
     146             : 
     147             : //= OImageControlControl
     148             : 
     149             : typedef ::cppu::ImplHelper2 <   ::com::sun::star::awt::XMouseListener
     150             :                             ,   ::com::sun::star::util::XModifyBroadcaster
     151             :                             >   OImageControlControl_Base;
     152           0 : class OImageControlControl  : public OBoundControl
     153             :                             , public OImageControlControl_Base
     154             : {
     155             : private:
     156             :     ::cppu::OInterfaceContainerHelper   m_aModifyListeners;
     157             : 
     158             :     // XTypeProvider
     159             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes() SAL_OVERRIDE;
     160             : 
     161             : public:
     162             :     OImageControlControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxFactory);
     163             : 
     164             :     // UNO
     165           0 :     DECLARE_UNO3_AGG_DEFAULTS( OImageControlControl, OBoundControl )
     166             :     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     167             : 
     168             :     // XEventListener
     169             :     virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     170             : 
     171             :     // XServiceInfo
     172           0 :     IMPLEMENTATION_NAME(OImageControlControl);
     173             :     virtual StringSequence SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
     174             : 
     175             :     // XMouseListener
     176             :     virtual void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     177             :     virtual void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     178             :     virtual void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     179             :     virtual void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             : 
     181             :     // XModifyBroadcaster
     182             :     virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     183             :     virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     184             : 
     185             :     // OComponentHelper
     186             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     187             : 
     188             : private:
     189             :     void    implClearGraphics( sal_Bool _bForce );
     190             :     bool    implInsertGraphics();
     191             : 
     192             :     /** determines whether the control does currently have an empty grahic set
     193             :     */
     194             :     bool    impl_isEmptyGraphics_nothrow() const;
     195             : };
     196             : 
     197             : 
     198             : }   // namespace frm
     199             : 
     200             : 
     201             : #endif // INCLUDED_FORMS_SOURCE_COMPONENT_IMAGECONTROL_HXX
     202             : 
     203             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10