officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 2 sfx2/source/devtools/ObjectInspectorTreeHandler.cxx | 49 +++++----- 2 files changed, 28 insertions(+), 23 deletions(-)
New commits: commit 14589413c8d10bfe9186994b55d436331a97a43e Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Mar 15 19:14:17 2021 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Mar 16 03:42:19 2021 +0100 devtools: rename menu "Development Tool" to "Development Tools" Change-Id: I9da31857bfbf16c99bdf1a811395ab7346cf8d24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112550 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index fe562574ef86..7711f6f3da36 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -6536,7 +6536,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 </node> <node oor:name=".uno:DevelopmentToolsDockingWindow" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Development Tool</value> + <value xml:lang="en-US">Development Tools</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> <value>1</value> commit 42503d3e3004242b96d41c0722078fef6c69188a Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Mar 15 16:22:40 2021 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Mar 16 03:41:58 2021 +0100 devtools: extract conv. from enum value to name into a function This conversion is not that trivial, as it needs to access some reflection UNO classes, so extract it to its own function. Change-Id: Iafd1aa7443f21d90efe60c70f725c07f6638feb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112549 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx index d5a9c9b990cf..a912e51fe704 100644 --- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx +++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx @@ -49,6 +49,27 @@ namespace constexpr OUStringLiteral constTypeDescriptionManagerSingletonName = u"/singletons/com.sun.star.reflection.theTypeDescriptionManager"; +OUString enumValueToEnumName(uno::Any const& aValue, + uno::Reference<uno::XComponentContext> const& xContext) +{ + sal_Int32 nIntValue = 0; + if (!cppu::enum2int(nIntValue, aValue)) + return OUString(); + + uno::Reference<container::XHierarchicalNameAccess> xManager; + xManager.set(xContext->getValueByName(constTypeDescriptionManagerSingletonName), + uno::UNO_QUERY); + + uno::Reference<reflection::XEnumTypeDescription> xTypeDescription; + xTypeDescription.set(xManager->getByHierarchicalName(aValue.getValueType().getTypeName()), + uno::UNO_QUERY); + + uno::Sequence<sal_Int32> aValues = xTypeDescription->getEnumValues(); + sal_Int32 nValuesIndex = std::find(aValues.begin(), aValues.end(), nIntValue) - aValues.begin(); + uno::Sequence<OUString> aNames = xTypeDescription->getEnumNames(); + return aNames[nValuesIndex]; +} + /** converts any value to a string */ OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponentContext>& xContext) { @@ -56,7 +77,7 @@ OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponen // return early if we don't have any value if (!aValue.hasValue()) - return "NULL"; + return u"NULL"; uno::Type aValType = aValue.getValueType(); uno::TypeClass eType = aValType.getTypeClass(); @@ -67,14 +88,14 @@ OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponen { uno::Reference<uno::XInterface> xInterface(aValue, uno::UNO_QUERY); if (!xInterface.is()) - aRetStr = "NULL"; + aRetStr = u"NULL"; else - aRetStr = "<Object>"; + aRetStr = u"<Object>"; break; } case uno::TypeClass_STRUCT: { - aRetStr = "<Struct>"; + aRetStr = u"<Struct>"; break; } case uno::TypeClass_BOOLEAN: @@ -91,7 +112,7 @@ OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponen } case uno::TypeClass_STRING: { - aRetStr = "\"" + aValue.get<OUString>() + "\""; + aRetStr = u"\"" + aValue.get<OUString>() + u"\""; break; } case uno::TypeClass_FLOAT: @@ -156,23 +177,7 @@ OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponen } case uno::TypeClass_ENUM: { - sal_Int32 nIntValue = 0; - if (cppu::enum2int(nIntValue, aValue)) - { - uno::Reference<container::XHierarchicalNameAccess> xManager; - xManager.set(xContext->getValueByName(constTypeDescriptionManagerSingletonName), - uno::UNO_QUERY); - - uno::Reference<reflection::XEnumTypeDescription> xTypeDescription; - xTypeDescription.set(xManager->getByHierarchicalName(aValType.getTypeName()), - uno::UNO_QUERY); - - uno::Sequence<sal_Int32> aValues = xTypeDescription->getEnumValues(); - sal_Int32 nValuesIndex - = std::find(aValues.begin(), aValues.end(), nIntValue) - aValues.begin(); - uno::Sequence<OUString> aNames = xTypeDescription->getEnumNames(); - aRetStr = aNames[nValuesIndex]; - } + aRetStr = enumValueToEnumName(aValue, xContext); break; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits