[Libreoffice-commits] .: Branch 'feature/unitymenus' - framework/inc framework/source vcl/inc
Antonio Fernandez
afernandez at kemper.freedesktop.org
Wed Jul 18 09:07:03 PDT 2012
framework/inc/classes/menumanager.hxx | 22 ++--
framework/inc/uielement/menubarmanager.hxx | 24 ++--
framework/inc/uielement/menubarmerger.hxx | 16 +-
framework/source/classes/menumanager.cxx | 16 +-
framework/source/uielement/menubarmanager.cxx | 32 ++---
framework/source/uielement/menubarmerger.cxx | 18 +--
vcl/inc/vcl/menu.hxx | 140 +++++++++++++++++++++-----
7 files changed, 178 insertions(+), 90 deletions(-)
New commits:
commit 358a80b7a82bc13f18e42c9b42adab8a3677f31a
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Wed Jul 18 17:04:55 2012 +0100
Refactor of Menu classes from VCL module and Framework module.
Change-Id: I47aa65d3851692d38ee0741031d72fb02e9da785
diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx
index 3ac4588..56ecc90 100644
--- a/framework/inc/classes/menumanager.hxx
+++ b/framework/inc/classes/menumanager.hxx
@@ -78,7 +78,7 @@ class MenuManager : public ThreadHelpBase ,
MenuManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
REFERENCE< XFRAME >& rFrame,
- Menu* pMenu,
+ AbstractMenu* pMenu,
sal_Bool bDelete,
sal_Bool bDeleteChildren );
@@ -90,33 +90,33 @@ class MenuManager : public ThreadHelpBase ,
// XEventListener
virtual void SAL_CALL disposing( const EVENTOBJECT& Source ) throw ( RUNTIMEEXCEPTION );
- DECL_LINK( Select, Menu * );
+ DECL_LINK( Select, AbstractMenu * );
- Menu* GetMenu() const { return m_pVCLMenu; }
+ AbstractMenu* GetMenu() const { return m_pVCLMenu; }
void RemoveListener();
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory();
- static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,IMutex& _rMutex);
+ static void UpdateSpecialWindowMenu( AbstractMenu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,IMutex& _rMutex);
static void FillMenuImages(
::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame,
- Menu* _pMenu,
+ AbstractMenu* _pMenu,
sal_Bool bShowMenuImages
);
protected:
DECL_LINK(Highlight, void *);
- DECL_LINK( Activate, Menu * );
- DECL_LINK( Deactivate, Menu * );
+ DECL_LINK( Activate, AbstractMenu * );
+ DECL_LINK( Deactivate, AbstractMenu * );
private:
- void UpdateSpecialFileMenu( Menu* pMenu );
- void UpdateSpecialWindowMenu( Menu* pMenu );
+ void UpdateSpecialFileMenu( AbstractMenu* pMenu );
+ void UpdateSpecialWindowMenu( AbstractMenu* pMenu );
void ClearMenuDispatch(const EVENTOBJECT& Source = EVENTOBJECT(),bool _bRemoveOnly = true);
void SetHdl();
void AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCommand,sal_uInt16 _nItemId,sal_Bool _bDelete,sal_Bool _bDeleteChildren);
- sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,sal_uInt16 _nIndex) const;
+ sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand, AbstractMenu* _pMenu,sal_uInt16 _nIndex) const;
struct MenuItemHandler
@@ -147,7 +147,7 @@ class MenuManager : public ThreadHelpBase ,
sal_Bool m_bIsBookmarkMenu;
sal_Bool m_bShowMenuImages;
::rtl::OUString m_aMenuItemCommand;
- Menu* m_pVCLMenu;
+ AbstractMenu* m_pVCLMenu;
REFERENCE< XFRAME > m_xFrame;
::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector;
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx
index 6836707..59273e8 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -120,7 +120,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
const rtl::OUString& aModuleIdentifier,
- Menu* pMenu,
+ AbstractMenu* pMenu,
sal_Bool bDelete,
sal_Bool bDeleteChildren );
@@ -155,22 +155,22 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
// XSystemDependentMenuPeer
virtual ::com::sun::star::uno::Any SAL_CALL getMenuHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw (::com::sun::star::uno::RuntimeException);
- DECL_LINK( Select, Menu * );
+ DECL_LINK( Select, AbstractMenu * );
- Menu* GetMenuBar() const { return m_pVCLMenu; }
+ AbstractMenu* GetMenuBar() const { return m_pVCLMenu; }
// Configuration methods
- static void FillMenuWithConfiguration( sal_uInt16& nId, Menu* pMenu,
+ static void FillMenuWithConfiguration( sal_uInt16& nId, AbstractMenu* pMenu,
const ::rtl::OUString& rModuleIdentifier,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer,
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& rTransformer );
static void FillMenu( sal_uInt16& nId,
- Menu* pMenu,
+ AbstractMenu* pMenu,
const ::rtl::OUString& rModuleIdentifier,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider );
- void FillMenuManager( Menu* pMenu,
+ void FillMenuManager( AbstractMenu* pMenu,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
const rtl::OUString& rModuleIdentifier,
@@ -181,8 +181,8 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
protected:
DECL_LINK(Highlight, void *);
- DECL_LINK( Activate, Menu * );
- DECL_LINK( Deactivate, Menu * );
+ DECL_LINK( Activate, AbstractMenu * );
+ DECL_LINK( Deactivate, AbstractMenu * );
DECL_LINK( AsyncSettingsHdl, Timer * );
void RemoveListener();
@@ -225,16 +225,16 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
void CreatePicklistArguments(
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgsList,
const MenuItemHandler* );
- void CheckAndAddMenuExtension( Menu* pMenu );
+ void CheckAndAddMenuExtension( AbstractMenu* pMenu );
static void impl_RetrieveShortcutsFromConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration >& rAccelCfg,
const ::com::sun::star::uno::Sequence< rtl::OUString >& rCommands,
std::vector< MenuItemHandler* >& aMenuShortCuts );
- static void MergeAddonMenus( Menu* pMenuBar, const MergeMenuInstructionContainer&, const ::rtl::OUString& aModuleIdentifier );
+ static void MergeAddonMenus( AbstractMenu* pMenuBar, const MergeMenuInstructionContainer&, const ::rtl::OUString& aModuleIdentifier );
MenuItemHandler* GetMenuItemHandler( sal_uInt16 nItemId );
sal_Bool CreatePopupMenuController( MenuItemHandler* pMenuItemHandler );
void AddMenu(MenuBarManager* pSubMenuManager,const ::rtl::OUString& _sItemCommand,sal_uInt16 _nItemId);
- sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,sal_uInt16 _nIndex) const;
+ sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand, AbstractMenu* _pMenu,sal_uInt16 _nIndex) const;
void Init(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,AddonMenu* pAddonMenu,sal_Bool bDelete,sal_Bool bDeleteChildren,bool _bHandlePopUp = false);
void SetHdl();
@@ -250,7 +250,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
sal_Bool m_bModuleIdentified;
::rtl::OUString m_aMenuItemCommand;
::rtl::OUString m_aModuleIdentifier;
- Menu* m_pVCLMenu;
+ AbstractMenu* m_pVCLMenu;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xPopupMenuControllerRegistration;
diff --git a/framework/inc/uielement/menubarmerger.hxx b/framework/inc/uielement/menubarmerger.hxx
index 869e031..17a2b3f 100644
--- a/framework/inc/uielement/menubarmerger.hxx
+++ b/framework/inc/uielement/menubarmerger.hxx
@@ -60,7 +60,7 @@ enum RPResultInfo
struct ReferencePathInfo
{
- Menu* pPopupMenu;
+ AbstractMenu* pPopupMenu;
sal_uInt16 nPos;
sal_Int32 nLevel;
RPResultInfo eResult;
@@ -73,14 +73,14 @@ class MenuBarMerger
static void RetrieveReferencePath( const ::rtl::OUString&,
std::vector< ::rtl::OUString >& aReferencePath );
- static ReferencePathInfo FindReferencePath( const std::vector< ::rtl::OUString >& aReferencePath, Menu* pMenu );
+ static ReferencePathInfo FindReferencePath( const std::vector< ::rtl::OUString >& aReferencePath, AbstractMenu* pMenu );
static sal_uInt16 FindMenuItem( const ::rtl::OUString& rCmd,
- Menu* pMenu );
+ AbstractMenu* pMenu );
static void GetMenuEntry( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rAddonMenuEntry,
AddonMenuItem& aAddonMenu );
static void GetSubMenu( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& rSubMenuEntries,
AddonMenuContainer& rSubMenu );
- static bool ProcessMergeOperation( Menu* pMenu,
+ static bool ProcessMergeOperation( AbstractMenu* pMenu,
sal_uInt16 nPos,
sal_uInt16& rItemId,
const ::rtl::OUString& rMergeCommand,
@@ -95,21 +95,21 @@ class MenuBarMerger
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonMenuItems );
static bool ProcessFallbackOperation();
- static bool MergeMenuItems( Menu* pMenu,
+ static bool MergeMenuItems( AbstractMenu* pMenu,
sal_uInt16 nPos,
sal_uInt16 nModIndex,
sal_uInt16& rItemId,
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonMenuItems );
- static bool ReplaceMenuItem( Menu* pMenu,
+ static bool ReplaceMenuItem( AbstractMenu* pMenu,
sal_uInt16 nPos,
sal_uInt16& rItemId,
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonMenuItems );
- static bool RemoveMenuItems( Menu* pMenu,
+ static bool RemoveMenuItems( AbstractMenu* pMenu,
sal_uInt16 nPos,
const ::rtl::OUString& rMergeCommandParameter );
- static bool CreateSubMenu( Menu* pSubMenu,
+ static bool CreateSubMenu( AbstractMenu* pSubMenu,
sal_uInt16& nItemId,
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonSubMenu );
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index 8319bec..bf9a1e4 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -134,7 +134,7 @@ const char UNO_COMMAND[] = ".uno:";
MenuManager::MenuManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
+ REFERENCE< XFRAME >& rFrame, AbstractMenu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
:
ThreadHelpBase( &Application::GetSolarMutex() ),
mxServiceFactory(xServiceFactory)
@@ -479,7 +479,7 @@ void SAL_CALL MenuManager::disposing( const EVENTOBJECT& Source ) throw ( RUNTIM
}
-void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
+void MenuManager::UpdateSpecialFileMenu( AbstractMenu* pMenu )
{
// update picklist
Sequence< Sequence< PropertyValue > > aHistoryList = SvtHistoryOptions().GetList( ePICKLIST );
@@ -645,7 +645,7 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
}
}
-void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XMultiServiceFactory >& xServiceFactory,framework::IMutex& _rMutex )
+void MenuManager::UpdateSpecialWindowMenu( AbstractMenu* pMenu,const Reference< XMultiServiceFactory >& xServiceFactory,framework::IMutex& _rMutex )
{
// update window list
::std::vector< ::rtl::OUString > aNewWindowListVector;
@@ -759,7 +759,7 @@ void MenuManager::CreatePicklistArguments( Sequence< PropertyValue >& aArgsList,
// vcl handler
//_________________________________________________________________________________________________________________
-IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
+IMPL_LINK( MenuManager, Activate, AbstractMenu *, pMenu )
{
if ( pMenu == m_pVCLMenu )
{
@@ -862,7 +862,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
}
-IMPL_LINK( MenuManager, Deactivate, Menu *, pMenu )
+IMPL_LINK( MenuManager, Deactivate, AbstractMenu *, pMenu )
{
if ( pMenu == m_pVCLMenu )
m_bActive = sal_False;
@@ -871,7 +871,7 @@ IMPL_LINK( MenuManager, Deactivate, Menu *, pMenu )
}
-IMPL_LINK( MenuManager, Select, Menu *, pMenu )
+IMPL_LINK( MenuManager, Select, AbstractMenu *, pMenu )
{
URL aTargetURL;
Sequence<PropertyValue> aArgs;
@@ -973,7 +973,7 @@ void MenuManager::AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCo
m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
}
-sal_uInt16 MenuManager::FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,sal_uInt16 _nIndex) const
+sal_uInt16 MenuManager::FillItemCommand(::rtl::OUString& _rItemCommand, AbstractMenu* _pMenu,sal_uInt16 _nIndex) const
{
sal_uInt16 nItemId = _pMenu->GetItemId( _nIndex );
@@ -987,7 +987,7 @@ sal_uInt16 MenuManager::FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pM
}
return nItemId;
}
-void MenuManager::FillMenuImages(Reference< XFrame >& _xFrame,Menu* _pMenu,sal_Bool bShowMenuImages)
+void MenuManager::FillMenuImages(Reference< XFrame >& _xFrame, AbstractMenu* _pMenu,sal_Bool bShowMenuImages)
{
AddonsOptions aAddonOptions;
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 4c64446..5e85620 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -196,7 +196,7 @@ MenuBarManager::MenuBarManager(
const Reference< XURLTransformer >& _xURLTransformer,
const Reference< XDispatchProvider >& rDispatchProvider,
const rtl::OUString& rModuleIdentifier,
- Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
+ AbstractMenu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
: ThreadHelpBase( &Application::GetSolarMutex() ), OWeakObject()
, m_bDisposed( sal_False )
, m_bRetrieveImages( sal_False )
@@ -771,7 +771,7 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& Source ) throw ( Run
}
-void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu )
+void MenuBarManager::CheckAndAddMenuExtension( AbstractMenu* pMenu )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::CheckAndAddMenuExtension" );
static const char REFERENCECOMMAND_BEFORE[] = ".uno:About";
@@ -803,7 +803,7 @@ void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu )
}
}
-static void lcl_CheckForChildren(Menu* pMenu, sal_uInt16 nItemId)
+static void lcl_CheckForChildren(AbstractMenu* pMenu, sal_uInt16 nItemId)
{
if (PopupMenu* pThisPopup = pMenu->GetPopupMenu( nItemId ))
pMenu->EnableItem( nItemId, pThisPopup->GetItemCount() ? true : false );
@@ -813,7 +813,7 @@ static void lcl_CheckForChildren(Menu* pMenu, sal_uInt16 nItemId)
// vcl handler
//_________________________________________________________________________________________________________________
-IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
+IMPL_LINK( MenuBarManager, Activate, AbstractMenu *, pMenu )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::Activate" );
if ( pMenu == m_pVCLMenu )
@@ -1008,7 +1008,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
}
-IMPL_LINK( MenuBarManager, Deactivate, Menu *, pMenu )
+IMPL_LINK( MenuBarManager, Deactivate, AbstractMenu *, pMenu )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::Deactivate" );
if ( pMenu == m_pVCLMenu )
@@ -1044,7 +1044,7 @@ IMPL_LINK( MenuBarManager, AsyncSettingsHdl, Timer*,)
return 0;
}
-IMPL_LINK( MenuBarManager, Select, Menu *, pMenu )
+IMPL_LINK( MenuBarManager, Select, AbstractMenu *, pMenu )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::Select" );
URL aTargetURL;
@@ -1219,7 +1219,7 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa
return sal_False;
}
-void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rFrame, const Reference< XDispatchProvider >& rDispatchProvider, const rtl::OUString& rModuleIdentifier, sal_Bool bDelete, sal_Bool bDeleteChildren )
+void MenuBarManager::FillMenuManager( AbstractMenu* pMenu, const Reference< XFrame >& rFrame, const Reference< XDispatchProvider >& rDispatchProvider, const rtl::OUString& rModuleIdentifier, sal_Bool bDelete, sal_Bool bDeleteChildren )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::FillMenuManager" );
m_xFrame = rFrame;
@@ -1664,8 +1664,8 @@ void MenuBarManager::RetrieveImageManagers()
}
void MenuBarManager::FillMenuWithConfiguration(
- sal_uInt16& nId,
- Menu* pMenu,
+ sal_uInt16& nId,
+ AbstractMenu* pMenu,
const ::rtl::OUString& rModuleIdentifier,
const Reference< XIndexAccess >& rItemContainer,
const Reference< XURLTransformer >& rTransformer )
@@ -1675,7 +1675,7 @@ void MenuBarManager::FillMenuWithConfiguration(
MenuBarManager::FillMenu( nId, pMenu, rModuleIdentifier, rItemContainer, xEmptyDispatchProvider );
// Merge add-on menu entries into the menu bar
- MenuBarManager::MergeAddonMenus( static_cast< Menu* >( pMenu ),
+ MenuBarManager::MergeAddonMenus( static_cast< AbstractMenu* >( pMenu ),
AddonsOptions().GetMergeMenuInstructions(),
rModuleIdentifier );
@@ -1700,8 +1700,8 @@ void MenuBarManager::FillMenuWithConfiguration(
}
void MenuBarManager::FillMenu(
- sal_uInt16& nId,
- Menu* pMenu,
+ sal_uInt16& nId,
+ AbstractMenu* pMenu,
const rtl::OUString& rModuleIdentifier,
const Reference< XIndexAccess >& rItemContainer,
const Reference< XDispatchProvider >& rDispatchProvider )
@@ -1811,7 +1811,7 @@ void MenuBarManager::FillMenu(
}
void MenuBarManager::MergeAddonMenus(
- Menu* pMenuBar,
+ AbstractMenu* pMenuBar,
const MergeMenuInstructionContainer& aMergeInstructionContainer,
const ::rtl::OUString& rModuleIdentifier )
{
@@ -1836,7 +1836,7 @@ void MenuBarManager::MergeAddonMenus(
MenuBarMerger::GetSubMenu( rMergeInstruction.aMergeMenu, aMergeMenuItems );
// try to find the reference point for our merge operation
- Menu* pMenu = pMenuBar;
+ AbstractMenu* pMenu = pMenuBar;
ReferencePathInfo aResult = MenuBarMerger::FindReferencePath( aMergePath, pMenu );
if ( aResult.eResult == RP_OK )
@@ -1916,7 +1916,7 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon
sal_uInt16 nId = 1;
// Fill menu bar with container contents
- FillMenuWithConfiguration( nId, (Menu *)m_pVCLMenu, m_aModuleIdentifier, rItemContainer, m_xURLTransformer );
+ FillMenuWithConfiguration( nId, (AbstractMenu *)m_pVCLMenu, m_aModuleIdentifier, rItemContainer, m_xURLTransformer );
// Refill menu manager again
Reference< XDispatchProvider > xDispatchProvider;
@@ -1996,7 +1996,7 @@ void MenuBarManager::AddMenu(MenuBarManager* pSubMenuManager,const ::rtl::OUStri
m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
}
-sal_uInt16 MenuBarManager::FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,sal_uInt16 _nIndex) const
+sal_uInt16 MenuBarManager::FillItemCommand(::rtl::OUString& _rItemCommand, AbstractMenu* _pMenu,sal_uInt16 _nIndex) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::FillItemCommand" );
sal_uInt16 nItemId = _pMenu->GetItemId( _nIndex );
diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx
index 544c52a..213ad89 100644
--- a/framework/source/uielement/menubarmerger.cxx
+++ b/framework/source/uielement/menubarmerger.cxx
@@ -96,7 +96,7 @@ void MenuBarMerger::RetrieveReferencePath(
ReferencePathInfo MenuBarMerger::FindReferencePath(
const ::std::vector< ::rtl::OUString >& rReferencePath,
- Menu* pMenu )
+ AbstractMenu* pMenu )
{
sal_uInt32 i( 0 );
const sal_uInt32 nCount( rReferencePath.size() );
@@ -108,7 +108,7 @@ ReferencePathInfo MenuBarMerger::FindReferencePath(
return aResult;
}
- Menu* pCurrMenu( pMenu );
+ AbstractMenu* pCurrMenu( pMenu );
RPResultInfo eResult( RP_OK );
sal_Int32 nLevel( - 1 );
@@ -157,7 +157,7 @@ ReferencePathInfo MenuBarMerger::FindReferencePath(
return aResult;
}
-sal_uInt16 MenuBarMerger::FindMenuItem( const ::rtl::OUString& rCmd, Menu* pCurrMenu )
+sal_uInt16 MenuBarMerger::FindMenuItem( const ::rtl::OUString& rCmd, AbstractMenu* pCurrMenu )
{
for ( sal_uInt16 i = 0; i < pCurrMenu->GetItemCount(); i++ )
{
@@ -173,7 +173,7 @@ sal_uInt16 MenuBarMerger::FindMenuItem( const ::rtl::OUString& rCmd, Menu* pCurr
}
bool MenuBarMerger::CreateSubMenu(
- Menu* pSubMenu,
+ AbstractMenu* pSubMenu,
sal_uInt16& nItemId,
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonSubMenu )
@@ -211,7 +211,7 @@ bool MenuBarMerger::CreateSubMenu(
}
bool MenuBarMerger::MergeMenuItems(
- Menu* pMenu,
+ AbstractMenu* pMenu,
sal_uInt16 nPos,
sal_uInt16 nModIndex,
sal_uInt16& nItemId,
@@ -253,7 +253,7 @@ bool MenuBarMerger::MergeMenuItems(
}
bool MenuBarMerger::ReplaceMenuItem(
- Menu* pMenu,
+ AbstractMenu* pMenu,
sal_uInt16 nPos,
sal_uInt16& rItemId,
const ::rtl::OUString& rModuleIdentifier,
@@ -267,7 +267,7 @@ bool MenuBarMerger::ReplaceMenuItem(
}
bool MenuBarMerger::RemoveMenuItems(
- Menu* pMenu,
+ AbstractMenu* pMenu,
sal_uInt16 nPos,
const ::rtl::OUString& rMergeCommandParameter )
{
@@ -287,7 +287,7 @@ bool MenuBarMerger::RemoveMenuItems(
}
bool MenuBarMerger::ProcessMergeOperation(
- Menu* pMenu,
+ AbstractMenu* pMenu,
sal_uInt16 nPos,
sal_uInt16& nItemId,
const ::rtl::OUString& rMergeCommand,
@@ -336,7 +336,7 @@ bool MenuBarMerger::ProcessFallbackOperation(
}
else if ( rMergeFallback.equalsAsciiL( MERGEFALLBACK_ADDPATH, MERGEFALLBACK_ADDPATH_LEN ))
{
- Menu* pCurrMenu( aRefPathInfo.pPopupMenu );
+ AbstractMenu* pCurrMenu( aRefPathInfo.pPopupMenu );
sal_Int32 nLevel( aRefPathInfo.nLevel );
const sal_Int32 nSize( rReferencePath.size() );
bool bFirstLevel( true );
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx
index c9388ee..3c4c753 100644
--- a/vcl/inc/vcl/menu.hxx
+++ b/vcl/inc/vcl/menu.hxx
@@ -112,6 +112,94 @@ struct ImplMenuDelData
bool isDeleted() const { return mpMenu == 0; }
};
+// ----------------
+// - AbstractMenu -
+// ----------------
+
+class VCL_DLLPUBLIC AbstractMenu : public Resource
+{
+public:
+ virtual ~AbstractMenu() {}
+
+ virtual SAL_DLLPRIVATE Window* ImplGetWindow() const = 0;
+
+ virtual void InsertItem( sal_uInt16 nItemId, const XubString& rStr,
+ MenuItemBits nItemBits = 0,
+ sal_uInt16 nPos = MENU_APPEND ) = 0;
+ virtual void InsertItem( sal_uInt16 nItemId,
+ const XubString& rString, const Image& rImage,
+ MenuItemBits nItemBits = 0,
+ sal_uInt16 nPos = MENU_APPEND ) = 0;
+ virtual void InsertSeparator( sal_uInt16 nPos = MENU_APPEND ) = 0;
+ virtual void RemoveItem( sal_uInt16 nPos ) = 0;
+ virtual void CopyItem( const Menu& rMenu, sal_uInt16 nPos,
+ sal_uInt16 nNewPos = MENU_APPEND ) = 0;
+ virtual void Clear() = 0;
+
+ virtual void SetMenuFlags( sal_uInt16 nFlags ) = 0;
+ virtual sal_uInt16 GetMenuFlags() const = 0;
+
+ virtual sal_uInt16 GetItemCount() const = 0;
+ virtual sal_uInt16 GetItemId( sal_uInt16 nPos ) const = 0;
+ virtual sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const = 0;
+ virtual MenuItemType GetItemType( sal_uInt16 nPos ) const = 0;
+ virtual sal_uInt16 GetCurItemId() const = 0;
+
+ virtual void SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits ) = 0;
+ virtual MenuItemBits GetItemBits( sal_uInt16 nItemId ) const = 0;
+
+ virtual void SetUserValue( sal_uInt16 nItemId, sal_uLong nValue ) = 0;
+ virtual sal_uLong GetUserValue( sal_uInt16 nItemId ) const = 0;
+
+ virtual void SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu ) = 0;
+ virtual PopupMenu* GetPopupMenu( sal_uInt16 nItemId ) const = 0;
+
+ virtual void SetAccelKey( sal_uInt16 nItemId, const KeyCode& rKeyCode ) = 0;
+
+ virtual void CheckItem( sal_uInt16 nItemId, sal_Bool bCheck = sal_True ) = 0;
+ virtual sal_Bool IsItemChecked( sal_uInt16 nItemId ) const = 0;
+
+ virtual void EnableItem( sal_uInt16 nItemId, sal_Bool bEnable = sal_True ) = 0;
+ virtual sal_Bool IsItemEnabled( sal_uInt16 nItemId ) const = 0;
+
+ virtual void ShowItem( sal_uInt16 nItemId, sal_Bool bVisible = sal_True ) = 0;
+ virtual void HideItem( sal_uInt16 nItemId ) = 0;
+
+ virtual sal_Bool IsMenuBar() const = 0;
+
+ virtual void RemoveDisabledEntries( sal_Bool bCheckPopups = sal_True,
+ sal_Bool bRemoveEmptyPopups = sal_False ) = 0;
+
+ virtual void SetItemText( sal_uInt16 nItemId, const XubString& rStr ) = 0;
+ virtual XubString GetItemText( sal_uInt16 nItemId ) const = 0;
+
+ virtual void SetItemImage( sal_uInt16 nItemId, const Image& rImage ) = 0;
+ virtual Image GetItemImage( sal_uInt16 nItemId ) const = 0;
+
+ virtual void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand ) = 0;
+ virtual const XubString& GetItemCommand( sal_uInt16 nItemId ) const = 0;
+
+ virtual void SetTipHelpText( sal_uInt16 nItemId, const XubString& rString ) = 0;
+
+ virtual void SetHelpCommand( sal_uInt16 nItemId, const XubString& rString ) = 0;
+ virtual const XubString& GetHelpCommand( sal_uInt16 nItemId ) const = 0;
+
+ virtual void SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId ) = 0;
+ virtual rtl::OString GetHelpId( sal_uInt16 nItemId ) const = 0;
+
+ virtual void SetActivateHdl( const Link& rLink ) = 0;
+
+ virtual void SetDeactivateHdl( const Link& rLink ) = 0;
+
+ virtual void SetHighlightHdl( const Link& rLink ) = 0;
+
+ virtual void SetSelectHdl( const Link& rLink ) = 0;
+
+ // Returns the system's menu handle if native menus are supported
+ // pData must point to a SystemMenuData structure
+ virtual sal_Bool GetSystemMenuData( SystemMenuData* pData ) const = 0;
+};
+
// --------
// - Menu -
// --------
@@ -123,7 +211,7 @@ struct MenuLogo
Color aEndColor;
};
-class VCL_DLLPUBLIC Menu : public Resource
+class VCL_DLLPUBLIC Menu : public AbstractMenu
{
friend class MenuBar;
friend class MenuBarWindow;
@@ -158,7 +246,7 @@ private:
sal_uInt16 nImgOrChkPos;
sal_uInt16 nTextPos;
- sal_Bool bIsMenuBar : 1, // Handelt es sich um den MenuBar
+ sal_Bool bIsMenuBar : 1, // Handelt es sich um den MenuBar
bCanceled : 1, // Waehrend eines Callbacks abgebrochen
bInCallback : 1, // In Activate/Deactivate
bKilled : 1; // Gekillt...
@@ -276,12 +364,12 @@ public:
void ShowItem( sal_uInt16 nItemId, sal_Bool bVisible = sal_True );
void HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId, sal_False ); }
- sal_Bool IsItemPosVisible( sal_uInt16 nItemPos ) const;
- sal_Bool IsMenuVisible() const;
- sal_Bool IsMenuBar() const { return bIsMenuBar; }
+ sal_Bool IsItemPosVisible( sal_uInt16 nItemPos ) const;
+ sal_Bool IsMenuVisible() const;
+ sal_Bool IsMenuBar() const { return bIsMenuBar; }
void RemoveDisabledEntries( sal_Bool bCheckPopups = sal_True, sal_Bool bRemoveEmptyPopups = sal_False );
- sal_Bool HasValidEntries( sal_Bool bCheckPopups = sal_True );
+ sal_Bool HasValidEntries( sal_Bool bCheckPopups = sal_True );
void SetItemText( sal_uInt16 nItemId, const XubString& rStr );
XubString GetItemText( sal_uInt16 nItemId ) const;
@@ -291,7 +379,7 @@ public:
void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
long GetItemImageAngle( sal_uInt16 nItemId ) const;
void SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror );
- sal_Bool GetItemImageMirrorMode( sal_uInt16 ) const;
+ sal_Bool GetItemImageMirrorMode( sal_uInt16 ) const;
void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand );
const XubString& GetItemCommand( sal_uInt16 nItemId ) const;
@@ -327,8 +415,8 @@ public:
void AddEventListener( const Link& rEventListener );
void RemoveEventListener( const Link& rEventListener );
- //void AddChildEventListener( const Link& rEventListener );
- //void RemoveChildEventListener( const Link& rEventListener );
+ void AddChildEventListener( const Link& rEventListener );
+ void RemoveChildEventListener( const Link& rEventListener );
Menu& operator =( const Menu& rMenu );
@@ -378,10 +466,10 @@ class VCL_DLLPUBLIC MenuBar : public Menu
Link maCloserHdl;
Link maFloatHdl;
Link maHideHdl;
- sal_Bool mbCloserVisible;
- sal_Bool mbFloatBtnVisible;
- sal_Bool mbHideBtnVisible;
- sal_Bool mbDisplayable;
+ sal_Bool mbCloserVisible;
+ sal_Bool mbFloatBtnVisible;
+ sal_Bool mbHideBtnVisible;
+ sal_Bool mbDisplayable;
friend class Application;
friend class Menu;
@@ -391,7 +479,7 @@ class VCL_DLLPUBLIC MenuBar : public Menu
SAL_DLLPRIVATE static Window* ImplCreate( Window* pParent, Window* pWindow, MenuBar* pMenu );
SAL_DLLPRIVATE static void ImplDestroy( MenuBar* pMenu, sal_Bool bDelete );
- SAL_DLLPRIVATE sal_Bool ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bFromMenu = sal_True );
+ SAL_DLLPRIVATE sal_Bool ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bFromMenu = sal_True );
public:
MenuBar();
@@ -401,17 +489,17 @@ public:
MenuBar& operator =( const MenuBar& rMenu );
void ShowCloser( sal_Bool bShow = sal_True );
- sal_Bool HasCloser() const { return mbCloserVisible; }
- sal_Bool HasFloatButton() const { return mbFloatBtnVisible; }
- sal_Bool HasHideButton() const { return mbHideBtnVisible; }
+ sal_Bool HasCloser() const { return mbCloserVisible; }
+ sal_Bool HasFloatButton() const { return mbFloatBtnVisible; }
+ sal_Bool HasHideButton() const { return mbHideBtnVisible; }
void ShowButtons( sal_Bool bClose, sal_Bool bFloat, sal_Bool bHide );
void SelectEntry( sal_uInt16 nId );
- sal_Bool HandleMenuActivateEvent( Menu *pMenu ) const;
- sal_Bool HandleMenuDeActivateEvent( Menu *pMenu ) const;
- sal_Bool HandleMenuHighlightEvent( Menu *pMenu, sal_uInt16 nEventId ) const;
- sal_Bool HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nEventId ) const;
- sal_Bool HandleMenuButtonEvent( Menu *pMenu, sal_uInt16 nEventId ) const;
+ sal_Bool HandleMenuActivateEvent( Menu *pMenu ) const;
+ sal_Bool HandleMenuDeActivateEvent( Menu *pMenu ) const;
+ sal_Bool HandleMenuHighlightEvent( Menu *pMenu, sal_uInt16 nEventId ) const;
+ sal_Bool HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nEventId ) const;
+ sal_Bool HandleMenuButtonEvent( Menu *pMenu, sal_uInt16 nEventId ) const;
void SetCloserHdl( const Link& rLink ) { maCloserHdl = rLink; }
const Link& GetCloserHdl() const { return maCloserHdl; }
@@ -425,18 +513,18 @@ public:
// and it will be hidden if it was visible before
// - note: if a menubar is diplayable, this does not necessarily mean that it is currently visible
void SetDisplayable( sal_Bool bDisplayable );
- sal_Bool IsDisplayable() const { return mbDisplayable; }
+ sal_Bool IsDisplayable() const { return mbDisplayable; }
struct MenuBarButtonCallbackArg
{
sal_uInt16 nId; // Id of the button
- bool bHighlight; // highlight on/off
- MenuBar* pMenuBar; // menubar the button belongs to
+ bool bHighlight; // highlight on/off
+ MenuBar* pMenuBar; // menubar the button belongs to
};
// add an arbitrary button to the menubar (will appear next to closer)
// passed link will be call with a MenuBarButtonCallbackArg on press
// passed string will be set as tooltip
- sal_uInt16 AddMenuBarButton( const Image&, const Link&, const String&, sal_uInt16 nPos = 0 );
+ sal_uInt16 AddMenuBarButton( const Image&, const Link&, const String&, sal_uInt16 nPos = 0 );
// set the highlight link for additional button with ID nId
// highlight link will be called with a MenuBarButtonHighlightArg
// the bHighlight member of that struct shall contain the new state
More information about the Libreoffice-commits
mailing list