[Libreoffice-commits] core.git: extensions/source winaccessibility/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 7 09:51:42 UTC 2020


 extensions/source/ole/oleobjw.cxx                   |    6 +-
 extensions/source/ole/oleobjw.hxx                   |    7 +--
 winaccessibility/source/UAccCOM/AccEditableText.cxx |   44 ++++++++++----------
 winaccessibility/source/UAccCOM/AccEditableText.h   |    6 ++
 4 files changed, 34 insertions(+), 29 deletions(-)

New commits:
commit 3ee2868a0a27d27daa3845ce979ff5f862ca7f66
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Dec 7 09:16:39 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Dec 7 10:51:03 2020 +0100

    loplugin:stringviewparam (clang-cl)
    
    Change-Id: Ie29f1a5a66dd53d1e1fc9332ca4b817fa4eb43de
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107332
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 3985f51bc015..91f136a8a235 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -1521,7 +1521,7 @@ Reference<XInterface> IUnknownWrapper::createComWrapperInstance()
 }
 
 
-void IUnknownWrapper::getMethodInfo(const OUString& sName, TypeDescription& methodInfo)
+void IUnknownWrapper::getMethodInfo(std::u16string_view sName, TypeDescription& methodInfo)
 {
     TypeDescription desc= getInterfaceMemberDescOfCurrentCall(sName);
     if( desc.is())
@@ -1532,7 +1532,7 @@ void IUnknownWrapper::getMethodInfo(const OUString& sName, TypeDescription& meth
     }
 }
 
-void IUnknownWrapper::getAttributeInfo(const OUString& sName, TypeDescription& attributeInfo)
+void IUnknownWrapper::getAttributeInfo(std::u16string_view sName, TypeDescription& attributeInfo)
 {
     TypeDescription desc= getInterfaceMemberDescOfCurrentCall(sName);
     if( desc.is())
@@ -1544,7 +1544,7 @@ void IUnknownWrapper::getAttributeInfo(const OUString& sName, TypeDescription& a
         }
     }
 }
-TypeDescription IUnknownWrapper::getInterfaceMemberDescOfCurrentCall(const OUString& sName)
+TypeDescription IUnknownWrapper::getInterfaceMemberDescOfCurrentCall(std::u16string_view sName)
 {
     TypeDescription ret;
 
diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx
index 86e74cb56e19..b92039de4142 100644
--- a/extensions/source/ole/oleobjw.hxx
+++ b/extensions/source/ole/oleobjw.hxx
@@ -23,6 +23,7 @@
 #include "ole2uno.hxx"
 #include "wincrap.hxx"
 
+#include <string_view>
 #include <unordered_map>
 #include <vector>
 
@@ -149,11 +150,11 @@ protected:
     // These functions are for the case if an object of this class wraps an IDispatch
     // object that implements UNO interfaces. In that case the member m_seqTypes
     // is set through XInitialization::initialize.
-    void getMethodInfo(const OUString& sName, TypeDescription& methodDescription);
+    void getMethodInfo(std::u16string_view sName, TypeDescription& methodDescription);
     // After return attributInfo contains typelib_InterfaceAttributeTypeDescription::pAttributeTypeRef
-    void getAttributeInfo(const OUString& sName, TypeDescription& attributeInfo);
+    void getAttributeInfo(std::u16string_view sName, TypeDescription& attributeInfo);
     // used by get MethodInfo
-    TypeDescription  getInterfaceMemberDescOfCurrentCall(const OUString& sName);
+    TypeDescription  getInterfaceMemberDescOfCurrentCall(std::u16string_view sName);
     /** Returns always a valid ITypeInfo interface or throws a BridgeRuntimeError.
         The returned interface does not need to be AddRef'ed as long as it is locally
         used. The interface is kept in the instance of this class.
diff --git a/winaccessibility/source/UAccCOM/AccEditableText.cxx b/winaccessibility/source/UAccCOM/AccEditableText.cxx
index aa3e8f904a14..c290098d33dc 100644
--- a/winaccessibility/source/UAccCOM/AccEditableText.cxx
+++ b/winaccessibility/source/UAccCOM/AccEditableText.cxx
@@ -261,57 +261,57 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::setAttributes(long startOffs
  * @param   ouValue     the string of attribute value.
  * @param   rAny        the Any object to be returned.
  */
-void CAccEditableText::get_AnyFromOLECHAR(const OUString &ouName, const OUString &ouValue, Any &rAny)
+void CAccEditableText::get_AnyFromOLECHAR(std::u16string_view ouName, const OUString &ouValue, Any &rAny)
 {
-    if(ouName == "CharBackColor" ||
-            ouName == "CharColor" ||
-            ouName == "ParaAdjust" ||
-            ouName == "ParaFirstLineIndent" ||
-            ouName == "ParaLeftMargin" ||
-            ouName == "ParaRightMargin" ||
-            ouName == "ParaTopMargin" ||
-            ouName == "ParaBottomMargin" ||
-            ouName == "CharFontPitch" )
+    if(ouName == u"CharBackColor" ||
+            ouName == u"CharColor" ||
+            ouName == u"ParaAdjust" ||
+            ouName == u"ParaFirstLineIndent" ||
+            ouName == u"ParaLeftMargin" ||
+            ouName == u"ParaRightMargin" ||
+            ouName == u"ParaTopMargin" ||
+            ouName == u"ParaBottomMargin" ||
+            ouName == u"CharFontPitch" )
     {
         // Convert to int.
         // NOTE: CharFontPitch is not implemented in java file.
         sal_Int32 nValue = ouValue.toInt32();
         rAny.setValue(&nValue, cppu::UnoType<sal_Int32>::get());
     }
-    else if(ouName == "CharShadowed" ||
-            ouName == "CharContoured" )
+    else if(ouName == u"CharShadowed" ||
+            ouName == u"CharContoured" )
     {
         // Convert to boolean.
         rAny <<= ouValue.toBoolean();
     }
-    else if(ouName == "CharEscapement" ||
-            ouName == "CharStrikeout"  ||
-            ouName == "CharUnderline" ||
-            ouName == "CharFontPitch" )
+    else if(ouName == u"CharEscapement" ||
+            ouName == u"CharStrikeout"  ||
+            ouName == u"CharUnderline" ||
+            ouName == u"CharFontPitch" )
     {
         // Convert to short.
         short nValue = static_cast<short>(ouValue.toInt32());
         rAny.setValue(&nValue, cppu::UnoType<short>::get());
     }
-    else if(ouName == "CharHeight" ||
-            ouName == "CharWeight" )
+    else if(ouName == u"CharHeight" ||
+            ouName == u"CharWeight" )
     {
         // Convert to float.
         float fValue = ouValue.toFloat();
         rAny.setValue(&fValue, cppu::UnoType<float>::get());
     }
-    else if(ouName == "CharFontName" )
+    else if(ouName == u"CharFontName" )
     {
         // Convert to string.
         rAny.setValue(&ouValue, cppu::UnoType<OUString>::get());
     }
-    else if(ouName == "CharPosture" )
+    else if(ouName == u"CharPosture" )
     {
         // Convert to FontSlant.
         css::awt::FontSlant fontSlant = static_cast<css::awt::FontSlant>(ouValue.toInt32());
         rAny.setValue(&fontSlant, cppu::UnoType<css::awt::FontSlant>::get());
     }
-    else if(ouName == "ParaTabStops" )
+    else if(ouName == u"ParaTabStops" )
     {
 
         // Convert to the Sequence with TabStop element.
@@ -420,7 +420,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const OUString &ouName, const OUString
         // Assign to Any object.
         rAny.setValue(&seqTabStop, cppu::UnoType<Sequence< css::style::TabStop >>::get());
     }
-    else if(ouName == "ParaLineSpacing" )
+    else if(ouName == u"ParaLineSpacing" )
     {
         // Parse value string.
         css::style::LineSpacing lineSpacing;
diff --git a/winaccessibility/source/UAccCOM/AccEditableText.h b/winaccessibility/source/UAccCOM/AccEditableText.h
index 62bfc662d3b4..3925fc060024 100644
--- a/winaccessibility/source/UAccCOM/AccEditableText.h
+++ b/winaccessibility/source/UAccCOM/AccEditableText.h
@@ -20,6 +20,10 @@
 #ifndef INCLUDED_WINACCESSIBILITY_SOURCE_UACCCOM_ACCEDITABLETEXT_H
 #define INCLUDED_WINACCESSIBILITY_SOURCE_UACCCOM_ACCEDITABLETEXT_H
 
+#include <sal/config.h>
+
+#include <string_view>
+
 #include "Resource.h"
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
@@ -104,7 +108,7 @@ private:
 
     css::uno::Reference<css::accessibility::XAccessibleEditableText> pRXEdtTxt;
 
-    static void get_AnyFromOLECHAR(const OUString &ouName, const OUString &ouValue, css::uno::Any &rAny);
+    static void get_AnyFromOLECHAR(std::u16string_view ouName, const OUString &ouValue, css::uno::Any &rAny);
 
     css::accessibility::XAccessibleEditableText* GetXInterface()
     {


More information about the Libreoffice-commits mailing list