LCOV - code coverage report
Current view: top level - forms/source/component - Button.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 8 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_BUTTON_HXX
      21             : #define INCLUDED_FORMS_SOURCE_COMPONENT_BUTTON_HXX
      22             : 
      23             : #include "clickableimage.hxx"
      24             : #include "togglestate.hxx"
      25             : #include "formnavigation.hxx"
      26             : #include "resettable.hxx"
      27             : 
      28             : #include <com/sun/star/awt/MouseEvent.hpp>
      29             : #include <com/sun/star/lang/EventObject.hpp>
      30             : #include <com/sun/star/awt/ActionEvent.hpp>
      31             : #include <com/sun/star/awt/XActionListener.hpp>
      32             : #include <com/sun/star/awt/XButton.hpp>
      33             : #include <com/sun/star/form/XReset.hpp>
      34             : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
      35             : 
      36             : #include <cppuhelper/implbase1.hxx>
      37             : 
      38             : 
      39             : namespace frm
      40             : {
      41             : 
      42             : 
      43             : 
      44             : // OButtonModel
      45             : 
      46             : typedef ::cppu::ImplHelper1 <   ::com::sun::star::form::XReset
      47             :                             >   OButtonModel_Base;
      48             : class OButtonModel  :public OClickableImageBaseModel
      49             :                     ,public OButtonModel_Base
      50             : {
      51             : public:
      52             :     DECLARE_DEFAULT_LEAF_XTOR( OButtonModel );
      53             : 
      54             :     // UNO
      55           0 :     DECLARE_UNO3_AGG_DEFAULTS( OButtonModel, OClickableImageBaseModel )
      56             :     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;
      57             : 
      58             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes() SAL_OVERRIDE;
      59             : 
      60             : // ::com::sun::star::lang::XServiceInfo
      61           0 :     IMPLEMENTATION_NAME(OButtonModel);
      62             :     virtual StringSequence SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
      63             : 
      64             : // ::com::sun::star::io::XPersistObject
      65             :     virtual OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      66             :     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;
      67             :     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;
      68             : 
      69             :     // XReset
      70             :     virtual void SAL_CALL reset(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      71             :     virtual void SAL_CALL addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      72             :     virtual void SAL_CALL removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      73             : 
      74             :     // OControlModel's property handling
      75             :     virtual void describeFixedProperties(
      76             :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
      77             :     ) const SAL_OVERRIDE;
      78             : 
      79             :     // XPropertySet and friends
      80             :     virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const SAL_OVERRIDE;
      81             :     virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
      82             :                 throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
      83             :     virtual sal_Bool SAL_CALL convertFastPropertyValue(
      84             :                 ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
      85             :                 throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
      86             :     virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const SAL_OVERRIDE;
      87             : 
      88             :     // OComponentHelper
      89             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
      90             : 
      91             : protected:
      92             :     DECLARE_XCLONEABLE();
      93             : 
      94             : private:
      95             :     void    impl_resetNoBroadcast_nothrow();
      96             : 
      97             :     using ::cppu::OPropertySetHelper::getFastPropertyValue;
      98             : 
      99             : private:
     100             :     ResetHelper m_aResetHelper;
     101             : 
     102             :     // <properties>
     103             :     ToggleState m_eDefaultState;          // the default check state
     104             :     // </properties>
     105             : protected:
     106             :     using OClickableImageBaseModel::disposing;
     107             : };
     108             : 
     109             : 
     110             : // OButtonControl
     111             : 
     112             : typedef ::cppu::ImplHelper3 <   ::com::sun::star::awt::XButton
     113             :                             ,   ::com::sun::star::awt::XActionListener
     114             :                             ,   ::com::sun::star::beans::XPropertyChangeListener
     115             :                             >   OButtonControl_BASE;
     116             : 
     117             : class OButtonControl    :public OButtonControl_BASE
     118             :                         ,public OClickableImageBaseControl
     119             :                         ,public OFormNavigationHelper
     120             : {
     121             : private:
     122             :     sal_uLong m_nClickEvent;
     123             :     sal_Int16   m_nTargetUrlFeatureId;
     124             :     /// caches the value of the "Enabled" property of our model
     125             :     sal_Bool    m_bEnabledByPropertyValue;
     126             : 
     127             : protected:
     128             : 
     129             :     // UNO binding
     130             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes() SAL_OVERRIDE;
     131             : 
     132             : public:
     133             :     OButtonControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxFactory);
     134             :     virtual ~OButtonControl();
     135             : 
     136             :     // XServiceInfo
     137           0 :     IMPLEMENTATION_NAME(OButtonControl);
     138             :     virtual StringSequence SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
     139             : 
     140             :     // UNO binding
     141           0 :     DECLARE_UNO3_AGG_DEFAULTS(OButtonControl, OClickableImageBaseControl)
     142             :     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;
     143             : 
     144             :     // XActionListener
     145             :     virtual void SAL_CALL actionPerformed(const ::com::sun::star::awt::ActionEvent& rEvent) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     146             : 
     147             :     // XButton
     148             :     virtual void SAL_CALL addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             :     virtual void SAL_CALL removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     150             :     virtual void SAL_CALL setLabel(const OUString& Label) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     151             :     virtual void SAL_CALL setActionCommand(const OUString& _rCommand) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             : 
     153             :     // OComponentHelper
     154             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     155             : 
     156             :     // XPropertyChangeListener
     157             :     virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     158             : 
     159             :     // XEventListener
     160             :     virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     161             : 
     162             :     // XControl
     163             :     virtual sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     164             :     void SAL_CALL setDesignMode(sal_Bool bOn) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     165             : 
     166             : protected:
     167             :     // OFormNavigationHelper overriables
     168             :     virtual void    getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ) SAL_OVERRIDE;
     169             :     virtual void    featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled ) SAL_OVERRIDE;
     170             :     virtual void    allFeatureStatesChanged( ) SAL_OVERRIDE;
     171             :     virtual bool    isEnabled( sal_Int16 _nFeatureId ) const SAL_OVERRIDE;
     172             : 
     173             :     // XDispatchProviderInterception disambiguaiton
     174             :     virtual void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     175             :     virtual void SAL_CALL releaseDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     176             : 
     177             :     // OImageControl overridables
     178             :     virtual void    actionPerformed_Impl( sal_Bool bNotifyListener, const ::com::sun::star::awt::MouseEvent& _rEvt ) SAL_OVERRIDE;
     179             : 
     180             : private:
     181             :     DECL_LINK( OnClick, void* );
     182             : 
     183             :     /** to be called whenever the feature URL represented by our model has potentially changed
     184             :     */
     185             :     void        modelFeatureUrlPotentiallyChanged( );
     186             : 
     187             :     /** retrieves the feature id (see OFormNavigationHelper) of the TargetURL of
     188             :         the model.
     189             :     */
     190             :     sal_Int16   getModelUrlFeatureId( ) const;
     191             : 
     192             :     /** starts or stops listening for changes in model properties we're interested in
     193             :     */
     194             :     void        startOrStopModelPropertyListening( bool _bStart );
     195             : };
     196             : 
     197             : 
     198             : }   // namespace frm
     199             : 
     200             : 
     201             : #endif // INCLUDED_FORMS_SOURCE_COMPONENT_BUTTON_HXX
     202             : 
     203             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10