framework/source/fwe/classes/addonsoptions.cxx | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
New commits: commit 15d655f0133d986a85f4ba9630587566d90a0c50 Author: Maxim Monastirsky <momonas...@gmail.com> AuthorDate: Sun Aug 30 19:04:03 2020 +0300 Commit: Maxim Monastirsky <momonas...@gmail.com> CommitDate: Sun Aug 30 21:33:26 2020 +0200 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 <momonas...@gmail.com> 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); + } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits