diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-28 17:56:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-29 16:42:33 +0100 |
commit | 042033f1e6da22616cb76c8d950c20c9efecbad5 (patch) | |
tree | 26b3f1f42d067506f44550b410f3fb9640616a5b /sw | |
parent | ccfd8e9d09f9ac0a0ea92d0f378391006faaf934 (diff) |
loplugin:stringviewparam: operator +
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw')
56 files changed, 251 insertions, 187 deletions
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 8e79ee930a30..30f176bf0633 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -28,6 +28,7 @@ #include <unordered_map> #include <memory> +#include <string_view> #include <vector> class SwDoc; @@ -152,12 +153,12 @@ class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener void rehash(); public: SwPoolFormatList() {} - void Append( char cChar, const OUString& rStr ); + void Append( char cChar, std::u16string_view rStr ); void clear() { maImpl.clear(); maUnique.clear(); } size_t size() { return maImpl.size(); } bool empty() { return maImpl.empty(); } - sal_uInt32 FindName(SfxStyleFamily eFam, const OUString &rName); - void RemoveName(SfxStyleFamily eFam, const OUString &rName); + sal_uInt32 FindName(SfxStyleFamily eFam, std::u16string_view rName); + void RemoveName(SfxStyleFamily eFam, std::u16string_view rName); const OUString &operator[](sal_uInt32 nIdx) { return maImpl[ nIdx ]; } }; diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx index eb0dbdb0d540..28984e6950e3 100644 --- a/sw/inc/unocrsrhelper.hxx +++ b/sw/inc/unocrsrhelper.hxx @@ -24,6 +24,7 @@ #include "pam.hxx" #include <map> +#include <string_view> class SfxItemSet; class SfxItemPropertySet; @@ -176,7 +177,7 @@ namespace SwUnoCursorHelper css::uno::Any GetPropertyValue( SwPaM& rPaM, const SfxItemPropertySet & rPropSet, - const OUString & rPropertyName); + std::u16string_view rPropertyName); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException css::uno::Sequence< css::beans::PropertyState > GetPropertyStates( @@ -197,14 +198,14 @@ namespace SwUnoCursorHelper void SetPropertyToDefault( SwPaM & rPaM, const SfxItemPropertySet & rPropSet, - const OUString & rPropertyName); + std::u16string_view rPropertyName); /// @throws css::beans::UnknownPropertyException /// @throws css::lang::WrappedTargetException /// @throws css::uno::RuntimeException css::uno::Any GetPropertyDefault( SwPaM const & rPaM, const SfxItemPropertySet & rPropSet, - const OUString & rPropertyName); + std::u16string_view rPropertyName); bool SetPageDesc( const css::uno::Any& rValue, diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx index 2d3f411d88f0..bc3446f30514 100644 --- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx +++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx @@ -17,7 +17,7 @@ class AccessibilityCheckTest : public SwModelTestBase public: SwDoc* createDoc(const char* pName = nullptr) { - load("/sw/qa/core/accessibilitycheck/data/", pName); + load(u"/sw/qa/core/accessibilitycheck/data/", pName); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); return pTextDoc->GetDocShell()->GetDoc(); diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index 5db4e52fcb9e..c39f4e48edf5 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -129,50 +129,50 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, void SwFiltersTest::testCVEs() { testDir("StarOffice XML (Writer)", - m_directories.getURLFromSrc("/sw/qa/core/data/xml/"), + m_directories.getURLFromSrc(u"/sw/qa/core/data/xml/"), FILTER_XML, SfxFilterFlags::IMPORT | SfxFilterFlags::OWN | SfxFilterFlags::DEFAULT, isstorage, SOFFICE_FILEFORMAT_CURRENT); testDir("writer8", - m_directories.getURLFromSrc("/sw/qa/core/data/odt/"), + m_directories.getURLFromSrc(u"/sw/qa/core/data/odt/"), FILTER_XML, SfxFilterFlags::IMPORT | SfxFilterFlags::OWN | SfxFilterFlags::DEFAULT, isstorage, SOFFICE_FILEFORMAT_CURRENT); testDir("MS Word 97", - m_directories.getURLFromSrc("/sw/qa/core/data/ww8/"), + m_directories.getURLFromSrc(u"/sw/qa/core/data/ww8/"), FILTER_WW8); testDir("MS WinWord 5", - m_directories.getURLFromSrc("/sw/qa/core/data/ww5/"), + m_directories.getURLFromSrc(u"/sw/qa/core/data/ww5/"), sWW5); testDir("Text (encoded)", - m_directories.getURLFromSrc("/sw/qa/core/data/txt/"), + m_directories.getURLFromSrc(u"/sw/qa/core/data/txt/"), FILTER_TEXT_DLG); testDir("MS Word 2007 XML", - m_directories.getURLFromSrc("/sw/qa/core/data/ooxml/"), + m_directories.getURLFromSrc(u"/sw/qa/core/data/ooxml/"), OUString(), SfxFilterFlags::STARONEFILTER); testDir("Rich Text Format", - m_directories.getURLFromSrc("/sw/qa/core/data/rtf/"), + m_directories.getURLFromSrc(u"/sw/qa/core/data/rtf/"), OUString(), SfxFilterFlags::STARONEFILTER); testDir("HTML", - m_directories.getURLFromSrc("/sw/qa/core/data/html/"), + m_directories.getURLFromSrc(u"/sw/qa/core/data/html/"), sHTML); testDir("T602Document", - m_directories.getURLFromSrc("/sw/qa/core/data/602/"), + m_directories.getURLFromSrc(u"/sw/qa/core/data/602/"), OUString(), SfxFilterFlags::STARONEFILTER); testDir("Rich Text Format", - m_directories.getURLFromSrc("/sw/qa/core/exportdata/rtf/"), + m_directories.getURLFromSrc(u"/sw/qa/core/exportdata/rtf/"), OUString(), SfxFilterFlags::STARONEFILTER, SotClipboardFormatId::NONE, @@ -180,7 +180,7 @@ void SwFiltersTest::testCVEs() /*bExport=*/true); testDir("HTML", - m_directories.getURLFromSrc("/sw/qa/core/exportdata/html/"), + m_directories.getURLFromSrc(u"/sw/qa/core/exportdata/html/"), sHTML, SfxFilterFlags::NONE, SotClipboardFormatId::NONE, @@ -188,7 +188,7 @@ void SwFiltersTest::testCVEs() /*bExport=*/true); testDir("MS Word 2007 XML", - m_directories.getURLFromSrc("/sw/qa/core/exportdata/ooxml/"), + m_directories.getURLFromSrc(u"/sw/qa/core/exportdata/ooxml/"), OUString(), SfxFilterFlags::STARONEFILTER, SotClipboardFormatId::NONE, diff --git a/sw/qa/core/filters-test2.cxx b/sw/qa/core/filters-test2.cxx index 20d8eed4a644..22fd9cfe525a 100644 --- a/sw/qa/core/filters-test2.cxx +++ b/sw/qa/core/filters-test2.cxx @@ -122,7 +122,7 @@ bool SwFiltersTest2::filter(const OUString& rFilter, const OUString& rURL, void SwFiltersTest2::testCVEs() { - testDir("MS WinWord 6.0", m_directories.getURLFromSrc("/sw/qa/core/data/ww6/"), sWW6); + testDir("MS WinWord 6.0", m_directories.getURLFromSrc(u"/sw/qa/core/data/ww6/"), sWW6); } void SwFiltersTest2::setUp() diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index f85d56342207..cb2616333486 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -8,6 +8,9 @@ */ #include <sal/config.h> + +#include <string_view> + #include <unotest/macros_test.hxx> #include <test/bootstrapfixture.hxx> @@ -61,7 +64,7 @@ class SwMacrosTest : public test::BootstrapFixture, public unotest::MacrosTest public: SwMacrosTest(); - void createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath); + void createFileURL(std::u16string_view aFileBase, std::u16string_view aFileExtension, OUString& rFilePath); virtual void setUp() override; virtual void tearDown() override; @@ -91,7 +94,7 @@ private: OUString m_aBaseString; }; -void SwMacrosTest::createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath) +void SwMacrosTest::createFileURL(std::u16string_view aFileBase, std::u16string_view aFileExtension, OUString& rFilePath) { rFilePath = m_directories.getSrcRootURL() + m_aBaseString + "/" + aFileExtension + "/" + aFileBase + aFileExtension; @@ -108,7 +111,7 @@ void SwMacrosTest::testVba() for ( size_t i=0; i<SAL_N_ELEMENTS( testInfo ); ++i ) { OUString aFileName; - createFileURL(testInfo[i].sFileBaseName, "doc", aFileName); + createFileURL(testInfo[i].sFileBaseName, u"doc", aFileName); uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.text.TextDocument"); OUString sMsg = "Failed to load " + aFileName; CPPUNIT_ASSERT_MESSAGE( OUStringToOString( sMsg, RTL_TEXTENCODING_UTF8 ).getStr(), xComponent.is() ); @@ -203,7 +206,7 @@ void SwMacrosTest::testBookmarkDeleteTdf90816() void SwMacrosTest::testControlShapeGrouping() { OUString aFileName; - createFileURL("testControlShapeGrouping.", "odt", aFileName); + createFileURL(u"testControlShapeGrouping.", u"odt", aFileName); Reference< css::lang::XComponent > xComponent( loadFromDesktop(aFileName, "com.sun.star.text.TextDocument")); CPPUNIT_ASSERT(xComponent.is()); @@ -343,7 +346,7 @@ void SwMacrosTest::testFdo55289() void SwMacrosTest::testFdo68983() { OUString aFileName; - createFileURL("fdo68983.", "odt", aFileName); + createFileURL(u"fdo68983.", u"odt", aFileName); Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.text.TextDocument"); diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 732c0438da5b..8915ed808232 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -106,7 +106,7 @@ void Test::testEmbeddedGraphicRoundtrip() if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_two_images.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/document_with_two_images.odt"), "com.sun.star.text.TextDocument"); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -172,7 +172,7 @@ void Test::testLinkedGraphicRT() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); @@ -240,7 +240,7 @@ void Test::testImageWithSpecialID() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/images_with_special_IDs.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/images_with_special_IDs.odt"), "com.sun.star.text.TextDocument"); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -335,7 +335,7 @@ void Test::testGraphicShape() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/graphic_shape.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/graphic_shape.odt"), "com.sun.star.text.TextDocument"); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -443,7 +443,7 @@ void Test::testMultipleIdenticalGraphics() if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/multiple_identical_graphics.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/multiple_identical_graphics.odt"), "com.sun.star.text.TextDocument"); // Export the document and import again for a check utl::MediaDescriptor aMediaDescriptor; @@ -494,7 +494,7 @@ void Test::testCharHighlightBody() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_highlight.docx"), + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/char_highlight.docx"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); @@ -590,7 +590,7 @@ void Test::testCharStyleHighlight() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/tdf138345_charstyle_highlight.odt"), + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/tdf138345_charstyle_highlight.odt"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); @@ -634,7 +634,7 @@ void Test::testCharHighlight() void Test::testCharHighlightODF() { - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background_editing.docx"), + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/char_background_editing.docx"), "com.sun.star.text.TextDocument"); // don't check import, testMSCharBackgroundEditing already does that @@ -727,7 +727,7 @@ void Test::testMSCharBackgroundEditing() if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background_editing.docx"), + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/char_background_editing.docx"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); @@ -839,7 +839,7 @@ void Test::testCharBackgroundToHighlighting() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background.odt"), + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/char_background.odt"), "com.sun.star.text.TextDocument"); OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); @@ -1053,7 +1053,7 @@ void Test::testNestedFieldmark() } mxComponent = loadFromDesktop(m_directories.getURLFromSrc( - "/sw/qa/extras/globalfilter/data/" + rFilterName.second), + OUString("/sw/qa/extras/globalfilter/data/" + rFilterName.second)), "com.sun.star.text.TextDocument"); verifyNestedFieldmark(rFilterName.first + ", load", mxComponent); @@ -1109,7 +1109,7 @@ void Test::testODF13() { // import mxComponent = loadFromDesktop(m_directories.getURLFromSrc( - "/sw/qa/extras/globalfilter/data/text13e.odt"), + u"/sw/qa/extras/globalfilter/data/text13e.odt"), "com.sun.star.text.TextDocument"); // check model @@ -1295,7 +1295,7 @@ void Test::testBulletAsImage() if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/BulletAsImage.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/BulletAsImage.odt"), "com.sun.star.text.TextDocument"); // Check if import was successful { @@ -1431,7 +1431,7 @@ void Test::testTextFormField() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/text_form_field.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/text_form_field.odt"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); @@ -1486,7 +1486,7 @@ void Test::testCheckBoxFormField() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/checkbox_form_field.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/checkbox_form_field.odt"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); @@ -1549,7 +1549,7 @@ void Test::testDropDownFormField() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/dropdown_form_field.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/dropdown_form_field.odt"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); @@ -1634,7 +1634,7 @@ void Test::testDateFormField() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/date_form_field.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/date_form_field.odt"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); @@ -1750,7 +1750,7 @@ void Test::testDateFormFieldCharacterFormatting() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/date_form_field_char_formatting.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/date_form_field_char_formatting.odt"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 20e45e7a23b5..be654093e229 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -8,6 +8,7 @@ */ #include <memory> +#include <string_view> #include <swmodeltestbase.hxx> @@ -95,12 +96,12 @@ protected: protected: /// Copy&paste helper. - bool paste(const OUString& rFilename, const uno::Reference<text::XTextRange>& xTextRange) + bool paste(std::u16string_view rFilename, const uno::Reference<text::XTextRange>& xTextRange) { uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.WriterFilter"), uno::UNO_QUERY_THROW); uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW); xImporter->setTargetDocument(mxComponent); - std::unique_ptr<SvStream> pStream = utl::UcbStreamHelper::CreateStream(m_directories.getURLFromSrc("/sw/qa/extras/ooxmlexport/data/") + rFilename, StreamMode::READ); + std::unique_ptr<SvStream> pStream = utl::UcbStreamHelper::CreateStream(m_directories.getURLFromSrc(u"/sw/qa/extras/ooxmlexport/data/") + rFilename, StreamMode::READ); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream))); uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence( { @@ -1096,7 +1097,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf94374) uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); // This failed: it wasn't possible to insert a DOCX document into an existing Writer one. - CPPUNIT_ASSERT(paste("tdf94374.docx", xEnd)); + CPPUNIT_ASSERT(paste(u"tdf94374.docx", xEnd)); } DECLARE_OOXMLEXPORT_TEST(testTdf83300, "tdf83300.docx") diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index bde4a109d687..62154c0eaaca 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -599,7 +599,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyPastePageStyle) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("rtfexport/data/copypaste-pagestyle-paste.rtf", xEnd); + paste(u"rtfexport/data/copypaste-pagestyle-paste.rtf", xEnd); uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); @@ -614,7 +614,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyPasteFootnote) uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); - paste("rtfexport/data/copypaste-footnote-paste.rtf", xTextRange); + paste(u"rtfexport/data/copypaste-footnote-paste.rtf", xTextRange); CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString()); } @@ -626,7 +626,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo63428) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("rtfexport/data/fdo63428.rtf", xEnd); + paste(u"rtfexport/data/fdo63428.rtf", xEnd); // Additionally, commented range was imported as a normal comment. CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), @@ -651,7 +651,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69384Inserted) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("rtfexport/data/fdo69384-paste.rtf", xEnd); + paste(u"rtfexport/data/fdo69384-paste.rtf", xEnd); // During insert of the RTF document we do not change pre-existing styles // vs testFdo69384 where it is @@ -667,7 +667,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo61193) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("rtfexport/data/fdo61193.rtf", xEnd); + paste(u"rtfexport/data/fdo61193.rtf", xEnd); } CPPUNIT_TEST_FIXTURE(Test, testTdf108123) @@ -678,7 +678,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108123) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("rtfexport/data/tdf108123.rtf", xEnd); + paste(u"rtfexport/data/tdf108123.rtf", xEnd); } DECLARE_RTFEXPORT_TEST(testShptxtPard, "shptxt-pard.rtf") diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index fea953889795..d356ed1c0938 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -127,7 +127,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo62044) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("rtfexport/data/fdo62044-paste.rtf", xEnd); + paste(u"rtfexport/data/fdo62044-paste.rtf", xEnd); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY); @@ -812,7 +812,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf90260Nopar) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("rtfexport/data/tdf90260-nopar.rtf", xEnd); + paste(u"rtfexport/data/tdf90260-nopar.rtf", xEnd); CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); } @@ -958,7 +958,7 @@ CPPUNIT_TEST_FIXTURE(Test, testClassificatonPasteLevels) // Classified source and classified destination, but internal only has a // higher level than confidential: nothing should happen. OUString aOld = xText->getString(); - paste("rtfexport/data/classification-yes.rtf", xEnd); + paste(u"rtfexport/data/classification-yes.rtf", xEnd); CPPUNIT_ASSERT_EQUAL(aOld, xText->getString()); } diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 399ca38e0ab2..4749fa3acf6f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -823,7 +823,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo68291) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("rtfimport/data/fdo68291-paste.rtf", xEnd); + paste(u"rtfimport/data/fdo68291-paste.rtf", xEnd); // This was "Standard", causing an unwanted page break on next paste. CPPUNIT_ASSERT_EQUAL(uno::Any(), @@ -1208,7 +1208,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf90260Par) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("rtfimport/data/tdf90260-par.rtf", xEnd); + paste(u"rtfimport/data/tdf90260-par.rtf", xEnd); CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); } @@ -1319,12 +1319,12 @@ CPPUNIT_TEST_FIXTURE(Test, testClassificatonPaste) uno::Reference<text::XTextRange> xEnd = xText->getEnd(); // Not classified source, not classified destination: OK. - paste("rtfimport/data/classification-no.rtf", xEnd); + paste(u"rtfimport/data/classification-no.rtf", xEnd); CPPUNIT_ASSERT_EQUAL(OUString("classification-no"), getParagraph(2)->getString()); // Classified source, not classified destination: nothing should happen. OUString aOld = xText->getString(); - paste("rtfimport/data/classification-yes.rtf", xEnd); + paste(u"rtfimport/data/classification-yes.rtf", xEnd); CPPUNIT_ASSERT_EQUAL(aOld, xText->getString()); } diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 6bce5bff36c3..c5aeeae93efb 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -8,6 +8,8 @@ */ #include <memory> +#include <string_view> + #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/drawing/GraphicExportFilter.hpp> #include <com/sun/star/drawing/FillStyle.hpp> @@ -631,7 +633,8 @@ public: private: SwDoc* createDoc(const char* pName = nullptr); - std::unique_ptr<SwTextBlocks> readDOCXAutotext(const OUString& sFileName, bool bEmpty = false); + std::unique_ptr<SwTextBlocks> readDOCXAutotext( + std::u16string_view sFileName, bool bEmpty = false); }; SwDoc* SwUiWriterTest::createDoc(const char* pName) @@ -646,7 +649,7 @@ SwDoc* SwUiWriterTest::createDoc(const char* pName) return pTextDoc->GetDocShell()->GetDoc(); } -std::unique_ptr<SwTextBlocks> SwUiWriterTest::readDOCXAutotext(const OUString& sFileName, bool bEmpty) +std::unique_ptr<SwTextBlocks> SwUiWriterTest::readDOCXAutotext(std::u16string_view sFileName, bool bEmpty) { utl::TempFile tmp; tmp.EnableKillingFile(); @@ -1078,14 +1081,14 @@ void SwUiWriterTest::testExportRTF() void SwUiWriterTest::testDOCXAutoTextEmpty() { // file contains normal content but no AutoText - std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext("autotext-empty.dotx", true); + std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext(u"autotext-empty.dotx", true); CPPUNIT_ASSERT(pGlossary != nullptr); } void SwUiWriterTest::testDOCXAutoTextMultiple() { // file contains three AutoText entries - std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext("autotext-multiple.dotx"); + std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext(u"autotext-multiple.dotx"); // check entries count CPPUNIT_ASSERT_EQUAL(sal_uInt16(3), pGlossary->GetCount()); @@ -1126,7 +1129,7 @@ void SwUiWriterTest::testDOTMAutoText() { // this is dotm file difference is that in the dotm // there are no empty paragraphs at the end of each entry - std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext("autotext-dotm.dotm"); + std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext(u"autotext-dotm.dotm"); SwDoc* pDoc = pGlossary->GetDoc(); CPPUNIT_ASSERT(pDoc != nullptr); @@ -1142,7 +1145,7 @@ void SwUiWriterTest::testDOCXAutoTextGallery() { // this file contains one AutoText entry and other // entries which are not AutoText (have different "gallery" value) - std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext("autotext-gallery.dotx"); + std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext(u"autotext-gallery.dotx"); SwDoc* pDoc = pGlossary->GetDoc(); CPPUNIT_ASSERT(pDoc != nullptr); @@ -1780,7 +1783,7 @@ void SwUiWriterTest::testChineseConversionSimplifiedToTraditional() void SwUiWriterTest::testFdo85554() { // Load the document, it contains one shape with a textbox. - load("/sw/qa/extras/uiwriter/data/", "fdo85554.odt"); + load(u"/sw/qa/extras/uiwriter/data/", "fdo85554.odt"); // Add a second shape to the document. uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); @@ -4435,7 +4438,7 @@ void SwUiWriterTest::testEmbeddedDataSource() // Load: should have a component and a data source, too. // Path with "#" must not cause issues - load(DATA_DIRECTORY + OUStringLiteral(u"hash%23path/"), "embedded-data-source.odt"); + load(OUString(DATA_DIRECTORY + OUStringLiteral(u"hash%23path/")), "embedded-data-source.odt"); CPPUNIT_ASSERT(mxComponent.is()); CPPUNIT_ASSERT(xDatabaseContext->hasByName("calc-data-source")); @@ -7368,7 +7371,7 @@ void SwUiWriterTest::testTdf117225() { // Test that saving a document with an embedded object does not leak // tempfiles in the directory of the target file. - OUString aTargetDirectory = m_directories.getURLFromWorkdir("/CppunitTest/sw_uiwriter.test.user/"); + OUString aTargetDirectory = m_directories.getURLFromWorkdir(u"/CppunitTest/sw_uiwriter.test.user/"); OUString aTargetFile = aTargetDirectory + "tdf117225.odt"; OUString aSourceFile = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf117225.odt"; osl::File::copy(aSourceFile, aTargetFile); diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 5dc5aab4eb80..91a429a7b151 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -3396,7 +3396,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf128603) // only care that it doesn't assert/crash CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testOfz18563) { - OUString sURL(m_directories.getURLFromSrc("/sw/qa/extras/uiwriter/data2/ofz18563.docx")); + OUString sURL(m_directories.getURLFromSrc(u"/sw/qa/extras/uiwriter/data2/ofz18563.docx")); SvFileStream aFileStream(sURL, StreamMode::READ); TestImportDOCX(aFileStream); } diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index faaad80c6a7c..ceb2bbe125d0 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -11,6 +11,8 @@ #define INCLUDED_SW_QA_INC_SWMODELTESTBASE_HXX #include <memory> +#include <string_view> + #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/drawing/XShape.hpp> @@ -145,7 +147,7 @@ protected: virtual OUString getTestName() { return OUString(); } /// Copy&paste helper. - void paste(const OUString& aFilename, css::uno::Reference<css::text::XTextRange> const& xTextRange); + void paste(std::u16string_view aFilename, css::uno::Reference<css::text::XTextRange> const& xTextRange); public: void setFilterOptions(const OUString &rFilterOptions) @@ -340,7 +342,7 @@ protected: void header(); - void load(const OUString& pDir, const char* pName, const char* pPassword = nullptr) + void load(std::u16string_view pDir, const char* pName, const char* pPassword = nullptr) { return loadURL(m_directories.getURLFromSrc(pDir) + OUString::createFromAscii(pName), pName, pPassword); } @@ -393,7 +395,8 @@ protected: * SwDoc* pDoc = createSwDoc(); * SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "test.fodt"); */ - SwDoc* createSwDoc(const OUString& rDataDirectory = OUString(), const char* pName = nullptr); + SwDoc* createSwDoc( + std::u16string_view rDataDirectory = std::u16string_view(), const char* pName = nullptr); }; /** diff --git a/sw/qa/unit/sw-dialogs-test.cxx b/sw/qa/unit/sw-dialogs-test.cxx index 70584b601803..48652ca1db74 100644 --- a/sw/qa/unit/sw-dialogs-test.cxx +++ b/sw/qa/unit/sw-dialogs-test.cxx @@ -93,7 +93,7 @@ VclPtr<VclAbstractDialog> SwDialogsTest::createDialogByID(sal_uInt32 /*nID*/) void SwDialogsTest::openAnyDialog() { /// process input file containing the UXMLDescriptions of the dialogs to dump - processDialogBatchFile("sw/qa/unit/data/sw-dialogs-test.txt"); + processDialogBatchFile(u"sw/qa/unit/data/sw-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(SwDialogsTest); diff --git a/sw/qa/unit/sw-dialogs-test_2.cxx b/sw/qa/unit/sw-dialogs-test_2.cxx index a925a8e9c615..42e8d4b786da 100644 --- a/sw/qa/unit/sw-dialogs-test_2.cxx +++ b/sw/qa/unit/sw-dialogs-test_2.cxx @@ -84,7 +84,7 @@ VclPtr<VclAbstractDialog> SwDialogsTest2::createDialogByID(sal_uInt32 /*nID*/) void SwDialogsTest2::openAnyDialog() { /// process input file containing the UXMLDescriptions of the dialogs to dump - processDialogBatchFile("sw/qa/unit/data/sw-dialogs-test_2.txt"); + processDialogBatchFile(u"sw/qa/unit/data/sw-dialogs-test_2.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(SwDialogsTest2); diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index b69ade4d1b8e..3a1c6b89e9d6 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -34,7 +34,7 @@ using namespace css; -void SwModelTestBase::paste(const OUString& aFilename, +void SwModelTestBase::paste(std::u16string_view aFilename, uno::Reference<text::XTextRange> const& xTextRange) { uno::Reference<document::XFilter> xFilter( @@ -44,7 +44,7 @@ void SwModelTestBase::paste(const OUString& aFilename, uno::Sequence<beans::PropertyValue> aDescriptor(3); aDescriptor[0].Name = "InputStream"; std::unique_ptr<SvStream> pStream = utl::UcbStreamHelper::CreateStream( - m_directories.getURLFromSrc("/sw/qa/extras/") + aFilename, StreamMode::STD_READ); + m_directories.getURLFromSrc(u"/sw/qa/extras/") + aFilename, StreamMode::STD_READ); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, pStream->GetError()); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream))); aDescriptor[0].Value <<= xStream; @@ -825,9 +825,9 @@ void SwModelTestBase::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) BAD_CAST("http://www.w3.org/1999/xhtml")); } -SwDoc* SwModelTestBase::createSwDoc(const OUString& rDataDirectory, const char* pName) +SwDoc* SwModelTestBase::createSwDoc(std::u16string_view rDataDirectory, const char* pName) { - if (rDataDirectory.isEmpty() || !pName) + if (rDataDirectory.empty() || !pName) loadURL("private:factory/swriter", nullptr); else load(rDataDirectory, pName); diff --git a/sw/source/core/bastyp/SwSmartTagMgr.cxx b/sw/source/core/bastyp/SwSmartTagMgr.cxx index e99c11a02f93..cbe194fc005c 100644 --- a/sw/source/core/bastyp/SwSmartTagMgr.cxx +++ b/sw/source/core/bastyp/SwSmartTagMgr.cxx @@ -33,7 +33,7 @@ SwSmartTagMgr& SwSmartTagMgr::Get() if (!spTheSwSmartTagMgr) { spTheSwSmartTagMgr = new SwSmartTagMgr(SwDocShell::Factory().GetModuleName()); - spTheSwSmartTagMgr->Init("Writer"); + spTheSwSmartTagMgr->Init(u"Writer"); } return *spTheSwSmartTagMgr; } diff --git a/sw/source/core/crsr/annotationmark.cxx b/sw/source/core/crsr/annotationmark.cxx index 62895ab852c9..ce7c03675e14 100644 --- a/sw/source/core/crsr/annotationmark.cxx +++ b/sw/source/core/crsr/annotationmark.cxx @@ -40,7 +40,7 @@ namespace sw::mark { if ( rName.getLength() == 0 ) { - SetName( MarkBase::GenerateNewName("__Annotation__") ); + SetName( MarkBase::GenerateNewName(u"__Annotation__") ); } } diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 9df25b47bcfd..18cdae33edfd 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -314,7 +314,7 @@ namespace sw::mark MarkBase::~MarkBase() { } - OUString MarkBase::GenerateNewName(const OUString& rPrefix) + OUString MarkBase::GenerateNewName(std::u16string_view rPrefix) { static bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr); @@ -354,15 +354,15 @@ namespace sw::mark } NavigatorReminder::NavigatorReminder(const SwPaM& rPaM) - : MarkBase(rPaM, MarkBase::GenerateNewName("__NavigatorReminder__")) + : MarkBase(rPaM, MarkBase::GenerateNewName(u"__NavigatorReminder__")) { } UnoMark::UnoMark(const SwPaM& aPaM) - : MarkBase(aPaM, MarkBase::GenerateNewName("__UnoMark__")) + : MarkBase(aPaM, MarkBase::GenerateNewName(u"__UnoMark__")) { } DdeBookmark::DdeBookmark(const SwPaM& aPaM) - : MarkBase(aPaM, MarkBase::GenerateNewName("__DdeLink__")) + : MarkBase(aPaM, MarkBase::GenerateNewName(u"__DdeLink__")) { } void DdeBookmark::SetRefObject(SwServerObject* pObj) @@ -485,7 +485,7 @@ namespace sw::mark } Fieldmark::Fieldmark(const SwPaM& rPaM) - : MarkBase(rPaM, MarkBase::GenerateNewName("__Fieldmark__")) + : MarkBase(rPaM, MarkBase::GenerateNewName(u"__Fieldmark__")) { if(!IsExpanded()) SetOtherMarkPos(GetMarkPos()); diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx index a2f046f2fa84..5090f2024d0a 100644 --- a/sw/source/core/crsr/crossrefbookmark.cxx +++ b/sw/source/core/crsr/crossrefbookmark.cxx @@ -35,7 +35,7 @@ namespace sw::mark CrossRefBookmark::CrossRefBookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, const OUString& rName, - const OUString& rPrefix) + std::u16string_view rPrefix) : Bookmark( // ensure that m_pPos2 is null by only passing start to super SwPaM(*rPaM.Start()), rCode, rName) @@ -70,7 +70,7 @@ namespace sw::mark CrossRefHeadingBookmark::CrossRefHeadingBookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, const OUString& rName) - : CrossRefBookmark(rPaM, rCode, rName, IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()+"_Toc") + : CrossRefBookmark(rPaM, rCode, rName, OUString(IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()+"_Toc")) { } bool CrossRefHeadingBookmark::IsLegalName(const OUString& rName) diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 757e95334011..575980cac40c 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <mutex> +#include <string_view> #include <config_features.h> @@ -932,7 +933,7 @@ SfxObjectShell* SwDoc::CreateCopy( bool bCallInitNew, bool bEmpty ) const } // save bulk letters as single documents -static OUString lcl_FindUniqueName(SwWrtShell* pTargetShell, const OUString& rStartingPageDesc, sal_uLong nDocNo ) +static OUString lcl_FindUniqueName(SwWrtShell* pTargetShell, std::u16string_view rStartingPageDesc, sal_uLong nDocNo ) { do { diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index f6b1291bee99..de9f04bc59b4 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -357,7 +357,7 @@ struct SignatureDescr SignatureDescr lcl_getSignatureDescr(const uno::Reference<frame::XModel>& xModel, const uno::Reference<css::text::XTextContent>& xParagraph, - const OUString& sFieldId) + std::u16string_view sFieldId) { SignatureDescr aDescr; diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 017a226c82a8..b7ab6e94e44a 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <hintids.hxx> #include <tools/helpers.hxx> #include <tools/urlobj.hxx> @@ -168,7 +172,7 @@ bool SwGrfNode::ReRead( nNewType = sfx2::SvBaseLinkObjectType::ClientDde; else { - sfx2::MakeLnkName( sCmd, nullptr, sURLLink, OUString(), &rFltName ); + sfx2::MakeLnkName( sCmd, nullptr, sURLLink, std::u16string_view(), &rFltName ); nNewType = sfx2::SvBaseLinkObjectType::ClientGraphic; } diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx index a73cc31c9874..63e05befe41b 100644 --- a/sw/source/core/inc/bookmrk.hxx +++ b/sw/source/core/inc/bookmrk.hxx @@ -24,6 +24,8 @@ #include <sfx2/Metadatable.hxx> #include <vcl/keycod.hxx> #include <memory> +#include <string_view> + #include <rtl/ustring.hxx> #include <osl/diagnose.h> #include <tools/ref.hxx> @@ -111,7 +113,7 @@ namespace sw::mark { std::unique_ptr<SwPosition> m_pPos1; std::unique_ptr<SwPosition> m_pPos2; OUString m_aName; - static OUString GenerateNewName(const OUString& rPrefix); + static OUString GenerateNewName(std::u16string_view rPrefix); css::uno::WeakReference< css::text::XTextContent> m_wXBookmark; }; diff --git a/sw/source/core/inc/crossrefbookmark.hxx b/sw/source/core/inc/crossrefbookmark.hxx index e3976329ed4c..fa364a9b8742 100644 --- a/sw/source/core/inc/crossrefbookmark.hxx +++ b/sw/source/core/inc/crossrefbookmark.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SW_SOURCE_CORE_INC_CROSSREFBOOKMARK_HXX #define INCLUDED_SW_SOURCE_CORE_INC_CROSSREFBOOKMARK_HXX +#include <sal/config.h> + +#include <string_view> + #include "bookmrk.hxx" #include <rtl/ustring.hxx> #include <vcl/keycod.hxx> @@ -32,7 +36,7 @@ namespace sw::mark { CrossRefBookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, const OUString& rName, - const OUString& rPrefix); + std::u16string_view rPrefix); // getters virtual SwPosition& GetOtherMarkPos() const override; diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 963ab8e3910f..8688490ffe38 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -738,7 +738,7 @@ void SwNumberPortion::Paint( const SwTextPaintInfo &rInf ) const } SwBulletPortion::SwBulletPortion( const sal_UCS4 cBullet, - const OUString& rBulletFollowedBy, + std::u16string_view rBulletFollowedBy, std::unique_ptr<SwFont> pFont, const bool bLft, const bool bCntr, diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index c7382d601d14..d9e18f1d772a 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <swtypes.hxx> #include <swfont.hxx> #include "porexp.hxx" @@ -148,7 +152,7 @@ class SwBulletPortion : public SwNumberPortion { public: SwBulletPortion( const sal_UCS4 cCh, - const OUString& rBulletFollowedBy, + std::u16string_view rBulletFollowedBy, std::unique_ptr<SwFont> pFnt, const bool bLeft, const bool bCenter, diff --git a/sw/source/core/text/porhyph.hxx b/sw/source/core/text/porhyph.hxx index 57f685abe2dc..4227336918d3 100644 --- a/sw/source/core/text/porhyph.hxx +++ b/sw/source/core/text/porhyph.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_SW_SOURCE_CORE_TEXT_PORHYPH_HXX #define INCLUDED_SW_SOURCE_CORE_TEXT_PORHYPH_HXX +#include <sal/config.h> + +#include <string_view> + #include "porexp.hxx" class SwHyphPortion : public SwExpandPortion @@ -39,8 +43,8 @@ class SwHyphStrPortion : public SwHyphPortion { OUString aExpand; public: - explicit SwHyphStrPortion(const OUString &rStr) - : aExpand(rStr + "-") + explicit SwHyphStrPortion(std::u16string_view rStr) + : aExpand(OUString::Concat(rStr) + "-") { SetWhichPor( PortionType::HyphenStr ); } @@ -75,7 +79,7 @@ public: class SwSoftHyphStrPortion : public SwHyphStrPortion { public: - explicit SwSoftHyphStrPortion( const OUString &rStr ); + explicit SwSoftHyphStrPortion( std::u16string_view rStr ); virtual void Paint( const SwTextPaintInfo &rInf ) const override; }; diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index d0b411fa2a14..b88d34df4610 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -562,7 +562,7 @@ void SwSoftHyphStrPortion::Paint( const SwTextPaintInfo &rInf ) const SwHyphStrPortion::Paint( rInf ); } -SwSoftHyphStrPortion::SwSoftHyphStrPortion( const OUString &rStr ) +SwSoftHyphStrPortion::SwSoftHyphStrPortion( std::u16string_view rStr ) : SwHyphStrPortion( rStr ) { SetLen(TextFrameIndex(1)); diff --git a/sw/source/core/undo/unbkmk.cxx b/sw/source/core/undo/unbkmk.cxx index 5372899623f3..932ad9522ce4 100644 --- a/sw/source/core/undo/unbkmk.cxx +++ b/sw/source/core/undo/unbkmk.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <UndoBookmark.hxx> #include <strings.hrc> @@ -111,7 +115,7 @@ SwUndoRenameBookmark::~SwUndoRenameBookmark() { } -static OUString lcl_QuoteName(const OUString& rName) +static OUString lcl_QuoteName(std::u16string_view rName) { static const OUString sStart = SwResId(STR_START_QUOTE); static const OUString sEnd = SwResId(STR_END_QUOTE); diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 8004c18ee579..927235b7e239 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -18,6 +18,7 @@ */ #include <algorithm> +#include <string_view> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart2/data/LabelOrigin.hpp> @@ -249,21 +250,21 @@ static OUString GetCellRangeName( SwFrameFormat &rTableFormat, SwUnoCursor &rTab return aRes; } -static OUString GetRangeRepFromTableAndCells( const OUString &rTableName, - const OUString &rStartCell, const OUString &rEndCell, +static OUString GetRangeRepFromTableAndCells( std::u16string_view rTableName, + std::u16string_view rStartCell, std::u16string_view rEndCell, bool bForceEndCellName ) { - OSL_ENSURE( !rTableName.isEmpty(), "table name missing" ); - OSL_ENSURE( !rStartCell.isEmpty(), "cell name missing" ); - OUString aRes = rTableName + "." + rStartCell; + OSL_ENSURE( !rTableName.empty(), "table name missing" ); + OSL_ENSURE( !rStartCell.empty(), "cell name missing" ); + OUString aRes = OUString::Concat(rTableName) + "." + rStartCell; - if (!rEndCell.isEmpty()) + if (!rEndCell.empty()) { - aRes += ":" + rEndCell; + aRes += OUString::Concat(":") + rEndCell; } else if (bForceEndCellName) { - aRes += ":" + rStartCell; + aRes += OUString::Concat(":") + rStartCell; } return aRes; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index b8f64541ab58..bf0f89ac0bbe 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1723,7 +1723,7 @@ SwXTextCursor::setString(const OUString& aString) uno::Any SwUnoCursorHelper::GetPropertyValue( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, - const OUString& rPropertyName) + std::u16string_view rPropertyName) { uno::Any aAny; SfxItemPropertySimpleEntry const*const pEntry = @@ -1732,7 +1732,7 @@ uno::Any SwUnoCursorHelper::GetPropertyValue( if (!pEntry) { throw beans::UnknownPropertyException( - "Unknown property: " + rPropertyName, + OUString::Concat("Unknown property: ") + rPropertyName, static_cast<cppu::OWeakObject *>(nullptr)); } @@ -2004,7 +2004,7 @@ lcl_SelectParaAndReset( SwPaM &rPaM, SwDoc & rDoc, void SwUnoCursorHelper::SetPropertyToDefault( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, - const OUString& rPropertyName) + std::u16string_view rPropertyName) { SwDoc& rDoc = rPaM.GetDoc(); SfxItemPropertySimpleEntry const*const pEntry = @@ -2012,14 +2012,14 @@ void SwUnoCursorHelper::SetPropertyToDefault( if (!pEntry) { throw beans::UnknownPropertyException( - "Unknown property: " + rPropertyName, + OUString::Concat("Unknown property: ") + rPropertyName, static_cast<cppu::OWeakObject *>(nullptr)); } if (pEntry->nFlags & beans::PropertyAttribute::READONLY) { throw uno::RuntimeException( - "setPropertyToDefault: property is read-only: " + OUString::Concat("setPropertyToDefault: property is read-only: ") + rPropertyName, nullptr); } @@ -2043,14 +2043,15 @@ void SwUnoCursorHelper::SetPropertyToDefault( uno::Any SwUnoCursorHelper::GetPropertyDefault( SwPaM const & rPaM, const SfxItemPropertySet& rPropSet, - const OUString& rPropertyName) + std::u16string_view rPropertyName) { SfxItemPropertySimpleEntry const*const pEntry = rPropSet.getPropertyMap().getByName(rPropertyName); if (!pEntry) { throw beans::UnknownPropertyException( - "Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject *>(nullptr)); + OUString::Concat("Unknown property: ") + rPropertyName, + static_cast<cppu::OWeakObject *>(nullptr)); } uno::Any aRet; diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index c404d77d58b1..2560ef45bb8d 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -1454,11 +1454,11 @@ bool SwCSS1Parser::MayBePositioned( const SvxCSS1PropertyInfo& rPropInfo, SVX_CSS1_LTYPE_PERCENTAGE == rPropInfo.m_eWidthType ); } -void SwCSS1Parser::AddClassName( OUString& rFormatName, const OUString& rClass ) +void SwCSS1Parser::AddClassName( OUString& rFormatName, std::u16string_view rClass ) { - OSL_ENSURE( !rClass.isEmpty(), "Style class without length?" ); + OSL_ENSURE( !rClass.empty(), "Style class without length?" ); - rFormatName += "." + rClass; + rFormatName += OUString::Concat(".") + rClass; } void SwCSS1Parser::FillDropCap( SwFormatDrop& rDrop, diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 18c5def4ccf6..bb51694df012 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <hintids.hxx> #include <comphelper/documentinfo.hxx> #include <comphelper/string.hxx> @@ -818,7 +822,7 @@ static bool lcl_html_setEvents( return true; } -static void lcl_html_getEvents( const OUString& rOption, const OUString& rValue, +static void lcl_html_getEvents( const OUString& rOption, std::u16string_view rValue, std::vector<OUString>& rUnoMacroTable, std::vector<OUString>& rUnoMacroParamTable ) { diff --git a/sw/source/filter/html/swcss1.hxx b/sw/source/filter/html/swcss1.hxx index b9f127c1ec04..9d930f6bfcd7 100644 --- a/sw/source/filter/html/swcss1.hxx +++ b/sw/source/filter/html/swcss1.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SW_SOURCE_FILTER_HTML_SWCSS1_HXX #define INCLUDED_SW_SOURCE_FILTER_HTML_SWCSS1_HXX +#include <sal/config.h> + +#include <string_view> + #include <svtools/htmltokn.h> #include <tools/solar.h> @@ -128,7 +132,7 @@ public: bool SetFormatBreak( SfxItemSet& rItemSet, const SvxCSS1PropertyInfo& rPropInfo ); - static void AddClassName( OUString& rFormatName, const OUString& rClass ); + static void AddClassName( OUString& rFormatName, std::u16string_view rClass ); static bool MayBePositioned( const SvxCSS1PropertyInfo& rPropInfo, bool bAutoWidth=false ); diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 7d95066ef5b4..741448d96f7f 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -1219,10 +1219,10 @@ void SwHTMLWriter::OutPointFieldmarks( const SwPosition& rPos ) // TODO : Handle other single-point fieldmark types here (if any). } -void SwHTMLWriter::OutImplicitMark( const OUString& rMark, +void SwHTMLWriter::OutImplicitMark( std::u16string_view rMark, const char *pMarkType ) { - if( !rMark.isEmpty() && !m_aImplicitMarks.empty() ) + if( !rMark.empty() && !m_aImplicitMarks.empty() ) { OUString sMark(rMark + OUStringChar(cMarkSeparator) + OUString::createFromAscii(pMarkType)); if( 0 != m_aImplicitMarks.erase( sMark ) ) diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 26312473f7be..cef3eb788167 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -419,7 +419,7 @@ public: void OutAnchor( const OUString& rName ); void OutBookmarks(); void OutPointFieldmarks( const SwPosition& rPos ); - void OutImplicitMark( const OUString& rMark, const char *pMarkType ); + void OutImplicitMark( std::u16string_view rMark, const char *pMarkType ); OUString convertHyperlinkHRefValue(const OUString& rURL); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 6f76dcbaebaa..1134900df65e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7010,7 +7010,7 @@ void DocxAttributeOutput::FontPitchType( FontPitch ePitch ) const m_pSerializer->singleElementNS(XML_w, XML_pitch, FSNS(XML_w, XML_val), pPitch); } -void DocxAttributeOutput::EmbedFont( const OUString& name, FontFamily family, FontPitch pitch ) +void DocxAttributeOutput::EmbedFont( std::u16string_view name, FontFamily family, FontPitch pitch ) { if( !m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) return; // no font embedding with this document @@ -7025,7 +7025,7 @@ static char toHexChar( int value ) return value >= 10 ? value + 'A' - 10 : value + '0'; } -void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, FontFamily family, FontItalic italic, +void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, FontFamily family, FontItalic italic, FontWeight weight, FontPitch pitch ) { // Embed font if at least viewing is allowed (in which case the opening app must check diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index ed9fe43c5dbf..20781b13ceb3 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -325,7 +325,7 @@ public: void FontPitchType( FontPitch ePitch ) const; /// Write out the font into the document, if it's an embedded font. - void EmbedFont( const OUString& name, FontFamily family, FontPitch pitch ); + void EmbedFont( std::u16string_view name, FontFamily family, FontPitch pitch ); /// Definition of a numbering instance. virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule ) override; @@ -435,7 +435,7 @@ private: void WriteFFData( const FieldInfos& rInfos ); void WritePendingPlaceholder(); - void EmbedFontStyle( const OUString& name, int tag, FontFamily family, FontItalic italic, FontWeight weight, + void EmbedFontStyle( std::u16string_view name, int tag, FontFamily family, FontItalic italic, FontWeight weight, FontPitch pitch ); /** diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index ebff8c9db442..fdee9d097f31 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1062,8 +1062,8 @@ public: virtual void OutputField( const SwField* pField, ww::eField eFieldType, const OUString& rFieldCmd, FieldFlags nMode = FieldFlags::All ) override; - void StartCommentOutput( const OUString& rName ); - void EndCommentOutput( const OUString& rName ); + void StartCommentOutput( std::u16string_view rName ); + void EndCommentOutput( std::u16string_view rName ); void OutGrf(const ww8::Frame &rFrame); bool TestOleNeedsGraphic(const SwAttrSet& rSet, tools::SvRef<SotStorage> const& xOleStg, const tools::SvRef<SotStorage>& xObjStg, OUString const& rStorageName, diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 1cd22f2ee910..e05882cd09ad 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1893,15 +1893,15 @@ void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType, InsertSpecialChar( *this, 0x15, nullptr, bIncludeEmptyPicLocation ); } -void WW8Export::StartCommentOutput(const OUString& rName) +void WW8Export::StartCommentOutput(std::u16string_view rName) { const OUString sStr{ FieldString(ww::eQUOTE) + "[" + rName + "] " }; OutputField(nullptr, ww::eQUOTE, sStr, FieldFlags::Start | FieldFlags::CmdStart); } -void WW8Export::EndCommentOutput(const OUString& rName) +void WW8Export::EndCommentOutput(std::u16string_view rName) { - const OUString sStr{ " [" + rName + "] " }; + const OUString sStr{ OUString::Concat(" [") + rName + "] " }; OutputField(nullptr, ww::eQUOTE, sStr, FieldFlags::CmdEnd | FieldFlags::End | FieldFlags::Close); } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index c141c857f37c..d76614290239 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -159,9 +159,9 @@ static Color WW8TransCol(SVBT32 nWC) return Color(nWC[0], nWC[1], nWC[2]); } -void wwFrameNamer::SetUniqueGraphName(SwFrameFormat *pFrameFormat, const OUString &rFixed) +void wwFrameNamer::SetUniqueGraphName(SwFrameFormat *pFrameFormat, std::u16string_view rFixed) { - if (mbIsDisabled || rFixed.isEmpty()) + if (mbIsDisabled || rFixed.empty()) return; pFrameFormat->SetName(msSeed+OUString::number(++mnImportedGraphicsCount) + ": " + rFixed); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index b3d4fba36294..c8e52560564c 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -382,7 +382,7 @@ bool BasicProjImportHelper::import( const uno::Reference< io::XInputStream >& rx oox::StorageRef vbaStg = root.openSubStorage( "Macros" , false ); if ( vbaStg ) { - oox::ole::VbaProject aVbaPrj( mxCtx, mrDocShell.GetModel(), "Writer" ); + oox::ole::VbaProject aVbaPrj( mxCtx, mrDocShell.GetModel(), u"Writer" ); bRet = aVbaPrj.importVbaProject( *vbaStg ); } } diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 7629d2e5a63d..57b53e05589c 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -942,7 +942,7 @@ private: wwFrameNamer& operator=(wwFrameNamer const&) = delete; public: - void SetUniqueGraphName(SwFrameFormat *pFrameFormat, const OUString &rFixedPart); + void SetUniqueGraphName(SwFrameFormat *pFrameFormat, std::u16string_view rFixedPart); wwFrameNamer(bool bIsDisabled, const OUString &rSeed) : msSeed(rSeed), mnImportedGraphicsCount(0), mbIsDisabled(bIsDisabled) { diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx index 22e6a42368a7..42c5034c3f1c 100644 --- a/sw/source/filter/xml/xmlexp.hxx +++ b/sw/source/filter/xml/xmlexp.hxx @@ -23,6 +23,8 @@ #include <xmloff/xmlexp.hxx> #include "xmlitmap.hxx" #include <xmloff/xmltoken.hxx> + +#include <string_view> #include <vector> class SwDoc; @@ -66,7 +68,7 @@ class SwXMLExport : public SvXMLExport void ExportTableLinesAutoStyles( const SwTableLines& rLines, sal_uInt32 nAbsWidth, sal_uInt32 nBaseWidth, - const OUString& rNamePrefix, + std::u16string_view rNamePrefix, SwXMLTableColumnsSortByWidth_Impl& rExpCols, SwXMLTableFrameFormatsSort_Impl& rExpRows, SwXMLTableFrameFormatsSort_Impl& rExpCells, diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index 605845088fa1..a681fc4cf38d 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextSection.hpp> @@ -181,13 +185,13 @@ class SwXMLTableFrameFormatsSort_Impl private: SwXMLFrameFormats_Impl aFormatList; public: - bool AddRow( SwFrameFormat& rFrameFormat, const OUString& rNamePrefix, sal_uInt32 nLine ); - bool AddCell( SwFrameFormat& rFrameFormat, const OUString& rNamePrefix, + bool AddRow( SwFrameFormat& rFrameFormat, std::u16string_view rNamePrefix, sal_uInt32 nLine ); + bool AddCell( SwFrameFormat& rFrameFormat, std::u16string_view rNamePrefix, sal_uInt32 nCol, sal_uInt32 nRow, bool bTop ); }; bool SwXMLTableFrameFormatsSort_Impl::AddRow( SwFrameFormat& rFrameFormat, - const OUString& rNamePrefix, + std::u16string_view rNamePrefix, sal_uInt32 nLine ) { const SwFormatFrameSize *pFrameSize = nullptr; @@ -280,7 +284,7 @@ bool SwXMLTableFrameFormatsSort_Impl::AddRow( SwFrameFormat& rFrameFormat, if( bInsert ) { - rFrameFormat.SetName( rNamePrefix + "." + OUString::number(nLine+1) ); + rFrameFormat.SetName( OUString::Concat(rNamePrefix) + "." + OUString::number(nLine+1) ); if ( i != aFormatList.end() ) ++i; aFormatList.insert( i, &rFrameFormat ); } @@ -288,22 +292,22 @@ bool SwXMLTableFrameFormatsSort_Impl::AddRow( SwFrameFormat& rFrameFormat, return bInsert; } -static OUString lcl_xmltble_appendBoxPrefix(const OUString& rNamePrefix, +static OUString lcl_xmltble_appendBoxPrefix(std::u16string_view rNamePrefix, sal_uInt32 nCol, sal_uInt32 nRow, bool bTop ) { if( bTop ) { OUString sTmp; sw_GetTableBoxColStr( static_cast<sal_uInt16>(nCol), sTmp ); - return rNamePrefix + "." + sTmp + OUString::number(nRow + 1); + return OUString::Concat(rNamePrefix) + "." + sTmp + OUString::number(nRow + 1); } - return rNamePrefix + return OUString::Concat(rNamePrefix) + "." + OUString::number(nCol + 1) + "." + OUString::number(nRow + 1); } bool SwXMLTableFrameFormatsSort_Impl::AddCell( SwFrameFormat& rFrameFormat, - const OUString& rNamePrefix, + std::u16string_view rNamePrefix, sal_uInt32 nCol, sal_uInt32 nRow, bool bTop ) { const SwFormatVertOrient *pVertOrient = nullptr; @@ -557,7 +561,7 @@ void SwXMLExport::ExportTableColumnStyle( const SwXMLTableColumn_Impl& rCol ) void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, sal_uInt32 nAbsWidth, sal_uInt32 nBaseWidth, - const OUString& rNamePrefix, + std::u16string_view rNamePrefix, SwXMLTableColumnsSortByWidth_Impl& rExpCols, SwXMLTableFrameFormatsSort_Impl& rExpRows, SwXMLTableFrameFormatsSort_Impl& rExpCells, @@ -620,11 +624,12 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, { OUString sTmp; sw_GetTableBoxColStr( nColumn, sTmp ); - pColumn->SetStyleName( rNamePrefix + "." + sTmp ); + pColumn->SetStyleName( OUString::Concat(rNamePrefix) + "." + sTmp ); } else { - pColumn->SetStyleName( rNamePrefix + "." + OUString::number(nColumn + 1U) ); + pColumn->SetStyleName( + OUString::Concat(rNamePrefix) + "." + OUString::number(nColumn + 1U) ); } ExportTableColumnStyle( *pColumn ); rExpCols.insert( pColumn ); diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index d0a42a4bfbb3..15a77cdabb82 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -76,6 +76,8 @@ #include <o3tl/any.hxx> #include <memory> +#include <string_view> + #include <swuiexp.hxx> using namespace ::dbtools; @@ -1420,34 +1422,34 @@ void SwInsertDBColAutoPilot::SetTabSet() rSh.MoveTable( GotoCurrTable, fnTableStart ); } -static Sequence<OUString> lcl_createSourceNames(const OUString& rNodeName) +static Sequence<OUString> lcl_createSourceNames(std::u16string_view rNodeName) { Sequence<OUString> aSourceNames(11); OUString* pNames = aSourceNames.getArray(); - pNames[0] = rNodeName + "/DataSource"; - pNames[1] = rNodeName + "/Command"; - pNames[2] = rNodeName + "/CommandType"; - pNames[3] = rNodeName + "/ColumnsToText"; - pNames[4] = rNodeName + "/ColumnsToTable"; - pNames[5] = rNodeName + "/ParaStyle"; - pNames[6] = rNodeName + "/TableAutoFormat"; - pNames[7] = rNodeName + "/IsTable"; - pNames[8] = rNodeName + "/IsField"; - pNames[9] = rNodeName + "/IsHeadlineOn"; - pNames[10] = rNodeName + "/IsEmptyHeadline"; + pNames[0] = OUString::Concat(rNodeName) + "/DataSource"; + pNames[1] = OUString::Concat(rNodeName) + "/Command"; + pNames[2] = OUString::Concat(rNodeName) + "/CommandType"; + pNames[3] = OUString::Concat(rNodeName) + "/ColumnsToText"; + pNames[4] = OUString::Concat(rNodeName) + "/ColumnsToTable"; + pNames[5] = OUString::Concat(rNodeName) + "/ParaStyle"; + pNames[6] = OUString::Concat(rNodeName) + "/TableAutoFormat"; + pNames[7] = OUString::Concat(rNodeName) + "/IsTable"; + pNames[8] = OUString::Concat(rNodeName) + "/IsField"; + pNames[9] = OUString::Concat(rNodeName) + "/IsHeadlineOn"; + pNames[10] = OUString::Concat(rNodeName) + "/IsEmptyHeadline"; return aSourceNames; } -static Sequence<OUString> lcl_CreateSubNames(const OUString& rSubNodeName) +static Sequence<OUString> lcl_CreateSubNames(std::u16string_view rSubNodeName) { Sequence<OUString> aSubSourceNames(6); OUString* pNames = aSubSourceNames.getArray(); - pNames[0] = rSubNodeName + "/ColumnName"; - pNames[1] = rSubNodeName + "/ColumnIndex"; - pNames[2] = rSubNodeName + "/IsNumberFormat"; - pNames[3] = rSubNodeName + "/IsNumberFormatFromDataBase"; - pNames[4] = rSubNodeName + "/NumberFormat"; - pNames[5] = rSubNodeName + "/NumberFormatLocale"; + pNames[0] = OUString::Concat(rSubNodeName) + "/ColumnName"; + pNames[1] = OUString::Concat(rSubNodeName) + "/ColumnIndex"; + pNames[2] = OUString::Concat(rSubNodeName) + "/IsNumberFormat"; + pNames[3] = OUString::Concat(rSubNodeName) + "/IsNumberFormatFromDataBase"; + pNames[4] = OUString::Concat(rSubNodeName) + "/NumberFormat"; + pNames[5] = OUString::Concat(rSubNodeName) + "/NumberFormatLocale"; return aSubSourceNames; } @@ -1614,7 +1616,7 @@ void SwInsertDBColAutoPilot::Load() for(const OUString& rSubName : aSubNames) { Sequence <OUString> aSubNodeNames = - lcl_CreateSubNames(sSubNodeName + rSubName); + lcl_CreateSubNames(OUString(sSubNodeName + rSubName)); Sequence< Any> aSubProps = GetProperties(aSubNodeNames); const Any* pSubProps = aSubProps.getConstArray(); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 14215accd178..357be32aa182 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -58,6 +58,7 @@ #include <svx/dialogs.hrc> #include <svx/flagsdef.hxx> #include <memory> +#include <string_view> using namespace ::com::sun::star; @@ -171,8 +172,8 @@ public: OUString GetFile() const; OUString GetSubRegion() const; void SetFile(OUString const& rFile); - void SetFilter(OUString const& rFilter); - void SetSubRegion(OUString const& rSubRegion); + void SetFilter(std::u16string_view rFilter); + void SetSubRegion(std::u16string_view rSubRegion); bool IsContent() const { return m_bContent; } void SetContent(bool const bValue) { m_bContent = bValue; } @@ -235,7 +236,7 @@ void SectRepr::SetFile( const OUString& rFile ) } } -void SectRepr::SetFilter( const OUString& rFilter ) +void SectRepr::SetFilter( std::u16string_view rFilter ) { OUString sNewFile; const OUString sOldFileName( m_SectionData.GetLinkFileName() ); @@ -257,7 +258,7 @@ void SectRepr::SetFilter( const OUString& rFilter ) } } -void SectRepr::SetSubRegion(const OUString& rSubRegion) +void SectRepr::SetSubRegion(std::u16string_view rSubRegion) { OUString sNewFile; sal_Int32 n(0); @@ -265,13 +266,13 @@ void SectRepr::SetSubRegion(const OUString& rSubRegion) const OUString sOldFileName( sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n ) ); const OUString sFilter( sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n ) ); - if( !rSubRegion.isEmpty() || !sOldFileName.isEmpty() ) + if( !rSubRegion.empty() || !sOldFileName.isEmpty() ) sNewFile = sOldFileName + OUStringChar(sfx2::cTokenSeparator) + sFilter + OUStringChar(sfx2::cTokenSeparator) + rSubRegion; m_SectionData.SetLinkFileName( sNewFile ); - if( !rSubRegion.isEmpty() || !sOldFileName.isEmpty() ) + if( !rSubRegion.empty() || !sOldFileName.isEmpty() ) { m_SectionData.SetType( SectionType::FileLink ); } @@ -942,7 +943,7 @@ IMPL_LINK(SwEditRegionDlg, UseFileHdl, weld::ToggleButton&, rButton, void) else { pSectRepr->SetFile(OUString()); - pSectRepr->SetSubRegion(OUString()); + pSectRepr->SetSubRegion(std::u16string_view()); pSectRepr->GetSectionData().SetLinkFilePassword(OUString()); } return false; diff --git a/sw/source/ui/dochdl/selglos.cxx b/sw/source/ui/dochdl/selglos.cxx index 46acd407f057..1d2b93f239a6 100644 --- a/sw/source/ui/dochdl/selglos.cxx +++ b/sw/source/ui/dochdl/selglos.cxx @@ -19,7 +19,7 @@ #include <selglos.hxx> -SwSelGlossaryDlg::SwSelGlossaryDlg(weld::Window * pParent, const OUString &rShortName) +SwSelGlossaryDlg::SwSelGlossaryDlg(weld::Window * pParent, std::u16string_view rShortName) : GenericDialogController(pParent, "modules/swriter/ui/insertautotextdialog.ui", "InsertAutoTextDialog") , m_xFrame(m_xBuilder->weld_frame("frame")) , m_xGlosBox(m_xBuilder->weld_tree_view("treeview")) diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 7a9620b876cf..16b3a66d8460 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -1108,7 +1108,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) { SfxViewShell* pViewShell = GetView()? GetView(): SfxViewShell::Current(); bool bVisible = sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame()->GetBindings(), - "modules/swriter/ui/"); + u"modules/swriter/ui/"); rSet.Put( SfxBoolItem( SID_NOTEBOOKBAR, bVisible ) ); } break; diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index c720c3775c8c..d824ac393cbd 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -368,7 +368,7 @@ static const SwBoxAutoFormat* lcl_FindCellStyle(SwDoc& rDoc, std::u16string_view } sal_uInt32 SwStyleSheetIterator::SwPoolFormatList::FindName(SfxStyleFamily eFam, - const OUString &rName) + std::u16string_view rName) { if(!maImpl.empty()) { @@ -423,7 +423,7 @@ void SwStyleSheetIterator::SwPoolFormatList::rehash() } void SwStyleSheetIterator::SwPoolFormatList::RemoveName(SfxStyleFamily eFam, - const OUString &rName) + std::u16string_view rName) { sal_uInt32 nTmpPos = FindName( eFam, rName ); if( nTmpPos < maImpl.size() ) @@ -435,7 +435,7 @@ void SwStyleSheetIterator::SwPoolFormatList::RemoveName(SfxStyleFamily eFam, } // Add Strings to the list of templates -void SwStyleSheetIterator::SwPoolFormatList::Append( char cChar, const OUString& rStr ) +void SwStyleSheetIterator::SwPoolFormatList::Append( char cChar, std::u16string_view rStr ) { const OUString aStr = OUStringChar(cChar) + rStr; diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx index ab18e2118cc3..5536f9634c6d 100644 --- a/sw/source/uibase/inc/inputwin.hxx +++ b/sw/source/uibase/inc/inputwin.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_INPUTWIN_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_INPUTWIN_HXX +#include <sal/config.h> + +#include <string_view> + #include <vcl/InterimItemWindow.hxx> #include <vcl/menu.hxx> #include <vcl/toolbox.hxx> @@ -49,7 +53,7 @@ public: SetSizePixel(m_xWidget->get_preferred_size()); } - void UpdateRange(const OUString& rSel, const OUString& rTableName); + void UpdateRange(std::u16string_view rSel, const OUString& rTableName); virtual void dispose() override { diff --git a/sw/source/uibase/inc/selglos.hxx b/sw/source/uibase/inc/selglos.hxx index 0109051a5f68..fd5de379631a 100644 --- a/sw/source/uibase/inc/selglos.hxx +++ b/sw/source/uibase/inc/selglos.hxx @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <vcl/weld.hxx> class SwSelGlossaryDlg final : public weld::GenericDialogController @@ -28,12 +32,12 @@ class SwSelGlossaryDlg final : public weld::GenericDialogController DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); public: - SwSelGlossaryDlg(weld::Window * pParent, const OUString &rShortName); + SwSelGlossaryDlg(weld::Window * pParent, std::u16string_view rShortName); virtual ~SwSelGlossaryDlg() override; - void InsertGlos(const OUString &rRegion, const OUString &rGlosName) + void InsertGlos(std::u16string_view rRegion, std::u16string_view rGlosName) { - const OUString aTmp = rRegion + ":" + rGlosName; + const OUString aTmp = OUString::Concat(rRegion) + ":" + rGlosName; m_xGlosBox->append_text(aTmp); } sal_Int32 GetSelectedIdx() const diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index f4e58d08ffcd..181f8c7247e1 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -18,6 +18,7 @@ */ #include <algorithm> +#include <string_view> #include <com/sun/star/container/XNamed.hpp> #include <comphelper/servicehelper.hxx> @@ -47,9 +48,9 @@ using namespace ::com::sun::star::uno; namespace { -OUString lcl_FullPathName(const OUString& sPath, const OUString& sName) +OUString lcl_FullPathName(std::u16string_view sPath, std::u16string_view sName) { - return sPath + "/" + sName + SwGlossaries::GetExtension(); + return OUString::Concat(sPath) + "/" + sName + SwGlossaries::GetExtension(); } OUString lcl_CheckFileName( const OUString& rNewFilePath, diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index c5dfa9dc1366..fb1b082d6747 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -501,10 +501,10 @@ IMPL_LINK_NOARG(InputEdit, ActivateHdl, weld::Entry&, bool) return true; } -void InputEdit::UpdateRange(const OUString& rBoxes, +void InputEdit::UpdateRange(std::u16string_view rBoxes, const OUString& rName ) { - if( rBoxes.isEmpty() ) + if( rBoxes.empty() ) { GrabFocus(); return; |