editeng/source/items/frmitems.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 5c9b00ff3d12cb5699cbd0158d12f8300488dc41
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Nov 6 21:43:29 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Nov 6 20:26:48 2024 +0100

    tdf#163748: checking Any's value type is anti-pattern
    
    The type could be XInterface - yet it may hold XGraphic. Testing
    for exact type would fail then.
    
    And it looks like Java bridge code does just that: a code like
    
      XGraphic graphic = xGraphicProvider.queryGraphic(v);
      xStyleProps.setPropertyValue("BackGraphic", graphic);
    
    sends the XGraphic as an Any with XInterface type (unlike a similar
    code in Basic). It's sad that we *move* tests to Python, instead of
    having both - it's not like "Python works -> Java would work, too".
    
    Change-Id: I5cd9b1f750e71895232b2c31174ef969a7b15b7c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176149
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 93d1c33fcc8f..74f28a1febb9 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -4377,14 +4377,12 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
         {
             Graphic aGraphic;
 
-            if (rVal.getValueType() == ::cppu::UnoType<OUString>::get())
+            if (OUString aURL; rVal >>= aURL)
             {
-                OUString aURL = rVal.get<OUString>();
                 aGraphic = vcl::graphic::loadFromURL(aURL);
             }
-            else if (rVal.getValueType() == 
cppu::UnoType<graphic::XGraphic>::get())
+            else if (uno::Reference<graphic::XGraphic> xGraphic; rVal >>= 
xGraphic)
             {
-                auto xGraphic = rVal.get<uno::Reference<graphic::XGraphic>>();
                 aGraphic = Graphic(xGraphic);
             }
 

Reply via email to