LCOV - code coverage report
Current view: top level - include/toolkit/awt - vclxmenu.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 6 100.0 %
Date: 2014-11-03 Functions: 8 8 100.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_TOOLKIT_AWT_VCLXMENU_HXX
      21             : #define INCLUDED_TOOLKIT_AWT_VCLXMENU_HXX
      22             : 
      23             : #include <toolkit/dllapi.h>
      24             : #include <toolkit/helper/listenermultiplexer.hxx>
      25             : 
      26             : #include <com/sun/star/awt/XMenuBar.hpp>
      27             : #include <com/sun/star/awt/XPopupMenu.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             : 
      32             : #include <cppuhelper/weak.hxx>
      33             : #include <osl/mutex.hxx>
      34             : 
      35             : #include <tools/link.hxx>
      36             : 
      37             : #include <vector>
      38             : 
      39             : class Menu;
      40             : class MenuBar;
      41             : class VclSimpleEvent;
      42             : class PopupMenu;
      43             : 
      44             : typedef ::std::vector<
      45             :     css::uno::Reference< css::awt::XPopupMenu >*
      46             : > PopupMenuRefList;
      47             : 
      48             : 
      49             : //  class VCLXMenu
      50             : 
      51             : 
      52             : class TOOLKIT_DLLPUBLIC VCLXMenu :  public css::awt::XMenuBar,
      53             :                                     public css::awt::XPopupMenu,
      54             :                                     public css::lang::XServiceInfo,
      55             :                                     public css::lang::XTypeProvider,
      56             :                                     public css::lang::XUnoTunnel,
      57             :                                     public ::cppu::OWeakObject
      58             : {
      59             : private:
      60             :     ::osl::Mutex            maMutex;
      61             :     Menu*                   mpMenu;
      62             :     MenuListenerMultiplexer maMenuListeners;
      63             :     PopupMenuRefList        maPopupMenuRefs;
      64             : 
      65             : protected:
      66       42811 :     ::osl::Mutex&           GetMutex() { return maMutex; }
      67             : 
      68             :     DECL_LINK( MenuEventListener, VclSimpleEvent* );
      69             : 
      70             :     void ImplCreateMenu( bool bPopup );
      71             : 
      72             : public:
      73             :     VCLXMenu();
      74             :     VCLXMenu( Menu* pMenu );
      75             :     virtual ~VCLXMenu();
      76             : 
      77             : 
      78       25860 :     Menu*    GetMenu() const { return mpMenu; }
      79             :     bool IsPopupMenu() const;
      80             : 
      81             :     // css::uno::XInterface
      82             :     css::uno::Any  SAL_CALL queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      83      142240 :     void SAL_CALL acquire() throw() SAL_OVERRIDE  { OWeakObject::acquire(); }
      84      142236 :     void SAL_CALL release() throw() SAL_OVERRIDE  { OWeakObject::release(); }
      85             : 
      86             :     // css::lang::XUnoTunnel
      87             :     static const css::uno::Sequence< sal_Int8 >&   GetUnoTunnelId() throw();
      88             :     static VCLXMenu* GetImplementation( const css::uno::Reference< css::uno::XInterface >& rxIFace );
      89             :     sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      90             : 
      91             :     // css::lang::XTypeProvider
      92             :     css::uno::Sequence< css::uno::Type >  SAL_CALL getTypes() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             :     css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      94             : 
      95             :     // css::awt::XMenu
      96             :     virtual void SAL_CALL addMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             :     virtual void SAL_CALL removeMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             :     virtual void SAL_CALL insertItem( sal_Int16 nItemId, const OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             :     virtual void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             :     virtual void SAL_CALL clear( ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             :     virtual sal_Int16 SAL_CALL getItemCount(  ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             :     virtual sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             :     virtual sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             :     virtual css::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     105             :     virtual void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     106             :     virtual sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     107             :     virtual void SAL_CALL hideDisabledEntries( sal_Bool bHide ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     108             :     virtual void SAL_CALL enableAutoMnemonics( sal_Bool bEnable ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             :     virtual void SAL_CALL setItemText( sal_Int16 nItemId, const OUString& aText ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     110             :     virtual OUString SAL_CALL getItemText( sal_Int16 nItemId ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             :     virtual void SAL_CALL setCommand( sal_Int16 nItemId, const OUString& aCommand ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     112             :     virtual OUString SAL_CALL getCommand( sal_Int16 nItemId ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     113             :     virtual void SAL_CALL setHelpCommand( sal_Int16 nItemId, const OUString& aHelp ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     114             :     virtual OUString SAL_CALL getHelpCommand( sal_Int16 nItemId ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             :     virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const OUString& sHelpText ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             :     virtual OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             :     virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const OUString& sTipHelpText ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     118             :     virtual OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             : 
     120             :     virtual sal_Bool SAL_CALL isPopupMenu(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             :     virtual void SAL_CALL setPopupMenu( sal_Int16 nItemId, const css::uno::Reference< css::awt::XPopupMenu >& aPopupMenu ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             :     virtual css::uno::Reference< css::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     123             : 
     124             :     // css::awt::XPopupMenu
     125             :     virtual void SAL_CALL insertSeparator( sal_Int16 nPos ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             :     virtual void SAL_CALL setDefaultItem( sal_Int16 nItemId ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             :     virtual sal_Int16 SAL_CALL getDefaultItem(  ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     128             :     virtual void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     129             :     virtual sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     130             :     virtual ::sal_Int16 SAL_CALL execute( const css::uno::Reference< css::awt::XWindowPeer >& Parent, const css::awt::Rectangle& Position, ::sal_Int16 Direction ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     131             :     virtual sal_Bool SAL_CALL isInExecute(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     132             :     virtual void SAL_CALL endExecute(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     133             :     virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const css::awt::KeyEvent& aKeyEvent ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             :     virtual css::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     135             :     virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const css::uno::Reference< css::graphic::XGraphic >& xGraphic, sal_Bool bScale ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     136             :     virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     137             : 
     138             :     // css::lang::XServiceInfo
     139             :     virtual OUString SAL_CALL getImplementationName(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     141             :     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     142             : };
     143             : 
     144       10944 : class TOOLKIT_DLLPUBLIC VCLXMenuBar : public VCLXMenu
     145             : {
     146             : public:
     147             :     VCLXMenuBar();
     148             :     VCLXMenuBar( MenuBar* pMenuBar );
     149             : };
     150             : 
     151       29740 : class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu
     152             : {
     153             : public:
     154             :     VCLXPopupMenu();
     155             :     VCLXPopupMenu( PopupMenu* pPopMenu );
     156             : };
     157             : 
     158             : #endif // INCLUDED_TOOLKIT_AWT_VCLXMENU_HXX
     159             : 
     160             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10