LCOV - code coverage report
Current view: top level - include/toolkit/awt - vclxwindow.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 5 100.0 %
Date: 2015-06-13 12:38:46 Functions: 27 47 57.4 %
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_TOOLKIT_AWT_VCLXWINDOW_HXX
      21             : #define INCLUDED_TOOLKIT_AWT_VCLXWINDOW_HXX
      22             : 
      23             : #include <toolkit/dllapi.h>
      24             : #include <toolkit/awt/vclxdevice.hxx>
      25             : #include <toolkit/helper/listenermultiplexer.hxx>
      26             : #include <vcl/window.hxx>
      27             : 
      28             : #include <com/sun/star/awt/XWindow2.hpp>
      29             : #include <com/sun/star/awt/XVclWindowPeer.hpp>
      30             : #include <com/sun/star/awt/XLayoutConstrains.hpp>
      31             : #include <com/sun/star/awt/XView.hpp>
      32             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      33             : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      34             : #include <com/sun/star/accessibility/XAccessible.hpp>
      35             : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
      36             : #include <com/sun/star/awt/XDockableWindow.hpp>
      37             : #include <com/sun/star/awt/XStyleSettingsSupplier.hpp>
      38             : 
      39             : #include <cppuhelper/weak.hxx>
      40             : #include <cppuhelper/implbase9.hxx>
      41             : #include <osl/mutex.hxx>
      42             : 
      43             : #include <tools/gen.hxx>
      44             : #include <tools/link.hxx>
      45             : 
      46             : #include <stdarg.h>
      47             : #include <list>
      48             : #include <boost/function.hpp>
      49             : 
      50             : class VclSimpleEvent;
      51             : class VclWindowEvent;
      52             : struct SystemParentData;
      53             : 
      54             : namespace toolkit
      55             : {
      56             :     class IAccessibleFactory;
      57             : }
      58             : 
      59             : 
      60             : 
      61             : //  class VCLXWINDOW
      62             : 
      63             : 
      64             : class UnoPropertyArrayHelper;
      65             : class VCLXWindowImpl;
      66             : typedef ::cppu::ImplInheritanceHelper9  <   VCLXDevice
      67             :                                         ,   ::com::sun::star::awt::XWindow2
      68             :                                         ,   ::com::sun::star::awt::XVclWindowPeer
      69             :                                         ,   ::com::sun::star::awt::XLayoutConstrains
      70             :                                         ,   ::com::sun::star::awt::XView
      71             :                                         ,   ::com::sun::star::awt::XDockableWindow
      72             :                                         ,   ::com::sun::star::accessibility::XAccessible
      73             :                                         ,   ::com::sun::star::lang::XEventListener
      74             :                                         ,   ::com::sun::star::beans::XPropertySetInfo
      75             :                                         ,   ::com::sun::star::awt::XStyleSettingsSupplier
      76             :                                         >   VCLXWindow_Base;
      77             : 
      78             : class TOOLKIT_DLLPUBLIC VCLXWindow : public VCLXWindow_Base
      79             : {
      80             : private:
      81             :     VCLXWindowImpl*                 mpImpl;
      82             : 
      83             :     UnoPropertyArrayHelper *GetPropHelper();
      84             : 
      85             : protected:
      86             :     Size            ImplCalcWindowSize( const Size& rOutSz ) const;
      87             :     DECL_LINK(      WindowEventListener, VclSimpleEvent* );
      88             : 
      89             :     virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
      90             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
      91             :                     CreateAccessibleContext();
      92             : 
      93             :     void            SetSynthesizingVCLEvent( bool b );
      94             :     bool            IsSynthesizingVCLEvent() const;
      95             : 
      96             :     void        SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle );
      97             : 
      98             :     ::toolkit::IAccessibleFactory&  getAccessibleFactory();
      99             : 
     100             :     // helper ...
     101             :     static void     PushPropertyIds( std::list< sal_uInt16 > &aIds, int nFirstId, ...);
     102             :     // for use in controls/
     103             :     static void     ImplGetPropertyIds( std::list< sal_uInt16 > &aIds,
     104             :                                         bool bWithDefaults = false );
     105             :     virtual void    GetPropertyIds( std::list< sal_uInt16 > &aIds );
     106             : 
     107             :     ::cppu::OInterfaceContainerHelper&  GetContainerListeners();
     108             :     ::cppu::OInterfaceContainerHelper&  GetTopWindowListeners();
     109             : 
     110             : public:
     111             :     typedef ::boost::function0< void >  Callback;
     112             : 
     113             : protected:
     114             :     /** executes the given callback asynchronously
     115             : 
     116             :         At the moment the callback is called, the Solar Mutex is not locked. In particular, this implies that
     117             :         you cannot rely on |this| not being disposed. However, you *can* rely on |this| being still alive (i.e.
     118             :         having a ref count > 0).
     119             : 
     120             :         As a consequence, this can be used for doing listener notifications, using event multiplexers. Those multiplexers
     121             :         care for the disposed state themself, and are alive as long as |this| is alive.
     122             :     */
     123             :     void    ImplExecuteAsyncWithoutSolarLock(
     124             :                 const Callback& i_callback
     125             :             );
     126             : 
     127             : public:
     128             :     VCLXWindow( bool bWithDefaultProps = false );
     129             :     virtual ~VCLXWindow();
     130             : 
     131             :     virtual void SetWindow( const VclPtr< vcl::Window > &pWindow );
     132     2811859 :     template< class derived_type > VclPtr< derived_type > GetAs() const {
     133     2811859 :         return VclPtr< derived_type >( static_cast< derived_type * >( GetOutputDevice().get() ) ); }
     134         238 :     template< class derived_type > VclPtr< derived_type > GetAsDynamic() const {
     135         238 :         return VclPtr< derived_type >( dynamic_cast< derived_type * >( GetOutputDevice().get() ) ); }
     136     2773730 :     VclPtr<vcl::Window> GetWindow() const { return GetAs<vcl::Window>(); }
     137             : 
     138             :     void    suspendVclEventListening( );
     139             :     void    resumeVclEventListening( );
     140             : 
     141             :     void    notifyWindowRemoved( vcl::Window& _rWindow );
     142             : 
     143             :     // ::com::sun::star::lang::XUnoTunnel
     144             :     static const ::com::sun::star::uno::Sequence< sal_Int8 >&   GetUnoTunnelId() throw();
     145             :     static VCLXWindow*                                          GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace );
     146             :     sal_Int64                                                   SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     147             : 
     148             :     // ::com::sun::star::lang::XEventListener
     149             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     150             : 
     151             :     // ::com::sun::star::lang::XComponent
     152             :     void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             :     void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     154             :     void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     155             : 
     156             :     // ::com::sun::star::awt::XWindow
     157             :     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, std::exception) SAL_OVERRIDE;
     158             :     ::com::sun::star::awt::Rectangle SAL_CALL getPosSize(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     159             :     void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     160             :     void SAL_CALL setEnable( sal_Bool Enable ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     161             :     void SAL_CALL setFocus(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     162             :     void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     163             :     void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             :     void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     165             :     void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     166             :     void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     167             :     void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     168             :     void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     169             :     void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     170             :     void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     171             :     void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     172             :     void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     173             :     void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     174             : 
     175             :     // ::com::sun::star::awt::XWindowPeer
     176             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > SAL_CALL getToolkit(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     177             :     void SAL_CALL setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& Pointer ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     178             :     void SAL_CALL setBackground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     179             :     void SAL_CALL invalidate( sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             :     void SAL_CALL invalidateRect( const ::com::sun::star::awt::Rectangle& Rect, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     181             : 
     182             :     // ::com::sun::star::awt::XVclWindowPeer
     183             :     sal_Bool SAL_CALL isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Peer ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     184             :     void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     185             :     sal_Bool SAL_CALL isDesignMode(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     186             :     void SAL_CALL enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     187             :     void SAL_CALL setForeground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     188             :     void SAL_CALL setControlFont( const ::com::sun::star::awt::FontDescriptor& aFont ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     189             :     void SAL_CALL getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     190             :     void SAL_CALL setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value )
     191             :         throw(::com::sun::star::uno::RuntimeException,
     192             :               std::exception) SAL_OVERRIDE;
     193             :     ::com::sun::star::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     194             : 
     195             :     // ::com::sun::star::awt::XLayoutConstrains
     196             :     ::com::sun::star::awt::Size SAL_CALL getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     197             :     ::com::sun::star::awt::Size SAL_CALL getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     198             :     ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     199             : 
     200             :     // ::com::sun::star::awt::XView
     201             :     sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& aDevice ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     202             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     203             :     ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     204             :     void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     205             :     void SAL_CALL setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     206             : 
     207             :     // ::com::sun::star::accessibility::XAccessible
     208             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     209             : 
     210             :     // ::com::sun::star::awt::XDockableWindow
     211             :     void SAL_CALL addDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     212             :     void SAL_CALL removeDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     213             :     void SAL_CALL enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     214             :     sal_Bool SAL_CALL isFloating(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     215             :     void SAL_CALL setFloatingMode( sal_Bool bFloating ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     216             :     void SAL_CALL lock(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     217             :     void SAL_CALL unlock(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     218             :     sal_Bool SAL_CALL isLocked(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     219             :     void SAL_CALL startPopupMode( const ::com::sun::star::awt::Rectangle& WindowRect ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     220             :     sal_Bool SAL_CALL isInPopupMode(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     221             : 
     222             :     // ::com::sun::star::awt::XWindow2
     223             :     void SAL_CALL setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     224             :     ::com::sun::star::awt::Size SAL_CALL getOutputSize(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     225             :     sal_Bool SAL_CALL isVisible(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     226             :     sal_Bool SAL_CALL isActive(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     227             :     sal_Bool SAL_CALL isEnabled(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     228             :     sal_Bool SAL_CALL hasFocus(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     229             : 
     230             :     // ::com::sun::star::beans::XPropertySetInfo
     231             :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     232             :     ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const OUString& aName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     233             :     sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     234             : 
     235             :     // XStyleSettingsSupplier
     236             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleSettings > SAL_CALL getStyleSettings() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     237             : };
     238             : 
     239             : #endif // INCLUDED_TOOLKIT_AWT_VCLXWINDOW_HXX
     240             : 
     241             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11