[Libreoffice-commits] core.git: sfx2/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 12 15:01:21 UTC 2021


 sfx2/source/devtools/ObjectInspectorTreeHandler.cxx |   27 ++------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

New commits:
commit 4acad9bad5f17991c2e426348704fc5cdaabd8ec
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Mar 4 22:08:32 2021 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Mar 12 16:00:32 2021 +0100

    devtools: simplify getting the type name for Any object
    
    We actually don't need the XIdlClass to get the name for the type.
    
    Change-Id: Ie2a39ede1dcd7163120a40e64cca39a559796eeb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112112
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index 1977a30ce473..ea864bb7a8f1 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -50,22 +50,6 @@ namespace
 constexpr OUStringLiteral constTypeDescriptionManagerSingletonName
     = u"/singletons/com.sun.star.reflection.theTypeDescriptionManager";
 
-uno::Reference<reflection::XIdlClass>
-TypeToIdlClass(const uno::Type& rType, const uno::Reference<uno::XComponentContext>& xContext)
-{
-    auto xReflection = reflection::theCoreReflection::get(xContext);
-
-    uno::Reference<reflection::XIdlClass> xRetClass;
-    typelib_TypeDescription* pTD = nullptr;
-    rType.getDescription(&pTD);
-    if (pTD)
-    {
-        OUString sOWName(pTD->pTypeName);
-        xRetClass = xReflection->forName(sOWName);
-    }
-    return xRetClass;
-}
-
 OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponentContext>& xContext)
 {
     OUString aRetStr;
@@ -198,12 +182,7 @@ OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponen
     return aRetStr;
 }
 
-OUString getAnyType(const uno::Any& aValue, const uno::Reference<uno::XComponentContext>& xContext)
-{
-    uno::Type aValType = aValue.getValueType();
-    auto xIdlClass = TypeToIdlClass(aValType, xContext);
-    return xIdlClass->getName();
-}
+OUString getAnyType(const uno::Any& aValue) { return aValue.getValueType().getTypeName(); }
 
 // Object inspector nodes
 
@@ -399,7 +378,7 @@ public:
     std::vector<std::pair<sal_Int32, OUString>> getColumnValues() override
     {
         OUString aValue = AnyToString(maAny, mxContext);
-        OUString aType = getAnyType(maAny, mxContext);
+        OUString aType = getAnyType(maAny);
 
         return {
             { 1, aValue },
@@ -478,7 +457,7 @@ public:
         int nLength = xIdlArray->getLen(maAny);
 
         OUString aValue = "0 to " + OUString::number(nLength - 1);
-        OUString aType = getAnyType(maAny, mxContext);
+        OUString aType = getAnyType(maAny);
 
         return {
             { 1, aValue },


More information about the Libreoffice-commits mailing list