summaryrefslogtreecommitdiff
path: root/framework/source
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2020-08-30 19:04:03 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2020-08-30 21:33:26 +0200
commit15d655f0133d986a85f4ba9630587566d90a0c50 (patch)
tree546b59981fb11904ef1ceeb258e6fe249f7f1526 /framework/source
parent2e21240f23ac2191a3535d697a7308b29303c67c (diff)
Related: tdf#107548 Make sure embedded images have higher priority
As documented in the schema, the dev guide and a comment in AddonsOptions_Impl::ReadImageData. Noticed the problem while testing the ProtocolHandlerAddon sdk example which has the ImageSmall props defined yet didn't show the icons. Turned out this was a result of the previous commit that fixed ImageSmallURL, which started now to override ImageSmall. Change-Id: I0a9eb6b13b73a60efc801905601894c862d68cba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101666 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework/source')
-rw-r--r--framework/source/fwe/classes/addonsoptions.cxx26
1 files changed, 14 insertions, 12 deletions
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index 4201a6a5f4f7..00766c66e208 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -256,7 +256,8 @@ class AddonsOptions_Impl : public ConfigItem
// accessed in this order
OneImageEntry aSizeEntry[2];
ImageEntry() {}
- void addImage(ImageSize eSize, const BitmapEx &rImage, const OUString &rURL);
+ void addImage(ImageSize eSize, const BitmapEx &rImage);
+ void addImage(ImageSize eSize, const OUString &rURL);
};
typedef std::unordered_map< OUString, ImageEntry > ImageManager;
@@ -349,11 +350,13 @@ class AddonsOptions_Impl : public ConfigItem
MergeStatusbarInstructionContainer m_aCachedStatusbarMergingInstructions;
};
-void AddonsOptions_Impl::ImageEntry::addImage(ImageSize eSize,
- const BitmapEx& rImage,
- const OUString &rURL)
+void AddonsOptions_Impl::ImageEntry::addImage(ImageSize eSize, const BitmapEx& rImage)
{
aSizeEntry[static_cast<int>(eSize)].aImage = rImage;
+}
+
+void AddonsOptions_Impl::ImageEntry::addImage(ImageSize eSize, const OUString &rURL)
+{
aSizeEntry[static_cast<int>(eSize)].aURL = rURL;
}
@@ -1608,8 +1611,7 @@ void AddonsOptions_Impl::ReadAndAssociateImages( const OUString& aURL, const OUS
aFileURL.appendAscii( aExtArray[i] );
aFileURL.append( ".bmp" );
- aImageEntry.addImage( !i ? IMGSIZE_SMALL : IMGSIZE_BIG,
- BitmapEx(), aFileURL.makeStringAndClear() );
+ aImageEntry.addImage( !i ? IMGSIZE_SMALL : IMGSIZE_BIG, aFileURL.makeStringAndClear() );
}
m_aImageManager.emplace( aURL, aImageEntry );
@@ -1639,7 +1641,7 @@ std::unique_ptr<AddonsOptions_Impl::ImageEntry> AddonsOptions_Impl::ReadImageDat
{
if ( !pEntry )
pEntry.reset(new ImageEntry);
- pEntry->addImage(i == OFFSET_IMAGES_SMALL ? IMGSIZE_SMALL : IMGSIZE_BIG, aImage, "");
+ pEntry->addImage(i == OFFSET_IMAGES_SMALL ? IMGSIZE_SMALL : IMGSIZE_BIG, aImage);
}
}
else if ( i == OFFSET_IMAGES_SMALL_URL || i == OFFSET_IMAGES_BIG_URL )
@@ -1649,11 +1651,11 @@ std::unique_ptr<AddonsOptions_Impl::ImageEntry> AddonsOptions_Impl::ReadImageDat
// Retrieve image data from an external bitmap file. Make sure that embedded image data
// has a higher priority.
- aPropertyData[i] >>= aImageURL;
-
- SubstituteVariables( aImageURL );
-
- pEntry->addImage(i == OFFSET_IMAGES_SMALL_URL ? IMGSIZE_SMALL : IMGSIZE_BIG, BitmapEx(), aImageURL);
+ if (aPropertyData[i] >>= aImageURL)
+ {
+ SubstituteVariables(aImageURL);
+ pEntry->addImage(i == OFFSET_IMAGES_SMALL_URL ? IMGSIZE_SMALL : IMGSIZE_BIG, aImageURL);
+ }
}
}