desktop/source/lib/init.cxx                    |   12 ++++----
 editeng/source/editeng/impedit4.cxx            |    4 +-
 sc/source/filter/excel/excdoc.cxx              |   26 ++++++++---------
 sc/source/filter/excel/excrecds.cxx            |   35 +++++++++++------------
 sc/source/filter/excel/xeescher.cxx            |   11 +++----
 sc/source/filter/excel/xename.cxx              |    2 -
 sc/source/filter/excel/xepage.cxx              |   16 +++++-----
 sc/source/filter/excel/xestream.cxx            |   37 ++++++++++++-------------
 sc/source/filter/xcl97/xcl97rec.cxx            |    4 +-
 sd/source/filter/eppt/pptx-epptooxml.cxx       |   32 ++++++++++-----------
 starmath/source/view.cxx                       |    4 +-
 svtools/source/svrtf/rtfout.cxx                |    3 --
 sw/source/filter/ww8/WW8TableInfo.cxx          |    2 -
 sw/source/filter/ww8/docxexport.cxx            |   10 +++---
 tools/source/stream/stream.cxx                 |    6 +---
 writerfilter/source/ooxml/OOXMLPropertySet.cxx |    4 +-
 writerfilter/source/rtftok/rtfvalue.cxx        |    4 +-
 xmloff/source/core/fasttokenhandler.cxx        |    8 ++---
 18 files changed, 107 insertions(+), 113 deletions(-)

New commits:
commit f6fa9c455502e9a00e4a4cff6e19f3e17c5479c3
Author:     Mike Kaganski <[email protected]>
AuthorDate: Mon Apr 10 18:01:17 2023 +0300
Commit:     Mike Kaganski <[email protected]>
CommitDate: Mon Apr 10 20:09:26 2023 +0200

    Use more *string_view
    
    Change-Id: I1172febd45da4dba006f8495427fe45c6d9b9fa6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150187
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index cda953a928f4..0521af8b427a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -490,18 +490,18 @@ static bool extractLinks(const uno::Reference< 
container::XNameAccess >& xLinks,
     return bIsTarget;
 }
 
-static void unoAnyToJson(tools::JsonWriter& rJson, const char * pNodeName, 
const uno::Any& anyItem)
+static void unoAnyToJson(tools::JsonWriter& rJson, std::string_view pNodeName, 
const uno::Any& anyItem)
 {
     auto aNode = rJson.startNode(pNodeName);
     OUString aType = anyItem.getValueTypeName();
-    rJson.put("type", aType.toUtf8().getStr());
+    rJson.put("type", aType);
 
     if (aType == "string")
-        rJson.put("value", anyItem.get<OUString>().toUtf8().getStr());
+        rJson.put("value", anyItem.get<OUString>());
     else if (aType == "unsigned long")
-        rJson.put("value", 
OString::number(anyItem.get<sal_uInt32>()).getStr());
+        rJson.put("value", OString::number(anyItem.get<sal_uInt32>()));
     else if (aType == "long")
-        rJson.put("value", OString::number(anyItem.get<sal_Int32>()).getStr());
+        rJson.put("value", OString::number(anyItem.get<sal_Int32>()));
     else if (aType == "[]any")
     {
         uno::Sequence<uno::Any> aSeq;
@@ -511,7 +511,7 @@ static void unoAnyToJson(tools::JsonWriter& rJson, const 
char * pNodeName, const
 
             for (auto i = 0; i < aSeq.getLength(); ++i)
             {
-                unoAnyToJson(rJson, OString::number(i).getStr(), aSeq[i]);
+                unoAnyToJson(rJson, OString::number(i), aSeq[i]);
             }
         }
     }
diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index 424b43aadaeb..2bc0e8a2e8a7 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -954,8 +954,8 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             // SWG:
             if ( nEsc )
             {
-                rOutput.WriteCharPtr( "{\\*\\updnprop" ).WriteCharPtr( 
OString::number(
-                    nProp100).getStr() ).WriteChar( '}' );
+                rOutput.WriteCharPtr( "{\\*\\updnprop" ).WriteOString( 
OString::number(
+                    nProp100) ).WriteChar( '}' );
             }
             tools::Long nUpDown = nFontHeight * std::abs( nEsc ) / 100;
             if ( nEsc < 0 )
diff --git a/sc/source/filter/excel/excdoc.cxx 
b/sc/source/filter/excel/excdoc.cxx
index c01dde32981c..8e394ad73146 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -692,12 +692,12 @@ void ExcTable::WriteXml( XclExpXmlStream& rStrm )
     rStrm.PushStream( pWorksheet );
 
     pWorksheet->startElement( XML_worksheet,
-        XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
-        FSNS(XML_xmlns, XML_r), 
rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
-        FSNS(XML_xmlns, XML_xdr), 
"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing";, // 
rStrm.getNamespaceURL(OOX_NS(xm)).toUtf8() -> 
"http://schemas.microsoft.com/office/excel/2006/main";,
-        FSNS(XML_xmlns, XML_x14), 
rStrm.getNamespaceURL(OOX_NS(xls14Lst)).toUtf8(),
-        FSNS(XML_xmlns, XML_xr2), rStrm.getNamespaceURL(OOX_NS(xr2)).toUtf8(),
-        FSNS(XML_xmlns, XML_mc), rStrm.getNamespaceURL(OOX_NS(mce)).toUtf8());
+        XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)),
+        FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)),
+        FSNS(XML_xmlns, XML_xdr), 
"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing";, // 
rStrm.getNamespaceURL(OOX_NS(xm)) -> 
"http://schemas.microsoft.com/office/excel/2006/main";,
+        FSNS(XML_xmlns, XML_x14), rStrm.getNamespaceURL(OOX_NS(xls14Lst)),
+        FSNS(XML_xmlns, XML_xr2), rStrm.getNamespaceURL(OOX_NS(xr2)),
+        FSNS(XML_xmlns, XML_mc), rStrm.getNamespaceURL(OOX_NS(mce)));
 
     SetCurrScTab( mnScTab );
     if (mxCellTable)
@@ -835,8 +835,8 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
 
     sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
     rWorkbook->startElement( XML_workbook,
-            XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
-            FSNS(XML_xmlns, XML_r), 
rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8() );
+            XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)),
+            FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)) );
     rWorkbook->singleElement( XML_fileVersion,
             XML_appName, "Calc"
             // OOXTODO: XML_codeName
@@ -848,14 +848,14 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
     if (bHasPasswordHash)
         rWorkbook->singleElement(XML_fileSharing,
                 XML_userName, sUserName,
-                XML_reservationPassword, OString::number(nWriteProtHash, 
16).getStr());
+                XML_reservationPassword, OString::number(nWriteProtHash, 16));
     else if (bHasPasswordInfo)
         rWorkbook->singleElement(XML_fileSharing,
                 XML_userName, sUserName,
-                XML_algorithmName, sAlgorithm.toUtf8().getStr(),
-                XML_hashValue, sHash.toUtf8().getStr(),
-                XML_saltValue, sSalt.toUtf8().getStr(),
-                XML_spinCount, OString::number(nCount).getStr());
+                XML_algorithmName, sAlgorithm,
+                XML_hashValue, sHash,
+                XML_saltValue, sSalt,
+                XML_spinCount, OString::number(nCount));
 
     if( !maTableList.IsEmpty() )
     {
diff --git a/sc/source/filter/excel/excrecds.cxx 
b/sc/source/filter/excel/excrecds.cxx
index f69a5ca431c8..3c4aa0571fc6 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -439,7 +439,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm 
)
         aPH = rPH;
 
     Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL);
-    OString sHash;
+    std::optional<OString> sHash;
     if (aHash.getLength() >= 2)
     {
         sHash = OString::number(
@@ -449,12 +449,12 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& 
rStrm )
     }
     sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
     rWorksheet->singleElement( XML_sheetProtection,
-        XML_algorithmName, aPH.maAlgorithmName.isEmpty() ? nullptr : 
aPH.maAlgorithmName.toUtf8().getStr(),
-        XML_hashValue, aPH.maHashValue.isEmpty() ? nullptr : 
aPH.maHashValue.toUtf8().getStr(),
-        XML_saltValue, aPH.maSaltValue.isEmpty() ? nullptr : 
aPH.maSaltValue.toUtf8().getStr(),
-        XML_spinCount, aPH.mnSpinCount ? OString::number( 
aPH.mnSpinCount).getStr() : nullptr,
+        XML_algorithmName, sax_fastparser::UseIf(aPH.maAlgorithmName, 
!aPH.maAlgorithmName.isEmpty()),
+        XML_hashValue, sax_fastparser::UseIf(aPH.maHashValue, 
!aPH.maHashValue.isEmpty()),
+        XML_saltValue, sax_fastparser::UseIf(aPH.maSaltValue, 
!aPH.maSaltValue.isEmpty()),
+        XML_spinCount, sax_fastparser::UseIf(OString::number(aPH.mnSpinCount), 
aPH.mnSpinCount != 0),
         XML_sheet,  ToPsz( true ),
-        XML_password, sHash.isEmpty()? nullptr : sHash.getStr(),
+        XML_password, sHash,
         XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS 
) ? nullptr : ToPsz( true ),
         XML_scenarios, pTabProtect->isOptionEnabled( 
ScTableProtection::SCENARIOS ) ? nullptr : ToPsz( true ),
         XML_formatCells, pTabProtect->isOptionEnabled( 
ScTableProtection::FORMAT_CELLS ) ? ToPsz( false ) : nullptr,
@@ -481,17 +481,17 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& 
rStrm )
         SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && 
!rProt.maSecurityDescriptor.empty(),
                 "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF 
security descriptor");
         rWorksheet->singleElement( XML_protectedRange,
-                XML_name, rProt.maTitle.isEmpty() ? nullptr : 
rProt.maTitle.toUtf8().getStr(),
-                XML_securityDescriptor, 
rProt.maSecurityDescriptorXML.isEmpty() ? nullptr : 
rProt.maSecurityDescriptorXML.toUtf8().getStr(),
+                XML_name, sax_fastparser::UseIf(rProt.maTitle, 
!rProt.maTitle.isEmpty()),
+                XML_securityDescriptor, 
sax_fastparser::UseIf(rProt.maSecurityDescriptorXML, 
!rProt.maSecurityDescriptorXML.isEmpty()),
                 /* XXX 'password' is not part of OOXML, but Excel2013
                  * writes it if loaded from BIFF, in which case
                  * 'algorithmName', 'hashValue', 'saltValue' and
                  * 'spinCount' are absent; so do we if it was present. */
-                XML_password, rProt.mnPasswordVerifier ? OString::number( 
rProt.mnPasswordVerifier, 16).getStr() : nullptr,
-                XML_algorithmName, 
rProt.maPasswordHash.maAlgorithmName.isEmpty() ? nullptr : 
rProt.maPasswordHash.maAlgorithmName.toUtf8().getStr(),
-                XML_hashValue, rProt.maPasswordHash.maHashValue.isEmpty() ? 
nullptr : rProt.maPasswordHash.maHashValue.toUtf8().getStr(),
-                XML_saltValue, rProt.maPasswordHash.maSaltValue.isEmpty() ? 
nullptr : rProt.maPasswordHash.maSaltValue.toUtf8().getStr(),
-                XML_spinCount, rProt.maPasswordHash.mnSpinCount ? 
OString::number( rProt.maPasswordHash.mnSpinCount).getStr() : nullptr,
+                XML_password, 
sax_fastparser::UseIf(OString::number(rProt.mnPasswordVerifier, 16), 
rProt.mnPasswordVerifier != 0),
+                XML_algorithmName, 
sax_fastparser::UseIf(rProt.maPasswordHash.maAlgorithmName, 
!rProt.maPasswordHash.maAlgorithmName.isEmpty()),
+                XML_hashValue, 
sax_fastparser::UseIf(rProt.maPasswordHash.maHashValue, 
!rProt.maPasswordHash.maHashValue.isEmpty()),
+                XML_saltValue, 
sax_fastparser::UseIf(rProt.maPasswordHash.maSaltValue, 
!rProt.maPasswordHash.maSaltValue.isEmpty()),
+                XML_spinCount, 
sax_fastparser::UseIf(OString::number(rProt.maPasswordHash.mnSpinCount), 
rProt.maPasswordHash.mnSpinCount != 0),
                 XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( 
rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr);
     }
     rWorksheet->endElement( XML_protectedRanges);
@@ -888,14 +888,13 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm )
 
             for (const auto& rMultiValue : maMultiValues)
             {
-                OString aStr = OUStringToOString(rMultiValue.first, 
RTL_TEXTENCODING_UTF8);
                 if( !rMultiValue.second )
                 {
-                    const char* pz = aStr.getStr();
-                    rWorksheet->singleElement(XML_filter, XML_val, pz);
+                    rWorksheet->singleElement(XML_filter, XML_val, 
rMultiValue.first);
                 }
                 else
                 {
+                    OString aStr = OUStringToOString(rMultiValue.first, 
RTL_TEXTENCODING_UTF8);
                     rtl::Reference<sax_fastparser::FastAttributeList> 
pAttrList = sax_fastparser::FastSerializerHelper::createAttrList();
                     sal_Int32 aDateGroup[3] = { XML_year, XML_month, XML_day };
                     sal_Int32 idx = 0;
@@ -1166,12 +1165,12 @@ void ExcAutoFilterRecs::SaveXml( XclExpXmlStream& rStrm 
)
                                           XML_ref, 
XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(),
                                                                           
std::get<0>(rSortCriteria)),
                                           XML_descending, "1",
-                                          XML_customList, 
std::get<1>(rSortCriteria).toUtf8().getStr());
+                                          XML_customList, 
std::get<1>(rSortCriteria));
             else
                 rWorksheet->singleElement(XML_sortCondition,
                                           XML_ref, 
XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(),
                                                                           
std::get<0>(rSortCriteria)),
-                                          XML_customList, 
std::get<1>(rSortCriteria).toUtf8().getStr());
+                                          XML_customList, 
std::get<1>(rSortCriteria));
         }
 
         rWorksheet->endElement(XML_sortState);
diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index 44e1225cf17c..ed634c1fcf84 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1240,7 +1240,7 @@ void XclExpTbxControlObj::SaveXml( XclExpXmlStream& rStrm 
)
             pDrawing->startElement(FSNS(XML_xdr, XML_nvSpPr));
             {
                 pDrawing->singleElement(FSNS(XML_xdr, XML_cNvPr),
-                    XML_id, OString::number(mnShapeId).getStr(),
+                    XML_id, OString::number(mnShapeId),
                     XML_name, msCtrlName, // control name
                     XML_descr, msLabel, // description as alt text
                     XML_hidden, mbVisible ? "0" : "1");
@@ -1453,7 +1453,7 @@ void XclExpTbxControlObj::SaveSheetXml(XclExpXmlStream& 
rStrm, const OUString& a
 
             rWorksheet->startElement(
                 XML_control,
-                XML_shapeId, OString::number(mnShapeId).getStr(),
+                XML_shapeId, OString::number(mnShapeId),
                 FSNS(XML_r, XML_id), aIdFormControlPr,
                 XML_name, msLabel); // text to display with checkbox button
 
@@ -1498,15 +1498,14 @@ void XclExpTbxControlObj::SaveSheetXml(XclExpXmlStream& 
rStrm, const OUString& a
                                      rStrm.getNamespaceURL(OOX_NS(mce)));
             rWorksheet->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, 
"x14");
 
-            rWorksheet->startElement(XML_control, XML_shapeId, 
OString::number(mnShapeId).getStr(),
+            rWorksheet->startElement(XML_control, XML_shapeId, 
OString::number(mnShapeId),
                                      FSNS(XML_r, XML_id), aIdFormControlPr, 
XML_name, msCtrlName);
 
-            OString aMacroName = GetMacroName().toUtf8();
+            OUString aMacroName = GetMacroName();
             // Omit the macro attribute if it would be empty.
-            const char* pMacroName = aMacroName.isEmpty() ? nullptr : 
aMacroName.getStr();
             rWorksheet->startElement(XML_controlPr, XML_defaultSize, "0", 
XML_print,
                                      mbPrint ? "true" : "false", XML_autoFill, 
"0", XML_autoPict,
-                                     "0", XML_macro, pMacroName);
+                                     "0", XML_macro, 
sax_fastparser::UseIf(aMacroName, !aMacroName.isEmpty()));
 
             rWorksheet->startElement(XML_anchor, XML_moveWithCells, "true", 
XML_sizeWithCells,
                                      "false");
diff --git a/sc/source/filter/excel/xename.cxx 
b/sc/source/filter/excel/xename.cxx
index c8fd0ed37036..4e837a97fadf 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -333,7 +333,7 @@ void XclExpName::SaveXml( XclExpXmlStream& rStrm )
             // OOXTODO: XML_functionGroupId, "",
             // OOXTODO: XML_help, "",
             XML_hidden, ToPsz( ::get_flag( mnFlags, EXC_NAME_HIDDEN ) ),
-            XML_localSheetId, mnScTab == SCTAB_GLOBAL ? nullptr : 
OString::number( mnScTab ).getStr(),
+            XML_localSheetId, sax_fastparser::UseIf(OString::number( mnScTab 
), mnScTab != SCTAB_GLOBAL),
             XML_name, maOrigName.toUtf8(),
             // OOXTODO: XML_publishToServer, "",
             // OOXTODO: XML_shortcutKey, "",
diff --git a/sc/source/filter/excel/xepage.cxx 
b/sc/source/filter/excel/xepage.cxx
index d9a2b1ed8bdc..144ab51c076e 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -101,7 +101,7 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
     if( rStrm.getVersion() != oox::core::ISOIEC_29500_2008 ||
         mrData.mnStrictPaperSize != EXC_PAPERSIZE_USER )
     {
-        pAttrList->add( XML_paperSize,           OString::number(  
mrData.mnPaperSize ).getStr() );
+        pAttrList->add( XML_paperSize,           OString::number(  
mrData.mnPaperSize ) );
     }
     else
     {
@@ -109,9 +109,9 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
         pAttrList->add( XML_paperHeight,    OString::number( 
mrData.mnPaperHeight ) + "mm" );
         // pAttrList->add( XML_paperUnits,          "mm" );
     }
-    pAttrList->add( XML_scale,              OString::number(  mrData.mnScaling 
).getStr() );
-    pAttrList->add( XML_fitToWidth,         OString::number(  
mrData.mnFitToWidth ).getStr() );
-    pAttrList->add( XML_fitToHeight,        OString::number(  
mrData.mnFitToHeight ).getStr() );
+    pAttrList->add( XML_scale,              OString::number(  mrData.mnScaling 
) );
+    pAttrList->add( XML_fitToWidth,         OString::number(  
mrData.mnFitToWidth ) );
+    pAttrList->add( XML_fitToHeight,        OString::number(  
mrData.mnFitToHeight ) );
     pAttrList->add( XML_pageOrder,          mrData.mbPrintInRows ? 
"overThenDown" : "downThenOver" );
     pAttrList->add( XML_orientation,        mrData.mbPortrait ? "portrait" : 
"landscape" );   // OOXTODO: "default"?
     // tdf#48767 if XML_usePrinterDefaults field is exist, then 
XML_orientation is always "portrait" in MS Excel
@@ -124,13 +124,13 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
 
     if ( mrData.mbManualStart )
     {
-        pAttrList->add( XML_firstPageNumber,    OString::number(  
mrData.mnStartPage ).getStr() );
+        pAttrList->add( XML_firstPageNumber,    OString::number(  
mrData.mnStartPage ) );
         pAttrList->add( XML_useFirstPageNumber, ToPsz( mrData.mbManualStart ) 
);
     }
     // OOXTODO: XML_errors, // == displayed|blank|dash|NA
-    pAttrList->add( XML_horizontalDpi,      OString::number(  
mrData.mnHorPrintRes ).getStr() );
-    pAttrList->add( XML_verticalDpi,        OString::number(  
mrData.mnVerPrintRes ).getStr() );
-    pAttrList->add( XML_copies,             OString::number(  mrData.mnCopies 
).getStr() );
+    pAttrList->add( XML_horizontalDpi,      OString::number(  
mrData.mnHorPrintRes ) );
+    pAttrList->add( XML_verticalDpi,        OString::number(  
mrData.mnVerPrintRes ) );
+    pAttrList->add( XML_copies,             OString::number(  mrData.mnCopies 
) );
     // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
 
     rStrm.GetCurrentStream()->singleElement( XML_pageSetup, pAttrList );
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 374743786212..75f03dfde94d 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -834,13 +834,6 @@ OUString XclXmlUtils::ToOUString( const XclExpString& s )
     return ToOUString( s.GetUnicodeBuffer() );
 }
 
-static void lcl_WriteValue( const sax_fastparser::FSHelperPtr& rStream, 
sal_Int32 nElement, const char* pValue )
-{
-    if( !pValue )
-        return;
-    rStream->singleElement(nElement, XML_val, pValue);
-}
-
 static const char* lcl_GetUnderlineStyle( FontLineStyle eUnderline, bool& 
bHaveUnderline )
 {
     bHaveUnderline = true;
@@ -873,16 +866,23 @@ sax_fastparser::FSHelperPtr XclXmlUtils::WriteFontData( 
sax_fastparser::FSHelper
     const char* pUnderline = lcl_GetUnderlineStyle( 
rFontData.GetScUnderline(), bHaveUnderline );
     const char* pVertAlign = lcl_ToVerticalAlignmentRun( 
rFontData.GetScEscapement(), bHaveVertAlign );
 
-    lcl_WriteValue( pStream, XML_b,          rFontData.mnWeight > 400 ? ToPsz( 
true ) : nullptr );
-    lcl_WriteValue( pStream, XML_i,          rFontData.mbItalic       ? ToPsz( 
true ) : nullptr );
-    lcl_WriteValue( pStream, XML_strike,     rFontData.mbStrikeout    ? ToPsz( 
true ) : nullptr );
+    if (rFontData.mnWeight > 400)
+        pStream->singleElement(XML_b, XML_val, ToPsz( true ));
+    if (rFontData.mbItalic)
+        pStream->singleElement(XML_i, XML_val, ToPsz( true ));
+    if (rFontData.mbStrikeout)
+        pStream->singleElement(XML_strike, XML_val, ToPsz( true ));
     // OOXTODO: lcl_WriteValue( rStream, XML_condense, );    // mac 
compatibility setting
     // OOXTODO: lcl_WriteValue( rStream, XML_extend, );      // compatibility 
setting
-    lcl_WriteValue( pStream, XML_outline,    rFontData.mbOutline      ? ToPsz( 
true ) : nullptr );
-    lcl_WriteValue( pStream, XML_shadow,     rFontData.mbShadow       ? ToPsz( 
true ) : nullptr );
-    lcl_WriteValue( pStream, XML_u,          bHaveUnderline           ? 
pUnderline    : nullptr );
-    lcl_WriteValue( pStream, XML_vertAlign,  bHaveVertAlign           ? 
pVertAlign    : nullptr );
-    lcl_WriteValue( pStream, XML_sz,         OString::number( 
rFontData.mnHeight / 20.0 ).getStr() );  // Twips->Pt
+    if (rFontData.mbOutline)
+        pStream->singleElement(XML_outline, XML_val, ToPsz( true ));
+    if (rFontData.mbShadow)
+        pStream->singleElement(XML_shadow, XML_val, ToPsz( true ));
+    if (bHaveUnderline)
+        pStream->singleElement(XML_u, XML_val, pUnderline);
+    if (bHaveVertAlign)
+        pStream->singleElement(XML_vertAlign, XML_val, pVertAlign);
+    pStream->singleElement(XML_sz, XML_val, OString::number( 
rFontData.mnHeight / 20.0 )); // Twips->Pt
     if( rFontData.maColor != Color( ColorAlpha, 0, 0xFF, 0xFF, 0xFF ) )
         pStream->singleElement( XML_color,
                 // OOXTODO: XML_auto,       bool
@@ -891,9 +891,10 @@ sax_fastparser::FSHelperPtr XclXmlUtils::WriteFontData( 
sax_fastparser::FSHelper
                 // OOXTODO: XML_theme,      index into <clrScheme/>
                 // OOXTODO: XML_tint,       double
         );
-    lcl_WriteValue( pStream, nFontId,        
rFontData.maName.toUtf8().getStr() );
-    lcl_WriteValue( pStream, XML_family,     OString::number(  
rFontData.mnFamily ).getStr() );
-    lcl_WriteValue( pStream, XML_charset,    rFontData.mnCharSet != 0 ? 
OString::number(  rFontData.mnCharSet ).getStr() : nullptr );
+    pStream->singleElement(nFontId, XML_val, rFontData.maName);
+    pStream->singleElement(XML_family, XML_val, OString::number(  
rFontData.mnFamily ));
+    if (rFontData.mnCharSet != 0)
+        pStream->singleElement(XML_charset, XML_val, 
OString::number(rFontData.mnCharSet));
 
     return pStream;
 }
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index 8f930c80993b..f9031449bf70 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1591,10 +1591,10 @@ void ExcEScenario::SaveXml( XclExpXmlStream& rStrm )
 {
     sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
     rWorkbook->startElement( XML_scenario,
-            XML_name,       XclXmlUtils::ToOString( sName ).getStr(),
+            XML_name,       XclXmlUtils::ToOString( sName ),
             XML_locked,     ToPsz( bProtected ),
             // OOXTODO: XML_hidden,
-            XML_count,      OString::number(  aCells.size() ).getStr(),
+            XML_count,      OString::number(  aCells.size() ),
             XML_user,       XESTRING_TO_PSZ( sUserName ),
             XML_comment,    XESTRING_TO_PSZ( sComment ) );
 
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index dd555514650a..c0215ecca162 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -79,17 +79,17 @@
 #endif
 
 // presentation namespaces
-#define PNMSS         FSNS(XML_xmlns, XML_a),   
OUStringToOString(this->getNamespaceURL(OOX_NS(dml)), 
RTL_TEXTENCODING_UTF8).getStr(), \
-                      FSNS(XML_xmlns, XML_p),   
OUStringToOString(this->getNamespaceURL(OOX_NS(ppt)), 
RTL_TEXTENCODING_UTF8).getStr(), \
-                      FSNS(XML_xmlns, XML_r),   
OUStringToOString(this->getNamespaceURL(OOX_NS(officeRel)), 
RTL_TEXTENCODING_UTF8).getStr(), \
-                      FSNS(XML_xmlns, XML_p14), 
OUStringToOString(this->getNamespaceURL(OOX_NS(p14)), 
RTL_TEXTENCODING_UTF8).getStr(), \
-                      FSNS(XML_xmlns, XML_p15), 
OUStringToOString(this->getNamespaceURL(OOX_NS(p15)), 
RTL_TEXTENCODING_UTF8).getStr(), \
-                      FSNS(XML_xmlns, XML_mc),  
OUStringToOString(this->getNamespaceURL(OOX_NS(mce)), 
RTL_TEXTENCODING_UTF8).getStr()
+#define PNMSS         FSNS(XML_xmlns, XML_a),   
this->getNamespaceURL(OOX_NS(dml)), \
+                      FSNS(XML_xmlns, XML_p),   
this->getNamespaceURL(OOX_NS(ppt)), \
+                      FSNS(XML_xmlns, XML_r),   
this->getNamespaceURL(OOX_NS(officeRel)), \
+                      FSNS(XML_xmlns, XML_p14), 
this->getNamespaceURL(OOX_NS(p14)), \
+                      FSNS(XML_xmlns, XML_p15), 
this->getNamespaceURL(OOX_NS(p15)), \
+                      FSNS(XML_xmlns, XML_mc),  
this->getNamespaceURL(OOX_NS(mce))
 
 // presentationPr namespace
-#define PPRNMSS       FSNS(XML_xmlns, XML_a),   
OUStringToOString(this->getNamespaceURL(OOX_NS(dml)), 
RTL_TEXTENCODING_UTF8).getStr(), \
-                      FSNS(XML_xmlns, XML_r),   
OUStringToOString(this->getNamespaceURL(OOX_NS(officeRel)), 
RTL_TEXTENCODING_UTF8).getStr(), \
-                      FSNS(XML_xmlns, XML_p),   
OUStringToOString(this->getNamespaceURL(OOX_NS(ppt)), 
RTL_TEXTENCODING_UTF8).getStr()
+#define PPRNMSS       FSNS(XML_xmlns, XML_a),   
this->getNamespaceURL(OOX_NS(dml)), \
+                      FSNS(XML_xmlns, XML_r),   
this->getNamespaceURL(OOX_NS(officeRel)), \
+                      FSNS(XML_xmlns, XML_p),   
this->getNamespaceURL(OOX_NS(ppt))
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::animations;
@@ -1338,10 +1338,10 @@ void PowerPointExport::WriteModifyVerifier()
                     XML_cryptProviderType, "rsaAES",
                     XML_cryptAlgorithmClass, "hash",
                     XML_cryptAlgorithmType, "typeAny",
-                    XML_cryptAlgorithmSid, 
OString::number(nAlgorithmSid).getStr(),
-                    XML_spinCount, OString::number(nCount).getStr(),
-                    XML_saltData, sSalt.toUtf8().getStr(),
-                    XML_hashData, sHash.toUtf8().getStr());
+                    XML_cryptAlgorithmSid, OString::number(nAlgorithmSid),
+                    XML_spinCount, OString::number(nCount),
+                    XML_saltData, sSalt,
+                    XML_hashData, sHash);
         }
     }
 }
@@ -1802,7 +1802,7 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceShape(
     mpFS->startElementNS(XML_p, XML_nvSpPr);
     const OString aPlaceholderID("PlaceHolder " + 
OString::number(mnShapeIdMax++));
     GetFS()->singleElementNS(XML_p, XML_cNvPr, XML_id, 
OString::number(mnShapeIdMax), XML_name,
-                             aPlaceholderID.getStr());
+                             aPlaceholderID);
 
     mpFS->startElementNS(XML_p, XML_cNvSpPr);
     mpFS->singleElementNS(XML_a, XML_spLocks, XML_noGrp, "1");
@@ -1869,7 +1869,7 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
                 aSlideNum = OUString::number(nSlideNum);
             }
             OString aUUID(comphelper::xml::generateGUIDString());
-            mpFS->startElementNS(XML_a, XML_fld, XML_id, aUUID.getStr(), 
XML_type, "slidenum");
+            mpFS->startElementNS(XML_a, XML_fld, XML_id, aUUID, XML_type, 
"slidenum");
             mpFS->startElementNS(XML_a, XML_t);
             mpFS->writeEscaped(aSlideNum);
             mpFS->endElementNS(XML_a, XML_t);
@@ -1910,7 +1910,7 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
             if(!bIsDateTimeFixed)
             {
                 OString aUUID(comphelper::xml::generateGUIDString());
-                mpFS->startElementNS(XML_a, XML_fld, XML_id, aUUID.getStr(), 
XML_type, aDateTimeType);
+                mpFS->startElementNS(XML_a, XML_fld, XML_id, aUUID, XML_type, 
aDateTimeType);
             }
             else
             {
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index e52e7eaa7cc1..daddbb51e9ac 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -510,7 +510,7 @@ void SmGraphicWidget::SetIsCursorVisible(bool bVis)
     {
         mrViewShell.SendCaretToLOK();
         mrViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE,
-                                               
OString::boolean(bVis).getStr());
+                                               OString::boolean(bVis));
     }
 }
 
@@ -2181,7 +2181,7 @@ public:
         if (comphelper::LibreOfficeKit::isActive())
             if (auto pViewShell = GetViewShell_Impl())
                 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE,
-                                                       
OString::boolean(false).getStr());
+                                                       
OString::boolean(false));
 
         SfxBaseController::dispose();
     }
diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx
index 7a8f0e252002..e66e66d840bb 100644
--- a/svtools/source/svrtf/rtfout.cxx
+++ b/svtools/source/svrtf/rtfout.cxx
@@ -155,8 +155,7 @@ SvStream& Out_Char(SvStream& rStream, sal_Unicode c,
                             *pUCMode = nLen;
                         }
                         rStream.WriteCharPtr( "\\u" )
-                           .WriteCharPtr( OString::number(
-                                static_cast<sal_Int32>(c)).getStr() );
+                           .WriteInt32AsString(c);
                     }
 
                     for (sal_Int32 nI = 0; nI < nLen; ++nI)
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx 
b/sw/source/filter/ww8/WW8TableInfo.cxx
index 56aef2e1e8a6..5f843439bf2b 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -1276,7 +1276,7 @@ std::string WW8TableCellGrid::toString()
     while (aTopsIt != getRowTopsEnd())
     {
         sResult += "<row y=\"";
-        sResult += OString::number(*aTopsIt).getStr();
+        sResult += OString::number(*aTopsIt);
         sResult += "\">";
 
         CellInfoMultiSet::const_iterator aCellIt = getCellsBegin(*aTopsIt);
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index bb1da3074765..38a33ca6a1a5 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1083,10 +1083,10 @@ void DocxExport::WriteSettings()
                     FSNS(XML_w, XML_cryptProviderType), "rsaAES",
                     FSNS(XML_w, XML_cryptAlgorithmClass), "hash",
                     FSNS(XML_w, XML_cryptAlgorithmType), "typeAny",
-                    FSNS(XML_w, XML_cryptAlgorithmSid), 
OString::number(nAlgorithmSid).getStr(),
-                    FSNS(XML_w, XML_cryptSpinCount), 
OString::number(nCount).getStr(),
-                    FSNS(XML_w, XML_hash), sHash.toUtf8().getStr(),
-                    FSNS(XML_w, XML_salt), sSalt.toUtf8().getStr());
+                    FSNS(XML_w, XML_cryptAlgorithmSid), 
OString::number(nAlgorithmSid),
+                    FSNS(XML_w, XML_cryptSpinCount), OString::number(nCount),
+                    FSNS(XML_w, XML_hash), sHash,
+                    FSNS(XML_w, XML_salt), sSalt);
         }
     }
 
@@ -1176,7 +1176,7 @@ void DocxExport::WriteSettings()
         pFS->singleElementNS(XML_w, XML_dataType,
             FSNS( XML_w, XML_val ), "textFile" );
         pFS->singleElementNS( XML_w, XML_query,
-            FSNS( XML_w, XML_val ), OUStringToOString( sDataSource, 
RTL_TEXTENCODING_UTF8 ).getStr() );
+            FSNS( XML_w, XML_val ), sDataSource );
         pFS->endElementNS( XML_w, XML_mailMerge );
     }
 
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index d5abf5e2d9e2..25c658a7685b 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1361,15 +1361,13 @@ void SvStream::RefreshBuffer()
 
 SvStream& SvStream::WriteInt32AsString(sal_Int32 nInt32)
 {
-    auto const buffer = OString::number(nInt32);
-    WriteBytes(buffer.getStr(), buffer.length);
+    WriteOString(OString::number(nInt32));
     return *this;
 }
 
 SvStream& SvStream::WriteUInt32AsString(sal_uInt32 nUInt32)
 {
-    auto const buffer = OString::number(nUInt32);
-    WriteBytes(buffer.getStr(), buffer.length);
+    WriteOString(OString::number(nUInt32));
     return *this;
 }
 
diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
index 930fa5a7f85b..fd18e04e6908 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
@@ -650,7 +650,7 @@ int OOXMLUniversalMeasureValue::getInt() const
 #ifdef DBG_UTIL
 std::string OOXMLUniversalMeasureValue::toString() const
 {
-    return OString::number(mnValue).getStr();
+    return std::string(OString::number(mnValue));
 }
 #endif
 
@@ -680,7 +680,7 @@ int OOXMLMeasurementOrPercentValue::getInt() const
 #ifdef DBG_UTIL
 std::string OOXMLMeasurementOrPercentValue::toString() const
 {
-    return OString::number(mnValue).getStr();
+    return std::string(OString::number(mnValue));
 }
 #endif
 
diff --git a/writerfilter/source/rtftok/rtfvalue.cxx 
b/writerfilter/source/rtftok/rtfvalue.cxx
index 42f60a1c97d7..373fb7521b13 100644
--- a/writerfilter/source/rtftok/rtfvalue.cxx
+++ b/writerfilter/source/rtftok/rtfvalue.cxx
@@ -143,9 +143,9 @@ writerfilter::Reference<BinaryObj>::Pointer_t 
RTFValue::getBinary()
 std::string RTFValue::toString() const
 {
     if (!m_sValue.isEmpty() || m_bForceString)
-        return OUStringToOString(m_sValue, RTL_TEXTENCODING_UTF8).getStr();
+        return std::string(OUStringToOString(m_sValue, RTL_TEXTENCODING_UTF8));
 
-    return OString::number(m_nValue).getStr();
+    return std::string(OString::number(m_nValue));
 }
 #endif
 
diff --git a/xmloff/source/core/fasttokenhandler.cxx 
b/xmloff/source/core/fasttokenhandler.cxx
index 5a9c9e6dcdda..b82ee67bfe54 100644
--- a/xmloff/source/core/fasttokenhandler.cxx
+++ b/xmloff/source/core/fasttokenhandler.cxx
@@ -55,12 +55,10 @@ TokenMap::TokenMap() :
     int i = 0;
     for( auto& rTokenName : maTokenNamesUtf8 )
     {
-        const char* pStr = *ppcTokenName;
-        int nStrLen = strlen(pStr);
+        std::string_view pStr = *ppcTokenName;
         rTokenName = uno::Sequence< sal_Int8 >(
-                    reinterpret_cast< const sal_Int8* >( pStr ), nStrLen );
-        maTokenNames[i++] = OUString( pStr,
-                    nStrLen, RTL_TEXTENCODING_UTF8 );
+                    reinterpret_cast< const sal_Int8* >( pStr.data() ), 
pStr.length() );
+        maTokenNames[i++] = OStringToOUString( pStr, RTL_TEXTENCODING_UTF8 );
         ++ppcTokenName;
     }
 }

Reply via email to