summaryrefslogtreecommitdiff
path: root/sc/source/filter/xcl97/XclExpChangeTrack.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-03-27 16:52:50 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-04-01 12:09:59 +0200
commit0267a2326b5282023e8b08a147eca178c5db1980 (patch)
treec1a1643ffa5fd49236048bc9c5ed76e9c442e3e0 /sc/source/filter/xcl97/XclExpChangeTrack.cxx
parent5c725eb7dee248c6d1792a9b9b9a9c813ca627e6 (diff)
Get rid of XclXmlUtils::ToOString(const OUString& s)
The helper function is used in export code to convert UTF-16 internal string representation to UTF-8 used in XML encoding. I suppose that all strings here should be already valid UTF-16 (an invalid input should have been validated at import/input stage). An invalid string at this stage means a programming error in another part of code that breaks this precondition, and should not be handled at export stage. This effectively changes flags used in conversion from UTF-16 to UTF-8, so that now RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR is used instead of RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT, so that the result would be truncated on invalid bytes instead of inserting U+FFFD, and would fail assertion in debug builds. Other changed flags don't affect UTF-16-to-UTF-8 conversion. Change-Id: I8b154249e66ee32b531b8ab503e0222b9108d829 Reviewed-on: https://gerrit.libreoffice.org/69830 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source/filter/xcl97/XclExpChangeTrack.cxx')
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index d5c4ef0e421b..7c491e5497cb 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -380,8 +380,8 @@ void XclExpXmlChTrHeaders::SaveXml( XclExpXmlStream& rStrm )
pHeaders->write("<")->writeId(XML_headers);
rStrm.WriteAttributes(
- XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(),
- FSNS(XML_xmlns, XML_r), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(officeRel))).getStr(),
+ XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8().getStr(),
+ FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8().getStr(),
XML_guid, lcl_GuidToOString(maGUID).getStr(),
XML_lastGuid, nullptr, // OOXTODO
XML_shared, nullptr, // OOXTODO
@@ -431,8 +431,8 @@ void XclExpXmlChTrHeader::SaveXml( XclExpXmlStream& rStrm )
rStrm.WriteAttributes(
XML_guid, lcl_GuidToOString(maGUID).getStr(),
XML_dateTime, lcl_DateTimeToOString(maDateTime).getStr(),
- XML_userName, XclXmlUtils::ToOString(maUserName).getStr(),
- FSNS(XML_r, XML_id), XclXmlUtils::ToOString(aRelId).getStr(),
+ XML_userName, maUserName.toUtf8(),
+ FSNS(XML_r, XML_id), aRelId.toUtf8(),
FSEND);
if (mnMinAction)
@@ -473,8 +473,8 @@ void XclExpXmlChTrHeader::SaveXml( XclExpXmlStream& rStrm )
pRevLogStrm->write("<")->writeId(XML_revisions);
rStrm.WriteAttributes(
- XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(),
- FSNS(XML_xmlns, XML_r), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(officeRel))).getStr(),
+ XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
+ FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
FSEND);
pRevLogStrm->write(">");
@@ -1241,7 +1241,7 @@ void XclExpChTrInsertTab::SaveXml( XclExpXmlStream& rStrm )
XML_ua, ToPsz( GetAccepted () ), // OOXTODO? bAccepted == ua or ra; not sure.
XML_ra, nullptr, // OOXTODO: RRD.fUndoAction? Or RRD.fAccepted?
XML_sheetId, OString::number( GetTabId( nTab ) ).getStr(),
- XML_name, XclXmlUtils::ToOString( GetTabInfo().GetScTabName( nTab ) ).getStr(),
+ XML_name, GetTabInfo().GetScTabName(nTab).toUtf8(),
XML_sheetPosition, OString::number( nTab ).getStr(),
FSEND );
}
@@ -1636,8 +1636,8 @@ static void lcl_WriteUserNamesXml( XclExpXmlStream& rWorkbookStrm )
"application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml",
CREATE_OFFICEDOC_RELATION_TYPE("usernames"));
pUserNames->startElement( XML_users,
- XML_xmlns, XclXmlUtils::ToOString(rWorkbookStrm.getNamespaceURL(OOX_NS(xls))).getStr(),
- FSNS( XML_xmlns, XML_r ), XclXmlUtils::ToOString(rWorkbookStrm.getNamespaceURL(OOX_NS(officeRel))).getStr(),
+ XML_xmlns, rWorkbookStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
+ FSNS( XML_xmlns, XML_r ), rWorkbookStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
XML_count, "0",
FSEND );
// OOXTODO: XML_userinfo elements for each user editing the file