tdf#95844 Refactor CommandInfoProvider
Instead of a singleton, CommandInfoProvider should just be a set of static methods. Change-Id: I16d4406e361a72f013d78f18d6bd0ae20c0cc5e9
This commit is contained in:
parent
e25bf8505c
commit
33c51e8002
@ -197,7 +197,7 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
|
|||||||
|
|
||||||
m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
|
m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
|
||||||
m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,
|
m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,
|
||||||
vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(".uno:DBDisablePreview", "com.sun.star.sdb.OfficeDatabaseDocument"),
|
vcl::CommandInfoProvider::GetCommandPropertyFromModule(".uno:DBDisablePreview", "com.sun.star.sdb.OfficeDatabaseDocument"),
|
||||||
ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
|
ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
|
||||||
m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
|
m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
|
||||||
m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
|
m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
|
||||||
@ -995,7 +995,7 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString aCommandLabel = vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
|
OUString aCommandLabel = vcl::CommandInfoProvider::GetCommandPropertyFromModule(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
|
||||||
m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel));
|
m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel));
|
||||||
Resize();
|
Resize();
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ namespace dbaui
|
|||||||
m_sModule = OUString::createFromAscii( _pAsciiModuleName );
|
m_sModule = OUString::createFromAscii( _pAsciiModuleName );
|
||||||
|
|
||||||
// our label should equal the UI text of the "Open" command
|
// our label should equal the UI text of the "Open" command
|
||||||
OUString sLabel(vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(".uno:Open", m_sModule));
|
OUString sLabel(vcl::CommandInfoProvider::GetCommandPropertyFromModule(".uno:Open", m_sModule));
|
||||||
SetText(" " + sLabel.replaceAll("~", ""));
|
SetText(" " + sLabel.replaceAll("~", ""));
|
||||||
|
|
||||||
// Place icon left of text and both centered in the button.
|
// Place icon left of text and both centered in the button.
|
||||||
|
@ -287,7 +287,7 @@ namespace frm
|
|||||||
OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) );
|
OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) );
|
||||||
m_pToolbar->SetItemCommand( pSupportedFeatures->nId, sCommandURL );
|
m_pToolbar->SetItemCommand( pSupportedFeatures->nId, sCommandURL );
|
||||||
m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId,
|
m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId,
|
||||||
vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(sCommandURL, m_sModuleId) );
|
vcl::CommandInfoProvider::GetCommandPropertyFromModule(sCommandURL, m_sModuleId) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pSupportedFeatures->bItemWindow )
|
if ( pSupportedFeatures->bItemWindow )
|
||||||
|
@ -122,14 +122,14 @@ static Image RetrieveImage( Reference< css::frame::XFrame >& rFrame,
|
|||||||
if ( !!aImage )
|
if ( !!aImage )
|
||||||
return aImage;
|
return aImage;
|
||||||
else
|
else
|
||||||
aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, rFrame, eImageType);
|
aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, rFrame, eImageType);
|
||||||
if ( !!aImage )
|
if ( !!aImage )
|
||||||
return aImage;
|
return aImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
aImage = framework::AddonsOptions().GetImageFromURL( aURL, bBigImage );
|
aImage = framework::AddonsOptions().GetImageFromURL( aURL, bBigImage );
|
||||||
if ( !aImage )
|
if ( !aImage )
|
||||||
aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, rFrame, eImageType);
|
aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, rFrame, eImageType);
|
||||||
|
|
||||||
return aImage;
|
return aImage;
|
||||||
}
|
}
|
||||||
@ -259,7 +259,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
|
|||||||
|
|
||||||
m_pToolBar->InsertItem( nId, aTitle );
|
m_pToolBar->InsertItem( nId, aTitle );
|
||||||
|
|
||||||
OUString aShortcut(vcl::CommandInfoProvider::Instance().GetCommandShortcut(aURL, m_xFrame));
|
OUString aShortcut(vcl::CommandInfoProvider::GetCommandShortcut(aURL, m_xFrame));
|
||||||
if (!aShortcut.isEmpty())
|
if (!aShortcut.isEmpty())
|
||||||
m_pToolBar->SetQuickHelpText(nId, aTitle + " (" + aShortcut + ")");
|
m_pToolBar->SetQuickHelpText(nId, aTitle + " (" + aShortcut + ")");
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo
|
|||||||
|
|
||||||
// insert basic
|
// insert basic
|
||||||
OUString aCommand(".uno:MacroDialog");
|
OUString aCommand(".uno:MacroDialog");
|
||||||
OUString aDisplayName = vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand(aCommand, m_xFrame);
|
OUString aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand(aCommand, m_xFrame);
|
||||||
pPopupMenu->InsertItem( 2, aDisplayName );
|
pPopupMenu->InsertItem( 2, aDisplayName );
|
||||||
pPopupMenu->SetItemCommand( 2, aCommand );
|
pPopupMenu->SetItemCommand( 2, aCommand );
|
||||||
|
|
||||||
|
@ -1085,9 +1085,9 @@ OUString MenuBarManager::RetrieveLabelFromCommand(const OUString& rCmdURL)
|
|||||||
if ( !m_bHasMenuBar )
|
if ( !m_bHasMenuBar )
|
||||||
{
|
{
|
||||||
// This is a context menu, prefer "PopupLabel" over "Label".
|
// This is a context menu, prefer "PopupLabel" over "Label".
|
||||||
return vcl::CommandInfoProvider::Instance().GetPopupLabelForCommand(rCmdURL, m_xFrame);
|
return vcl::CommandInfoProvider::GetPopupLabelForCommand(rCmdURL, m_xFrame);
|
||||||
}
|
}
|
||||||
return vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand(rCmdURL, m_xFrame);
|
return vcl::CommandInfoProvider::GetMenuLabelForCommand(rCmdURL, m_xFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandler )
|
bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandler )
|
||||||
@ -1183,7 +1183,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Command can be just an alias to another command.
|
// Command can be just an alias to another command.
|
||||||
OUString aRealCommand = vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( aItemCommand, m_xFrame );
|
OUString aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aItemCommand, m_xFrame );
|
||||||
if ( !aRealCommand.isEmpty() )
|
if ( !aRealCommand.isEmpty() )
|
||||||
aItemCommand = aRealCommand;
|
aItemCommand = aRealCommand;
|
||||||
|
|
||||||
@ -1289,7 +1289,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
|
|||||||
// Set image for the addon popup menu item
|
// Set image for the addon popup menu item
|
||||||
if ( bItemShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST ))
|
if ( bItemShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST ))
|
||||||
{
|
{
|
||||||
Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aItemCommand, rFrame);
|
Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aItemCommand, rFrame);
|
||||||
if ( !!aImage )
|
if ( !!aImage )
|
||||||
pPopup->SetItemImage( ITEMID_ADDONLIST, aImage );
|
pPopup->SetItemImage( ITEMID_ADDONLIST, aImage );
|
||||||
}
|
}
|
||||||
@ -1320,12 +1320,12 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
|
|||||||
if ( pMenuAttributes && !pMenuAttributes->aImageId.isEmpty() )
|
if ( pMenuAttributes && !pMenuAttributes->aImageId.isEmpty() )
|
||||||
{
|
{
|
||||||
// Retrieve image id from menu attributes
|
// Retrieve image id from menu attributes
|
||||||
aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, m_xFrame);
|
aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, m_xFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !aImage )
|
if ( !aImage )
|
||||||
{
|
{
|
||||||
aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aItemCommand, m_xFrame);
|
aImage = vcl::CommandInfoProvider::GetImageForCommand(aItemCommand, m_xFrame);
|
||||||
if ( !aImage )
|
if ( !aImage )
|
||||||
aImage = AddonsOptions().GetImageFromURL( aItemCommand, false );
|
aImage = AddonsOptions().GetImageFromURL( aItemCommand, false );
|
||||||
}
|
}
|
||||||
@ -1648,7 +1648,7 @@ void MenuBarManager::FillMenu(
|
|||||||
aProp[i].Value >>= bEnabled;
|
aProp[i].Value >>= bEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vcl::CommandInfoProvider::Instance().IsExperimental(aCommandURL, rModuleIdentifier) &&
|
if (vcl::CommandInfoProvider::IsExperimental(aCommandURL, rModuleIdentifier) &&
|
||||||
!SvtMiscOptions().IsExperimentalMode())
|
!SvtMiscOptions().IsExperimentalMode())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -2086,7 +2086,7 @@ void MenuBarManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,b
|
|||||||
|
|
||||||
if ( !aImageId.isEmpty() )
|
if ( !aImageId.isEmpty() )
|
||||||
{
|
{
|
||||||
Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, _xFrame);
|
Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, _xFrame);
|
||||||
if ( !!aImage )
|
if ( !!aImage )
|
||||||
{
|
{
|
||||||
bImageSet = true;
|
bImageSet = true;
|
||||||
@ -2097,7 +2097,7 @@ void MenuBarManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,b
|
|||||||
if ( !bImageSet )
|
if ( !bImageSet )
|
||||||
{
|
{
|
||||||
OUString aMenuItemCommand = _pMenu->GetItemCommand( nId );
|
OUString aMenuItemCommand = _pMenu->GetItemCommand( nId );
|
||||||
Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aMenuItemCommand, _xFrame);
|
Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aMenuItemCommand, _xFrame);
|
||||||
if ( !aImage )
|
if ( !aImage )
|
||||||
aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, false );
|
aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, false );
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, bool bSetImages )
|
|||||||
INetURLObject aURLObj( aImageId.isEmpty() ? aCmd : aImageId );
|
INetURLObject aURLObj( aImageId.isEmpty() ? aCmd : aImageId );
|
||||||
Image aImage = SvFileInformationManager::GetImageNoDefault( aURLObj );
|
Image aImage = SvFileInformationManager::GetImageNoDefault( aURLObj );
|
||||||
if ( !aImage )
|
if ( !aImage )
|
||||||
aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCmd, xFrame);
|
aImage = vcl::CommandInfoProvider::GetImageForCommand(aCmd, xFrame);
|
||||||
|
|
||||||
if ( !!aImage )
|
if ( !!aImage )
|
||||||
pPopupMenu->SetItemImage( nItemId, aImage );
|
pPopupMenu->SetItemImage( nItemId, aImage );
|
||||||
|
@ -370,7 +370,7 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
|
|||||||
{
|
{
|
||||||
removeStatusListener( m_aCommandURL );
|
removeStatusListener( m_aCommandURL );
|
||||||
|
|
||||||
OUString aRealCommand( vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( rCommand, m_xFrame ) );
|
OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand( rCommand, m_xFrame ) );
|
||||||
m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand;
|
m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand;
|
||||||
addStatusListener( m_aCommandURL );
|
addStatusListener( m_aCommandURL );
|
||||||
|
|
||||||
@ -380,12 +380,12 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
|
|||||||
{
|
{
|
||||||
pToolBox->SetItemCommand( nId, rCommand );
|
pToolBox->SetItemCommand( nId, rCommand );
|
||||||
pToolBox->SetHelpText( nId, OUString() ); // Will retrieve the new one from help.
|
pToolBox->SetHelpText( nId, OUString() ); // Will retrieve the new one from help.
|
||||||
pToolBox->SetItemText( nId, vcl::CommandInfoProvider::Instance().GetLabelForCommand( rCommand, m_xFrame ) );
|
pToolBox->SetItemText( nId, vcl::CommandInfoProvider::GetLabelForCommand( rCommand, m_xFrame ) );
|
||||||
pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::Instance().GetTooltipForCommand( rCommand, m_xFrame ) );
|
pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand( rCommand, m_xFrame ) );
|
||||||
|
|
||||||
vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize());
|
vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize());
|
||||||
|
|
||||||
Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommand, m_xFrame, eImageType);
|
Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, eImageType);
|
||||||
if ( !!aImage )
|
if ( !!aImage )
|
||||||
pToolBox->SetItemImage( nId, aImage );
|
pToolBox->SetItemImage( nId, aImage );
|
||||||
}
|
}
|
||||||
@ -503,7 +503,7 @@ void SaveToolbarController::updateImage()
|
|||||||
|
|
||||||
if ( m_bReadOnly )
|
if ( m_bReadOnly )
|
||||||
{
|
{
|
||||||
aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(".uno:SaveAs", m_xFrame, eImageType);
|
aImage = vcl::CommandInfoProvider::GetImageForCommand(".uno:SaveAs", m_xFrame, eImageType);
|
||||||
}
|
}
|
||||||
else if ( m_bModified )
|
else if ( m_bModified )
|
||||||
{
|
{
|
||||||
@ -512,7 +512,7 @@ void SaveToolbarController::updateImage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !aImage )
|
if ( !aImage )
|
||||||
aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(m_aCommandURL, m_xFrame, eImageType);
|
aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aCommandURL, m_xFrame, eImageType);
|
||||||
|
|
||||||
if ( !!aImage )
|
if ( !!aImage )
|
||||||
pToolBox->SetItemImage( nId, aImage );
|
pToolBox->SetItemImage( nId, aImage );
|
||||||
@ -530,7 +530,7 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent&
|
|||||||
if ( bLastReadOnly != m_bReadOnly )
|
if ( bLastReadOnly != m_bReadOnly )
|
||||||
{
|
{
|
||||||
pToolBox->SetQuickHelpText( nId,
|
pToolBox->SetQuickHelpText( nId,
|
||||||
vcl::CommandInfoProvider::Instance().GetTooltipForCommand( m_bReadOnly ? OUString( ".uno:SaveAs" ) : m_aCommandURL, m_xFrame ) );
|
vcl::CommandInfoProvider::GetTooltipForCommand( m_bReadOnly ? OUString( ".uno:SaveAs" ) : m_aCommandURL, m_xFrame ) );
|
||||||
pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~( m_bReadOnly ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) );
|
pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~( m_bReadOnly ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) );
|
||||||
pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( m_bReadOnly ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN ) );
|
pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( m_bReadOnly ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN ) );
|
||||||
updateImage();
|
updateImage();
|
||||||
|
@ -450,7 +450,7 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
|
|||||||
|
|
||||||
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
|
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
|
||||||
{
|
{
|
||||||
OUString aString( vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame));
|
OUString aString( vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_xFrame));
|
||||||
StatusBarItemBits nItemBits( impl_convertItemStyleToItemBits( nStyle ));
|
StatusBarItemBits nItemBits( impl_convertItemStyleToItemBits( nStyle ));
|
||||||
|
|
||||||
m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset );
|
m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset );
|
||||||
|
@ -291,7 +291,7 @@ void SubToolBarController::updateImage()
|
|||||||
else if (pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Size32)
|
else if (pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Size32)
|
||||||
eImageType = vcl::ImageType::Size32;
|
eImageType = vcl::ImageType::Size32;
|
||||||
|
|
||||||
Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(m_aLastCommand, getFrameInterface(), eImageType);
|
Image aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aLastCommand, getFrameInterface(), eImageType);
|
||||||
if ( !!aImage )
|
if ( !!aImage )
|
||||||
pToolBox->SetItemImage( nId, aImage );
|
pToolBox->SetItemImage( nId, aImage );
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ void ThesaurusMenuController::fillPopupMenu()
|
|||||||
|
|
||||||
pVCLMenu->InsertSeparator();
|
pVCLMenu->InsertSeparator();
|
||||||
OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );
|
OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );
|
||||||
pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::Instance().GetPopupLabelForCommand( aThesaurusDialogCmd, m_xFrame ) );
|
pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aThesaurusDialogCmd, m_xFrame ) );
|
||||||
pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
|
pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ void ToolBarManager::RefreshImages()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
OUString aCommandURL = m_pToolBar->GetItemCommand( it.first );
|
OUString aCommandURL = m_pToolBar->GetItemCommand( it.first );
|
||||||
Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, m_xFrame, eImageType);
|
Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, m_xFrame, eImageType);
|
||||||
// Try also to query for add-on images before giving up and use an
|
// Try also to query for add-on images before giving up and use an
|
||||||
// empty image.
|
// empty image.
|
||||||
bool bBigImages = eImageType != vcl::ImageType::Size16;
|
bool bBigImages = eImageType != vcl::ImageType::Size16;
|
||||||
@ -684,7 +684,7 @@ void ToolBarManager::CreateControllers()
|
|||||||
|
|
||||||
OUString aCommandURL( m_pToolBar->GetItemCommand( nId ) );
|
OUString aCommandURL( m_pToolBar->GetItemCommand( nId ) );
|
||||||
// Command can be just an alias to another command.
|
// Command can be just an alias to another command.
|
||||||
OUString aRealCommandURL( vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( aCommandURL, m_xFrame ) );
|
OUString aRealCommandURL( vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, m_xFrame ) );
|
||||||
if ( !aRealCommandURL.isEmpty() )
|
if ( !aRealCommandURL.isEmpty() )
|
||||||
aCommandURL = aRealCommandURL;
|
aCommandURL = aRealCommandURL;
|
||||||
|
|
||||||
@ -764,7 +764,7 @@ void ToolBarManager::CreateControllers()
|
|||||||
new GenericToolbarController( m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL ));
|
new GenericToolbarController( m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL ));
|
||||||
|
|
||||||
// Accessibility support: Set toggle button role for specific commands
|
// Accessibility support: Set toggle button role for specific commands
|
||||||
sal_Int32 nProps = vcl::CommandInfoProvider::Instance().GetPropertiesForCommand(aCommandURL, m_xFrame);
|
sal_Int32 nProps = vcl::CommandInfoProvider::GetPropertiesForCommand(aCommandURL, m_xFrame);
|
||||||
if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON )
|
if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON )
|
||||||
m_pToolBar->SetItemBits( nId, m_pToolBar->GetItemBits( nId ) | ToolBoxItemBits::CHECKABLE );
|
m_pToolBar->SetItemBits( nId, m_pToolBar->GetItemBits( nId ) | ToolBoxItemBits::CHECKABLE );
|
||||||
}
|
}
|
||||||
@ -1013,7 +1013,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
|
|||||||
aProp[i].Value >>= nStyle;
|
aProp[i].Value >>= nStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vcl::CommandInfoProvider::Instance().IsExperimental(aCommandURL, m_aModuleIdentifier) &&
|
if (vcl::CommandInfoProvider::IsExperimental(aCommandURL, m_aModuleIdentifier) &&
|
||||||
!SvtMiscOptions().IsExperimentalMode())
|
!SvtMiscOptions().IsExperimentalMode())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -1021,7 +1021,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
|
|||||||
|
|
||||||
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
|
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
|
||||||
{
|
{
|
||||||
OUString aString(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame));
|
OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_xFrame));
|
||||||
|
|
||||||
ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle );
|
ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle );
|
||||||
m_pToolBar->InsertItem( nId, aString, nItemBits );
|
m_pToolBar->InsertItem( nId, aString, nItemBits );
|
||||||
@ -1029,7 +1029,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
|
|||||||
if ( !aTooltip.isEmpty() )
|
if ( !aTooltip.isEmpty() )
|
||||||
m_pToolBar->SetQuickHelpText( nId, aTooltip );
|
m_pToolBar->SetQuickHelpText( nId, aTooltip );
|
||||||
else
|
else
|
||||||
m_pToolBar->SetQuickHelpText( nId, vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame) );
|
m_pToolBar->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand(aCommandURL, m_xFrame) );
|
||||||
|
|
||||||
if ( !aLabel.isEmpty() )
|
if ( !aLabel.isEmpty() )
|
||||||
{
|
{
|
||||||
@ -1468,7 +1468,7 @@ void ToolBarManager::AddCustomizeMenuItems(ToolBox* pToolBar)
|
|||||||
pVisibleItemsPopupMenu->InsertItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->GetItemText( nId ), MenuItemBits::CHECKABLE );
|
pVisibleItemsPopupMenu->InsertItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->GetItemText( nId ), MenuItemBits::CHECKABLE );
|
||||||
pVisibleItemsPopupMenu->CheckItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->IsItemVisible( nId ) );
|
pVisibleItemsPopupMenu->CheckItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->IsItemVisible( nId ) );
|
||||||
pVisibleItemsPopupMenu->SetItemCommand( STARTID_CUSTOMIZE_POPUPMENU+nPos, aCommandURL );
|
pVisibleItemsPopupMenu->SetItemCommand( STARTID_CUSTOMIZE_POPUPMENU+nPos, aCommandURL );
|
||||||
Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, m_xFrame));
|
Image aImage(vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, m_xFrame));
|
||||||
commandToImage[aCommandURL] = aImage;
|
commandToImage[aCommandURL] = aImage;
|
||||||
pVisibleItemsPopupMenu->SetItemImage( STARTID_CUSTOMIZE_POPUPMENU+nPos, aImage );
|
pVisibleItemsPopupMenu->SetItemImage( STARTID_CUSTOMIZE_POPUPMENU+nPos, aImage );
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ void ToolbarsMenuController::addCommand(
|
|||||||
|
|
||||||
OUString aLabel;
|
OUString aLabel;
|
||||||
if ( rLabel.isEmpty() )
|
if ( rLabel.isEmpty() )
|
||||||
aLabel = vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand( rCommandURL, m_xFrame );
|
aLabel = vcl::CommandInfoProvider::GetMenuLabelForCommand( rCommandURL, m_xFrame );
|
||||||
else
|
else
|
||||||
aLabel = rLabel;
|
aLabel = rLabel;
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ void ToolbarsMenuController::addCommand(
|
|||||||
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
|
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
|
||||||
|
|
||||||
if ( rSettings.GetUseImagesInMenus() )
|
if ( rSettings.GetUseImagesInMenus() )
|
||||||
aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommandURL, m_xFrame);
|
aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommandURL, m_xFrame);
|
||||||
|
|
||||||
VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(VCLXPopupMenu::GetImplementation( rPopupMenu ));
|
VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(VCLXPopupMenu::GetImplementation( rPopupMenu ));
|
||||||
if ( pPopupMenu )
|
if ( pPopupMenu )
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||||
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
|
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
|
||||||
|
|
||||||
|
using namespace css;
|
||||||
|
using namespace css::uno;
|
||||||
|
|
||||||
|
|
||||||
namespace vcl {
|
namespace vcl {
|
||||||
|
|
||||||
@ -36,16 +39,8 @@ namespace vcl {
|
|||||||
class VCL_DLLPUBLIC CommandInfoProvider
|
class VCL_DLLPUBLIC CommandInfoProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Return the singleton instance.
|
CommandInfoProvider();
|
||||||
|
~CommandInfoProvider();
|
||||||
It caches some objects for the last XFrame object given to
|
|
||||||
GetLabelForCommand. These objects are release and created new
|
|
||||||
when that method is called with a different XFrame from the
|
|
||||||
last call.
|
|
||||||
|
|
||||||
Lifetime control should work but could be more elegant.
|
|
||||||
*/
|
|
||||||
static CommandInfoProvider& Instance();
|
|
||||||
|
|
||||||
/** Return a label for the given command.
|
/** Return a label for the given command.
|
||||||
@param rsCommandName
|
@param rsCommandName
|
||||||
@ -55,15 +50,15 @@ public:
|
|||||||
@return
|
@return
|
||||||
The command labe.
|
The command labe.
|
||||||
*/
|
*/
|
||||||
OUString GetLabelForCommand (
|
static OUString GetLabelForCommand (
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
||||||
|
|
||||||
OUString GetMenuLabelForCommand (
|
static OUString GetMenuLabelForCommand (
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
||||||
|
|
||||||
OUString GetPopupLabelForCommand (
|
static OUString GetPopupLabelForCommand (
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
||||||
|
|
||||||
@ -76,67 +71,54 @@ public:
|
|||||||
The returned label contains the keyboard accelerator, if
|
The returned label contains the keyboard accelerator, if
|
||||||
one is defined and bIncludeShortcut is true.
|
one is defined and bIncludeShortcut is true.
|
||||||
*/
|
*/
|
||||||
OUString GetTooltipForCommand (
|
static OUString GetTooltipForCommand (
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
||||||
|
|
||||||
/** Returns the shortcut for a command in human-readable form */
|
/** Returns the shortcut for a command in human-readable form */
|
||||||
OUString GetCommandShortcut (const OUString& rCommandName,
|
static OUString GetCommandShortcut (const OUString& rCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
||||||
|
|
||||||
OUString GetRealCommandForCommand( const OUString& rCommandName,
|
static OUString GetRealCommandForCommand( const OUString& rCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame );
|
const css::uno::Reference<css::frame::XFrame>& rxFrame );
|
||||||
|
|
||||||
OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName );
|
static OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName );
|
||||||
|
|
||||||
BitmapEx GetBitmapForCommand(
|
static BitmapEx GetBitmapForCommand(
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
||||||
vcl::ImageType eImageType = vcl::ImageType::Small);
|
vcl::ImageType eImageType = vcl::ImageType::Small);
|
||||||
|
|
||||||
Image GetImageForCommand(
|
static Image GetImageForCommand(
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
||||||
vcl::ImageType eImageType = vcl::ImageType::Small);
|
vcl::ImageType eImageType = vcl::ImageType::Small);
|
||||||
|
|
||||||
sal_Int32 GetPropertiesForCommand(
|
static sal_Int32 GetPropertiesForCommand(
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
||||||
|
|
||||||
bool IsRotated(const OUString& rsCommandName);
|
static bool IsRotated(const OUString& rsCommandName,const Reference<frame::XFrame>& rxFrame);
|
||||||
bool IsMirrored(const OUString& rsCommandName);
|
static bool IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame);
|
||||||
|
|
||||||
/** Returns whether the command is experimental. */
|
/** Returns whether the command is experimental. */
|
||||||
bool IsExperimental(
|
static bool IsExperimental(
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const OUString& rModuleName);
|
const OUString& rModuleName);
|
||||||
|
|
||||||
/** Do not call. Should be part of a local and hidden interface.
|
/** Do not call. Should be part of a local and hidden interface.
|
||||||
*/
|
*/
|
||||||
void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
static void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
||||||
|
|
||||||
void dispose();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
css::uno::Reference<css::uno::XComponentContext> mxContext;
|
static css::uno::Reference<css::ui::XAcceleratorConfiguration> const GetDocumentAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame);
|
||||||
css::uno::Reference<css::frame::XFrame> mxCachedDataFrame;
|
static css::uno::Reference<css::ui::XAcceleratorConfiguration> const GetModuleAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame);
|
||||||
css::uno::Reference<css::ui::XAcceleratorConfiguration> mxCachedDocumentAcceleratorConfiguration;
|
static css::uno::Reference<css::ui::XAcceleratorConfiguration> const GetGlobalAcceleratorConfiguration();
|
||||||
css::uno::Reference<css::ui::XAcceleratorConfiguration> mxCachedModuleAcceleratorConfiguration;
|
static OUString const GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame);
|
||||||
css::uno::Reference<css::ui::XAcceleratorConfiguration> mxCachedGlobalAcceleratorConfiguration;
|
static css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties (
|
||||||
OUString msCachedModuleIdentifier;
|
const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame);
|
||||||
css::uno::Reference<css::lang::XComponent> mxFrameListener;
|
static OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName,const Reference<frame::XFrame>& rxFrame);
|
||||||
|
static bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame);
|
||||||
CommandInfoProvider();
|
|
||||||
~CommandInfoProvider();
|
|
||||||
|
|
||||||
css::uno::Reference<css::ui::XAcceleratorConfiguration> const & GetDocumentAcceleratorConfiguration();
|
|
||||||
css::uno::Reference<css::ui::XAcceleratorConfiguration> const & GetModuleAcceleratorConfiguration();
|
|
||||||
css::uno::Reference<css::ui::XAcceleratorConfiguration> const & GetGlobalAcceleratorConfiguration();
|
|
||||||
OUString const & GetModuleIdentifier();
|
|
||||||
css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties (
|
|
||||||
const OUString& rsCommandName);
|
|
||||||
OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName);
|
|
||||||
bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName);
|
|
||||||
static OUString RetrieveShortcutsFromConfiguration(
|
static OUString RetrieveShortcutsFromConfiguration(
|
||||||
const css::uno::Reference<css::ui::XAcceleratorConfiguration>& rxConfiguration,
|
const css::uno::Reference<css::ui::XAcceleratorConfiguration>& rxConfiguration,
|
||||||
const OUString& rsCommandName);
|
const OUString& rsCommandName);
|
||||||
|
@ -32,12 +32,15 @@ private:
|
|||||||
/** Dispatcher. Need to keep a reference to it as long as this StatusListener exists. */
|
/** Dispatcher. Need to keep a reference to it as long as this StatusListener exists. */
|
||||||
css::uno::Reference<css::frame::XDispatch> mxDispatch;
|
css::uno::Reference<css::frame::XDispatch> mxDispatch;
|
||||||
css::util::URL maCommandURL;
|
css::util::URL maCommandURL;
|
||||||
|
css::uno::Reference<css::frame::XFrame> mxFrame;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override;
|
void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override;
|
||||||
|
|
||||||
void SAL_CALL disposing(const css::lang::EventObject& /*Source*/) override;
|
void SAL_CALL disposing(const css::lang::EventObject& /*Source*/) override;
|
||||||
|
|
||||||
|
const css::uno::Reference<css::frame::XFrame>& getFrame() { return mxFrame; }
|
||||||
|
|
||||||
void dispose();
|
void dispose();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -52,6 +55,8 @@ VclStatusListener<T>::VclStatusListener(T* widget, const rtl::OUString& aCommand
|
|||||||
if (!xFrame.is())
|
if (!xFrame.is())
|
||||||
xFrame = css::uno::Reference<css::frame::XFrame>(xDesktop, css::uno::UNO_QUERY);
|
xFrame = css::uno::Reference<css::frame::XFrame>(xDesktop, css::uno::UNO_QUERY);
|
||||||
|
|
||||||
|
mxFrame = xFrame;
|
||||||
|
|
||||||
css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(xFrame, css::uno::UNO_QUERY);
|
css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(xFrame, css::uno::UNO_QUERY);
|
||||||
if (!xDispatchProvider.is())
|
if (!xDispatchProvider.is())
|
||||||
return;
|
return;
|
||||||
@ -86,6 +91,7 @@ void VclStatusListener<T>::dispose()
|
|||||||
mxDispatch->removeStatusListener(this, maCommandURL);
|
mxDispatch->removeStatusListener(this, maCommandURL);
|
||||||
mxDispatch.clear();
|
mxDispatch.clear();
|
||||||
}
|
}
|
||||||
|
mxFrame.clear();
|
||||||
mWidget.clear();
|
mWidget.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,11 +241,11 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, vcl::W
|
|||||||
sSlotStr = ".uno:DuplicatePage";
|
sSlotStr = ".uno:DuplicatePage";
|
||||||
else
|
else
|
||||||
sSlotStr = ".uno:Undo";
|
sSlotStr = ".uno:Undo";
|
||||||
aSlotImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(sSlotStr, xFrame);
|
aSlotImage = vcl::CommandInfoProvider::GetImageForCommand(sSlotStr, xFrame);
|
||||||
|
|
||||||
OUString sSlotTitle;
|
OUString sSlotTitle;
|
||||||
if( bInsertPage )
|
if( bInsertPage )
|
||||||
sSlotTitle = vcl::CommandInfoProvider::Instance().GetLabelForCommand( sSlotStr, xFrame );
|
sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand( sSlotStr, xFrame );
|
||||||
else
|
else
|
||||||
sSlotTitle = SD_RESSTR( STR_RESET_LAYOUT );
|
sSlotTitle = SD_RESSTR( STR_RESET_LAYOUT );
|
||||||
appendEntry( 2, sSlotTitle, aSlotImage);
|
appendEntry( 2, sSlotTitle, aSlotImage);
|
||||||
|
@ -976,7 +976,7 @@ vcl::Window* ViewShellBase::GetViewWindow()
|
|||||||
OUString ViewShellBase::RetrieveLabelFromCommand( const OUString& aCmdURL ) const
|
OUString ViewShellBase::RetrieveLabelFromCommand( const OUString& aCmdURL ) const
|
||||||
{
|
{
|
||||||
Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY );
|
Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY );
|
||||||
return vcl::CommandInfoProvider::Instance().GetLabelForCommand( aCmdURL, xFrame );
|
return vcl::CommandInfoProvider::GetLabelForCommand( aCmdURL, xFrame );
|
||||||
}
|
}
|
||||||
|
|
||||||
int ViewShellBase::getPart() const
|
int ViewShellBase::getPart() const
|
||||||
|
@ -446,7 +446,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask ,
|
|||||||
OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* pWindow )
|
OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* pWindow )
|
||||||
{
|
{
|
||||||
OUString sModuleName = GetHelpModuleName_Impl();
|
OUString sModuleName = GetHelpModuleName_Impl();
|
||||||
OUString sRealCommand = vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( aCommandURL, getCurrentFrame() );
|
OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, getCurrentFrame() );
|
||||||
OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName );
|
OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName );
|
||||||
|
|
||||||
OString aNewHelpId;
|
OString aNewHelpId;
|
||||||
@ -564,7 +564,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
|
|||||||
|
|
||||||
if ( nProtocol == INetProtocol::Uno )
|
if ( nProtocol == INetProtocol::Uno )
|
||||||
// Command can be just an alias to another command.
|
// Command can be just an alias to another command.
|
||||||
aRealCommand = vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( rURL, getCurrentFrame() );
|
aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( rURL, getCurrentFrame() );
|
||||||
|
|
||||||
// no URL, just a HelpID (maybe empty in case of keyword search)
|
// no URL, just a HelpID (maybe empty in case of keyword search)
|
||||||
aHelpURL = CreateHelpURL_Impl( aRealCommand.isEmpty() ? rURL : aRealCommand, aHelpModuleName );
|
aHelpURL = CreateHelpURL_Impl( aRealCommand.isEmpty() ? rURL : aRealCommand, aHelpModuleName );
|
||||||
|
@ -125,7 +125,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
|
|||||||
// Add tooltip.
|
// Add tooltip.
|
||||||
if (xController.is())
|
if (xController.is())
|
||||||
{
|
{
|
||||||
const OUString sTooltip (vcl::CommandInfoProvider::Instance().GetTooltipForCommand(
|
const OUString sTooltip (vcl::CommandInfoProvider::GetTooltipForCommand(
|
||||||
rsCommandName,
|
rsCommandName,
|
||||||
rxFrame));
|
rxFrame));
|
||||||
pToolBox->SetQuickHelpText(nItemId, sTooltip);
|
pToolBox->SetQuickHelpText(nItemId, sTooltip);
|
||||||
|
@ -275,7 +275,7 @@ IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void)
|
|||||||
{
|
{
|
||||||
OUString aCommandURL = GetItemCommand(it.first);
|
OUString aCommandURL = GetItemCommand(it.first);
|
||||||
css::uno::Reference<frame::XFrame> xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
|
css::uno::Reference<frame::XFrame> xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
|
||||||
Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, xFrame, eImageType);
|
Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, xFrame, eImageType);
|
||||||
SetItemImage(it.first, aImage);
|
SetItemImage(it.first, aImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
|
|||||||
uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
|
uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
|
||||||
|
|
||||||
OUStringBuffer aBuffer( 60 );
|
OUStringBuffer aBuffer( 60 );
|
||||||
aBuffer.append( vcl::CommandInfoProvider::Instance().GetLabelForCommand(
|
aBuffer.append( vcl::CommandInfoProvider::GetLabelForCommand(
|
||||||
".uno:PrintDefault",
|
".uno:PrintDefault",
|
||||||
xFrame ));
|
xFrame ));
|
||||||
aBuffer.append( " (" );
|
aBuffer.append( " (" );
|
||||||
|
@ -180,7 +180,7 @@ void SmartTagMenuController::FillMenu()
|
|||||||
{
|
{
|
||||||
const OUString aCommand = ".uno:AutoCorrectDlg?OpenSmartTag:bool=true";
|
const OUString aCommand = ".uno:AutoCorrectDlg?OpenSmartTag:bool=true";
|
||||||
pVCLMenu->InsertSeparator();
|
pVCLMenu->InsertSeparator();
|
||||||
pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::Instance().GetPopupLabelForCommand( aCommand, m_xFrame ) );
|
pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aCommand, m_xFrame ) );
|
||||||
pVCLMenu->SetItemCommand( nMenuId, aCommand );
|
pVCLMenu->SetItemCommand( nMenuId, aCommand );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ void DefaultShapesPanel::populateShapes()
|
|||||||
{
|
{
|
||||||
sSlotStr = aSet.second[i];
|
sSlotStr = aSet.second[i];
|
||||||
aSlotImage = ::GetImage(mxFrame, sSlotStr, false);
|
aSlotImage = ::GetImage(mxFrame, sSlotStr, false);
|
||||||
sLabel = vcl::CommandInfoProvider::Instance().GetTooltipForCommand(sSlotStr, mxFrame);
|
sLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, mxFrame);
|
||||||
aSet.first->InsertItem(i, aSlotImage, sLabel);
|
aSet.first->InsertItem(i, aSlotImage, sLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1312,7 +1312,7 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString aWindowTitle = vcl::CommandInfoProvider::Instance().GetLabelForCommand( rCommand, rFrame );
|
OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand( rCommand, rFrame );
|
||||||
SetText( aWindowTitle );
|
SetText( aWindowTitle );
|
||||||
mpColorSet->SetAccessibleName( aWindowTitle );
|
mpColorSet->SetAccessibleName( aWindowTitle );
|
||||||
|
|
||||||
|
@ -810,15 +810,15 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
|
|||||||
{
|
{
|
||||||
case SID_OBJECT_ALIGN_UP :
|
case SID_OBJECT_ALIGN_UP :
|
||||||
case FN_FRAME_ALIGN_VERT_TOP:
|
case FN_FRAME_ALIGN_VERT_TOP:
|
||||||
sNewLabel = vcl::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignTop", GetFrame()->GetFrame().GetFrameInterface());
|
sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignTop", GetFrame()->GetFrame().GetFrameInterface());
|
||||||
break;
|
break;
|
||||||
case SID_OBJECT_ALIGN_MIDDLE:
|
case SID_OBJECT_ALIGN_MIDDLE:
|
||||||
case FN_FRAME_ALIGN_VERT_CENTER:
|
case FN_FRAME_ALIGN_VERT_CENTER:
|
||||||
sNewLabel = vcl::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignVerticalCenter", GetFrame()->GetFrame().GetFrameInterface());
|
sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignVerticalCenter", GetFrame()->GetFrame().GetFrameInterface());
|
||||||
break;
|
break;
|
||||||
case SID_OBJECT_ALIGN_DOWN:
|
case SID_OBJECT_ALIGN_DOWN:
|
||||||
case FN_FRAME_ALIGN_VERT_BOTTOM:
|
case FN_FRAME_ALIGN_VERT_BOTTOM:
|
||||||
sNewLabel = vcl::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignBottom", GetFrame()->GetFrame().GetFrameInterface());
|
sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignBottom", GetFrame()->GetFrame().GetFrameInterface());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -526,7 +526,6 @@ void DeInitVCL()
|
|||||||
|
|
||||||
if (pSVData->mpCommandInfoProvider)
|
if (pSVData->mpCommandInfoProvider)
|
||||||
{
|
{
|
||||||
pSVData->mpCommandInfoProvider->dispose();
|
|
||||||
pSVData->mpCommandInfoProvider = nullptr;
|
pSVData->mpCommandInfoProvider = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,128 +39,49 @@ using namespace css;
|
|||||||
using namespace css::uno;
|
using namespace css::uno;
|
||||||
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
typedef ::cppu::WeakComponentImplHelper <
|
|
||||||
css::frame::XFrameActionListener
|
|
||||||
> FrameListenerInterfaceBase;
|
|
||||||
class FrameListener
|
|
||||||
: public ::cppu::BaseMutex,
|
|
||||||
public FrameListenerInterfaceBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FrameListener (vcl::CommandInfoProvider& rInfoProvider, const Reference<frame::XFrame>& rxFrame)
|
|
||||||
: FrameListenerInterfaceBase(m_aMutex),
|
|
||||||
mrInfoProvider(rInfoProvider),
|
|
||||||
mxFrame(rxFrame)
|
|
||||||
{
|
|
||||||
if (mxFrame.is())
|
|
||||||
mxFrame->addFrameActionListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override
|
|
||||||
{
|
|
||||||
// The same frame can be reused for a different component, e.g.
|
|
||||||
// starting component from the start center, so need to re-init the cached data.
|
|
||||||
if (aEvent.Action == css::frame::FrameAction_COMPONENT_DETACHING)
|
|
||||||
mrInfoProvider.SetFrame(nullptr);
|
|
||||||
}
|
|
||||||
virtual void SAL_CALL disposing() override
|
|
||||||
{
|
|
||||||
if (mxFrame.is())
|
|
||||||
mxFrame->removeFrameActionListener(this);
|
|
||||||
}
|
|
||||||
virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override
|
|
||||||
{
|
|
||||||
(void)rEvent;
|
|
||||||
mrInfoProvider.SetFrame(nullptr);
|
|
||||||
mxFrame = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
vcl::CommandInfoProvider& mrInfoProvider;
|
|
||||||
Reference<frame::XFrame> mxFrame;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace vcl {
|
namespace vcl {
|
||||||
|
|
||||||
CommandInfoProvider& CommandInfoProvider::Instance()
|
CommandInfoProvider::CommandInfoProvider() { }
|
||||||
{
|
|
||||||
static CommandInfoProvider aProvider;
|
|
||||||
return aProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandInfoProvider::CommandInfoProvider()
|
|
||||||
: mxContext(comphelper::getProcessComponentContext()),
|
|
||||||
mxCachedDataFrame(),
|
|
||||||
mxCachedDocumentAcceleratorConfiguration(),
|
|
||||||
mxCachedModuleAcceleratorConfiguration(),
|
|
||||||
mxCachedGlobalAcceleratorConfiguration(),
|
|
||||||
msCachedModuleIdentifier(),
|
|
||||||
mxFrameListener()
|
|
||||||
{
|
|
||||||
ImplGetSVData()->mpCommandInfoProvider = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CommandInfoProvider::dispose()
|
|
||||||
{
|
|
||||||
if (mxFrameListener.is())
|
|
||||||
{
|
|
||||||
mxFrameListener->dispose();
|
|
||||||
mxFrameListener.clear();
|
|
||||||
}
|
|
||||||
mxCachedGlobalAcceleratorConfiguration.clear();
|
|
||||||
mxCachedModuleAcceleratorConfiguration.clear();
|
|
||||||
mxCachedDocumentAcceleratorConfiguration.clear();
|
|
||||||
mxCachedDataFrame.clear();
|
|
||||||
mxContext.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandInfoProvider::~CommandInfoProvider()
|
CommandInfoProvider::~CommandInfoProvider()
|
||||||
{
|
{
|
||||||
dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString CommandInfoProvider::GetLabelForCommand (
|
OUString CommandInfoProvider::GetLabelForCommand (
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const Reference<frame::XFrame>& rxFrame)
|
const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
SetFrame(rxFrame);
|
|
||||||
|
|
||||||
return GetCommandProperty("Name", rsCommandName);
|
return GetCommandProperty("Name", rsCommandName, rxFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString CommandInfoProvider::GetMenuLabelForCommand (
|
OUString CommandInfoProvider::GetMenuLabelForCommand (
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const Reference<frame::XFrame>& rxFrame)
|
const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
SetFrame(rxFrame);
|
|
||||||
|
|
||||||
// Here we want to use "Label", not "Name". "Name" is a stripped-down version of "Label" without accelerators
|
// 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.
|
// and ellipsis. In the menu, we want to have those accelerators and ellipsis.
|
||||||
return GetCommandProperty("Label", rsCommandName);
|
return GetCommandProperty("Label", rsCommandName, rxFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString CommandInfoProvider::GetPopupLabelForCommand (
|
OUString CommandInfoProvider::GetPopupLabelForCommand (
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const css::uno::Reference<css::frame::XFrame>& rxFrame)
|
const css::uno::Reference<css::frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
SetFrame(rxFrame);
|
|
||||||
|
|
||||||
OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName));
|
OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName, rxFrame));
|
||||||
if (!sPopupLabel.isEmpty())
|
if (!sPopupLabel.isEmpty())
|
||||||
return sPopupLabel;
|
return sPopupLabel;
|
||||||
return GetCommandProperty("Label", rsCommandName);
|
return GetCommandProperty("Label", rsCommandName, rxFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString CommandInfoProvider::GetTooltipForCommand (
|
OUString CommandInfoProvider::GetTooltipForCommand (
|
||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const Reference<frame::XFrame>& rxFrame)
|
const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
SetFrame(rxFrame);
|
|
||||||
|
|
||||||
OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName));
|
OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName, rxFrame));
|
||||||
if (sLabel.isEmpty()) {
|
if (sLabel.isEmpty()) {
|
||||||
sLabel = GetPopupLabelForCommand(rsCommandName, rxFrame);
|
sLabel = GetPopupLabelForCommand(rsCommandName, rxFrame);
|
||||||
// Remove '...' at the end and mnemonics (we don't want those in tooltips)
|
// Remove '...' at the end and mnemonics (we don't want those in tooltips)
|
||||||
@ -180,15 +101,14 @@ OUString CommandInfoProvider::GetTooltipForCommand (
|
|||||||
OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName,
|
OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName,
|
||||||
const Reference<frame::XFrame>& rxFrame)
|
const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
SetFrame(rxFrame);
|
|
||||||
|
|
||||||
OUString sShortcut;
|
OUString sShortcut;
|
||||||
|
|
||||||
sShortcut = RetrieveShortcutsFromConfiguration(GetDocumentAcceleratorConfiguration(), rsCommandName);
|
sShortcut = RetrieveShortcutsFromConfiguration(GetDocumentAcceleratorConfiguration(rxFrame), rsCommandName);
|
||||||
if (sShortcut.getLength() > 0)
|
if (sShortcut.getLength() > 0)
|
||||||
return sShortcut;
|
return sShortcut;
|
||||||
|
|
||||||
sShortcut = RetrieveShortcutsFromConfiguration(GetModuleAcceleratorConfiguration(), rsCommandName);
|
sShortcut = RetrieveShortcutsFromConfiguration(GetModuleAcceleratorConfiguration(rxFrame), rsCommandName);
|
||||||
if (sShortcut.getLength() > 0)
|
if (sShortcut.getLength() > 0)
|
||||||
return sShortcut;
|
return sShortcut;
|
||||||
|
|
||||||
@ -202,16 +122,14 @@ OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName,
|
|||||||
OUString CommandInfoProvider::GetRealCommandForCommand(const OUString& rCommandName,
|
OUString CommandInfoProvider::GetRealCommandForCommand(const OUString& rCommandName,
|
||||||
const css::uno::Reference<frame::XFrame>& rxFrame)
|
const css::uno::Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
SetFrame(rxFrame);
|
|
||||||
|
|
||||||
return GetCommandProperty("TargetURL", rCommandName);
|
return GetCommandProperty("TargetURL", rCommandName, rxFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapEx CommandInfoProvider::GetBitmapForCommand(const OUString& rsCommandName,
|
BitmapEx CommandInfoProvider::GetBitmapForCommand(const OUString& rsCommandName,
|
||||||
const Reference<frame::XFrame>& rxFrame,
|
const Reference<frame::XFrame>& rxFrame,
|
||||||
vcl::ImageType eImageType)
|
vcl::ImageType eImageType)
|
||||||
{
|
{
|
||||||
SetFrame(rxFrame);
|
|
||||||
|
|
||||||
if (rsCommandName.isEmpty())
|
if (rsCommandName.isEmpty())
|
||||||
return BitmapEx();
|
return BitmapEx();
|
||||||
@ -251,8 +169,8 @@ BitmapEx CommandInfoProvider::GetBitmapForCommand(const OUString& rsCommandName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(ui::theModuleUIConfigurationManagerSupplier::get(mxContext));
|
Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext()));
|
||||||
Reference<ui::XUIConfigurationManager> xUICfgMgr(xModuleCfgMgrSupplier->getUIConfigurationManager(GetModuleIdentifier()));
|
Reference<ui::XUIConfigurationManager> xUICfgMgr(xModuleCfgMgrSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));
|
||||||
|
|
||||||
Sequence< Reference<graphic::XGraphic> > aGraphicSeq;
|
Sequence< Reference<graphic::XGraphic> > aGraphicSeq;
|
||||||
Reference<ui::XImageManager> xModuleImageManager(xUICfgMgr->getImageManager(), UNO_QUERY);
|
Reference<ui::XImageManager> xModuleImageManager(xUICfgMgr->getImageManager(), UNO_QUERY);
|
||||||
@ -285,10 +203,9 @@ sal_Int32 CommandInfoProvider::GetPropertiesForCommand (
|
|||||||
const OUString& rsCommandName,
|
const OUString& rsCommandName,
|
||||||
const Reference<frame::XFrame>& rxFrame)
|
const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
SetFrame(rxFrame);
|
|
||||||
|
|
||||||
sal_Int32 nValue = 0;
|
sal_Int32 nValue = 0;
|
||||||
const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));
|
const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
|
||||||
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
|
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
|
||||||
{
|
{
|
||||||
if (aProperties[nIndex].Name == "Properties")
|
if (aProperties[nIndex].Name == "Properties")
|
||||||
@ -300,14 +217,14 @@ sal_Int32 CommandInfoProvider::GetPropertiesForCommand (
|
|||||||
return nValue;
|
return nValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandInfoProvider::IsRotated(const OUString& rsCommandName)
|
bool CommandInfoProvider::IsRotated(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName);
|
return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName, rxFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandInfoProvider::IsMirrored(const OUString& rsCommandName)
|
bool CommandInfoProvider::IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName);
|
return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName, rxFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
|
bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
|
||||||
@ -318,7 +235,7 @@ bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
|
|||||||
{
|
{
|
||||||
if( rModuleName.getLength() > 0)
|
if( rModuleName.getLength() > 0)
|
||||||
{
|
{
|
||||||
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
|
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
|
||||||
Reference<container::XNameAccess> xUICommandLabels;
|
Reference<container::XNameAccess> xUICommandLabels;
|
||||||
if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
|
if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
|
||||||
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
|
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
|
||||||
@ -339,100 +256,60 @@ bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandInfoProvider::SetFrame (const Reference<frame::XFrame>& rxFrame)
|
Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetDocumentAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
if (rxFrame != mxCachedDataFrame)
|
Reference<frame::XController> xController = rxFrame->getController();
|
||||||
|
if (xController.is())
|
||||||
{
|
{
|
||||||
// Detach from the old frame.
|
Reference<frame::XModel> xModel (xController->getModel());
|
||||||
if (mxFrameListener.is())
|
if (xModel.is())
|
||||||
{
|
{
|
||||||
mxFrameListener->dispose();
|
Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);
|
||||||
mxFrameListener = nullptr;
|
if (xSupplier.is())
|
||||||
}
|
|
||||||
|
|
||||||
// Release objects that are tied to the old frame.
|
|
||||||
mxCachedDocumentAcceleratorConfiguration = nullptr;
|
|
||||||
mxCachedModuleAcceleratorConfiguration = nullptr;
|
|
||||||
msCachedModuleIdentifier.clear();
|
|
||||||
mxCachedDataFrame = rxFrame;
|
|
||||||
|
|
||||||
// Connect to the new frame.
|
|
||||||
if (rxFrame.is())
|
|
||||||
mxFrameListener = new FrameListener(*this, rxFrame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference<ui::XAcceleratorConfiguration> const & CommandInfoProvider::GetDocumentAcceleratorConfiguration()
|
|
||||||
{
|
|
||||||
if ( ! mxCachedDocumentAcceleratorConfiguration.is())
|
|
||||||
{
|
|
||||||
// Get the accelerator configuration for the document.
|
|
||||||
if (mxCachedDataFrame.is())
|
|
||||||
{
|
|
||||||
Reference<frame::XController> xController = mxCachedDataFrame->getController();
|
|
||||||
if (xController.is())
|
|
||||||
{
|
{
|
||||||
Reference<frame::XModel> xModel (xController->getModel());
|
Reference<ui::XUIConfigurationManager> xConfigurationManager(
|
||||||
if (xModel.is())
|
xSupplier->getUIConfigurationManager(),
|
||||||
|
UNO_QUERY);
|
||||||
|
if (xConfigurationManager.is())
|
||||||
{
|
{
|
||||||
Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);
|
return xConfigurationManager->getShortCutManager();
|
||||||
if (xSupplier.is())
|
|
||||||
{
|
|
||||||
Reference<ui::XUIConfigurationManager> xConfigurationManager(
|
|
||||||
xSupplier->getUIConfigurationManager(),
|
|
||||||
UNO_QUERY);
|
|
||||||
if (xConfigurationManager.is())
|
|
||||||
{
|
|
||||||
mxCachedDocumentAcceleratorConfiguration = xConfigurationManager->getShortCutManager();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mxCachedDocumentAcceleratorConfiguration;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference<ui::XAcceleratorConfiguration> const & CommandInfoProvider::GetModuleAcceleratorConfiguration()
|
Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetModuleAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
if ( ! mxCachedModuleAcceleratorConfiguration.is())
|
css::uno::Reference<css::ui::XAcceleratorConfiguration> curModuleAcceleratorConfiguration;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext());
|
||||||
{
|
Reference<ui::XUIConfigurationManager> xManager (
|
||||||
Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::theModuleUIConfigurationManagerSupplier::get(mxContext);
|
xSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));
|
||||||
Reference<ui::XUIConfigurationManager> xManager (
|
if (xManager.is())
|
||||||
xSupplier->getUIConfigurationManager(GetModuleIdentifier()));
|
|
||||||
if (xManager.is())
|
|
||||||
{
|
|
||||||
mxCachedModuleAcceleratorConfiguration = xManager->getShortCutManager();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception&)
|
|
||||||
{
|
{
|
||||||
|
curModuleAcceleratorConfiguration = xManager->getShortCutManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mxCachedModuleAcceleratorConfiguration;
|
catch (Exception&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return curModuleAcceleratorConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference<ui::XAcceleratorConfiguration> const & CommandInfoProvider::GetGlobalAcceleratorConfiguration()
|
Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetGlobalAcceleratorConfiguration()
|
||||||
{
|
{
|
||||||
// Get the global accelerator configuration.
|
// Get the global accelerator configuration.
|
||||||
if ( ! mxCachedGlobalAcceleratorConfiguration.is())
|
return ui::GlobalAcceleratorConfiguration::create(comphelper::getProcessComponentContext());
|
||||||
{
|
|
||||||
mxCachedGlobalAcceleratorConfiguration = ui::GlobalAcceleratorConfiguration::create(mxContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mxCachedGlobalAcceleratorConfiguration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString const & CommandInfoProvider::GetModuleIdentifier()
|
OUString const CommandInfoProvider::GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
if (msCachedModuleIdentifier.getLength() == 0)
|
Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(comphelper::getProcessComponentContext());
|
||||||
{
|
return xModuleManager->identify(rxFrame);
|
||||||
Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(mxContext);
|
|
||||||
msCachedModuleIdentifier = xModuleManager->identify(mxCachedDataFrame);
|
|
||||||
}
|
|
||||||
return msCachedModuleIdentifier;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
|
OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
|
||||||
@ -462,15 +339,15 @@ OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
|
|||||||
return OUString();
|
return OUString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName)
|
bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
Sequence< OUString > aSequence;
|
Sequence< OUString > aSequence;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const OUString sModuleIdentifier (GetModuleIdentifier());
|
const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
|
||||||
if (!sModuleIdentifier.isEmpty())
|
if (!sModuleIdentifier.isEmpty())
|
||||||
{
|
{
|
||||||
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
|
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
|
||||||
Reference<container::XNameAccess> xUICommandLabels;
|
Reference<container::XNameAccess> xUICommandLabels;
|
||||||
if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) {
|
if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) {
|
||||||
xUICommandLabels->getByName(rsResourceName) >>= aSequence;
|
xUICommandLabels->getByName(rsResourceName) >>= aSequence;
|
||||||
@ -488,16 +365,16 @@ bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const O
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const OUString& rsCommandName)
|
Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
Sequence<beans::PropertyValue> aProperties;
|
Sequence<beans::PropertyValue> aProperties;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const OUString sModuleIdentifier (GetModuleIdentifier());
|
const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
|
||||||
if (sModuleIdentifier.getLength() > 0)
|
if (sModuleIdentifier.getLength() > 0)
|
||||||
{
|
{
|
||||||
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
|
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
|
||||||
Reference<container::XNameAccess> xUICommandLabels;
|
Reference<container::XNameAccess> xUICommandLabels;
|
||||||
if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels)
|
if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels)
|
||||||
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
|
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
|
||||||
@ -510,9 +387,9 @@ Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const O
|
|||||||
return aProperties;
|
return aProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString CommandInfoProvider::GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName)
|
OUString CommandInfoProvider::GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
|
||||||
{
|
{
|
||||||
const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));
|
const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
|
||||||
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
|
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
|
||||||
{
|
{
|
||||||
if (aProperties[nIndex].Name == rsProperty)
|
if (aProperties[nIndex].Name == rsProperty)
|
||||||
@ -536,7 +413,7 @@ OUString CommandInfoProvider::GetCommandPropertyFromModule( const OUString& rCom
|
|||||||
{
|
{
|
||||||
if( rModuleName.getLength() > 0)
|
if( rModuleName.getLength() > 0)
|
||||||
{
|
{
|
||||||
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
|
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
|
||||||
Reference<container::XNameAccess> xUICommandLabels;
|
Reference<container::XNameAccess> xUICommandLabels;
|
||||||
if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
|
if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
|
||||||
xUICommandLabels->getByName(rCommandName) >>= aProperties;
|
xUICommandLabels->getByName(rCommandName) >>= aProperties;
|
||||||
|
@ -879,15 +879,15 @@ namespace
|
|||||||
if (aCommand.isEmpty())
|
if (aCommand.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommand, rFrame));
|
OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aCommand, rFrame));
|
||||||
if (!aLabel.isEmpty())
|
if (!aLabel.isEmpty())
|
||||||
pButton->SetText(aLabel);
|
pButton->SetText(aLabel);
|
||||||
|
|
||||||
OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommand, rFrame));
|
OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(aCommand, rFrame));
|
||||||
if (!aTooltip.isEmpty())
|
if (!aTooltip.isEmpty())
|
||||||
pButton->SetQuickHelpText(aTooltip);
|
pButton->SetQuickHelpText(aTooltip);
|
||||||
|
|
||||||
Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, rFrame));
|
Image aImage(vcl::CommandInfoProvider::GetImageForCommand(aCommand, rFrame));
|
||||||
pButton->SetModeImage(aImage);
|
pButton->SetModeImage(aImage);
|
||||||
|
|
||||||
pButton->SetCommandHandler(aCommand);
|
pButton->SetCommandHandler(aCommand);
|
||||||
|
@ -510,9 +510,9 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::f
|
|||||||
|
|
||||||
if (rFrame.is())
|
if (rFrame.is())
|
||||||
{
|
{
|
||||||
OUString aLabel(CommandInfoProvider::Instance().GetPopupLabelForCommand(rCommand, rFrame));
|
OUString aLabel(CommandInfoProvider::GetPopupLabelForCommand(rCommand, rFrame));
|
||||||
OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
|
OUString aTooltip(CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
|
||||||
Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, rFrame));
|
Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame));
|
||||||
|
|
||||||
InsertItem(nItemId, aLabel, aImage);
|
InsertItem(nItemId, aLabel, aImage);
|
||||||
SetHelpText(nItemId, aTooltip);
|
SetHelpText(nItemId, aTooltip);
|
||||||
|
@ -4540,9 +4540,9 @@ void ToolBox::statusChanged( const css::frame::FeatureStateEvent& Event )
|
|||||||
// update image orientation
|
// update image orientation
|
||||||
for (std::vector<ImplToolItem>::const_iterator it = mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it)
|
for (std::vector<ImplToolItem>::const_iterator it = mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it)
|
||||||
{
|
{
|
||||||
if (vcl::CommandInfoProvider::Instance().IsMirrored(it->maCommandStr))
|
if (vcl::CommandInfoProvider::IsMirrored(it->maCommandStr, mpStatusListener->getFrame()))
|
||||||
SetItemImageMirrorMode(it->mnId, mbImagesMirrored);
|
SetItemImageMirrorMode(it->mnId, mbImagesMirrored);
|
||||||
if (vcl::CommandInfoProvider::Instance().IsRotated(it->maCommandStr))
|
if (vcl::CommandInfoProvider::IsRotated(it->maCommandStr, mpStatusListener->getFrame()))
|
||||||
SetItemImageAngle(it->mnId, mnImagesRotationAngle);
|
SetItemImageAngle(it->mnId, mnImagesRotationAngle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,8 +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,
|
void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css::frame::XFrame>& rFrame, ToolBoxItemBits nBits,
|
||||||
const Size& rRequestedSize, sal_uInt16 nPos)
|
const Size& rRequestedSize, sal_uInt16 nPos)
|
||||||
{
|
{
|
||||||
OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(rCommand, rFrame));
|
OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(rCommand, rFrame));
|
||||||
OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
|
OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
|
||||||
|
|
||||||
vcl::ImageType eImageType = vcl::ImageType::Size16;
|
vcl::ImageType eImageType = vcl::ImageType::Size16;
|
||||||
|
|
||||||
@ -442,8 +442,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css
|
|||||||
else if (GetToolboxButtonSize() == ToolBoxButtonSize::Size32)
|
else if (GetToolboxButtonSize() == ToolBoxButtonSize::Size32)
|
||||||
eImageType = vcl::ImageType::Size32;
|
eImageType = vcl::ImageType::Size32;
|
||||||
|
|
||||||
CommandInfoProvider& rInfoProvider = vcl::CommandInfoProvider::Instance();
|
Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame, eImageType));
|
||||||
Image aImage(rInfoProvider.GetImageForCommand(rCommand, rFrame, eImageType));
|
|
||||||
|
|
||||||
sal_uInt16 nItemId = GetItemCount() + 1;
|
sal_uInt16 nItemId = GetItemCount() + 1;
|
||||||
InsertItem(nItemId, aImage, aLabel, nBits, nPos);
|
InsertItem(nItemId, aImage, aLabel, nBits, nPos);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user