summaryrefslogtreecommitdiff
path: root/framework/inc/classes
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-04-04 16:11:47 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-04-04 16:11:47 +0000
commit631a93a1830ba94a2e3677c911269e69f218a26d (patch)
tree308240cdc023c6b12f0c7038fd02ebb4876304ae /framework/inc/classes
parent8fefecbdf5f02b621d5e30f978c1c6de927eaeb1 (diff)
INTEGRATION: CWS fwk01 (1.1.2.1.6); FILE MERGED
2003/03/19 13:10:50 cd 1.1.2.1.6.5: #107568# Support Add-On help menu items directly in the Office help menu 2003/03/17 09:22:05 cd 1.1.2.1.6.4: #107568# Support context for all items 2003/03/10 14:02:54 cd 1.1.2.1.6.3: #107568# Added support for Add-Ons help integration 2003/03/07 09:28:28 cd 1.1.2.1.6.2: #107568# Support extended Add-Ons configuration format 2003/02/27 07:26:23 cd 1.1.2.1.6.1: #107568# Top-level addon popup menus shouldn't be stored or configured by the user
Diffstat (limited to 'framework/inc/classes')
-rw-r--r--framework/inc/classes/addonmenu.hxx114
1 files changed, 72 insertions, 42 deletions
diff --git a/framework/inc/classes/addonmenu.hxx b/framework/inc/classes/addonmenu.hxx
index 80b27d763b25..139a890f67d2 100644
--- a/framework/inc/classes/addonmenu.hxx
+++ b/framework/inc/classes/addonmenu.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: addonmenu.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: hr $ $Date: 2003-03-25 18:19:30 $
+ * last change: $Author: hr $ $Date: 2003-04-04 17:11:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,79 +73,109 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
#include <vcl/menu.hxx>
-#include <vcl/image.hxx>
-
-class String;
-class ImageList;
-#define ADDONMENU_ITEMID_START 20000
+#define ADDONMENU_ITEMID_START 1500
+#define ADDONMENU_ITEMID_END 2000
namespace framework
{
-class AddonMenu_Impl;
class AddonMenu : public PopupMenu
{
public:
AddonMenu( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
~AddonMenu();
- void Initialize(); // Synchrones Laden der Eintraege
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xFrame;
+};
+
+class AddonMenuManager;
+class AddonPopupMenu : public PopupMenu
+{
+ public:
+ ~AddonPopupMenu();
+
+ // Check if command URL string has the unique prefix to identify addon popup menus
+ static sal_Bool IsCommandURLPrefix( const rtl::OUString& aCmdURL );
- static sal_Bool HasElements();
+ void SetCommandURL( const rtl::OUString& aCmdURL ) { m_aCommandURL = aCmdURL; }
+ const rtl::OUString& GetCommandURL() const { return m_aCommandURL; }
protected:
- USHORT CreateMenuId();
+ void Initialize( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonPopupMenuDefinition );
private:
- AddonMenu( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, AddonMenu* pRoot );
- PopupMenu* BuildSubMenu( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aAddonSubMenuDefinition );
+ AddonPopupMenu( com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
- AddonMenu_Impl* _pImp;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xFrame;
+ rtl::OUString m_aCommandURL;
+ ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& m_xFrame;
+
+ friend AddonMenuManager;
};
-class AddonPopupMenu : public PopupMenu
+class AddonMenuManager
{
public:
- ~AddonPopupMenu();
+ enum MenuType
+ {
+ ADDON_MENU,
+ ADDON_POPUPMENU
+ };
- const rtl::OUString& GetContext() const { return m_aContext; }
- const rtl::OUString& GetCommandURL() const { return m_aCommandURL; }
- const rtl::OUString& GetTitle() const { return m_aTitle; }
- USHORT GetId() const { return m_nId; }
+ static sal_Bool HasAddonMenuElements();
+ static sal_Bool HasAddonHelpMenuElements();
- // Get the top-level popup menus for addons. The menubar is used as a container. Every popup menu is from type AddonPopupMenu!
- static void GetAddonPopupMenus( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
- MenuBar* pAddonPopupMenus );
+ static sal_Bool IsAddonMenuId( USHORT nId ) { return (( nId >= ADDONMENU_ITEMID_START ) && ( nId < ADDONMENU_ITEMID_END )); }
- // Merge the addon popup menus into the given menu bar at the provided pos.
- static void MergeAddonPopupMenus( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel,
- USHORT nMergeAtPos,
- MenuBar* pMergeMenuBar );
+ // Check if the context string matches the provided xModel context
+ static sal_Bool IsCorrectContext( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, const rtl::OUString& aContext );
- protected:
- void Initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rAddonPopupMenuDefinition );
- USHORT CreateMenuId();
- sal_Bool IsCorrectContext( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel ) const;
+ // Factory method to create different Add-On menu types
+ static PopupMenu* CreatePopupMenuType( MenuType eMenuType, com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
- private:
- AddonPopupMenu( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ // Create the Add-Ons menu
+ static AddonMenu* CreateAddonMenu( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
- PopupMenu* BuildSubMenu( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aAddonSubMenuDefinition );
+ // Merge the Add-Ons help menu items into the given menu bar at a defined pos
+ static void MergeAddonHelpMenu( com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ MenuBar* pMergeMenuBar );
- USHORT m_nId;
- rtl::OUString m_aCommandURL;
- rtl::OUString m_aTitle;
- rtl::OUString m_aContext;
- AddonMenu_Impl* _pImp;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xFrame;
+ // Merge the addon popup menus into the given menu bar at the provided pos.
+ static void MergeAddonPopupMenus( com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel,
+ USHORT nMergeAtPos,
+ MenuBar* pMergeMenuBar );
+
+ // Returns the next position to insert a menu item/sub menu
+ static USHORT GetNextPos( USHORT nPos );
+
+ // Build up the menu item and sub menu into the provided pCurrentMenu. The sub menus should be of type nSubMenuType.
+ static void BuildMenu( PopupMenu* pCurrentMenu,
+ MenuType nSubMenuType,
+ USHORT nInsPos,
+ USHORT& nUniqueMenuId,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > aAddonMenuDefinition,
+ com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel );
+
+ // Retrieve the menu entry property values from a sequence
+ static void GetMenuEntry( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonMenuEntry,
+ ::rtl::OUString& rTitle,
+ ::rtl::OUString& rURL,
+ ::rtl::OUString& rTarget,
+ ::rtl::OUString& rImageId,
+ ::rtl::OUString& rContext,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rAddonSubMenu );
};
} // namespace framework