summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-09-30 13:54:26 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-10-03 19:50:44 +0200
commitad1557f5d775739230e0e2252c293948977b42a0 (patch)
tree610e2e849d87583888c0c658088044d6dc3966a5 /sd
parent7e7dd7f152bc7457437f541e7ff88d69e9f8e765 (diff)
A more lightweight O[U]StringConcatenation
...compared to a full-blown O[U]String, for temporary objects holding an O[U]StringConcat result that can then be used as a std::[u16]string_view. It's instructive to see how some invocations of operator ==, operator !=, and O[U]StringBuffer::insert with an O[U]StringConcat argument required implicit materialization of an O[U]String temporary, and how that expensive operation has now been made explicit with the explicit O[U]StringConcatenation ctor. (The additional operator == and operator != overloads are necessary because the overloads taking two std::[u16]string_view parameters wouldn't even be found here with ADL. And the OUString-related ones would cause ambiguities in at least sal/qa/rtl/strings/test_oustring_stringliterals.cxx built with RTL_STRING_UNITTEST, so have simply been disabled for that special test-code case.) Change-Id: Id29799fa8da21a09ff9794cbc7cc9b366e6803b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122890 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/import-tests.cxx2
-rw-r--r--sd/source/core/drawdoc3.cxx2
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx20
3 files changed, 12 insertions, 12 deletions
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 9bae1492fbca..36b3886d852f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -445,7 +445,7 @@ void SdImportTest::testDocumentLayout()
if( aFilesToCompare[i].nExportType >= 0 )
xDocShRef = saveAndReload( xDocShRef.get(), aFilesToCompare[i].nExportType );
compareWithShapesDump( xDocShRef,
- OUString(m_directories.getPathFromSrc( u"/sd/qa/unit/data/" ) + aFilesToCompare[i].sDump),
+ OUStringConcatenation(m_directories.getPathFromSrc( u"/sd/qa/unit/data/" ) + aFilesToCompare[i].sDump),
i == nUpdateMe );
}
}
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 0b2af6470786..79f22b4eb864 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -915,7 +915,7 @@ bool SdDrawDocument::InsertBookmarkAsPage(
if(pPg->GetObj(i)->GetStyleSheet())
{
OUString aStyleName = pPg->GetObj(i)->GetStyleSheet()->GetName();
- SfxStyleSheet *pSheet = lcl_findStyle(aNewGraphicStyles, OUString(aStyleName + aRenameStr));
+ SfxStyleSheet *pSheet = lcl_findStyle(aNewGraphicStyles, OUStringConcatenation(aStyleName + aRenameStr));
if(pSheet != nullptr)
pPg->GetObj(i)->SetStyleSheet(pSheet, true);
}
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 8917dd23b44e..9070b6135259 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1263,7 +1263,7 @@ void PowerPointExport::ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum
// add explicit relation of presentation to this slide
OUString sRelId = addRelation(mPresentationFS->getOutputStream(),
oox::getRelationship(Relationship::SLIDE),
- OUString("slides/slide" + OUString::number(nPageNum + 1) +".xml"));
+ OUStringConcatenation("slides/slide" + OUString::number(nPageNum + 1) +".xml"));
mPresentationFS->singleElementNS(XML_p, XML_sldId,
XML_id, OString::number(GetNewSlideId()),
@@ -1313,7 +1313,7 @@ void PowerPointExport::ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum
// add implicit relation to slide layout
addRelation(pFS->getOutputStream(),
oox::getRelationship(Relationship::SLIDELAYOUT),
- OUString("../slideLayouts/slideLayout" +
+ OUStringConcatenation("../slideLayouts/slideLayout" +
OUString::number(GetLayoutFileId(GetPPTXLayoutId(GetLayoutOffset(mXPagePropSet)), nMasterNum)) +
".xml"));
@@ -1321,7 +1321,7 @@ void PowerPointExport::ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum
// add implicit relation to slide comments
addRelation(pFS->getOutputStream(),
oox::getRelationship(Relationship::COMMENTS),
- OUString("../comments/comment" + OUString::number(nPageNum + 1) + ".xml"));
+ OUStringConcatenation("../comments/comment" + OUString::number(nPageNum + 1) + ".xml"));
SAL_INFO("sd.eppt", "----------------");
}
@@ -1352,13 +1352,13 @@ void PowerPointExport::ImplWriteNotes(sal_uInt32 nPageNum)
// add implicit relation to slide
addRelation(pFS->getOutputStream(),
oox::getRelationship(Relationship::SLIDE),
- OUString("../slides/slide" + OUString::number(nPageNum + 1) + ".xml"));
+ OUStringConcatenation("../slides/slide" + OUString::number(nPageNum + 1) + ".xml"));
// add slide implicit relation to notes
if (nPageNum < mpSlidesFSArray.size())
addRelation(mpSlidesFSArray[ nPageNum ]->getOutputStream(),
oox::getRelationship(Relationship::NOTESSLIDE),
- OUString("../notesSlides/notesSlide" + OUString::number(nPageNum + 1) + ".xml"));
+ OUStringConcatenation("../notesSlides/notesSlide" + OUString::number(nPageNum + 1) + ".xml"));
// add implicit relation to notes master
addRelation(pFS->getOutputStream(),
@@ -1373,7 +1373,7 @@ void PowerPointExport::AddLayoutIdAndRelation(const FSHelperPtr& pFS, sal_Int32
// add implicit relation of slide master to slide layout
OUString sRelId = addRelation(pFS->getOutputStream(),
oox::getRelationship(Relationship::SLIDELAYOUT),
- OUString("../slideLayouts/slideLayout" + OUString::number(nLayoutFileId) + ".xml"));
+ OUStringConcatenation("../slideLayouts/slideLayout" + OUString::number(nLayoutFileId) + ".xml"));
pFS->singleElementNS(XML_p, XML_sldLayoutId,
XML_id, OString::number(GetNewSlideMasterId()),
@@ -1390,7 +1390,7 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 nPageNum, Reference< XPro
OUString sRelId = addRelation(mPresentationFS->getOutputStream(),
oox::getRelationship(Relationship::SLIDEMASTER),
- OUString("slideMasters/slideMaster" + OUString::number(nPageNum + 1) + ".xml"));
+ OUStringConcatenation("slideMasters/slideMaster" + OUString::number(nPageNum + 1) + ".xml"));
mPresentationFS->singleElementNS(XML_p, XML_sldMasterId,
XML_id, OString::number(GetNewSlideMasterId()),
@@ -1410,7 +1410,7 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 nPageNum, Reference< XPro
// add implicit relation to the presentation theme
addRelation(pFS->getOutputStream(),
oox::getRelationship(Relationship::THEME),
- OUString("../theme/theme" + OUString::number(nPageNum + 1) + ".xml"));
+ OUStringConcatenation("../theme/theme" + OUString::number(nPageNum + 1) + ".xml"));
pFS->startElementNS(XML_p, XML_sldMaster, PNMSS);
@@ -1507,7 +1507,7 @@ void PowerPointExport::ImplWritePPTXLayout(sal_Int32 nOffset, sal_uInt32 nMaster
// add implicit relation of slide layout to slide master
addRelation(pFS->getOutputStream(),
oox::getRelationship(Relationship::SLIDEMASTER),
- OUString("../slideMasters/slideMaster" + OUString::number(nMasterNum + 1) + ".xml"));
+ OUStringConcatenation("../slideMasters/slideMaster" + OUString::number(nMasterNum + 1) + ".xml"));
pFS->startElementNS(XML_p, XML_sldLayout,
PNMSS,
@@ -2178,7 +2178,7 @@ void PowerPointExport::WriteNotesMaster()
// add implicit relation to the presentation theme
addRelation(pFS->getOutputStream(),
oox::getRelationship(Relationship::THEME),
- OUString("../theme/theme" + OUString::number(mnMasterPages + 1) + ".xml"));
+ OUStringConcatenation("../theme/theme" + OUString::number(mnMasterPages + 1) + ".xml"));
pFS->startElementNS(XML_p, XML_notesMaster, PNMSS);