From 48e279c6748bf023fba12fdc3f4cee402f611c6e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 26 Apr 2021 14:03:48 +0200 Subject: use string_view in INetURLObject::decode Change-Id: I10e04970ceac33c9c3fbfd0182dd2140e06cb80b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114658 Tested-by: Jenkins Reviewed-by: Noel Grandin --- fpicker/source/office/RemoteFilesDialog.cxx | 2 +- include/oox/core/xmlfilterbase.hxx | 4 +-- include/oox/export/drawingml.hxx | 2 +- include/tools/urlobj.hxx | 19 ++---------- oox/source/core/xmlfilterbase.cxx | 16 +++++----- oox/source/export/drawingml.cxx | 14 ++++----- oox/source/export/shapes.cxx | 2 +- sc/source/core/tool/compiler.cxx | 2 +- sc/source/filter/excel/xecontent.cxx | 2 +- sc/source/filter/excel/xestream.cxx | 4 +-- sc/source/filter/excel/xestyle.cxx | 2 +- sc/source/filter/inc/xestream.hxx | 2 +- sc/source/filter/xcl97/XclExpChangeTrack.cxx | 4 +-- sd/source/filter/eppt/pptx-epptooxml.cxx | 12 ++++---- sfx2/source/appl/macroloader.cxx | 6 ++-- sfx2/source/notify/eventsupplier.cxx | 2 +- sw/inc/mdiexp.hxx | 2 +- sw/inc/view.hxx | 2 +- sw/qa/extras/ooxmlexport/ooxmllinks.cxx | 2 +- sw/qa/extras/uiwriter/uiwriter3.cxx | 12 ++++---- .../doc/DocumentLinksAdministrationManager.cxx | 2 +- .../inc/DocumentLinksAdministrationManager.hxx | 3 +- sw/source/filter/ww8/docxattributeoutput.cxx | 2 +- sw/source/filter/ww8/docxexport.cxx | 36 +++++++++++----------- sw/source/filter/ww8/docxexport.hxx | 2 +- sw/source/filter/ww8/wrtw8nds.cxx | 4 +-- sw/source/filter/ww8/wrtww8.cxx | 18 +++++------ sw/source/filter/ww8/wrtww8.hxx | 2 +- sw/source/filter/ww8/ww8par.hxx | 4 +-- sw/source/filter/ww8/ww8par5.cxx | 2 +- sw/source/ui/dialog/uiregionsw.cxx | 16 +++++----- sw/source/uibase/docvw/edtwin3.cxx | 2 +- sw/source/uibase/uiview/view2.cxx | 4 +-- 33 files changed, 99 insertions(+), 111 deletions(-) diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 1282d47115a3..ee031caf099d 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -1087,7 +1087,7 @@ void RemoteFilesDialog::UpdateControls( const OUString& rURL ) if( nTitleStart != -1 ) { OUString sTitle( INetURLObject::decode( - aFolderName.copy( nTitleStart + 1 ), + aFolderName.subView( nTitleStart + 1 ), INetURLObject::DecodeMechanism::WithCharset ) ); if( rFolder.mbIsFolder ) diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx index ce8ab9e3ae47..7c1cada284d2 100644 --- a/include/oox/core/xmlfilterbase.hxx +++ b/include/oox/core/xmlfilterbase.hxx @@ -163,7 +163,7 @@ public: @return Added relation Id. */ - OUString addRelation( const OUString& rType, const OUString& rTarget ); + OUString addRelation( const OUString& rType, std::u16string_view rTarget ); /** Adds new relation to part's relations. @@ -178,7 +178,7 @@ public: @return Added relation Id. */ - OUString addRelation( const css::uno::Reference< css::io::XOutputStream >& rOutputStream, const OUString& rType, const OUString& rTarget, bool bExternal = false ); + OUString addRelation( const css::uno::Reference< css::io::XOutputStream >& rOutputStream, const OUString& rType, std::u16string_view rTarget, bool bExternal = false ); /** Returns a stack of used textfields, used by the pptx importer to replace links to slidepages with the real page name */ TextFieldStack& getTextFieldStack() const; diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index bc9c8bc9dd69..2876d59c5367 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -323,7 +323,7 @@ public: sax_fastparser::FSHelperPtr CreateOutputStream ( const OUString& sFullStream, - const OUString& sRelativeStream, + std::u16string_view sRelativeStream, const css::uno::Reference< css::io::XOutputStream >& xParentRelation, const char* sContentType, const char* sRelationshipType, diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx index 1fb5f4e86aea..e323e5049987 100644 --- a/include/tools/urlobj.hxx +++ b/include/tools/urlobj.hxx @@ -839,12 +839,7 @@ public: @return The text, decoded according to the given mechanism and charset (escape sequences replaced by 'raw' characters). */ - static inline OUString decode(OUString const & rText, - DecodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - static inline OUString decode(OUStringBuffer const & rText, + static inline OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); @@ -1298,19 +1293,11 @@ inline OUString INetURLObject::encode(OUString const & rText, Part ePart, } // static -inline OUString INetURLObject::decode(OUString const & rText, - DecodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return decode(rText.getStr(), rText.getStr() + rText.getLength(), - eMechanism, eCharset); -} - -inline OUString INetURLObject::decode(OUStringBuffer const & rText, +inline OUString INetURLObject::decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset) { - return decode(rText.getStr(), rText.getStr() + rText.getLength(), + return decode(rText.data(), rText.data() + rText.size(), eMechanism, eCharset); } diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index b46392d1a246..a61d80e6cc6b 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -507,7 +507,7 @@ TextFieldStack& XmlFilterBase::getTextFieldStack() const namespace { -OUString lclAddRelation( const Reference< XRelationshipAccess >& rRelations, sal_Int32 nId, const OUString& rType, const OUString& rTarget, bool bExternal ) +OUString lclAddRelation( const Reference< XRelationshipAccess >& rRelations, sal_Int32 nId, const OUString& rType, std::u16string_view rTarget, bool bExternal ) { OUString sId = "rId" + OUString::number( nId ); @@ -528,7 +528,7 @@ OUString lclAddRelation( const Reference< XRelationshipAccess >& rRelations, sal } // namespace -OUString XmlFilterBase::addRelation( const OUString& rType, const OUString& rTarget ) +OUString XmlFilterBase::addRelation( const OUString& rType, std::u16string_view rTarget ) { Reference< XRelationshipAccess > xRelations( getStorage()->getXStorage(), UNO_QUERY ); if( xRelations.is() ) @@ -537,7 +537,7 @@ OUString XmlFilterBase::addRelation( const OUString& rType, const OUString& rTar return OUString(); } -OUString XmlFilterBase::addRelation( const Reference< XOutputStream >& rOutputStream, const OUString& rType, const OUString& rTarget, bool bExternal ) +OUString XmlFilterBase::addRelation( const Reference< XOutputStream >& rOutputStream, const OUString& rType, std::u16string_view rTarget, bool bExternal ) { sal_Int32 nId = 0; @@ -631,7 +631,7 @@ writeCoreProperties( XmlFilterBase& rSelf, const Reference< XDocumentProperties else sValue = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"; - rSelf.addRelation( sValue, "docProps/core.xml" ); + rSelf.addRelation( sValue, u"docProps/core.xml" ); FSHelperPtr pCoreProps = rSelf.openFragmentStreamWithSerializer( "docProps/core.xml", "application/vnd.openxmlformats-package.core-properties+xml" ); @@ -705,7 +705,7 @@ writeAppProperties( XmlFilterBase& rSelf, const Reference< XDocumentProperties > { rSelf.addRelation( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", - "docProps/app.xml" ); + u"docProps/app.xml" ); FSHelperPtr pAppProps = rSelf.openFragmentStreamWithSerializer( "docProps/app.xml", "application/vnd.openxmlformats-officedocument.extended-properties+xml" ); @@ -845,7 +845,7 @@ writeCustomProperties( XmlFilterBase& rSelf, const Reference< XDocumentPropertie rSelf.addRelation( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties", - "docProps/custom.xml" ); + u"docProps/custom.xml" ); FSHelperPtr pAppProps = rSelf.openFragmentStreamWithSerializer( "docProps/custom.xml", "application/vnd.openxmlformats-officedocument.custom-properties+xml" ); @@ -1177,7 +1177,7 @@ void XmlFilterBase::exportCustomFragments() const OUString fragmentPath = "customXml/item" + OUString::number((j+1)) + ".xml"; if (customXmlDom.is()) { - addRelation(oox::getRelationship(Relationship::CUSTOMXML), "../" + fragmentPath); + addRelation(oox::getRelationship(Relationship::CUSTOMXML), OUString("../" + fragmentPath)); uno::Reference serializer(customXmlDom, uno::UNO_QUERY); uno::Reference writer = xml::sax::Writer::create(comphelper::getProcessComponentContext()); @@ -1198,7 +1198,7 @@ void XmlFilterBase::exportCustomFragments() // Adding itemprops's relationship entry to item.xml.rels file addRelation(openFragmentStream(fragmentPath, "application/xml"), oox::getRelationship(Relationship::CUSTOMXMLPROPS), - "itemProps"+OUString::number((j+1))+".xml"); + OUString("itemProps"+OUString::number((j+1))+".xml")); } } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index dfb81a27e713..07dad1fb8b75 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3821,7 +3821,7 @@ sal_Unicode DrawingML::SubstituteBullet( sal_Unicode cBulletId, css::awt::FontDe sax_fastparser::FSHelperPtr DrawingML::CreateOutputStream ( const OUString& sFullStream, - const OUString& sRelativeStream, + std::u16string_view sRelativeStream, const Reference< XOutputStream >& xParentRelation, const char* sContentType, const char* sRelationshipType, @@ -4856,7 +4856,7 @@ void DrawingML::WriteDiagram(const css::uno::Reference& rX OUString dataFileName = "diagrams/data" + OUString::number(nDiagramId) + ".xml"; OString dataRelId = OUStringToOString( mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::DIAGRAMDATA), - sRelationCompPrefix + dataFileName), + OUString(sRelationCompPrefix + dataFileName)), RTL_TEXTENCODING_UTF8); // add layout relation @@ -4864,7 +4864,7 @@ void DrawingML::WriteDiagram(const css::uno::Reference& rX OString layoutRelId = OUStringToOString(mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::DIAGRAMLAYOUT), - sRelationCompPrefix + layoutFileName), + OUString(sRelationCompPrefix + layoutFileName)), RTL_TEXTENCODING_UTF8); // add style relation @@ -4872,7 +4872,7 @@ void DrawingML::WriteDiagram(const css::uno::Reference& rX OString styleRelId = OUStringToOString(mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::DIAGRAMQUICKSTYLE), - sRelationCompPrefix + styleFileName), + OUString(sRelationCompPrefix + styleFileName)), RTL_TEXTENCODING_UTF8); // add color relation @@ -4880,7 +4880,7 @@ void DrawingML::WriteDiagram(const css::uno::Reference& rX OString colorRelId = OUStringToOString(mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::DIAGRAMCOLORS), - sRelationCompPrefix + colorFileName), + OUString(sRelationCompPrefix + colorFileName)), RTL_TEXTENCODING_UTF8); OUString drawingFileName; @@ -4890,7 +4890,7 @@ void DrawingML::WriteDiagram(const css::uno::Reference& rX drawingFileName = "diagrams/drawing" + OUString::number(nDiagramId) + ".xml"; OUString drawingRelId = mpFB->addRelation( mpFS->getOutputStream(), oox::getRelationship(Relationship::DIAGRAMDRAWING), - sRelationCompPrefix + drawingFileName); + OUString(sRelationCompPrefix + drawingFileName)); // the data dom contains a reference to the drawing relation. We need to update it with the new generated // relation value before writing the dom to a file @@ -5021,7 +5021,7 @@ void DrawingML::writeDiagramRels(const uno::Sequence>& x PropertySet aProps(xOutStream); aProps.setAnyProperty(PROP_RelId, uno::makeAny(sRelId.toInt32())); - mpFB->addRelation(xOutStream, sType, "../" + sFragment); + mpFB->addRelation(xOutStream, sType, OUString("../" + sFragment)); OUString sDir = OUString::createFromAscii(GetComponentDir()); uno::Reference xBinOutStream diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 81aae66df134..f45b0aabc61d 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -2114,7 +2114,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape ) OUString const sRelId = mpFB->addRelation( mpFS->getOutputStream(), sRelationType, - OUString::createFromAscii(GetRelationCompPrefix()) + sFileName); + OUString(OUString::createFromAscii(GetRelationCompPrefix()) + sFileName)); mpFS->startElementNS(mnXmlNamespace, XML_graphicFrame); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 488e5ab1fd9f..9e8f8929dc12 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -1184,7 +1184,7 @@ struct ConventionXL return lcl_makeExternalNameStr( rFile, rName, '!', false); } - static void makeExternalDocStr( OUStringBuffer& rBuffer, const OUString& rFullName ) + static void makeExternalDocStr( OUStringBuffer& rBuffer, std::u16string_view rFullName ) { // Format that is easier to deal with inside OOo, because we use file // URL, and all characters are allowed. Check if it makes sense to do diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index f505968d6373..cf0c3777f39f 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -209,7 +209,7 @@ void XclExpSstImpl::SaveXml( XclExpXmlStream& rStrm ) sax_fastparser::FSHelperPtr pSst = rStrm.CreateOutputStream( "xl/sharedStrings.xml", - "sharedStrings.xml", + u"sharedStrings.xml", rStrm.GetCurrentStream()->getOutputStream(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml", oox::getRelationship(Relationship::SHAREDSTRINGS)); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 18647bbd3c02..f98d81601f41 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -939,7 +939,7 @@ void XclExpXmlStream::WriteAttribute(sal_Int32 nAttr, std::u16string_view sVal) sax_fastparser::FSHelperPtr XclExpXmlStream::CreateOutputStream ( const OUString& sFullStream, - const OUString& sRelativeStream, + std::u16string_view sRelativeStream, const uno::Reference< XOutputStream >& xParentRelation, const char* sContentType, std::u16string_view sRelationshipType, @@ -1093,7 +1093,7 @@ bool XclExpXmlStream::exportDocument() openFragmentStream("xl/vbaProject.bin", "application/vnd.ms-office.vbaProject"); comphelper::OStorageHelper::CopyInputToOutput(xVBAStream, xVBAOutput); - addRelation(GetCurrentStream()->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), "vbaProject.bin"); + addRelation(GetCurrentStream()->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), u"vbaProject.bin"); } } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 6376371fb1da..d3830d7ad9b0 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3189,7 +3189,7 @@ void XclExpXmlStyleSheet::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr aStyleSheet = rStrm.CreateOutputStream( "xl/styles.xml", - "styles.xml", + u"styles.xml", rStrm.GetCurrentStream()->getOutputStream(), "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", oox::getRelationship(Relationship::STYLES)); diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx index e8161e31e182..3dfdb87fbe40 100644 --- a/sc/source/filter/inc/xestream.hxx +++ b/sc/source/filter/inc/xestream.hxx @@ -309,7 +309,7 @@ public: sax_fastparser::FSHelperPtr CreateOutputStream ( const OUString& sFullStream, - const OUString& sRelativeStream, + std::u16string_view sRelativeStream, const css::uno::Reference< css::io::XOutputStream >& xParentRelation, const char* sContentType, std::u16string_view sRelationshipType, diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 1efcd8b4f0e9..5ddd4bf64d7e 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -1616,7 +1616,7 @@ static void lcl_WriteUserNamesXml( XclExpXmlStream& rWorkbookStrm ) { sax_fastparser::FSHelperPtr pUserNames = rWorkbookStrm.CreateOutputStream( "xl/revisions/userNames.xml", - "revisions/userNames.xml", + u"revisions/userNames.xml", rWorkbookStrm.GetCurrentStream()->getOutputStream(), "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml", CREATE_OFFICEDOC_RELATION_TYPE("usernames")); @@ -1639,7 +1639,7 @@ void XclExpChangeTrack::WriteXml( XclExpXmlStream& rWorkbookStrm ) sax_fastparser::FSHelperPtr pRevisionHeaders = rWorkbookStrm.CreateOutputStream( "xl/revisions/revisionHeaders.xml", - "revisions/revisionHeaders.xml", + u"revisions/revisionHeaders.xml", rWorkbookStrm.GetCurrentStream()->getOutputStream(), "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml", CREATE_OFFICEDOC_RELATION_TYPE("revisionHeaders")); diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index afed524c0452..d87f51a07712 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -384,7 +384,7 @@ bool PowerPointExport::exportDocument() //write document properties writeDocumentProperties(); - addRelation(oox::getRelationship(Relationship::OFFICEDOCUMENT), "ppt/presentation.xml"); + addRelation(oox::getRelationship(Relationship::OFFICEDOCUMENT), u"ppt/presentation.xml"); OUString aMediaType; if (mbPptm) @@ -414,7 +414,7 @@ bool PowerPointExport::exportDocument() addRelation(mPresentationFS->getOutputStream(), oox::getRelationship(Relationship::THEME), - "theme/theme1.xml"); + u"theme/theme1.xml"); mPresentationFS->startElementNS(XML_p, XML_presentation, PNMSS); @@ -953,7 +953,7 @@ void PowerPointExport::WriteAuthors() "application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml"); addRelation(mPresentationFS->getOutputStream(), oox::getRelationship(Relationship::COMMENTAUTHORS), - "commentAuthors.xml"); + u"commentAuthors.xml"); pFS->startElementNS(XML_p, XML_cmAuthorLst, FSNS(XML_xmlns, XML_p), getNamespaceURL(OOX_NS(ppt))); @@ -1070,7 +1070,7 @@ void PowerPointExport::WriteVBA() comphelper::OStorageHelper::CopyInputToOutput(xMacrosStream, xOutputStream); // Write the relationship. - addRelation(mPresentationFS->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), "vbaProject.bin"); + addRelation(mPresentationFS->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), u"vbaProject.bin"); } void PowerPointExport::ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 /* nMode */, @@ -1205,7 +1205,7 @@ void PowerPointExport::ImplWriteNotes(sal_uInt32 nPageNum) // add implicit relation to notes master addRelation(pFS->getOutputStream(), oox::getRelationship(Relationship::NOTESMASTER), - "../notesMasters/notesMaster1.xml"); + u"../notesMasters/notesMaster1.xml"); SAL_INFO("sd.eppt", "-----------------"); } @@ -1879,7 +1879,7 @@ void PowerPointExport::WriteNotesMaster() OUString sRelId = addRelation(mPresentationFS->getOutputStream(), oox::getRelationship(Relationship::NOTESMASTER), - "notesMasters/notesMaster1.xml"); + u"notesMasters/notesMaster1.xml"); mPresentationFS->singleElementNS(XML_p, XML_notesMasterId, FSNS(XML_r, XML_id), sRelId); diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx index 46090f712665..95ace6cf665e 100644 --- a/sfx2/source/appl/macroloader.cxx +++ b/sfx2/source/appl/macroloader.cxx @@ -215,7 +215,7 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, css::uno::Any& rRetval, { // find BasicManager SfxObjectShell* pDoc = nullptr; - OUString aBasMgrName( INetURLObject::decode(aMacro.copy( 8, nThirdSlashPos-8 ), INetURLObject::DecodeMechanism::WithCharset) ); + OUString aBasMgrName( INetURLObject::decode(aMacro.subView( 8, nThirdSlashPos-8 ), INetURLObject::DecodeMechanism::WithCharset) ); if ( aBasMgrName.isEmpty() ) pBasMgr = pAppMgr; else if ( aBasMgrName == "." ) @@ -252,7 +252,7 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, css::uno::Any& rRetval, } // find BASIC method - OUString aQualifiedMethod( INetURLObject::decode(aMacro.copy( nThirdSlashPos+1 ), INetURLObject::DecodeMechanism::WithCharset) ); + OUString aQualifiedMethod( INetURLObject::decode(aMacro.subView( nThirdSlashPos+1 ), INetURLObject::DecodeMechanism::WithCharset) ); OUString aArgs; if ( -1 != nArgsPos ) { @@ -315,7 +315,7 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, css::uno::Any& rRetval, { // direct API call on a specified object OUStringBuffer aCall; - aCall.append('[').append(INetURLObject::decode(aMacro.copy(6), + aCall.append('[').append(INetURLObject::decode(aMacro.subView(6), INetURLObject::DecodeMechanism::WithCharset)); aCall.append(']'); pAppMgr->GetLib(0)->Execute(aCall.makeStringAndClear()); diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index 091ed963de90..26028a16e4b5 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -431,7 +431,7 @@ void SfxEvents_Impl::NormalizeMacro( const ::comphelper::NamedValueCollection& i sal_Int32 nArgsPos = aScript.indexOf( '(' ); if ( ( nThirdSlashPos != -1 ) && ( nArgsPos == -1 || nThirdSlashPos < nArgsPos ) ) { - OUString aBasMgrName( INetURLObject::decode( aScript.copy( 8, nThirdSlashPos-8 ), INetURLObject::DecodeMechanism::WithCharset ) ); + OUString aBasMgrName( INetURLObject::decode( aScript.subView( 8, nThirdSlashPos-8 ), INetURLObject::DecodeMechanism::WithCharset ) ); if (pDoc && aBasMgrName == ".") aLibrary = pDoc->GetTitle(); else diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx index 3901fce1c12f..dea2b4361825 100644 --- a/sw/inc/mdiexp.hxx +++ b/sw/inc/mdiexp.hxx @@ -49,7 +49,7 @@ void RepaintPagePreview( SwViewShell const * pVwSh, const SwRect& rRect ); // Read ChgMode for tables from configuration. TableChgMode GetTableChgDefaultMode(); -bool JumpToSwMark( SwViewShell const * pVwSh, const OUString& rMark ); +bool JumpToSwMark( SwViewShell const * pVwSh, std::u16string_view rMark ); #endif diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index 4232d315478a..73dfc1c7a54f 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -591,7 +591,7 @@ public: void SetCursorAtTop( bool bFlag, bool bCenter = false ) { m_bTopCursor = bFlag; m_bCenterCursor = bCenter; } - bool JumpToSwMark( const OUString& rMark ); + bool JumpToSwMark( std::u16string_view rMark ); tools::Long InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName, const OUString& rFilterName, sal_Int16 nVersion = 0 ); diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index f29950b3c9cf..d5f0e8784516 100644 --- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx @@ -242,7 +242,7 @@ DECLARE_LINKS_EXPORT_TEST(testNon_ascii_link_export, "non_ascii_link.docx", USE_ xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[@TargetMode='External']", "Target", - INetURLObject::decode(OUString("file:///C:/TEMP/%C3%A9kezet.docx"), + INetURLObject::decode(u"file:///C:/TEMP/%C3%A9kezet.docx", INetURLObject::DecodeMechanism::ToIUri, RTL_TEXTENCODING_UTF8)); } diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index b2ece7527de4..ba2132e0d8ed 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -738,7 +738,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) rWrtShell.Push(); OUString const url(aSet.GetItem(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(OUString("#1%19the%20tocmark%19C%7Ctoxmark"), url); - rView.JumpToSwMark(url.copy(1)); // SfxApplication::OpenDocExec_Impl eats the "#" + rView.JumpToSwMark(url.subView(1)); // SfxApplication::OpenDocExec_Impl eats the "#" CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_INWORD) + "tocmark"), rWrtShell.GetCursor()->GetNode().GetTextNode()->GetText()); rWrtShell.Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -753,7 +753,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) rWrtShell.Push(); OUString const url(aSet.GetItem(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(OUString("#__RefHeading___Toc105_706348105"), url); - rView.JumpToSwMark(url.copy(1)); + rView.JumpToSwMark(url.subView(1)); CPPUNIT_ASSERT_EQUAL(OUString("foo"), rWrtShell.GetCursor()->GetNode().GetTextNode()->GetText()); rWrtShell.Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -773,7 +773,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) rWrtShell.Push(); OUString const url(aSet.GetItem(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(OUString("#1%19the%20udmark%19UUser-Defined%7Ctoxmark"), url); - rView.JumpToSwMark(url.copy(1)); + rView.JumpToSwMark(url.subView(1)); CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_INWORD) + "udmark the first"), rWrtShell.GetCursor()->GetNode().GetTextNode()->GetText()); rWrtShell.Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -788,7 +788,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) rWrtShell.Push(); OUString const url(aSet.GetItem(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(OUString("#2%19the%20udmark%19UUser-Defined%7Ctoxmark"), url); - rView.JumpToSwMark(url.copy(1)); + rView.JumpToSwMark(url.subView(1)); CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_INWORD) + "udmark the 2nd"), rWrtShell.GetCursor()->GetNode().GetTextNode()->GetText()); rWrtShell.Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -803,7 +803,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) rWrtShell.Push(); OUString const url(aSet.GetItem(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(OUString("#__RefHeading___Toc105_706348105"), url); - rView.JumpToSwMark(url.copy(1)); + rView.JumpToSwMark(url.subView(1)); CPPUNIT_ASSERT_EQUAL(OUString("foo"), rWrtShell.GetCursor()->GetNode().GetTextNode()->GetText()); rWrtShell.Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -823,7 +823,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) rWrtShell.Push(); OUString const url(aSet.GetItem(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(OUString("#1%19the%20udmark%19UNewUD!%7C%7Ctoxmark"), url); - rView.JumpToSwMark(url.copy(1)); + rView.JumpToSwMark(url.subView(1)); CPPUNIT_ASSERT_EQUAL(OUString("the udmark"), rWrtShell.GetCursor()->GetNode().GetTextNode()->GetText()); rWrtShell.Pop(SwCursorShell::PopMode::DeleteCurrent); diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 85a4d3a12856..6b4687aa8982 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -442,7 +442,7 @@ DocumentLinksAdministrationManager::~DocumentLinksAdministrationManager() { } -bool DocumentLinksAdministrationManager::SelectServerObj( const OUString& rStr, SwPaM*& rpPam, std::unique_ptr& rpRange ) const +bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rStr, SwPaM*& rpPam, std::unique_ptr& rpRange ) const { // Do we actually have the Item? rpPam = nullptr; diff --git a/sw/source/core/inc/DocumentLinksAdministrationManager.hxx b/sw/source/core/inc/DocumentLinksAdministrationManager.hxx index 7afae81ca880..e03d969d211b 100644 --- a/sw/source/core/inc/DocumentLinksAdministrationManager.hxx +++ b/sw/source/core/inc/DocumentLinksAdministrationManager.hxx @@ -23,6 +23,7 @@ #include #include +#include namespace sfx2 { class LinkManager; } class SwDoc; @@ -61,7 +62,7 @@ public: bool LinksUpdated() const override; //Non-Interface method - bool SelectServerObj( const OUString& rStr, SwPaM*& rpPam, std::unique_ptr& rpRange ) const; + bool SelectServerObj( std::u16string_view rStr, SwPaM*& rpPam, std::unique_ptr& rpRange ) const; virtual ~DocumentLinksAdministrationManager() override; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 48f1e1512f79..c7f672ae4f58 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7131,7 +7131,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon xOutStream->closeOutput(); OString relId = OUStringToOString( GetExport().GetFilter().addRelation( m_pSerializer->getOutputStream(), oox::getRelationship(Relationship::FONT), - "fonts/font" + OUString::number( m_nextFontId ) + ".odttf" ), RTL_TEXTENCODING_UTF8 ); + OUString("fonts/font" + OUString::number( m_nextFontId ) + ".odttf") ), RTL_TEXTENCODING_UTF8 ); EmbeddedFontRef ref; ref.relId = relId; ref.fontKey = fontKeyStr; diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index c3e5adc49331..429ae90f7775 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -216,7 +216,7 @@ void DocxExport::ExportGrfBullet(const SwTextNode&) CollectGrfsOfBullets(); } -OString DocxExport::AddRelation( const OUString& rType, const OUString& rTarget ) +OString DocxExport::AddRelation( const OUString& rType, std::u16string_view rTarget ) { OUString sId = m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), rType, rTarget, true ); @@ -474,7 +474,7 @@ std::pair DocxExport::WriteActiveXObject(const uno::Reference< const OUString sBinaryId = m_rFilter.addRelation( pActiveXFS->getOutputStream(), oox::getRelationship(Relationship::ACTIVEXCONTROLBINARY), - sBinaryFileName.copy(sBinaryFileName.lastIndexOf("/") + 1) ); + sBinaryFileName.subView(sBinaryFileName.lastIndexOf("/") + 1) ); pActiveXFS->singleElementNS(XML_ax, XML_ocx, FSNS(XML_xmlns, XML_ax), m_rFilter.getNamespaceURL(OOX_NS(ax)), @@ -485,7 +485,7 @@ std::pair DocxExport::WriteActiveXObject(const uno::Reference< OString sXMLId = OUStringToOString(m_rFilter.addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::CONTROL), - sXMLFileName.copy(sBinaryFileName.indexOf("/") + 1)), + sXMLFileName.subView(sBinaryFileName.indexOf("/") + 1)), RTL_TEXTENCODING_UTF8); return std::pair(sXMLId, sName); @@ -648,7 +648,7 @@ void DocxExport::InitStyles() // setup word/styles.xml and the relations + content type m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::STYLES), - "styles.xml" ); + u"styles.xml" ); ::sax_fastparser::FSHelperPtr pStylesFS = m_rFilter.openFragmentStreamWithSerializer( "word/styles.xml", @@ -671,7 +671,7 @@ void DocxExport::WriteFootnotesEndnotes() // setup word/styles.xml and the relations + content type m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::FOOTNOTES), - "footnotes.xml" ); + u"footnotes.xml" ); ::sax_fastparser::FSHelperPtr pFootnotesFS = m_rFilter.openFragmentStreamWithSerializer( "word/footnotes.xml", @@ -699,7 +699,7 @@ void DocxExport::WriteFootnotesEndnotes() // setup word/styles.xml and the relations + content type m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::ENDNOTES), - "endnotes.xml" ); + u"endnotes.xml" ); ::sax_fastparser::FSHelperPtr pEndnotesFS = m_rFilter.openFragmentStreamWithSerializer( "word/endnotes.xml", @@ -728,7 +728,7 @@ void DocxExport::WritePostitFields() m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::COMMENTS), - "comments.xml" ); + u"comments.xml" ); ::sax_fastparser::FSHelperPtr pPostitFS = m_rFilter.openFragmentStreamWithSerializer( "word/comments.xml", @@ -745,7 +745,7 @@ void DocxExport::WritePostitFields() m_rFilter.addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::COMMENTSEXTENDED), - "commentsExtended.xml"); + u"commentsExtended.xml"); pPostitFS = m_rFilter.openFragmentStreamWithSerializer( "word/commentsExtended.xml", @@ -768,7 +768,7 @@ void DocxExport::WriteNumbering() m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::NUMBERING), - "numbering.xml" ); + u"numbering.xml" ); ::sax_fastparser::FSHelperPtr pNumberingFS = m_rFilter.openFragmentStreamWithSerializer( "word/numbering.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" ); @@ -875,7 +875,7 @@ void DocxExport::WriteFonts() { m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::FONTTABLE), - "fontTable.xml" ); + u"fontTable.xml" ); ::sax_fastparser::FSHelperPtr pFS = m_rFilter.openFragmentStreamWithSerializer( "word/fontTable.xml", @@ -993,7 +993,7 @@ void DocxExport::WriteSettings() m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::SETTINGS), - "settings.xml" ); + u"settings.xml" ); ::sax_fastparser::FSHelperPtr pFS = m_rFilter.openFragmentStreamWithSerializer( "word/settings.xml", @@ -1381,7 +1381,7 @@ void DocxExport::WriteTheme() m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::THEME), - "theme/theme1.xml" ); + u"theme/theme1.xml" ); uno::Reference< xml::sax::XSAXSerializable > serializer( themeDom, uno::UNO_QUERY ); uno::Reference< xml::sax::XWriter > writer = xml::sax::Writer::create( comphelper::getProcessComponentContext() ); @@ -1428,7 +1428,7 @@ void DocxExport::WriteGlossary() m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::GLOSSARYDOCUMENT), - "glossary/document.xml" ); + u"glossary/document.xml" ); uno::Reference< io::XOutputStream > xOutputStream = GetFilter().openFragmentStream( "word/glossary/document.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml" ); @@ -1491,7 +1491,7 @@ void DocxExport::WriteCustomXml() { m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::CUSTOMXML), - "../customXml/item"+OUString::number((j+1))+".xml" ); + OUString("../customXml/item"+OUString::number((j+1))+".xml" )); uno::Reference< xml::sax::XSAXSerializable > serializer( customXmlDom, uno::UNO_QUERY ); uno::Reference< xml::sax::XWriter > writer = xml::sax::Writer::create( comphelper::getProcessComponentContext() ); @@ -1514,7 +1514,7 @@ void DocxExport::WriteCustomXml() m_rFilter.addRelation( GetFilter().openFragmentStream( "customXml/item"+OUString::number((j+1))+".xml", "application/xml" ) , oox::getRelationship(Relationship::CUSTOMXMLPROPS), - "itemProps"+OUString::number((j+1))+".xml" ); + OUString("itemProps"+OUString::number((j+1))+".xml" )); } } } @@ -1548,7 +1548,7 @@ void DocxExport::WriteVBA() pOut->WriteStream(*pIn); // Write the relationship. - m_rFilter.addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), "vbaProject.bin"); + m_rFilter.addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), u"vbaProject.bin"); } OUString aDataName("_MS_VBA_Macros_XML"); @@ -1575,7 +1575,7 @@ void DocxExport::WriteVBA() if (!xProjectStream.is()) return; - m_rFilter.addRelation(xProjectStream, oox::getRelationship(Relationship::WORDVBADATA), "vbaData.xml"); + m_rFilter.addRelation(xProjectStream, oox::getRelationship(Relationship::WORDVBADATA), u"vbaData.xml"); } void DocxExport::WriteEmbeddings() @@ -1804,7 +1804,7 @@ DocxExport::DocxExport(DocxExportFilter& rFilter, SwDoc& rDocument, // relations for the document m_rFilter.addRelation( oox::getRelationship(Relationship::OFFICEDOCUMENT), - "word/document.xml" ); + u"word/document.xml" ); // Set media type depending of document type OUString aMediaType; diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 08c5372460fd..381de49a7ef4 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -150,7 +150,7 @@ public: virtual void ExportGrfBullet(const SwTextNode&) override; /// Returns the relationd id - OString AddRelation( const OUString& rType, const OUString& rTarget ); + OString AddRelation( const OUString& rType, std::u16string_view rTarget ); virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/ ) override { /* FIXME no-op for docx, most probably should not even be in MSWordExportBase */ } virtual void WriteChar( sal_Unicode ) override { SAL_WARN("sw.ww8", "FIXME: WriteChar() has nothing to do for docx."); } diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index c2e72732878a..da5253f723b7 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -975,7 +975,7 @@ bool AttributeOutputBase::AnalyzeURL( const OUString& rUrl, const OUString& /*rT if ( rUrl.getLength() > 1 && rUrl[0] == '#' ) { - sMark = BookmarkToWriter( rUrl.copy(1) ); + sMark = BookmarkToWriter( rUrl.subView(1) ); const sal_Int32 nPos = sMark.lastIndexOf( cMarkSeparator ); @@ -1221,7 +1221,7 @@ OUString BookmarkToWord(const OUString &rBookmark) return TruncateBookmark(sRet); } -OUString BookmarkToWriter(const OUString &rBookmark) +OUString BookmarkToWriter(std::u16string_view rBookmark) { return INetURLObject::decode(rBookmark, INetURLObject::DecodeMechanism::Unambiguous, RTL_TEXTENCODING_ASCII_US); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index d5d708b97398..d8e4241422c8 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3121,12 +3121,12 @@ void WW8Export::StoreDoc1() WriteFkpPlcUsw(); // FKP, PLC, ... } -void MSWordExportBase::AddLinkTarget(const OUString& rURL) +void MSWordExportBase::AddLinkTarget(std::u16string_view rURL) { - if( rURL.isEmpty() || rURL[0] != '#' ) + if( rURL.empty() || rURL[0] != '#' ) return; - OUString aURL( BookmarkToWriter( rURL.copy( 1 ) ) ); + OUString aURL( BookmarkToWriter( rURL.substr( 1 ) ) ); sal_Int32 nPos = aURL.lastIndexOf( cMarkSeparator ); if( nPos < 2 ) @@ -3143,7 +3143,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) if( sCmp == "outline" ) { SwPosition aPos(*m_pCurPam->GetPoint()); - OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); + OUString aName(BookmarkToWriter(aURL.subView(0, nPos))); // If we can find the outline this bookmark refers to // save the name of the bookmark and the // node index number of where it points to @@ -3156,7 +3156,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) else if( sCmp == "graphic" ) { SwNodeIndex* pIdx; - OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); + OUString aName(BookmarkToWriter(aURL.subView(0, nPos))); const SwFlyFrameFormat* pFormat = m_rDoc.FindFlyByName(aName, SwNodeType::Grf); if (pFormat && nullptr != (pIdx = const_cast(pFormat->GetContent().GetContentIdx()))) { @@ -3167,7 +3167,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) else if( sCmp == "frame" ) { SwNodeIndex* pIdx; - OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); + OUString aName(BookmarkToWriter(aURL.subView(0, nPos))); const SwFlyFrameFormat* pFormat = m_rDoc.FindFlyByName(aName, SwNodeType::Text); if (pFormat && nullptr != (pIdx = const_cast(pFormat->GetContent().GetContentIdx()))) { @@ -3178,7 +3178,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) else if( sCmp == "ole" ) { SwNodeIndex* pIdx; - OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); + OUString aName(BookmarkToWriter(aURL.subView(0, nPos))); const SwFlyFrameFormat* pFormat = m_rDoc.FindFlyByName(aName, SwNodeType::Ole); if (pFormat && nullptr != (pIdx = const_cast(pFormat->GetContent().GetContentIdx()))) { @@ -3189,7 +3189,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) else if( sCmp == "region" ) { SwNodeIndex* pIdx; - OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); + OUString aName(BookmarkToWriter(aURL.subView(0, nPos))); for (const SwSectionFormat* pFormat : m_rDoc.GetSections()) { if (aName == pFormat->GetSection()->GetSectionName() @@ -3203,7 +3203,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) } else if( sCmp == "table" ) { - OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); + OUString aName(BookmarkToWriter(aURL.subView(0, nPos))); const SwTable* pTable = SwTable::FindTable(m_rDoc.FindTableFormatByName(aName)); if (pTable) { diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 15e0d902731b..d5835a289492 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -834,7 +834,7 @@ protected: /// Setup the chapter fields (maChapterFieldLocs). void GatherChapterFields(); - void AddLinkTarget( const OUString& rURL ); + void AddLinkTarget( std::u16string_view rURL ); void CollectOutlineBookmarks( const SwDoc &rDoc ); bool SetCurrentPageDescFromNode(const SwNode &rNd); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 97bff178f66e..d43182d2e93a 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1837,7 +1837,7 @@ public: // really private, but can only be done public void Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, short nLen); tools::Long MapBookmarkVariables(const WW8FieldDesc* pF, OUString &rOrigName, const OUString &rData); - OUString GetMappedBookmark(const OUString &rOrigName); + OUString GetMappedBookmark(std::u16string_view rOrigName); // fields eF_ResT Read_F_Input(WW8FieldDesc*, OUString& rStr); @@ -1932,7 +1932,7 @@ void SyncIndentWithList( SvxLRSpaceItem &rLR, const bool bFirstLineOfStSet, const bool bLeftIndentSet ); tools::Long GetListFirstLineIndent(const SwNumFormat &rFormat); -OUString BookmarkToWriter(const OUString &rBookmark); +OUString BookmarkToWriter(std::u16string_view rBookmark); bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, SwTwips nPageRight, SwTwips nPageSize); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index ad20690464ef..1bd48126ed35 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1341,7 +1341,7 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pField, return pRet; } -OUString SwWW8ImplReader::GetMappedBookmark(const OUString &rOrigName) +OUString SwWW8ImplReader::GetMappedBookmark(std::u16string_view rOrigName) { OUString sName(BookmarkToWriter(rOrigName)); OSL_ENSURE(m_xPlcxMan, "no pPlcxMan"); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index e905bc2a79cc..18c3d6f2476a 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -172,7 +172,7 @@ public: size_t GetArrPos() const { return m_nArrPos; } OUString GetFile() const; OUString GetSubRegion() const; - void SetFile(OUString const& rFile); + void SetFile(std::u16string_view rFile); void SetFilter(std::u16string_view rFilter); void SetSubRegion(std::u16string_view rSubRegion); @@ -209,17 +209,17 @@ SectRepr::SectRepr( size_t nPos, SwSection& rSect ) } } -void SectRepr::SetFile( const OUString& rFile ) +void SectRepr::SetFile( std::u16string_view rFile ) { OUString sNewFile( INetURLObject::decode( rFile, INetURLObject::DecodeMechanism::Unambiguous )); const OUString sOldFileName( m_SectionData.GetLinkFileName() ); const OUString sSub( sOldFileName.getToken( 2, sfx2::cTokenSeparator ) ); - if( !rFile.isEmpty() || !sSub.isEmpty() ) + if( !rFile.empty() || !sSub.isEmpty() ) { sNewFile += OUStringChar(sfx2::cTokenSeparator); - if( !rFile.isEmpty() ) // Filter only with FileName + if( !rFile.empty() ) // Filter only with FileName sNewFile += sOldFileName.getToken( 1, sfx2::cTokenSeparator ); sNewFile += OUStringChar(sfx2::cTokenSeparator) + sSub; @@ -227,7 +227,7 @@ void SectRepr::SetFile( const OUString& rFile ) m_SectionData.SetLinkFileName( sNewFile ); - if( !rFile.isEmpty() || !sSub.isEmpty() ) + if( !rFile.empty() || !sSub.isEmpty() ) { m_SectionData.SetType( SectionType::FileLink ); } @@ -943,7 +943,7 @@ IMPL_LINK(SwEditRegionDlg, UseFileHdl, weld::ToggleButton&, rButton, void) pSectRepr->SetContent(false); else { - pSectRepr->SetFile(OUString()); + pSectRepr->SetFile(u""); pSectRepr->SetSubRegion(std::u16string_view()); pSectRepr->GetSectionData().SetLinkFilePassword(OUString()); } @@ -1151,7 +1151,7 @@ IMPL_LINK(SwEditRegionDlg, DDEHdl, weld::ToggleButton&, rButton, void) m_xSubRegionED->hide(); if (SectionType::FileLink == rData.GetType()) { - pSectRepr->SetFile(OUString()); + pSectRepr->SetFile(u""); m_xFileNameED->set_text(OUString()); rData.SetLinkFilePassword(OUString()); } @@ -1170,7 +1170,7 @@ IMPL_LINK(SwEditRegionDlg, DDEHdl, weld::ToggleButton&, rButton, void) if (SectionType::DdeLink == rData.GetType()) { rData.SetType(SectionType::FileLink); - pSectRepr->SetFile(OUString()); + pSectRepr->SetFile(u""); rData.SetLinkFilePassword(OUString()); m_xFileNameED->set_text(OUString()); } diff --git a/sw/source/uibase/docvw/edtwin3.cxx b/sw/source/uibase/docvw/edtwin3.cxx index d90df78919d5..d417b08b0510 100644 --- a/sw/source/uibase/docvw/edtwin3.cxx +++ b/sw/source/uibase/docvw/edtwin3.cxx @@ -114,7 +114,7 @@ void RepaintPagePreview( SwViewShell const * pVwSh, const SwRect& rRect ) pSwPagePreview->RepaintCoreRect(rRect); } -bool JumpToSwMark( SwViewShell const * pVwSh, const OUString& rMark ) +bool JumpToSwMark( SwViewShell const * pVwSh, std::u16string_view rMark ) { SfxViewShell *pSfxViewShell = pVwSh->GetSfxViewShell(); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index db33b8c77c1d..39752c694d31 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2155,10 +2155,10 @@ static auto JumpToTOXMark(SwWrtShell & rSh, OUString const& rName) -> bool } } -bool SwView::JumpToSwMark( const OUString& rMark ) +bool SwView::JumpToSwMark( std::u16string_view rMark ) { bool bRet = false; - if( !rMark.isEmpty() ) + if( !rMark.empty() ) { // place bookmark at top-center bool bSaveCC = m_bCenterCursor; -- cgit