Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
2aac0070
Kaydet (Commit)
2aac0070
authored
May 16, 2014
tarafından
Tsutomu Uchino
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#i86528# use the module manager to identify the context for addons menu merging
üst
213aafbf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
62 deletions
+58
-62
addonmenu.hxx
framework/inc/framework/addonmenu.hxx
+9
-6
menumanager.cxx
framework/source/classes/menumanager.cxx
+1
-1
menudispatcher.cxx
framework/source/dispatch/menudispatcher.cxx
+2
-2
addonmenu.cxx
framework/source/fwe/classes/addonmenu.cxx
+39
-39
menubarmanager.cxx
framework/source/uielement/menubarmanager.cxx
+3
-7
virtmenu.cxx
sfx2/source/menu/virtmenu.cxx
+4
-7
No files found.
framework/inc/framework/addonmenu.hxx
Dosyayı görüntüle @
2aac0070
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// includes of other projects
// includes of other projects
...
@@ -92,23 +93,25 @@ class FWE_DLLPUBLIC AddonMenuManager
...
@@ -92,23 +93,25 @@ class FWE_DLLPUBLIC AddonMenuManager
static
sal_Bool
IsAddonMenuId
(
sal_uInt16
nId
)
{
return
((
nId
>=
ADDONMENU_ITEMID_START
)
&&
(
nId
<
ADDONMENU_ITEMID_END
));
}
static
sal_Bool
IsAddonMenuId
(
sal_uInt16
nId
)
{
return
((
nId
>=
ADDONMENU_ITEMID_START
)
&&
(
nId
<
ADDONMENU_ITEMID_END
));
}
// Check if the context string matches the provided xModel context
// Check if the context string matches the provided xModel context
static
sal_Bool
IsCorrectContext
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XModel
>&
rModel
,
const
rtl
::
OUString
&
aContext
);
static
sal_Bool
IsCorrectContext
(
const
::
rtl
::
OUString
&
rModuleIdentifier
,
const
rtl
::
OUString
&
aContext
);
// Factory method to create different Add-On menu types
// Factory method to create different Add-On menu types
static
PopupMenu
*
CreatePopupMenuType
(
MenuType
eMenuType
,
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
);
static
PopupMenu
*
CreatePopupMenuType
(
MenuType
eMenuType
,
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
);
// Create the Add-Ons menu
// Create the Add-Ons menu
static
AddonMenu
*
CreateAddonMenu
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
);
static
AddonMenu
*
CreateAddonMenu
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
rServiceManager
);
// Merge the Add-Ons help menu items into the given menu bar at a defined pos
// Merge the Add-Ons help menu items into the given menu bar at a defined pos
static
void
MergeAddonHelpMenu
(
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
,
static
void
MergeAddonHelpMenu
(
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
,
MenuBar
*
pMergeMenuBar
);
MenuBar
*
pMergeMenuBar
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
rServiceManager
);
// Merge the addon popup menus into the given menu bar at the provided pos.
// Merge the addon popup menus into the given menu bar at the provided pos.
static
void
MergeAddonPopupMenus
(
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
,
static
void
MergeAddonPopupMenus
(
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
,
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XModel
>&
rModel
,
sal_uInt16
nMergeAtPos
,
sal_uInt16
nMergeAtPos
,
MenuBar
*
pMergeMenuBar
);
MenuBar
*
pMergeMenuBar
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
rServiceManager
);
// Returns the next position to insert a menu item/sub menu
// Returns the next position to insert a menu item/sub menu
static
sal_uInt16
GetNextPos
(
sal_uInt16
nPos
);
static
sal_uInt16
GetNextPos
(
sal_uInt16
nPos
);
...
@@ -120,7 +123,7 @@ class FWE_DLLPUBLIC AddonMenuManager
...
@@ -120,7 +123,7 @@ class FWE_DLLPUBLIC AddonMenuManager
sal_uInt16
&
nUniqueMenuId
,
sal_uInt16
&
nUniqueMenuId
,
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
beans
::
PropertyValue
>
>
aAddonMenuDefinition
,
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
beans
::
PropertyValue
>
>
aAddonMenuDefinition
,
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
,
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XFrame
>&
rFrame
,
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
frame
::
XModel
>&
rModel
);
const
::
rtl
::
OUString
&
rModuleIdentifier
);
// Retrieve the menu entry property values from a sequence
// Retrieve the menu entry property values from a sequence
static
void
GetMenuEntry
(
const
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
beans
::
PropertyValue
>&
rAddonMenuEntry
,
static
void
GetMenuEntry
(
const
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
beans
::
PropertyValue
>&
rAddonMenuEntry
,
...
...
framework/source/classes/menumanager.cxx
Dosyayı görüntüle @
2aac0070
...
@@ -192,7 +192,7 @@ MenuManager::MenuManager(
...
@@ -192,7 +192,7 @@ MenuManager::MenuManager(
AddonMenuManager
::
HasAddonMenuElements
()
)
AddonMenuManager
::
HasAddonMenuElements
()
)
{
{
sal_uInt16
nCount
=
0
;
sal_uInt16
nCount
=
0
;
AddonMenu
*
pSubMenu
=
AddonMenuManager
::
CreateAddonMenu
(
rFrame
);
AddonMenu
*
pSubMenu
=
AddonMenuManager
::
CreateAddonMenu
(
rFrame
,
xServiceFactory
);
if
(
pSubMenu
&&
(
pSubMenu
->
GetItemCount
()
>
0
))
if
(
pSubMenu
&&
(
pSubMenu
->
GetItemCount
()
>
0
))
{
{
if
(
pPopupMenu
->
GetItemType
(
nCount
-
1
)
!=
MENUITEM_SEPARATOR
)
if
(
pPopupMenu
->
GetItemType
(
nCount
-
1
)
!=
MENUITEM_SEPARATOR
)
...
...
framework/source/dispatch/menudispatcher.cxx
Dosyayı görüntüle @
2aac0070
...
@@ -344,10 +344,10 @@ sal_Bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromR
...
@@ -344,10 +344,10 @@ sal_Bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromR
xModel
=
uno
::
Reference
<
XModel
>
(
xController
->
getModel
(),
UNO_QUERY
);
xModel
=
uno
::
Reference
<
XModel
>
(
xController
->
getModel
(),
UNO_QUERY
);
// retrieve addon popup menus and add them to our menu bar
// retrieve addon popup menus and add them to our menu bar
AddonMenuManager
::
MergeAddonPopupMenus
(
xFrame
,
xModel
,
nPos
,
pMenuBar
);
AddonMenuManager
::
MergeAddonPopupMenus
(
xFrame
,
nPos
,
pMenuBar
,
m_xFactory
);
// retrieve addon help menu items and add them to our help menu
// retrieve addon help menu items and add them to our help menu
AddonMenuManager
::
MergeAddonHelpMenu
(
xFrame
,
pMenuBar
);
AddonMenuManager
::
MergeAddonHelpMenu
(
xFrame
,
pMenuBar
,
m_xFactory
);
}
}
// set new menu on our system window and create new menu manager
// set new menu on our system window and create new menu manager
...
...
framework/source/fwe/classes/addonmenu.cxx
Dosyayı görüntüle @
2aac0070
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <macros/debug/assertion.hxx>
#include <macros/debug/assertion.hxx>
#include <framework/imageproducer.hxx>
#include <framework/imageproducer.hxx>
#include <framework/menuconfiguration.hxx>
#include <framework/menuconfiguration.hxx>
#include <services.h>
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// interface includes
// interface includes
...
@@ -40,7 +41,7 @@
...
@@ -40,7 +41,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/
lang/XServiceInfo
.hpp>
#include <com/sun/star/
frame/XModuleManager
.hpp>
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// includes of other projects
// includes of other projects
...
@@ -108,18 +109,21 @@ AddonPopupMenu::~AddonPopupMenu()
...
@@ -108,18 +109,21 @@ AddonPopupMenu::~AddonPopupMenu()
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
static
Reference
<
XModel
>
GetModelFromFrame
(
const
Reference
<
XFrame
>&
rFrame
)
static
::
rtl
::
OUString
GetModuleIdentifier
(
const
Reference
<
XMultiServiceFactory
>&
rServiceManager
,
const
Reference
<
XFrame
>&
rFrame
)
{
{
// Query for the model to get check the context information
Reference
<
XModuleManager
>
xModuleManager
(
rServiceManager
->
createInstance
(
SERVICENAME_MODULEMANAGER
),
UNO_QUERY
);
Reference
<
XModel
>
xModel
;
if
(
xModuleManager
.
is
()
)
if
(
rFrame
.
is
()
)
{
{
Reference
<
XController
>
xController
(
rFrame
->
getController
(),
UNO_QUERY
);
try
if
(
xController
.
is
()
)
{
xModel
=
xController
->
getModel
();
return
xModuleManager
->
identify
(
rFrame
);
}
catch
(
Exception
&
)
{
}
}
}
return
::
rtl
::
OUString
();
return
xModel
;
}
}
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
...
@@ -146,7 +150,8 @@ PopupMenu* AddonMenuManager::CreatePopupMenuType( MenuType eMenuType, const Refe
...
@@ -146,7 +150,8 @@ PopupMenu* AddonMenuManager::CreatePopupMenuType( MenuType eMenuType, const Refe
}
}
// Create the Add-Ons menu
// Create the Add-Ons menu
AddonMenu
*
AddonMenuManager
::
CreateAddonMenu
(
const
Reference
<
XFrame
>&
rFrame
)
AddonMenu
*
AddonMenuManager
::
CreateAddonMenu
(
const
Reference
<
XFrame
>&
rFrame
,
const
Reference
<
XMultiServiceFactory
>&
rServiceManager
)
{
{
AddonsOptions
aOptions
;
AddonsOptions
aOptions
;
AddonMenu
*
pAddonMenu
=
NULL
;
AddonMenu
*
pAddonMenu
=
NULL
;
...
@@ -156,8 +161,8 @@ AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame
...
@@ -156,8 +161,8 @@ AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame
if
(
rAddonMenuEntries
.
getLength
()
>
0
)
if
(
rAddonMenuEntries
.
getLength
()
>
0
)
{
{
pAddonMenu
=
(
AddonMenu
*
)
AddonMenuManager
::
CreatePopupMenuType
(
ADDON_MENU
,
rFrame
);
pAddonMenu
=
(
AddonMenu
*
)
AddonMenuManager
::
CreatePopupMenuType
(
ADDON_MENU
,
rFrame
);
Reference
<
XModel
>
xModel
=
GetModelFromFrame
(
rFrame
);
::
rtl
::
OUString
aModuleIdentifier
=
GetModuleIdentifier
(
rServiceManager
,
rFrame
);
AddonMenuManager
::
BuildMenu
(
pAddonMenu
,
ADDON_MENU
,
MENU_APPEND
,
nUniqueMenuId
,
rAddonMenuEntries
,
rFrame
,
xModel
);
AddonMenuManager
::
BuildMenu
(
pAddonMenu
,
ADDON_MENU
,
MENU_APPEND
,
nUniqueMenuId
,
rAddonMenuEntries
,
rFrame
,
aModuleIdentifier
);
// Don't return an empty Add-On menu
// Don't return an empty Add-On menu
if
(
pAddonMenu
->
GetItemCount
()
==
0
)
if
(
pAddonMenu
->
GetItemCount
()
==
0
)
...
@@ -194,7 +199,9 @@ static sal_uInt16 FindMenuId( Menu* pMenu, const String aCommand )
...
@@ -194,7 +199,9 @@ static sal_uInt16 FindMenuId( Menu* pMenu, const String aCommand )
// Merge the Add-Ons help menu items into the given menu bar at a defined pos
// Merge the Add-Ons help menu items into the given menu bar at a defined pos
void
AddonMenuManager
::
MergeAddonHelpMenu
(
const
Reference
<
XFrame
>&
rFrame
,
MenuBar
*
pMergeMenuBar
)
void
AddonMenuManager
::
MergeAddonHelpMenu
(
const
Reference
<
XFrame
>&
rFrame
,
MenuBar
*
pMergeMenuBar
,
const
Reference
<
XMultiServiceFactory
>&
rServiceManager
)
{
{
if
(
pMergeMenuBar
)
if
(
pMergeMenuBar
)
{
{
...
@@ -245,8 +252,8 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me
...
@@ -245,8 +252,8 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me
if
(
nInsPos
<
nItemCount
&&
pHelpMenu
->
GetItemType
(
nInsPos
)
!=
MENUITEM_SEPARATOR
)
if
(
nInsPos
<
nItemCount
&&
pHelpMenu
->
GetItemType
(
nInsPos
)
!=
MENUITEM_SEPARATOR
)
nInsSepAfterPos
=
nInsPos
;
nInsSepAfterPos
=
nInsPos
;
Reference
<
XModel
>
xModel
=
GetModelFromFrame
(
rFrame
);
::
rtl
::
OUString
aModuleIdentifier
=
GetModuleIdentifier
(
rServiceManager
,
rFrame
);
AddonMenuManager
::
BuildMenu
(
pHelpMenu
,
ADDON_MENU
,
nInsPos
,
nUniqueMenuId
,
rAddonHelpMenuEntries
,
rFrame
,
xModel
);
AddonMenuManager
::
BuildMenu
(
pHelpMenu
,
ADDON_MENU
,
nInsPos
,
nUniqueMenuId
,
rAddonHelpMenuEntries
,
rFrame
,
aModuleIdentifier
);
if
(
pHelpMenu
->
GetItemCount
()
>
nItemCount
)
if
(
pHelpMenu
->
GetItemCount
()
>
nItemCount
)
{
{
...
@@ -267,9 +274,9 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me
...
@@ -267,9 +274,9 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me
// Merge the addon popup menus into the given menu bar at the provided pos.
// Merge the addon popup menus into the given menu bar at the provided pos.
void
AddonMenuManager
::
MergeAddonPopupMenus
(
const
Reference
<
XFrame
>&
rFrame
,
void
AddonMenuManager
::
MergeAddonPopupMenus
(
const
Reference
<
XFrame
>&
rFrame
,
const
Reference
<
XModel
>&
rModel
,
sal_uInt16
nMergeAtPos
,
sal_uInt16
nMergeAtPos
,
MenuBar
*
pMergeMenuBar
)
MenuBar
*
pMergeMenuBar
,
const
Reference
<
XMultiServiceFactory
>&
rServiceManager
)
{
{
if
(
pMergeMenuBar
)
if
(
pMergeMenuBar
)
{
{
...
@@ -283,6 +290,7 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
...
@@ -283,6 +290,7 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
::
rtl
::
OUString
aContext
;
::
rtl
::
OUString
aContext
;
Sequence
<
Sequence
<
PropertyValue
>
>
aAddonSubMenu
;
Sequence
<
Sequence
<
PropertyValue
>
>
aAddonSubMenu
;
sal_uInt16
nUniqueMenuId
=
ADDONMENU_ITEMID_START
;
sal_uInt16
nUniqueMenuId
=
ADDONMENU_ITEMID_START
;
::
rtl
::
OUString
aModuleIdentifier
=
GetModuleIdentifier
(
rServiceManager
,
rFrame
);
const
Sequence
<
Sequence
<
PropertyValue
>
>&
rAddonMenuEntries
=
aAddonsOptions
.
GetAddonsMenuBarPart
();
const
Sequence
<
Sequence
<
PropertyValue
>
>&
rAddonMenuEntries
=
aAddonsOptions
.
GetAddonsMenuBarPart
();
for
(
sal_Int32
i
=
0
;
i
<
rAddonMenuEntries
.
getLength
();
i
++
)
for
(
sal_Int32
i
=
0
;
i
<
rAddonMenuEntries
.
getLength
();
i
++
)
...
@@ -297,12 +305,12 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
...
@@ -297,12 +305,12 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
if
(
aTitle
.
getLength
()
>
0
&&
if
(
aTitle
.
getLength
()
>
0
&&
aURL
.
getLength
()
>
0
&&
aURL
.
getLength
()
>
0
&&
aAddonSubMenu
.
getLength
()
>
0
&&
aAddonSubMenu
.
getLength
()
>
0
&&
AddonMenuManager
::
IsCorrectContext
(
rModel
,
aContext
))
AddonMenuManager
::
IsCorrectContext
(
aModuleIdentifier
,
aContext
))
{
{
sal_uInt16
nId
=
nUniqueMenuId
++
;
sal_uInt16
nId
=
nUniqueMenuId
++
;
AddonPopupMenu
*
pAddonPopupMenu
=
(
AddonPopupMenu
*
)
AddonMenuManager
::
CreatePopupMenuType
(
ADDON_POPUPMENU
,
rFrame
);
AddonPopupMenu
*
pAddonPopupMenu
=
(
AddonPopupMenu
*
)
AddonMenuManager
::
CreatePopupMenuType
(
ADDON_POPUPMENU
,
rFrame
);
AddonMenuManager
::
BuildMenu
(
pAddonPopupMenu
,
ADDON_MENU
,
MENU_APPEND
,
nUniqueMenuId
,
aAddonSubMenu
,
rFrame
,
rModel
);
AddonMenuManager
::
BuildMenu
(
pAddonPopupMenu
,
ADDON_MENU
,
MENU_APPEND
,
nUniqueMenuId
,
aAddonSubMenu
,
rFrame
,
aModuleIdentifier
);
if
(
pAddonPopupMenu
->
GetItemCount
()
>
0
)
if
(
pAddonPopupMenu
->
GetItemCount
()
>
0
)
{
{
...
@@ -327,7 +335,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
...
@@ -327,7 +335,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
sal_uInt16
&
nUniqueMenuId
,
sal_uInt16
&
nUniqueMenuId
,
Sequence
<
Sequence
<
PropertyValue
>
>
aAddonMenuDefinition
,
Sequence
<
Sequence
<
PropertyValue
>
>
aAddonMenuDefinition
,
const
Reference
<
XFrame
>&
rFrame
,
const
Reference
<
XFrame
>&
rFrame
,
const
Reference
<
XModel
>&
rModel
)
const
::
rtl
::
OUString
&
rModuleIdentifier
)
{
{
Sequence
<
Sequence
<
PropertyValue
>
>
aAddonSubMenu
;
Sequence
<
Sequence
<
PropertyValue
>
>
aAddonSubMenu
;
sal_Bool
bInsertSeparator
=
sal_False
;
sal_Bool
bInsertSeparator
=
sal_False
;
...
@@ -346,7 +354,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
...
@@ -346,7 +354,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
{
{
GetMenuEntry
(
aAddonMenuDefinition
[
i
],
aTitle
,
aURL
,
aTarget
,
aImageId
,
aContext
,
aAddonSubMenu
);
GetMenuEntry
(
aAddonMenuDefinition
[
i
],
aTitle
,
aURL
,
aTarget
,
aImageId
,
aContext
,
aAddonSubMenu
);
if
(
!
IsCorrectContext
(
rMod
el
,
aContext
)
||
(
!
aTitle
.
getLength
()
&&
!
aURL
.
getLength
()
))
if
(
!
IsCorrectContext
(
rMod
uleIdentifier
,
aContext
)
||
(
!
aTitle
.
getLength
()
&&
!
aURL
.
getLength
()
))
continue
;
continue
;
if
(
aURL
==
::
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"private:separator"
)))
if
(
aURL
==
::
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"private:separator"
)))
...
@@ -357,7 +365,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
...
@@ -357,7 +365,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
if
(
aAddonSubMenu
.
getLength
()
>
0
)
if
(
aAddonSubMenu
.
getLength
()
>
0
)
{
{
pSubMenu
=
AddonMenuManager
::
CreatePopupMenuType
(
nSubMenuType
,
rFrame
);
pSubMenu
=
AddonMenuManager
::
CreatePopupMenuType
(
nSubMenuType
,
rFrame
);
AddonMenuManager
::
BuildMenu
(
pSubMenu
,
nSubMenuType
,
MENU_APPEND
,
nUniqueMenuId
,
aAddonSubMenu
,
rFrame
,
rMod
el
);
AddonMenuManager
::
BuildMenu
(
pSubMenu
,
nSubMenuType
,
MENU_APPEND
,
nUniqueMenuId
,
aAddonSubMenu
,
rFrame
,
rMod
uleIdentifier
);
// Don't create a menu item for an empty sub menu
// Don't create a menu item for an empty sub menu
if
(
pSubMenu
->
GetItemCount
()
==
0
)
if
(
pSubMenu
->
GetItemCount
()
==
0
)
...
@@ -426,26 +434,18 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu
...
@@ -426,26 +434,18 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu
}
}
// Check if the context string matches the provided xModel context
// Check if the context string matches the provided xModel context
sal_Bool
AddonMenuManager
::
IsCorrectContext
(
const
Reference
<
XModel
>&
rModel
,
const
::
rtl
::
OUString
&
aContext
)
sal_Bool
AddonMenuManager
::
IsCorrectContext
(
const
::
rtl
::
OUString
&
rModuleIdentifier
,
const
::
rtl
::
OUString
&
aContext
)
{
{
if
(
rModel
.
is
()
)
if
(
aContext
.
isEmpty
()
)
{
return
sal_True
;
Reference
<
com
::
sun
::
star
::
lang
::
XServiceInfo
>
xServiceInfo
(
rModel
,
UNO_QUERY
);
if
(
xServiceInfo
.
is
()
)
{
sal_Int32
nIndex
=
0
;
do
{
::
rtl
::
OUString
aToken
=
aContext
.
getToken
(
0
,
','
,
nIndex
);
if
(
xServiceInfo
->
supportsService
(
aToken
))
if
(
!
rModuleIdentifier
.
isEmpty
()
)
return
sal_True
;
{
}
sal_Int32
nIndex
=
aContext
.
indexOf
(
rModuleIdentifier
);
while
(
nIndex
>=
0
);
return
(
nIndex
>=
0
);
}
}
}
return
(
aContext
.
getLength
()
==
0
)
;
return
sal_False
;
}
}
}
}
...
...
framework/source/uielement/menubarmanager.cxx
Dosyayı görüntüle @
2aac0070
...
@@ -1292,17 +1292,13 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
...
@@ -1292,17 +1292,13 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
aCommand
==
aSpecialWindowCommand
)
aCommand
==
aSpecialWindowCommand
)
{
{
// Retrieve addon popup menus and add them to our menu bar
// Retrieve addon popup menus and add them to our menu bar
Reference
<
com
::
sun
::
star
::
frame
::
XModel
>
xModel
;
framework
::
AddonMenuManager
::
MergeAddonPopupMenus
(
rFrame
,
nPos
,
(
MenuBar
*
)
pMenu
,
mxServiceFactory
);
Reference
<
com
::
sun
::
star
::
frame
::
XController
>
xController
(
rFrame
->
getController
(),
UNO_QUERY
);
if
(
xController
.
is
()
)
xModel
=
Reference
<
com
::
sun
::
star
::
frame
::
XModel
>
(
xController
->
getModel
(),
UNO_QUERY
);
framework
::
AddonMenuManager
::
MergeAddonPopupMenus
(
rFrame
,
xModel
,
nPos
,
(
MenuBar
*
)
pMenu
);
break
;
break
;
}
}
}
}
// Merge the Add-Ons help menu items into the Office help menu
// Merge the Add-Ons help menu items into the Office help menu
framework
::
AddonMenuManager
::
MergeAddonHelpMenu
(
rFrame
,
(
MenuBar
*
)
pMenu
);
framework
::
AddonMenuManager
::
MergeAddonHelpMenu
(
rFrame
,
(
MenuBar
*
)
pMenu
,
mxServiceFactory
);
}
}
String
aEmpty
;
String
aEmpty
;
...
@@ -1398,7 +1394,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
...
@@ -1398,7 +1394,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
{
{
// Create addon popup menu if there exist elements and this is the tools popup menu
// Create addon popup menu if there exist elements and this is the tools popup menu
sal_uInt16
nCount
=
0
;
sal_uInt16
nCount
=
0
;
AddonMenu
*
pSubMenu
=
AddonMenuManager
::
CreateAddonMenu
(
rFrame
);
AddonMenu
*
pSubMenu
=
AddonMenuManager
::
CreateAddonMenu
(
rFrame
,
mxServiceFactory
);
if
(
pSubMenu
&&
(
pSubMenu
->
GetItemCount
()
>
0
))
if
(
pSubMenu
&&
(
pSubMenu
->
GetItemCount
()
>
0
))
{
{
if
(
pPopup
->
GetItemType
(
nCount
-
1
)
!=
MENUITEM_SEPARATOR
)
if
(
pPopup
->
GetItemType
(
nCount
-
1
)
!=
MENUITEM_SEPARATOR
)
...
...
sfx2/source/menu/virtmenu.cxx
Dosyayı görüntüle @
2aac0070
...
@@ -341,20 +341,17 @@ void SfxVirtualMenu::CreateFromSVMenu()
...
@@ -341,20 +341,17 @@ void SfxVirtualMenu::CreateFromSVMenu()
if
(
pSVMenu
->
IsMenuBar
()
)
if
(
pSVMenu
->
IsMenuBar
()
)
{
{
Reference
<
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>
aXMultiServiceFactory
(
::
comphelper
::
getProcessServiceFactory
());
sal_uInt16
nPos
=
pSVMenu
->
GetItemPos
(
SID_MDIWINDOWLIST
);
sal_uInt16
nPos
=
pSVMenu
->
GetItemPos
(
SID_MDIWINDOWLIST
);
if
(
nPos
!=
MENU_ITEM_NOTFOUND
&&
xFrame
.
is
()
)
if
(
nPos
!=
MENU_ITEM_NOTFOUND
&&
xFrame
.
is
()
)
{
{
// Retrieve addon popup menus and add them to our menu bar
// Retrieve addon popup menus and add them to our menu bar
Reference
<
com
::
sun
::
star
::
frame
::
XModel
>
xModel
;
framework
::
AddonMenuManager
::
MergeAddonPopupMenus
(
xFrame
,
nPos
,
(
MenuBar
*
)
pSVMenu
,
aXMultiServiceFactory
);
Reference
<
com
::
sun
::
star
::
frame
::
XController
>
xController
(
xFrame
->
getController
(),
UNO_QUERY
);
if
(
xController
.
is
()
)
xModel
=
Reference
<
com
::
sun
::
star
::
frame
::
XModel
>
(
xController
->
getModel
(),
UNO_QUERY
);
framework
::
AddonMenuManager
::
MergeAddonPopupMenus
(
xFrame
,
xModel
,
nPos
,
(
MenuBar
*
)
pSVMenu
);
}
}
// Merge the Add-Ons help menu items into the Office help menu
// Merge the Add-Ons help menu items into the Office help menu
if
(
xFrame
.
is
()
)
if
(
xFrame
.
is
()
)
framework
::
AddonMenuManager
::
MergeAddonHelpMenu
(
xFrame
,
(
MenuBar
*
)
pSVMenu
);
framework
::
AddonMenuManager
::
MergeAddonHelpMenu
(
xFrame
,
(
MenuBar
*
)
pSVMenu
,
aXMultiServiceFactory
);
// Set addon menu pointer here to avoid problems. When accessibility is enabled, the whole menu
// Set addon menu pointer here to avoid problems. When accessibility is enabled, the whole menu
// is created immediately!
// is created immediately!
...
@@ -870,7 +867,7 @@ void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu )
...
@@ -870,7 +867,7 @@ void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu )
PopupMenu
*
pAddonMenu
=
NULL
;
PopupMenu
*
pAddonMenu
=
NULL
;
try
try
{
{
pAddonMenu
=
framework
::
AddonMenuManager
::
CreateAddonMenu
(
xFrame
);
pAddonMenu
=
framework
::
AddonMenuManager
::
CreateAddonMenu
(
xFrame
,
aXMultiServiceFactory
);
}
}
catch
(
::
com
::
sun
::
star
::
lang
::
WrappedTargetException
)
catch
(
::
com
::
sun
::
star
::
lang
::
WrappedTargetException
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment