LCOV - code coverage report
Current view: top level - include/framework - addonmenu.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 2 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             : #ifndef INCLUDED_FRAMEWORK_ADDONMENU_HXX
      20             : #define INCLUDED_FRAMEWORK_ADDONMENU_HXX
      21             : 
      22             : #include <com/sun/star/frame/XFrame.hpp>
      23             : #include <com/sun/star/beans/PropertyValue.hpp>
      24             : #include <com/sun/star/uno/Sequence.hxx>
      25             : 
      26             : #include <vcl/menu.hxx>
      27             : #include <framework/fwedllapi.h>
      28             : 
      29             : #define ADDONMENU_ITEMID_START       2000
      30             : #define ADDONMENU_ITEMID_END         3000
      31             : 
      32             : namespace framework
      33             : {
      34             : 
      35             : class FWE_DLLPUBLIC AddonMenu : public PopupMenu
      36             : {
      37             :     public:
      38             :         AddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
      39             :         virtual ~AddonMenu();
      40             : 
      41             :     protected:
      42             :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
      43             : };
      44             : 
      45             : class AddonMenuManager;
      46             : 
      47             : class FWE_DLLPUBLIC AddonPopupMenu : public AddonMenu
      48             : {
      49             :     public:
      50             :         virtual ~AddonPopupMenu();
      51             : 
      52             :         // Check if command URL string has the unique prefix to identify addon popup menus
      53             :         static bool        IsCommandURLPrefix( const OUString& aCmdURL );
      54             : 
      55           0 :         void               SetCommandURL( const OUString& aCmdURL ) { m_aCommandURL = aCmdURL; }
      56             :         const OUString&    GetCommandURL() const { return m_aCommandURL; }
      57             : 
      58             :     protected:
      59             :         void Initialize( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonPopupMenuDefinition );
      60             : 
      61             :     private:
      62             :         AddonPopupMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
      63             : 
      64             :         OUString               m_aCommandURL;
      65             : 
      66             :     friend class AddonMenuManager;
      67             : };
      68             : 
      69             : class FWE_DLLPUBLIC AddonMenuManager
      70             : {
      71             :     public:
      72             :         enum MenuType
      73             :         {
      74             :             ADDON_MENU,
      75             :             ADDON_POPUPMENU
      76             :         };
      77             : 
      78             :         static bool       HasAddonMenuElements();
      79             : 
      80           0 :         static bool       IsAddonMenuId( sal_uInt16 nId ) { return (( nId >= ADDONMENU_ITEMID_START ) && ( nId < ADDONMENU_ITEMID_END )); }
      81             : 
      82             :         // Check if the context string matches the provided xModel context
      83             :         static bool       IsCorrectContext( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, const OUString& aContext );
      84             : 
      85             :         // Factory method to create different Add-On menu types
      86             :         static PopupMenu* CreatePopupMenuType( MenuType eMenuType, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
      87             : 
      88             :         // Create the Add-Ons menu
      89             :         static AddonMenu* CreateAddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
      90             : 
      91             :         // Merge the Add-Ons help menu items into the given menu bar at a defined pos
      92             :         static void       MergeAddonHelpMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
      93             :                                               MenuBar* pMergeMenuBar );
      94             : 
      95             :         // Merge the addon popup menus into the given menu bar at the provided pos.
      96             :         static void       MergeAddonPopupMenus( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
      97             :                                                 const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel,
      98             :                                                 sal_uInt16   nMergeAtPos,
      99             :                                                 MenuBar* pMergeMenuBar );
     100             : 
     101             :         // Returns the next position to insert a menu item/sub menu
     102             :         static sal_uInt16     GetNextPos( sal_uInt16 nPos );
     103             : 
     104             :         // Build up the menu item and sub menu into the provided pCurrentMenu. The sub menus should be of type nSubMenuType.
     105             :         static void       BuildMenu( PopupMenu*  pCurrentMenu,
     106             :                                      MenuType    nSubMenuType,
     107             :                                      sal_uInt16      nInsPos,
     108             :                                      sal_uInt16&     nUniqueMenuId,
     109             :                                      com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > aAddonMenuDefinition,
     110             :                                      const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
     111             :                                      const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel );
     112             : 
     113             :         // Retrieve the menu entry property values from a sequence
     114             :         static void       GetMenuEntry( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonMenuEntry,
     115             :                                         OUString& rTitle,
     116             :                                         OUString& rURL,
     117             :                                         OUString& rTarget,
     118             :                                         OUString& rImageId,
     119             :                                         OUString& rContext,
     120             :                                         com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rAddonSubMenu );
     121             : };
     122             : 
     123             : } // namespace framework
     124             : 
     125             : #endif // INCLUDED_FRAMEWORK_ADDONMENU_HXX
     126             : 
     127             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10