LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/toolkit/controls - unocontrol.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 13 92.3 %
Date: 2012-12-27 Functions: 3 4 75.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 _TOOLKIT_CONTROLS_UNOCONTROL_HXX_
      21             : #define _TOOLKIT_CONTROLS_UNOCONTROL_HXX_
      22             : 
      23             : #include <toolkit/dllapi.h>
      24             : #include <com/sun/star/awt/XControl.hpp>
      25             : #include <com/sun/star/awt/XWindow2.hpp>
      26             : #include <com/sun/star/awt/XView.hpp>
      27             : #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/lang/XTypeProvider.hpp>
      30             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      31             : #include <com/sun/star/awt/XUnitConversion.hpp>
      32             : #include <com/sun/star/awt/XStyleSettingsSupplier.hpp>
      33             : #include <com/sun/star/accessibility/XAccessible.hpp>
      34             : #include <cppuhelper/weakagg.hxx>
      35             : #include <osl/mutex.hxx>
      36             : #include <toolkit/helper/mutexandbroadcasthelper.hxx>
      37             : #include <toolkit/helper/listenermultiplexer.hxx>
      38             : #include <cppuhelper/propshlp.hxx>
      39             : #include <cppuhelper/interfacecontainer.hxx>
      40             : #include <cppuhelper/weakref.hxx>
      41             : #include <cppuhelper/implbase9.hxx>
      42             : #include <comphelper/componentcontext.hxx>
      43             : #include <com/sun/star/util/XModeChangeBroadcaster.hpp>
      44             : #include <com/sun/star/awt/XVclWindowPeer.hpp>
      45             : 
      46             : 
      47             : struct UnoControlComponentInfos
      48             : {
      49             :     sal_Bool    bVisible;
      50             :     sal_Bool    bEnable;
      51             :     long        nX, nY, nWidth, nHeight;
      52             :     sal_uInt16  nFlags;
      53             :     float       nZoomX, nZoomY;
      54             : 
      55           9 :     UnoControlComponentInfos()
      56             :     {
      57           9 :         bVisible = sal_True;
      58           9 :         bEnable = sal_True;
      59           9 :         nX = nY = nWidth = nHeight = 0;
      60           9 :         nFlags = 0; // POSSIZE_POSSIZE;
      61           9 :         nZoomX = nZoomY = 1.0f;
      62           9 :     }
      63             : };
      64             : 
      65             : struct UnoControl_Data;
      66             : //  ----------------------------------------------------
      67             : //  class UnoControl
      68             : //  ----------------------------------------------------
      69             : typedef ::cppu::WeakAggImplHelper9  <   ::com::sun::star::awt::XControl
      70             :                                     ,   ::com::sun::star::awt::XWindow2
      71             :                                     ,   ::com::sun::star::awt::XView
      72             :                                     ,   ::com::sun::star::beans::XPropertiesChangeListener
      73             :                                     ,   ::com::sun::star::lang::XServiceInfo
      74             :                                     ,   ::com::sun::star::accessibility::XAccessible
      75             :                                     ,   ::com::sun::star::util::XModeChangeBroadcaster
      76             :                                     ,   ::com::sun::star::awt::XUnitConversion
      77             :                                     ,   ::com::sun::star::awt::XStyleSettingsSupplier
      78             :                                     >   UnoControl_Base;
      79             : 
      80             : class TOOLKIT_DLLPUBLIC UnoControl :    public UnoControl_Base
      81             : {
      82             : private:
      83             :     ::osl::Mutex    maMutex;
      84             : 
      85             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >      mxPeer;
      86             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >   mxVclWindowPeer; // just to avoid the query_interface thing
      87             : 
      88             : protected:
      89             :     const ::comphelper::ComponentContext    maContext;
      90             :     EventListenerMultiplexer            maDisposeListeners;
      91             :     WindowListenerMultiplexer           maWindowListeners;
      92             :     FocusListenerMultiplexer            maFocusListeners;
      93             :     KeyListenerMultiplexer              maKeyListeners;
      94             :     MouseListenerMultiplexer            maMouseListeners;
      95             :     MouseMotionListenerMultiplexer      maMouseMotionListeners;
      96             :     PaintListenerMultiplexer            maPaintListeners;
      97             :     ::cppu::OInterfaceContainerHelper   maModeChangeListeners;
      98             : 
      99             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >       mxContext;
     100             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >    mxModel;
     101             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >        mxGraphics;
     102             : 
     103             :     ::com::sun::star::uno::WeakReferenceHelper
     104             :                                         maAccessibleContext;    /// our most recent XAccessibleContext instance
     105             : 
     106             :     sal_Bool                            mbDisposePeer;
     107             :     sal_Bool                            mbRefeshingPeer;
     108             :     sal_Bool                            mbCreatingPeer;
     109             :     sal_Bool                            mbCreatingCompatiblePeer;
     110             :     sal_Bool                            mbDesignMode;
     111             : 
     112             :     UnoControlComponentInfos            maComponentInfos;
     113             :     UnoControl_Data*                    mpData;
     114             : 
     115          66 :     ::osl::Mutex&                                                               GetMutex() { return maMutex; }
     116             : 
     117             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >          getParentPeer() const;
     118             :     virtual void                                                                updateFromModel();
     119             :     void                                                                        peerCreated();
     120             :     bool                                                                        ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable );
     121             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >      ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer );
     122             :     virtual void                                                                ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
     123             :     virtual void                                                                PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
     124             :     virtual void                                                                ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents );
     125             : 
     126             :     void                                                                        ImplLockPropertyChangeNotification( const ::rtl::OUString& rPropertyName, bool bLock );
     127             :     void                                                                        ImplLockPropertyChangeNotifications( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames, bool bLock );
     128             : 
     129             :     void                                                                        disposeAccessibleContext();
     130             : 
     131          11 :     inline void setPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& _xPeer)
     132             :     {
     133          11 :         mxPeer = _xPeer;
     134          11 :         mxVclWindowPeer = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >(mxPeer,::com::sun::star::uno::UNO_QUERY); // just to avoid the query_interface thing
     135          11 :     }
     136             : 
     137             :     virtual sal_Bool   requiresNewPeer( const ::rtl::OUString& _rPropertyName ) const;
     138             : 
     139             : protected:
     140             :                 UnoControl();
     141             : 
     142             : public:
     143             :                 UnoControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
     144             :                 ~UnoControl();
     145             : 
     146           0 :                 UnoControlComponentInfos&           GetComponentInfos() { return maComponentInfos; }
     147             : 
     148             : 
     149             :     virtual ::rtl::OUString GetComponentServiceName();
     150             : 
     151             :     // ::com::sun::star::lang::XTypeProvider
     152             :     ::com::sun::star::uno::Sequence< sal_Int8 >                     SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
     153             : 
     154             :     // ::com::sun::star::lang::XComponent
     155             :     void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException);
     156             :     void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     157             :     void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
     158             : 
     159             :     // XEventListener
     160             :     void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
     161             : 
     162             :     // ::com::sun::star::awt::XWindow2
     163             :     virtual void SAL_CALL setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException);
     164             :     virtual ::com::sun::star::awt::Size SAL_CALL getOutputSize(  ) throw (::com::sun::star::uno::RuntimeException);
     165             :     virtual ::sal_Bool SAL_CALL isVisible(  ) throw (::com::sun::star::uno::RuntimeException);
     166             :     virtual ::sal_Bool SAL_CALL isActive(  ) throw (::com::sun::star::uno::RuntimeException);
     167             :     virtual ::sal_Bool SAL_CALL isEnabled(  ) throw (::com::sun::star::uno::RuntimeException);
     168             :     virtual ::sal_Bool SAL_CALL hasFocus(  ) throw (::com::sun::star::uno::RuntimeException);
     169             : 
     170             :     // ::com::sun::star::awt::XWindow
     171             :     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);
     172             :     ::com::sun::star::awt::Rectangle SAL_CALL getPosSize(  ) throw(::com::sun::star::uno::RuntimeException);
     173             :     void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
     174             :     void SAL_CALL setEnable( sal_Bool Enable ) throw(::com::sun::star::uno::RuntimeException);
     175             :     void SAL_CALL setFocus(  ) throw(::com::sun::star::uno::RuntimeException);
     176             :     void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     177             :     void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     178             :     void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     179             :     void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     180             :     void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     181             :     void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     182             :     void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     183             :     void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     184             :     void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     185             :     void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     186             :     void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     187             :     void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     188             : 
     189             :     // ::com::sun::star::awt::XView
     190             :     sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& aDevice ) throw(::com::sun::star::uno::RuntimeException);
     191             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics(  ) throw(::com::sun::star::uno::RuntimeException);
     192             :     ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw(::com::sun::star::uno::RuntimeException);
     193             :     void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
     194             :     void SAL_CALL setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException);
     195             : 
     196             :     // ::com::sun::star::awt::XControl
     197             :     void SAL_CALL setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Context ) throw(::com::sun::star::uno::RuntimeException);
     198             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getContext(  ) throw(::com::sun::star::uno::RuntimeException);
     199             :     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);
     200             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer(  ) throw(::com::sun::star::uno::RuntimeException);
     201             :     sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
     202             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel(  ) throw(::com::sun::star::uno::RuntimeException);
     203             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > SAL_CALL getView(  ) throw(::com::sun::star::uno::RuntimeException);
     204             :     void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
     205             :     sal_Bool SAL_CALL isDesignMode(  ) throw(::com::sun::star::uno::RuntimeException);
     206             :     sal_Bool SAL_CALL isTransparent(  ) throw(::com::sun::star::uno::RuntimeException);
     207             : 
     208             :     // ::com::sun::star::lang::XServiceInfo
     209             :     ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
     210             :     sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
     211             :     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
     212             : 
     213             :     // XAccessible
     214             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
     215             : 
     216             :     // XModeChangeBroadcaster
     217             :     virtual void SAL_CALL addModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
     218             :     virtual void SAL_CALL removeModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
     219             :     virtual void SAL_CALL addModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
     220             :     virtual void SAL_CALL removeModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
     221             : 
     222             :     // XUnitConversion
     223             :     virtual ::com::sun::star::awt::Point SAL_CALL convertPointToLogic( const ::com::sun::star::awt::Point& Point, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     224             :     virtual ::com::sun::star::awt::Point SAL_CALL convertPointToPixel( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     225             :     virtual ::com::sun::star::awt::Size SAL_CALL convertSizeToLogic( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     226             :     virtual ::com::sun::star::awt::Size SAL_CALL convertSizeToPixel( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     227             : 
     228             :     // XStyleSettingsSupplier
     229             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleSettings > SAL_CALL getStyleSettings() throw (::com::sun::star::uno::RuntimeException);
     230             : 
     231             : private:
     232             :     // ::com::sun::star::beans::XPropertiesChangeListener
     233             :     void SAL_CALL propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt ) throw(::com::sun::star::uno::RuntimeException);
     234             : };
     235             : 
     236             : 
     237             : 
     238             : 
     239             : #endif // _TOOLKIT_CONTROLS_UNOCONTROL_HXX_
     240             : 
     241             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10