summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2020-08-23 19:18:33 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2020-08-31 15:19:43 +0200
commit3e4968e6761c816c0a6aedf59485191af8a0fa4e (patch)
treee76c68df11b6f26ba5f27bb3e25e60eeb0880944
parent9bf4e2aa77c208d09b32c3638afab6f904bf0257 (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>
-rw-r--r--framework/inc/addonmenu.hxx1
-rw-r--r--framework/inc/uielement/toolbarmerger.hxx2
-rw-r--r--framework/source/fwe/classes/addonmenu.cxx10
-rw-r--r--framework/source/uielement/menubarmanager.cxx32
-rw-r--r--framework/source/uielement/toolbarmanager.cxx3
-rw-r--r--framework/source/uielement/toolbarmerger.cxx11
-rw-r--r--include/vcl/NotebookBarAddonsMerger.hxx8
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu15
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Addons.xcs12
-rw-r--r--pyuno/demo/Addons.xcu3
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx15
-rw-r--r--vcl/source/window/NotebookBarAddonsMerger.cxx7
12 files changed, 20 insertions, 99 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 )
diff --git a/include/vcl/NotebookBarAddonsMerger.hxx b/include/vcl/NotebookBarAddonsMerger.hxx
index c1fea5391683..20d6a7b71aef 100644
--- a/include/vcl/NotebookBarAddonsMerger.hxx
+++ b/include/vcl/NotebookBarAddonsMerger.hxx
@@ -38,18 +38,10 @@ struct NotebookBarAddonsItem
std::vector<css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>>> aAddonValues;
};
-struct AddonsParams
-{
- OUString sImageId;
- OUString sControlType;
- sal_uInt16 nWidth;
-};
-
struct AddonNotebookBarItem
{
OUString sCommandURL;
OUString sLabel;
- OUString sImageIdentifier;
OUString sTarget;
OUString sContext;
OUString sControlType;
diff --git a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu
index e9b9976d312e..2568a7c4f8e6 100644
--- a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu
+++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu
@@ -29,11 +29,6 @@
</prop>
- <prop oor:name="ImageIdentifier" oor:type="xs:string">
- <value>private:image/3216</value>
-
- </prop>
-
<prop oor:name="Title" oor:type="xs:string">
<!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. If it is not necessary. -->
<value xml:lang="x-no-translate"></value>
@@ -53,11 +48,6 @@
</prop>
- <prop oor:name="ImageIdentifier" oor:type="xs:string">
- <value>private:image/3216</value>
-
- </prop>
-
<prop oor:name="Title" oor:type="xs:string">
<!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. If it is not necessary. -->
<value xml:lang="x-no-translate"></value>
@@ -77,11 +67,6 @@
</prop>
- <prop oor:name="ImageIdentifier" oor:type="xs:string">
- <value>private:image/3216</value>
-
- </prop>
-
<prop oor:name="Title" oor:type="xs:string">
<!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. If it is not necessary. -->
<value xml:lang="x-no-translate"></value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Addons.xcs b/officecfg/registry/schema/org/openoffice/Office/Addons.xcs
index 98d08a7b2f3a..98f4bf85fd63 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Addons.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Addons.xcs
@@ -38,7 +38,9 @@
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<info>
- <desc>A private URL used to reference an optional internal menu image. Example: private:image/3216 addresses the internal Office image with id=3216.</desc>
+ <desc>A base name for an image to be used for the given URL. _26.bmp and _16.bmp are
+ appended to that base name for large or small size icons respectively. Has higher
+ priority than images defined in the Images set.</desc>
</info>
</prop>
<prop oor:name="Target" oor:type="xs:string">
@@ -168,7 +170,9 @@
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<info>
- <desc>A private URL used to reference an optional internal menu image. Example: private:image/3216 addresses the internal Office image with id=3216.</desc>
+ <desc>A base name for an image to be used for the given URL. _26.bmp and _16.bmp are
+ appended to that base name for large or small size icons respectively. Has higher
+ priority than images defined in the Images set.</desc>
</info>
</prop>
<prop oor:name="Target" oor:type="xs:string">
@@ -351,7 +355,9 @@
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<info>
- <desc>A private URL used to reference an optional internal menu image. Example: private:image/3216 addresses the internal Office image with id=3216.</desc>
+ <desc>A base name for an image to be used for the given URL. _26.bmp and _16.bmp are
+ appended to that base name for large or small size icons respectively. Has higher
+ priority than images defined in the Images set.</desc>
</info>
</prop>
<prop oor:name="Target" oor:type="xs:string">
diff --git a/pyuno/demo/Addons.xcu b/pyuno/demo/Addons.xcu
index b3e62f302529..59d2d1856335 100644
--- a/pyuno/demo/Addons.xcu
+++ b/pyuno/demo/Addons.xcu
@@ -26,9 +26,6 @@
<prop oor:name="URL" oor:type="xs:string">
<value>service:org.openoffice.comp.pyuno.demo.HelloWorld?insert</value>
</prop>
- <prop oor:name="ImageIdentifier" oor:type="xs:string">
- <value>private:image/3216</value>
- </prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="x-no-translate">Insert Hello World</value>
<value xml:lang="en-US">Insert Hello World</value>
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 16a0608f7b30..bacaf48e56f4 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -41,7 +41,6 @@ using namespace css;
#define MENUBAR_STR "private:resource/menubar/menubar"
const char MERGE_NOTEBOOKBAR_URL[] = "URL";
-const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier";
bool SfxNotebookBar::m_bLock = false;
bool SfxNotebookBar::m_bHide = false;
@@ -65,24 +64,12 @@ static void NotebookbarAddonValues(
for (const auto& rProp : rExtensionVal)
{
OUString sImage;
- if (rProp.Name == MERGE_NOTEBOOKBAR_IMAGEID)
+ if (rProp.Name == MERGE_NOTEBOOKBAR_URL)
{
rProp.Value >>= sImage;
aImage = Image(framework::AddonsOptions().GetImageFromURL(sImage, isBigImage));
}
}
- if(!aImage)
- {
- for (const auto& rProp : rExtensionVal)
- {
- OUString sImage;
- if (rProp.Name == MERGE_NOTEBOOKBAR_URL)
- {
- rProp.Value >>= sImage;
- aImage = Image(framework::AddonsOptions().GetImageFromURL(sImage, isBigImage));
- }
- }
- }
aImageValues.push_back(aImage);
}
aExtensionValues.push_back(aExtension);
diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx b/vcl/source/window/NotebookBarAddonsMerger.cxx
index c8c3c4bd2288..7ab27c038f13 100644
--- a/vcl/source/window/NotebookBarAddonsMerger.cxx
+++ b/vcl/source/window/NotebookBarAddonsMerger.cxx
@@ -33,7 +33,6 @@ const char STYLE_ICON[] = "Icon";
const char MERGE_NOTEBOOKBAR_URL[] = "URL";
const char MERGE_NOTEBOOKBAR_TITLE[] = "Title";
-const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier";
const char MERGE_NOTEBOOKBAR_CONTEXT[] = "Context";
const char MERGE_NOTEBOOKBAR_TARGET[] = "Target";
const char MERGE_NOTEBOOKBAR_CONTROLTYPE[] = "ControlType";
@@ -49,8 +48,6 @@ static void GetAddonNotebookBarItem(const css::uno::Sequence<css::beans::Propert
i.Value >>= aAddonNotebookBarItem.sCommandURL;
else if (i.Name == MERGE_NOTEBOOKBAR_TITLE)
i.Value >>= aAddonNotebookBarItem.sLabel;
- else if (i.Name == MERGE_NOTEBOOKBAR_IMAGEID)
- i.Value >>= aAddonNotebookBarItem.sImageIdentifier;
else if (i.Name == MERGE_NOTEBOOKBAR_CONTEXT)
i.Value >>= aAddonNotebookBarItem.sContext;
else if (i.Name == MERGE_NOTEBOOKBAR_TARGET)
@@ -89,8 +86,8 @@ static void CreateNotebookBarToolBox(vcl::Window* pNotebookbarToolBox,
sImage = aImageVec[nIter];
if (!sImage)
{
- sImage = vcl::CommandInfoProvider::GetImageForCommand(
- aAddonNotebookBarItem.sImageIdentifier, m_xFrame);
+ sImage = vcl::CommandInfoProvider::GetImageForCommand(aAddonNotebookBarItem.sCommandURL,
+ m_xFrame);
}
}