diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2020-08-23 19:18:33 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2020-08-31 15:19:43 +0200 |
commit | 3e4968e6761c816c0a6aedf59485191af8a0fa4e (patch) | |
tree | e76c68df11b6f26ba5f27bb3e25e60eeb0880944 /framework | |
parent | 9bf4e2aa77c208d09b32c3638afab6f904bf0257 (diff) |
Remove remains of private:image/ via ImageIdentifier addon property
This is broken since commit 5c39b28a87060f80404079ab77604f664addb063
("tdf#96059 Replaced imageproducer with CommandInfoProvider") but so
far no one complained (maybe because the usefulness of such internal
images from extensions is questionable at least). Given also that
the whole ImageIdentifier feature (even its still working part) is
obsolete since OOo 2.0.3 (according to the OOo dev guide), and that
the availability of a particular image from an internal hardcoded
image list by a particular numerical id is more an implementation
detail, let's just remove the broken code instead of fixing it.
In the meantime, the code was also copied into the newly introduced
notebookbar addon code, so I handled it there too.
There are also the registry schema and a sdk example that mention this
feature, and need to be adjusted. Interesting that the particular
example used there - private:image/3216 is actually broken since 2011
with commit 2559cab126f81375197051fb5b07ba6abb9efc77
("FDO#42454 - EasyHack: remove code associated with unused icons").
Change-Id: I968b4fb8c5b207654476dd92c57d8db0815520ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101529
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/addonmenu.hxx | 1 | ||||
-rw-r--r-- | framework/inc/uielement/toolbarmerger.hxx | 2 | ||||
-rw-r--r-- | framework/source/fwe/classes/addonmenu.cxx | 10 | ||||
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 32 | ||||
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 3 | ||||
-rw-r--r-- | framework/source/uielement/toolbarmerger.cxx | 11 |
6 files changed, 8 insertions, 51 deletions
diff --git a/framework/inc/addonmenu.hxx b/framework/inc/addonmenu.hxx index dbffa8c1e495..0b778b705afe 100644 --- a/framework/inc/addonmenu.hxx +++ b/framework/inc/addonmenu.hxx @@ -74,7 +74,6 @@ class AddonMenuManager OUString& rTitle, OUString& rURL, OUString& rTarget, - OUString& rImageId, OUString& rContext, css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rAddonSubMenu ); }; diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index f89bd8c6a1c3..d3ccc1c8cbcb 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -42,7 +42,6 @@ struct AddonToolbarItem { OUString aCommandURL; OUString aLabel; - OUString aImageIdentifier; OUString aTarget; OUString aContext; OUString aControlType; @@ -68,7 +67,6 @@ class ToolBarMerger static void ConvertSequenceToValues( const css::uno::Sequence< css::beans::PropertyValue >& rSequence, OUString& rCommandURL, OUString& rLabel, - OUString& rImageIdentifier, OUString& rTarget, OUString& rContext, OUString& rControlType, diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx index 80ac7c0e0850..22e24655350b 100644 --- a/framework/source/fwe/classes/addonmenu.cxx +++ b/framework/source/fwe/classes/addonmenu.cxx @@ -144,7 +144,6 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame, OUString aTitle; OUString aURL; OUString aTarget; - OUString aImageId; OUString aContext; Sequence< Sequence< PropertyValue > > aAddonSubMenu; sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START; @@ -158,7 +157,6 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame, aTitle, aURL, aTarget, - aImageId, aContext, aAddonSubMenu ); if ( !aTitle.isEmpty() && @@ -202,12 +200,11 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent OUString aTitle; OUString aURL; OUString aTarget; - OUString aImageId; OUString aContext; for ( i = 0; i < nCount; ++i ) { - GetMenuEntry( aAddonMenuDefinition[i], aTitle, aURL, aTarget, aImageId, aContext, aAddonSubMenu ); + GetMenuEntry( aAddonMenuDefinition[i], aTitle, aURL, aTarget, aContext, aAddonSubMenu ); if ( !IsCorrectContext( rModuleIdentifier, aContext ) || ( aTitle.isEmpty() && aURL.isEmpty() )) continue; @@ -248,7 +245,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent // Store values from configuration to the New and Wizard menu entries to enable // sfx2 based code to support high contrast mode correctly! - void* nAttributePtr = MenuAttributes::CreateAttribute(aTarget, aImageId); + void* nAttributePtr = MenuAttributes::CreateAttribute(aTarget, OUString()); pCurrentMenu->SetUserValue(nId, nAttributePtr, MenuAttributes::ReleaseAttribute); pCurrentMenu->SetItemCommand( nId, aURL ); @@ -263,7 +260,6 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu OUString& rTitle, OUString& rURL, OUString& rTarget, - OUString& rImageId, OUString& rContext, Sequence< Sequence< PropertyValue > >& rAddonSubMenu ) { @@ -279,8 +275,6 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu rEntry.Value >>= rTitle; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_TARGET ) rEntry.Value >>= rTarget; - else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_IMAGEIDENTIFIER ) - rEntry.Value >>= rImageId; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_SUBMENU ) rEntry.Value >>= rAddonSubMenu; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_CONTEXT ) diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index cbe4f5ebf64f..6b892148b29f 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -1726,34 +1726,12 @@ void MenuBarManager::FillMenuImages(Reference< XFrame > const & _xFrame, Menu* _ if ( bTmpShowMenuImages ) { - bool bImageSet = false; - OUString aImageId; + OUString aMenuItemCommand = _pMenu->GetItemCommand( nId ); + Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aMenuItemCommand, _xFrame); + if ( !aImage ) + aImage = Image(aAddonOptions.GetImageFromURL(aMenuItemCommand, false)); - ::framework::MenuAttributes* pMenuAttributes = - static_cast< ::framework::MenuAttributes*>(_pMenu->GetUserValue( nId )); - - if ( pMenuAttributes ) - aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes - - if ( !aImageId.isEmpty() ) - { - Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, _xFrame); - if ( !!aImage ) - { - bImageSet = true; - _pMenu->SetItemImage( nId, aImage ); - } - } - - if ( !bImageSet ) - { - OUString aMenuItemCommand = _pMenu->GetItemCommand( nId ); - Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aMenuItemCommand, _xFrame); - if ( !aImage ) - aImage = Image(aAddonOptions.GetImageFromURL(aMenuItemCommand, false)); - - _pMenu->SetItemImage( nId, aImage ); - } + _pMenu->SetItemImage( nId, aImage ); } else _pMenu->SetItemImage( nId, Image() ); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index b36a24d4784d..7fa0393f9f0c 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -1185,13 +1185,12 @@ void ToolBarManager::FillAddonToolbar( const Sequence< Sequence< PropertyValue > { OUString aURL; OUString aTitle; - OUString aImageId; OUString aContext; OUString aTarget; OUString aControlType; sal_uInt16 nWidth( 0 ); - ToolBarMerger::ConvertSequenceToValues( rSeq, aURL, aTitle, aImageId, aTarget, aContext, aControlType, nWidth ); + ToolBarMerger::ConvertSequenceToValues( rSeq, aURL, aTitle, aTarget, aContext, aControlType, nWidth ); if ( ToolBarMerger::IsCorrectContext( aContext, m_aModuleIdentifier ) ) { diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx index 771fbbe5df01..ad00c3b9800b 100644 --- a/framework/source/uielement/toolbarmerger.cxx +++ b/framework/source/uielement/toolbarmerger.cxx @@ -35,7 +35,6 @@ namespace framework const char MERGE_TOOLBAR_URL[] = "URL"; const char MERGE_TOOLBAR_TITLE[] = "Title"; -const char MERGE_TOOLBAR_IMAGEID[] = "ImageIdentifier"; const char MERGE_TOOLBAR_CONTEXT[] = "Context"; const char MERGE_TOOLBAR_TARGET[] = "Target"; const char MERGE_TOOLBAR_CONTROLTYPE[] = "ControlType"; @@ -121,7 +120,6 @@ void ToolBarMerger::ConvertSeqSeqToVector( ConvertSequenceToValues( rSequence[i], aAddonToolbarItem.aCommandURL, aAddonToolbarItem.aLabel, - aAddonToolbarItem.aImageIdentifier, aAddonToolbarItem.aTarget, aAddonToolbarItem.aContext, aAddonToolbarItem.aControlType, @@ -152,12 +150,6 @@ void ToolBarMerger::ConvertSeqSeqToVector( Name="Title" @param - rImageIdentifier - - Contains the value of the property with - Name="ImageIdentifier" - - @param rTarget Contains the value of the property with @@ -184,7 +176,6 @@ void ToolBarMerger::ConvertSequenceToValues( const uno::Sequence< beans::PropertyValue >& rSequence, OUString& rCommandURL, OUString& rLabel, - OUString& rImageIdentifier, OUString& rTarget, OUString& rContext, OUString& rControlType, @@ -196,8 +187,6 @@ void ToolBarMerger::ConvertSequenceToValues( prop.Value >>= rCommandURL; else if ( prop.Name == MERGE_TOOLBAR_TITLE ) prop.Value >>= rLabel; - else if ( prop.Name == MERGE_TOOLBAR_IMAGEID ) - prop.Value >>= rImageIdentifier; else if ( prop.Name == MERGE_TOOLBAR_CONTEXT ) prop.Value >>= rContext; else if ( prop.Name == MERGE_TOOLBAR_TARGET ) |