Remove remains of private:image/ via ImageIdentifier addon property
This is broken since commit5c39b28a87("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 commit2559cab126("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>
This commit is contained in:
@@ -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 );
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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() );
|
||||
|
||||
@@ -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 ) )
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
@@ -151,12 +149,6 @@ void ToolBarMerger::ConvertSeqSeqToVector(
|
||||
Contains the value of the property with
|
||||
Name="Title"
|
||||
|
||||
@param
|
||||
rImageIdentifier
|
||||
|
||||
Contains the value of the property with
|
||||
Name="ImageIdentifier"
|
||||
|
||||
@param
|
||||
rTarget
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user