[Libreoffice-commits] core.git: editeng/source include/editeng
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 22 21:23:02 UTC 2021
editeng/source/uno/unofield.cxx | 35 ++++++++++++++++++++---------------
include/editeng/unofield.hxx | 3 ++-
2 files changed, 22 insertions(+), 16 deletions(-)
New commits:
commit 59646d3fa4fab037ccedc7ebe765de11d5016f3f
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Sep 22 20:28:09 2021 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Sep 22 23:22:26 2021 +0200
Extend loplugin:stringviewparam to starts/endsWith: editeng
Change-Id: Ic275bbd167e69060f6442ceed6c4dd88733d5e1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122486
Tested-by: Stephan Bergmann <sbergman at redhat.com>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 0e1dab6db253..765a40349075 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -17,8 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/text/FilenameDisplayFormat.hpp>
+#include <o3tl/string_view.hxx>
#include <vcl/svapp.hxx>
#include <tools/debug.hxx>
#include <svl/itemprop.hxx>
@@ -893,57 +898,57 @@ sal_Bool SAL_CALL SvxUnoTextField::supportsService( const OUString& ServiceName
return cppu::supportsService( this, ServiceName );
}
-uno::Reference< uno::XInterface > SvxUnoTextCreateTextField( const OUString& ServiceSpecifier )
+uno::Reference< uno::XInterface > SvxUnoTextCreateTextField( std::u16string_view ServiceSpecifier )
{
uno::Reference< uno::XInterface > xRet;
// #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is
// fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
- OUString aFieldType;
- if( (ServiceSpecifier.startsWith( "com.sun.star.text.textfield.", &aFieldType )) ||
- (ServiceSpecifier.startsWith( "com.sun.star.text.TextField.", &aFieldType )) )
+ std::u16string_view aFieldType;
+ if( (o3tl::starts_with( ServiceSpecifier, u"com.sun.star.text.textfield.", &aFieldType )) ||
+ (o3tl::starts_with( ServiceSpecifier, u"com.sun.star.text.TextField.", &aFieldType )) )
{
sal_Int32 nId = text::textfield::Type::UNSPECIFIED;
- if ( aFieldType == "DateTime" )
+ if ( aFieldType == u"DateTime" )
{
nId = text::textfield::Type::DATE;
}
- else if ( aFieldType == "URL" )
+ else if ( aFieldType == u"URL" )
{
nId = text::textfield::Type::URL;
}
- else if ( aFieldType == "PageNumber" )
+ else if ( aFieldType == u"PageNumber" )
{
nId = text::textfield::Type::PAGE;
}
- else if ( aFieldType == "PageCount" )
+ else if ( aFieldType == u"PageCount" )
{
nId = text::textfield::Type::PAGES;
}
- else if ( aFieldType == "SheetName" )
+ else if ( aFieldType == u"SheetName" )
{
nId = text::textfield::Type::TABLE;
}
- else if ( aFieldType == "FileName" )
+ else if ( aFieldType == u"FileName" )
{
nId = text::textfield::Type::EXTENDED_FILE;
}
- else if (aFieldType == "docinfo.Title" ||
- aFieldType == "DocInfo.Title" )
+ else if (aFieldType == u"docinfo.Title" ||
+ aFieldType == u"DocInfo.Title" )
{
nId = text::textfield::Type::DOCINFO_TITLE;
}
- else if ( aFieldType == "Author" )
+ else if ( aFieldType == u"Author" )
{
nId = text::textfield::Type::AUTHOR;
}
- else if ( aFieldType == "Measure" )
+ else if ( aFieldType == u"Measure" )
{
nId = text::textfield::Type::MEASURE;
}
- else if (aFieldType == "DocInfo.Custom")
+ else if (aFieldType == u"DocInfo.Custom")
{
nId = text::textfield::Type::DOCINFO_CUSTOM;
}
diff --git a/include/editeng/unofield.hxx b/include/editeng/unofield.hxx
index 3c0d1650f6cc..fe68cd95c060 100644
--- a/include/editeng/unofield.hxx
+++ b/include/editeng/unofield.hxx
@@ -29,6 +29,7 @@
#include <cppuhelper/basemutex.hxx>
#include <memory>
+#include <string_view>
namespace com::sun::star::beans { class XPropertySetInfo; }
@@ -39,7 +40,7 @@ class SvxFieldData;
/// @throws css::uno::Exception
/// @throws css::uno::RuntimeException
css::uno::Reference< css::uno::XInterface > EDITENG_DLLPUBLIC SvxUnoTextCreateTextField(
- const OUString& ServiceSpecifier );
+ std::u16string_view ServiceSpecifier );
class EDITENG_DLLPUBLIC SvxUnoTextField final : public cppu::BaseMutex,
public ::cppu::OComponentHelper,
More information about the Libreoffice-commits
mailing list