tdf#130445 Use actual icon size

maImageSize was always 0x0, unless the image list was
first loaded from a correctly saved file. Just drop it,
and use the actual size of the first icon of the list.

Change-Id: Ifcda130ed1acdde7ce53dda6f4e1b3636be2bb03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102224
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
(cherry picked from commit 8ef781e68f66a9bf7501ef82ee5625b3758b6c88)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103621
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/framework/source/uiconfiguration/ImageList.cxx b/framework/source/uiconfiguration/ImageList.cxx
index dfe936b..8e775ae 100644
--- a/framework/source/uiconfiguration/ImageList.cxx
+++ b/framework/source/uiconfiguration/ImageList.cxx
@@ -44,16 +44,16 @@ BitmapEx ImageList::GetAsHorizontalStrip() const
    sal_uInt16 nCount = maImages.size();
    if( !nCount )
        return BitmapEx();
    Size aSize( maImageSize.Width() * nCount, maImageSize.Height() );

    BitmapEx aTempl = maImages[ 0 ]->maImage.GetBitmapEx();
    Size aImageSize(aTempl.GetSizePixel());
    Size aSize(aImageSize.Width() * nCount, aImageSize.Height());
    BitmapEx aResult( aTempl, Point(), aSize );

    tools::Rectangle aSrcRect( Point( 0, 0 ), maImageSize );
    tools::Rectangle aSrcRect( Point( 0, 0 ), aImageSize );
    for (sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++)
    {
        tools::Rectangle aDestRect( Point( nIdx * maImageSize.Width(), 0 ),
                             maImageSize );
        tools::Rectangle aDestRect( Point( nIdx * aImageSize.Width(), 0 ), aImageSize );
        ImageAryData *pData = maImages[ nIdx ].get();
        BitmapEx aTmp = pData->maImage.GetBitmapEx();
        aResult.CopyPixel( aDestRect, aSrcRect, &aTmp);
@@ -77,7 +77,6 @@ void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx,
    maImages.clear();
    maNameHash.clear();
    maImages.reserve( nItems );
    maImageSize = aSize;
    maPrefix.clear();

    for (sal_uInt16 nIdx = 0; nIdx < nItems; nIdx++)
diff --git a/framework/source/uiconfiguration/ImageList.hxx b/framework/source/uiconfiguration/ImageList.hxx
index 7a7af3d..946805f 100644
--- a/framework/source/uiconfiguration/ImageList.hxx
+++ b/framework/source/uiconfiguration/ImageList.hxx
@@ -65,7 +65,6 @@ private:
    std::vector< std::unique_ptr<ImageAryData> >   maImages;
    std::unordered_map< OUString, ImageAryData * > maNameHash;
    OUString               maPrefix;
    Size                   maImageSize;

    sal_uInt16  ImplGetImageId( const OUString& rImageName ) const;
    void ImplAddImage( const OUString &aPrefix, const OUString &aName, sal_uInt16 nId, const Image &aImage );