summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-02-19 14:38:32 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2017-02-21 01:40:19 +0200
commitb6994cb75fb7e34574d933dff58fcec3bb1ab922 (patch)
treeb4ed563012a53742131ba72705bcadde04f99d9a
parent8c5a3b448a50981b41b2860c64a3039265398cf9 (diff)
Use module name when getting labels
Change-Id: I1d5196e1ca888dfb11d5bd6ef4676937dce49fdc
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx4
-rw-r--r--dbaccess/source/ui/control/opendoccontrols.cxx2
-rw-r--r--forms/source/solar/control/navtoolbar.cxx2
-rw-r--r--framework/source/uielement/macrosmenucontroller.cxx2
-rw-r--r--framework/source/uielement/menubarmanager.cxx6
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx4
-rw-r--r--framework/source/uielement/statusbarmanager.cxx2
-rw-r--r--framework/source/uielement/thesaurusmenucontroller.cxx2
-rw-r--r--framework/source/uielement/toolbarmanager.cxx6
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx2
-rw-r--r--include/vcl/commandinfoprovider.hxx20
-rw-r--r--sd/source/ui/controller/slidelayoutcontroller.cxx2
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx4
-rw-r--r--sfx2/source/appl/sfxhelp.cxx11
-rw-r--r--sfx2/source/view/viewsh.cxx2
-rw-r--r--svx/source/mnuctrls/smarttagmenu.cxx2
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx6
-rw-r--r--sw/source/uibase/shells/frmsh.cxx7
-rw-r--r--vcl/source/helper/commandinfoprovider.cxx93
-rw-r--r--vcl/source/window/builder.cxx3
-rw-r--r--vcl/source/window/menu.cxx3
-rw-r--r--vcl/source/window/toolbox.cxx5
-rw-r--r--vcl/source/window/toolbox2.cxx3
23 files changed, 76 insertions, 117 deletions
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 1e9ca0663138..240b9fac5274 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -197,7 +197,7 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,
- vcl::CommandInfoProvider::GetCommandPropertyFromModule(".uno:DBDisablePreview", "com.sun.star.sdb.OfficeDatabaseDocument"),
+ vcl::CommandInfoProvider::GetLabelForCommand(".uno:DBDisablePreview", "com.sun.star.sdb.OfficeDatabaseDocument"),
ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
@@ -995,7 +995,7 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
break;
}
- OUString aCommandLabel = vcl::CommandInfoProvider::GetCommandPropertyFromModule(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
+ OUString aCommandLabel = vcl::CommandInfoProvider::GetLabelForCommand(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel));
Resize();
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx
index dff3368f5528..207e017ad06b 100644
--- a/dbaccess/source/ui/control/opendoccontrols.cxx
+++ b/dbaccess/source/ui/control/opendoccontrols.cxx
@@ -118,7 +118,7 @@ namespace dbaui
m_sModule = OUString::createFromAscii( _pAsciiModuleName );
// our label should equal the UI text of the "Open" command
- OUString sLabel(vcl::CommandInfoProvider::GetCommandPropertyFromModule(".uno:Open", m_sModule));
+ OUString sLabel(vcl::CommandInfoProvider::GetLabelForCommand(".uno:Open", m_sModule));
SetText(" " + sLabel.replaceAll("~", ""));
// Place icon left of text and both centered in the button.
diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx
index 0a665844e060..f2be67199113 100644
--- a/forms/source/solar/control/navtoolbar.cxx
+++ b/forms/source/solar/control/navtoolbar.cxx
@@ -287,7 +287,7 @@ namespace frm
OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) );
m_pToolbar->SetItemCommand( pSupportedFeatures->nId, sCommandURL );
m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId,
- vcl::CommandInfoProvider::GetCommandPropertyFromModule(sCommandURL, m_sModuleId) );
+ vcl::CommandInfoProvider::GetLabelForCommand(sCommandURL, m_sModuleId) );
}
if ( pSupportedFeatures->bItemWindow )
diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx
index dcff602fe58d..c67c7c5574fe 100644
--- a/framework/source/uielement/macrosmenucontroller.cxx
+++ b/framework/source/uielement/macrosmenucontroller.cxx
@@ -83,7 +83,7 @@ void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo
// insert basic
OUString aCommand(".uno:MacroDialog");
- OUString aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand(aCommand, m_xFrame);
+ OUString aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand(aCommand, m_aModuleName);
pPopupMenu->InsertItem( 2, aDisplayName );
pPopupMenu->SetItemCommand( 2, aCommand );
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 6e3cc8d87a0c..989943e8a13e 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1082,9 +1082,9 @@ OUString MenuBarManager::RetrieveLabelFromCommand(const OUString& rCmdURL)
if ( !m_bHasMenuBar )
{
// This is a context menu, prefer "PopupLabel" over "Label".
- return vcl::CommandInfoProvider::GetPopupLabelForCommand(rCmdURL, m_xFrame);
+ return vcl::CommandInfoProvider::GetPopupLabelForCommand(rCmdURL, m_aModuleIdentifier);
}
- return vcl::CommandInfoProvider::GetMenuLabelForCommand(rCmdURL, m_xFrame);
+ return vcl::CommandInfoProvider::GetMenuLabelForCommand(rCmdURL, m_aModuleIdentifier);
}
bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandler )
@@ -1180,7 +1180,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
}
// Command can be just an alias to another command.
- OUString aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aItemCommand, m_xFrame );
+ OUString aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aItemCommand, m_aModuleIdentifier );
if ( !aRealCommand.isEmpty() )
aItemCommand = aRealCommand;
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 4a13605270ae..3fa27a805abf 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -370,7 +370,7 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
{
removeStatusListener( m_aCommandURL );
- OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand( rCommand, m_xFrame ) );
+ OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand( rCommand, m_sModuleName ) );
m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand;
addStatusListener( m_aCommandURL );
@@ -380,7 +380,7 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
{
pToolBox->SetItemCommand( nId, rCommand );
pToolBox->SetHelpText( nId, OUString() ); // Will retrieve the new one from help.
- pToolBox->SetItemText( nId, vcl::CommandInfoProvider::GetLabelForCommand( rCommand, m_xFrame ) );
+ pToolBox->SetItemText( nId, vcl::CommandInfoProvider::GetLabelForCommand( rCommand, m_sModuleName ) );
pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand( rCommand, m_xFrame ) );
vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize());
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 06baee2af7f8..53fc6dd2e9f7 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -450,7 +450,7 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
{
- OUString aString( vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_xFrame));
+ OUString aString( vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_aModuleIdentifier));
StatusBarItemBits nItemBits( impl_convertItemStyleToItemBits( nStyle ));
m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset );
diff --git a/framework/source/uielement/thesaurusmenucontroller.cxx b/framework/source/uielement/thesaurusmenucontroller.cxx
index cfbe7e80a0df..d5eeca206f1f 100644
--- a/framework/source/uielement/thesaurusmenucontroller.cxx
+++ b/framework/source/uielement/thesaurusmenucontroller.cxx
@@ -99,7 +99,7 @@ void ThesaurusMenuController::fillPopupMenu()
pVCLMenu->InsertSeparator();
OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );
- pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aThesaurusDialogCmd, m_xFrame ) );
+ pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aThesaurusDialogCmd, m_aModuleName ) );
pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
}
}
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index c3fa5ea4c568..518ef1a1d9ba 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -684,7 +684,7 @@ void ToolBarManager::CreateControllers()
OUString aCommandURL( m_pToolBar->GetItemCommand( nId ) );
// Command can be just an alias to another command.
- OUString aRealCommandURL( vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, m_xFrame ) );
+ OUString aRealCommandURL( vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, m_aModuleIdentifier ) );
if ( !aRealCommandURL.isEmpty() )
aCommandURL = aRealCommandURL;
@@ -764,7 +764,7 @@ void ToolBarManager::CreateControllers()
new GenericToolbarController( m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL ));
// Accessibility support: Set toggle button role for specific commands
- sal_Int32 nProps = vcl::CommandInfoProvider::GetPropertiesForCommand(aCommandURL, m_xFrame);
+ sal_Int32 nProps = vcl::CommandInfoProvider::GetPropertiesForCommand(aCommandURL, m_aModuleIdentifier);
if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON )
m_pToolBar->SetItemBits( nId, m_pToolBar->GetItemBits( nId ) | ToolBoxItemBits::CHECKABLE );
}
@@ -1021,7 +1021,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
{
- OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_xFrame));
+ OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_aModuleIdentifier));
ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle );
m_pToolBar->InsertItem( nId, aString, nItemBits );
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 9b6bc5e575b6..8633c1ca8265 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -147,7 +147,7 @@ void ToolbarsMenuController::addCommand(
OUString aLabel;
if ( rLabel.isEmpty() )
- aLabel = vcl::CommandInfoProvider::GetMenuLabelForCommand( rCommandURL, m_xFrame );
+ aLabel = vcl::CommandInfoProvider::GetMenuLabelForCommand( rCommandURL, m_aModuleName );
else
aLabel = rLabel;
diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx
index d254ee3e0c55..996d9e556480 100644
--- a/include/vcl/commandinfoprovider.hxx
+++ b/include/vcl/commandinfoprovider.hxx
@@ -29,22 +29,22 @@ namespace vcl { namespace CommandInfoProvider {
/** Return a label for the given command.
@param rsCommandName
The command name is expected to start with .uno:
- @param rxFrame
- The frame is used to identify the module and document.
+ @param rsModuleName
+ The current application module.
@return
The command label.
*/
VCL_DLLPUBLIC OUString GetLabelForCommand (
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ const OUString& rsModuleName);
VCL_DLLPUBLIC OUString GetMenuLabelForCommand (
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ const OUString& rsModuleName);
VCL_DLLPUBLIC OUString GetPopupLabelForCommand (
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ const OUString& rsModuleName);
/** Return a tooltip for the given command. Falls back to label if command has no tooltip.
@param rsCommandName
@@ -64,9 +64,7 @@ namespace vcl { namespace CommandInfoProvider {
const css::uno::Reference<css::frame::XFrame>& rxFrame);
VCL_DLLPUBLIC OUString GetRealCommandForCommand( const OUString& rCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame );
-
- VCL_DLLPUBLIC OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName );
+ const OUString& rsModuleName );
VCL_DLLPUBLIC BitmapEx GetBitmapForCommand(
const OUString& rsCommandName,
@@ -80,10 +78,10 @@ namespace vcl { namespace CommandInfoProvider {
VCL_DLLPUBLIC sal_Int32 GetPropertiesForCommand(
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ const OUString& rsModuleName);
- VCL_DLLPUBLIC bool IsRotated(const OUString& rsCommandName,const css::uno::Reference<css::frame::XFrame>& rxFrame);
- VCL_DLLPUBLIC bool IsMirrored(const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ VCL_DLLPUBLIC bool IsRotated(const OUString& rsCommandName, const OUString& rsModuleName);
+ VCL_DLLPUBLIC bool IsMirrored(const OUString& rsCommandName, const OUString& rsModuleName);
/** Returns whether the command is experimental. */
VCL_DLLPUBLIC bool IsExperimental(
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
index e2f2cfa8eff4..95b34206e9d2 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -245,7 +245,7 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, vcl::W
OUString sSlotTitle;
if( bInsertPage )
- sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand( sSlotStr, xFrame );
+ sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand( sSlotStr, rController.getModuleName() );
else
sSlotTitle = SD_RESSTR( STR_RESET_LAYOUT );
appendEntry( 2, sSlotTitle, aSlotImage);
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 378747e6474a..5e20423e1bd9 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -975,8 +975,8 @@ vcl::Window* ViewShellBase::GetViewWindow()
OUString ViewShellBase::RetrieveLabelFromCommand( const OUString& aCmdURL ) const
{
- Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY );
- return vcl::CommandInfoProvider::GetLabelForCommand( aCmdURL, xFrame );
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface()));
+ return vcl::CommandInfoProvider::GetLabelForCommand( aCmdURL, aModuleName );
}
int ViewShellBase::getPart() const
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index a8dce9d2f0a8..2fa709a4c098 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -259,13 +259,6 @@ OUString getDefaultModule_Impl()
return sDefaultModule;
}
-Reference< XFrame > getCurrentFrame()
-{
- Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- Reference < XDesktop2 > xDesktop = Desktop::create(xContext);
- return xDesktop->getCurrentFrame();
-}
-
OUString getCurrentModuleIdentifier_Impl()
{
OUString sIdentifier;
@@ -446,7 +439,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask ,
OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* pWindow )
{
OUString sModuleName = GetHelpModuleName_Impl();
- OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, getCurrentFrame() );
+ OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, getCurrentModuleIdentifier_Impl() );
OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName );
OString aNewHelpId;
@@ -564,7 +557,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
if ( nProtocol == INetProtocol::Uno )
// Command can be just an alias to another command.
- aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( rURL, getCurrentFrame() );
+ aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( rURL, getCurrentModuleIdentifier_Impl() );
// no URL, just a HelpID (maybe empty in case of keyword search)
aHelpURL = CreateHelpURL_Impl( aRealCommand.isEmpty() ? rURL : aRealCommand, aHelpModuleName );
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 7e84a768bb01..071d6e1ceed2 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -720,7 +720,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
OUStringBuffer aBuffer( 60 );
aBuffer.append( vcl::CommandInfoProvider::GetLabelForCommand(
".uno:PrintDefault",
- xFrame ));
+ vcl::CommandInfoProvider::GetModuleIdentifier( xFrame ) ) );
aBuffer.append( " (" );
aBuffer.append( aPrinterName );
aBuffer.append(')');
diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx
index 5d0eb6e03bde..af73107f55fc 100644
--- a/svx/source/mnuctrls/smarttagmenu.cxx
+++ b/svx/source/mnuctrls/smarttagmenu.cxx
@@ -180,7 +180,7 @@ void SmartTagMenuController::FillMenu()
{
const OUString aCommand = ".uno:AutoCorrectDlg?OpenSmartTag:bool=true";
pVCLMenu->InsertSeparator();
- pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aCommand, m_xFrame ) );
+ pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aCommand, m_aModuleName ) );
pVCLMenu->SetItemCommand( nMenuId, aCommand );
}
}
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index c1f2a3a0d1f4..28bc427898bf 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1312,9 +1312,7 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
}
}
- OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand( rCommand, rFrame );
- SetText( aWindowTitle );
- mpColorSet->SetAccessibleName( aWindowTitle );
+ mpColorSet->SetAccessibleName( GetText() );
mpPaletteListBox->SetStyle( mpPaletteListBox->GetStyle() | WB_BORDER | WB_AUTOSIZE );
mpPaletteListBox->SetSelectHdl( LINK( this, SvxColorWindow, SelectPaletteHdl ) );
@@ -2831,6 +2829,8 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow()
&GetToolBox(),
m_aColorSelectFunction);
+ OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand( m_aCommandURL, m_sModuleName );
+ pColorWin->SetText( aWindowTitle );
pColorWin->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
pColorWin->StartSelection();
SetPopupWindow(pColorWin);
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 811282d8c1f0..b2b6a19e9242 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -806,19 +806,20 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
}
}
}
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame()->GetFrame().GetFrameInterface()));
switch (nWhich)
{
case SID_OBJECT_ALIGN_UP :
case FN_FRAME_ALIGN_VERT_TOP:
- sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignTop", GetFrame()->GetFrame().GetFrameInterface());
+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignTop", aModuleName);
break;
case SID_OBJECT_ALIGN_MIDDLE:
case FN_FRAME_ALIGN_VERT_CENTER:
- sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignVerticalCenter", GetFrame()->GetFrame().GetFrameInterface());
+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignVerticalCenter", aModuleName);
break;
case SID_OBJECT_ALIGN_DOWN:
case FN_FRAME_ALIGN_VERT_BOTTOM:
- sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignBottom", GetFrame()->GetFrame().GetFrameInterface());
+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignBottom", aModuleName);
break;
}
}
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index 4b5b2b424b6c..3b22ebb7baf4 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -125,17 +125,17 @@ OUString RetrieveShortcutsFromConfiguration(
return OUString();
}
-bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const OUString& rsModuleName)
{
Sequence< OUString > aSequence;
try
{
- const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
- if (!sModuleIdentifier.isEmpty())
+ if (!rsModuleName.isEmpty())
{
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
Reference<container::XNameAccess> xUICommandLabels;
- if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) {
+ if (xNameAccess->getByName(rsModuleName) >>= xUICommandLabels)
+ {
xUICommandLabels->getByName(rsResourceName) >>= aSequence;
for ( sal_Int32 i = 0; i < aSequence.getLength(); i++ )
{
@@ -151,18 +151,17 @@ bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandNam
return false;
}
-Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandName, const OUString& rsModuleName)
{
Sequence<beans::PropertyValue> aProperties;
try
{
- const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
- if (sModuleIdentifier.getLength() > 0)
+ if (!rsModuleName.isEmpty())
{
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
Reference<container::XNameAccess> xUICommandLabels;
- if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels)
+ if (xNameAccess->getByName(rsModuleName) >>= xUICommandLabels)
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
}
}
@@ -173,9 +172,9 @@ Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandNam
return aProperties;
}
-OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const OUString& rsModuleName)
{
- const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rsModuleName));
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
{
if (aProperties[nIndex].Name == rsProperty)
@@ -190,41 +189,38 @@ OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsComman
OUString GetLabelForCommand (
const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
-
- return GetCommandProperty("Name", rsCommandName, rxFrame);
+ return GetCommandProperty("Name", rsCommandName, rsModuleName);
}
OUString GetMenuLabelForCommand (
const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
-
// Here we want to use "Label", not "Name". "Name" is a stripped-down version of "Label" without accelerators
// and ellipsis. In the menu, we want to have those accelerators and ellipsis.
- return GetCommandProperty("Label", rsCommandName, rxFrame);
+ return GetCommandProperty("Label", rsCommandName, rsModuleName);
}
OUString GetPopupLabelForCommand (
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
-
- OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName, rxFrame));
+ OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName, rsModuleName));
if (!sPopupLabel.isEmpty())
return sPopupLabel;
- return GetCommandProperty("Label", rsCommandName, rxFrame);
+ return GetCommandProperty("Label", rsCommandName, rsModuleName);
}
OUString GetTooltipForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
-
- OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName, rxFrame));
+ OUString sModuleName(GetModuleIdentifier(rxFrame));
+ OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName, sModuleName));
if (sLabel.isEmpty()) {
- sLabel = GetPopupLabelForCommand(rsCommandName, rxFrame);
+ sLabel = GetPopupLabelForCommand(rsCommandName, sModuleName);
// Remove '...' at the end and mnemonics (we don't want those in tooltips)
sLabel = comphelper::string::stripEnd(sLabel, '.');
sLabel = MnemonicGenerator::EraseAllMnemonicChars(sLabel);
@@ -232,7 +228,7 @@ OUString GetTooltipForCommand (
// Command can be just an alias to another command,
// so need to get the shortcut of the "real" command.
- const OUString sRealCommand(GetRealCommandForCommand(rsCommandName, rxFrame));
+ const OUString sRealCommand(GetRealCommandForCommand(rsCommandName, sModuleName));
const OUString sShortCut(GetCommandShortcut(!sRealCommand.isEmpty() ? sRealCommand : rsCommandName, rxFrame));
if (!sShortCut.isEmpty())
return sLabel + " (" + sShortCut + ")";
@@ -261,10 +257,9 @@ OUString GetCommandShortcut (const OUString& rsCommandName,
}
OUString GetRealCommandForCommand(const OUString& rCommandName,
- const css::uno::Reference<frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
-
- return GetCommandProperty("TargetURL", rCommandName, rxFrame);
+ return GetCommandProperty("TargetURL", rCommandName, rsModuleName);
}
BitmapEx GetBitmapForCommand(const OUString& rsCommandName,
@@ -342,11 +337,11 @@ Image GetImageForCommand(const OUString& rsCommandName,
sal_Int32 GetPropertiesForCommand (
const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
sal_Int32 nValue = 0;
- const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rsModuleName));
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
{
if (aProperties[nIndex].Name == "Properties")
@@ -358,14 +353,14 @@ sal_Int32 GetPropertiesForCommand (
return nValue;
}
-bool IsRotated(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+bool IsRotated(const OUString& rsCommandName, const OUString& rsModuleName)
{
- return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName, rxFrame);
+ return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName, rsModuleName);
}
-bool IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+bool IsMirrored(const OUString& rsCommandName, const OUString& rsModuleName)
{
- return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName, rxFrame);
+ return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName, rsModuleName);
}
bool IsExperimental(const OUString& rsCommandName,
@@ -403,38 +398,6 @@ OUString const GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame)
return xModuleManager->identify(rxFrame);
}
-OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName )
-{
- OUString sLabel;
- if ( rCommandName.isEmpty() )
- return sLabel;
-
- Sequence<beans::PropertyValue> aProperties;
- try
- {
- if( rModuleName.getLength() > 0)
- {
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
- Reference<container::XNameAccess> xUICommandLabels;
- if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
- xUICommandLabels->getByName(rCommandName) >>= aProperties;
-
- for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
- {
- if(aProperties[nIndex].Name == "Label")
- {
- aProperties[nIndex].Value >>= sLabel;
- return sLabel;
- }
- }
- }
- }
- catch (Exception&)
- {
- }
- return OUString();
-}
-
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 93494dab537f..f24029d677f7 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -879,7 +879,8 @@ namespace
if (aCommand.isEmpty())
return;
- OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aCommand, rFrame));
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
+ OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aCommand, aModuleName));
if (!aLabel.isEmpty())
pButton->SetText(aLabel);
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index da4f00da89a1..1e961b859383 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -510,7 +510,8 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::f
if (rFrame.is())
{
- OUString aLabel(CommandInfoProvider::GetPopupLabelForCommand(rCommand, rFrame));
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
+ OUString aLabel(CommandInfoProvider::GetPopupLabelForCommand(rCommand, aModuleName));
OUString aTooltip(CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame));
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 6c75ab8ad6cf..dfee6f2a5265 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -4538,11 +4538,12 @@ void ToolBox::statusChanged( const css::frame::FeatureStateEvent& Event )
mnImagesRotationAngle = aItem.GetRotation();
// update image orientation
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(mpStatusListener->getFrame()));
for (std::vector<ImplToolItem>::const_iterator it = mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it)
{
- if (vcl::CommandInfoProvider::IsMirrored(it->maCommandStr, mpStatusListener->getFrame()))
+ if (vcl::CommandInfoProvider::IsMirrored(it->maCommandStr, aModuleName))
SetItemImageMirrorMode(it->mnId, mbImagesMirrored);
- if (vcl::CommandInfoProvider::IsRotated(it->maCommandStr, mpStatusListener->getFrame()))
+ if (vcl::CommandInfoProvider::IsRotated(it->maCommandStr, aModuleName))
SetItemImageAngle(it->mnId, mnImagesRotationAngle);
}
}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 4fc6c9cba0c4..b95e1a801973 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -432,7 +432,8 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText, ToolBoxItem
void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css::frame::XFrame>& rFrame, ToolBoxItemBits nBits,
const Size& rRequestedSize, sal_uInt16 nPos)
{
- OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(rCommand, rFrame));
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
+ OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(rCommand, aModuleName));
OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
vcl::ImageType eImageType = vcl::ImageType::Size16;