diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2020-08-30 19:04:03 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2020-08-30 21:33:26 +0200 |
commit | 15d655f0133d986a85f4ba9630587566d90a0c50 (patch) | |
tree | 546b59981fb11904ef1ceeb258e6fe249f7f1526 /framework | |
parent | 2e21240f23ac2191a3535d697a7308b29303c67c (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')
-rw-r--r-- | framework/source/fwe/classes/addonsoptions.cxx | 26 |
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); + } } } |