LCOV - code coverage report
Current view: top level - forms/source/component - ImageControl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 6 83.3 %
Date: 2012-08-25 Functions: 10 11 90.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 8 37.5 %

           Branch data     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 _FRM_IMAGE_CONTROL_HXX_
      21                 :            : #define _FRM_IMAGE_CONTROL_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                 :            :     ::rtl::OUString                                 m_sImageURL;
      56                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject >
      57                 :            :                                                     m_xGraphicObject;
      58                 :            :     ::rtl::OUString                                 m_sDocumentURL;
      59                 :            : 
      60                 :            : protected:
      61                 :            :     // UNO Anbindung
      62                 :            :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
      63                 :            : 
      64                 :         24 :     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;
      70                 :            :     virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception);
      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);
      74                 :            : 
      75                 :            :     // UNO Anbindung
      76                 :      42399 :     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);
      78                 :            : 
      79                 :            :     // XServiceInfo
      80         [ +  - ]:         14 :     IMPLEMENTATION_NAME(OImageControlModel);
      81                 :            :     virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
      82                 :            : 
      83                 :            :     // OComponentHelper
      84                 :            :     virtual void SAL_CALL disposing();
      85                 :            : 
      86                 :            :     // XPersistObject
      87                 :            :     virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException);
      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);
      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);
      90                 :            : 
      91                 :            :     // XImageProducerSupplier
      92                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer> SAL_CALL getImageProducer() throw ( ::com::sun::star::uno::RuntimeException);
      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);
      96                 :            :     virtual void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException);
      97                 :            :     virtual void SAL_CALL startProduction(  ) throw (::com::sun::star::uno::RuntimeException);
      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;
     103                 :            :     virtual void describeFixedProperties(
     104                 :            :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
     105                 :            :     ) const;
     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 );
     114                 :            :     virtual void            onDisconnectedDbColumn();
     115                 :            :     virtual ::com::sun::star::uno::Any
     116                 :            :                             translateDbColumnToControlValue( );
     117                 :            :     virtual sal_Bool        commitControlValueToDbColumn( bool _bPostReset );
     118                 :            : 
     119                 :            :     virtual ::com::sun::star::uno::Any
     120                 :            :                             getControlValue( ) const;
     121                 :            :     virtual void            doSetControlValue( const ::com::sun::star::uno::Any& _rValue );
     122                 :            : 
     123                 :            :     virtual sal_Bool        approveDbColumnType(sal_Int32 _nColumnType);
     124                 :            : 
     125                 :            :     virtual void            resetNoBroadcast();
     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 ::rtl::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 [ +  - ][ -  + ]:          4 : 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();
     160                 :            : 
     161                 :            : public:
     162                 :            :     OImageControlControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
     163                 :            : 
     164                 :            :     // UNO
     165                 :       2266 :     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);
     167                 :            : 
     168                 :            :     // XEventListener
     169                 :            :     virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException);
     170                 :            : 
     171                 :            :     // XServiceInfo
     172         [ #  # ]:          0 :     IMPLEMENTATION_NAME(OImageControlControl);
     173                 :            :     virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
     174                 :            : 
     175                 :            :     // XMouseListener
     176                 :            :     virtual void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
     177                 :            :     virtual void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
     178                 :            :     virtual void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
     179                 :            :     virtual void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
     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);
     183                 :            :     virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
     184                 :            : 
     185                 :            :     // OComponentHelper
     186                 :            :     virtual void SAL_CALL disposing();
     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 // _FRM_IMAGE_CONTROL_HXX_
     202                 :            : 
     203                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10