summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-11 17:44:34 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-11 21:25:10 +0100
commit35e471bb4d1388cf5afcdcee214cf5111edf44e3 (patch)
treebb78f4f13f131f0cb206a9707cc3cfc495a3876a /sd
parent0c06e77c122f10a1842bc908bd6e25b1110ddbd2 (diff)
Adapt the remaining OUString functions to std string_view
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx7
-rw-r--r--sd/qa/unit/export-tests.cxx19
-rw-r--r--sd/qa/unit/import-tests.cxx2
-rw-r--r--sd/qa/unit/sdmodeltestbase.hxx4
-rw-r--r--sd/source/filter/html/htmlex.cxx2
-rw-r--r--sd/source/filter/html/htmlex.hxx3
6 files changed, 25 insertions, 12 deletions
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 75222f267a58..ca100c003967 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -6,6 +6,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+
+#include <sal/config.h>
+
+#include <string_view>
+
#include <officecfg/Office/Common.hxx>
#include "sdmodeltestbase.hxx"
#include <Outliner.hxx>
@@ -537,7 +542,7 @@ void SdOOXMLExportTest1::testTableCellFillProperties()
uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel();
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
- aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPTX].pFilterName), RTL_TEXTENCODING_UTF8);
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[PPTX].pFilterName), RTL_TEXTENCODING_UTF8);
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 69eb33240764..39700d4ab7cf 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -6,6 +6,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+
+#include <sal/config.h>
+
+#include <string_view>
+
#include <officecfg/Office/Common.hxx>
#include "sdmodeltestbase.hxx"
#include <sdpage.hxx>
@@ -416,7 +421,7 @@ void SdExportTest::testSwappedOutImageExport()
uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel();
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
- aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
@@ -472,7 +477,7 @@ void SdExportTest::testOOoXMLAnimations()
uno::Reference<lang::XComponent> xComponent = xDocShRef->GetModel();
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
- aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8);
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8);
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
@@ -548,7 +553,7 @@ void SdExportTest::testUnknownAttributes()
uno::Reference<lang::XComponent> xComponent = xDocShRef->GetModel();
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
- aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8);
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8);
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
@@ -601,7 +606,7 @@ void SdExportTest::testLinkedGraphicRT()
uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel();
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
- aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
// Check if the graphic has been imported correctly (before doing the export/import run)
{
@@ -713,7 +718,7 @@ void SdExportTest::testImageWithSpecialID()
uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel();
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
- aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
@@ -1014,7 +1019,7 @@ void SdExportTest::testTdf115394PPT()
uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel();
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
- aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPT].pFilterName), RTL_TEXTENCODING_UTF8);
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[PPT].pFilterName), RTL_TEXTENCODING_UTF8);
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
@@ -1053,7 +1058,7 @@ void SdExportTest::testBulletsAsImage()
uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel();
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
- aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[nExportFormat].pFilterName), RTL_TEXTENCODING_UTF8);
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[nExportFormat].pFilterName), RTL_TEXTENCODING_UTF8);
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8906d780c4bf..12b340ccf3fa 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -415,7 +415,7 @@ void SdImportTest::testDocumentLayout()
if( aFilesToCompare[i].nExportType >= 0 )
xDocShRef = saveAndReload( xDocShRef.get(), aFilesToCompare[i].nExportType );
compareWithShapesDump( xDocShRef,
- m_directories.getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump ),
+ OUString(m_directories.getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump )),
i == nUpdateMe );
}
}
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index de163fbc38ef..f2dd51b58b20 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -11,6 +11,8 @@
#define INCLUDED_SD_QA_UNIT_SDMODELTESTBASE_HXX
#include <memory>
+#include <string_view>
+
#include <test/bootstrapfixture.hxx>
#include <test/xmldiff.hxx>
#include <test/xmltesttools.hxx>
@@ -305,7 +307,7 @@ protected:
@param bCreate Instead of comparing to the reference file(s), create it/them.
*/
- void compareWithShapesDump( ::sd::DrawDocShellRef xDocShRef, const OUString &rShapesDumpFileNameBase, bool bCreate )
+ void compareWithShapesDump( ::sd::DrawDocShellRef xDocShRef, std::u16string_view rShapesDumpFileNameBase, bool bCreate )
{
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.is() );
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 7b1efa7e14b5..bcd21c6e8074 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -1144,7 +1144,7 @@ bool HtmlExport::CreateHtmlTextForPresPages()
/** exports the given html data into a non unicode file in the current export path with
the given filename */
-bool HtmlExport::WriteHtml( const OUString& rFileName, bool bAddExtension, const OUString& rHtmlData )
+bool HtmlExport::WriteHtml( const OUString& rFileName, bool bAddExtension, std::u16string_view rHtmlData )
{
ErrCode nErr = ERRCODE_NONE;
diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx
index 1622bc4a0e0c..2c07ab2358b8 100644
--- a/sd/source/filter/html/htmlex.hxx
+++ b/sd/source/filter/html/htmlex.hxx
@@ -29,6 +29,7 @@
#include "htmlpublishmode.hxx"
#include <memory>
+#include <string_view>
#include <vector>
namespace basegfx { class B2DPolyPolygon; }
@@ -207,7 +208,7 @@ class HtmlExport final
void ExportWebCast();
void ExportSingleDocument();
- bool WriteHtml( const OUString& rFileName, bool bAddExtension, const OUString& rHtmlData );
+ bool WriteHtml( const OUString& rFileName, bool bAddExtension, std::u16string_view rHtmlData );
static OUString GetButtonName( int nButton );
void WriteOutlinerParagraph(OUStringBuffer& aStr, SdrOutliner* pOutliner,