summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-03-27 10:07:31 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2019-04-04 15:24:49 +0200
commit4a4b1df72909fe96acdbcb95f90e30bd1a79c5eb (patch)
tree4da38d52d51c761cbf09f1a57b3f76b2dcd53d3a /sd
parent3154770b49f84981432ccc3756ceb1840ff8d8a0 (diff)
Get rid of USS macro
The helper marco 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. (See also commit 0267a2326b5282023e8b08a147eca178c5db1980.) 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: I12b2cc5378208904c3266924187d6402700ed6f3 Reviewed-on: https://gerrit.libreoffice.org/69801 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/filter/eppt/pptx-animations.cxx23
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx22
2 files changed, 23 insertions, 22 deletions
diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx
index d484fcc91cb0..d62b6214e898 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -123,8 +123,8 @@ void WriteAnimationProperty(const FSHelperPtr& pFS, const Any& rAny, sal_Int32 n
pFS->singleElementNS(XML_p, XML_fltVal, XML_val, DS(fDouble), FSEND);
break;
case TypeClass_STRING:
- pFS->singleElementNS(XML_p, XML_strVal, XML_val, USS(*o3tl::doAccess<OUString>(rAny)),
- FSEND);
+ pFS->singleElementNS(XML_p, XML_strVal, XML_val,
+ (*o3tl::doAccess<OUString>(rAny)).toUtf8(), FSEND);
break;
default:
break;
@@ -184,7 +184,7 @@ void WriteAnimateTo(const FSHelperPtr& pFS, const Any& rValue, const OUString& r
if (!rValue.hasValue())
return;
- SAL_INFO("sd.eppt", "to attribute name: " << USS(rAttributeName));
+ SAL_INFO("sd.eppt", "to attribute name: " << rAttributeName.toUtf8());
WriteAnimationProperty(pFS, AnimationExporter::convertAnimateValue(rValue, rAttributeName),
XML_to);
@@ -199,7 +199,7 @@ void WriteAnimateValues(const FSHelperPtr& pFS, const Reference<XAnimate>& rXAni
const OUString& sFormula = rXAnimate->getFormula();
const OUString& rAttributeName = rXAnimate->getAttributeName();
- SAL_INFO("sd.eppt", "animate values, formula: " << USS(sFormula));
+ SAL_INFO("sd.eppt", "animate values, formula: " << sFormula.toUtf8());
pFS->startElementNS(XML_p, XML_tavLst, FSEND);
@@ -209,7 +209,7 @@ void WriteAnimateValues(const FSHelperPtr& pFS, const Reference<XAnimate>& rXAni
if (aValues[i].hasValue())
{
pFS->startElementNS(XML_p, XML_tav, XML_fmla,
- sFormula.isEmpty() ? nullptr : USS(sFormula), XML_tm,
+ sFormula.isEmpty() ? nullptr : sFormula.toUtf8().getStr(), XML_tm,
I32S(static_cast<sal_Int32>(aKeyTimes[i] * 100000.0)), FSEND);
pFS->startElementNS(XML_p, XML_val, FSEND);
ValuePair aPair;
@@ -295,7 +295,7 @@ void WriteAnimationAttributeName(const FSHelperPtr& pFS, const OUString& rAttrib
pFS->startElementNS(XML_p, XML_attrNameLst, FSEND);
- SAL_INFO("sd.eppt", "write attribute name: " << USS(rAttributeName));
+ SAL_INFO("sd.eppt", "write attribute name: " << rAttributeName.toUtf8());
if (rAttributeName == "X;Y")
{
@@ -885,9 +885,10 @@ void PPTXAnimationExport::WriteAnimationNodeAnimate(sal_Int32 nXmlNodeType)
}
mpFS->startElementNS(XML_p, nXmlNodeType, XML_calcmode, pCalcMode, XML_valueType,
- pValueType, XML_from, sFrom.getLength() ? USS(sFrom) : nullptr, XML_to,
- sTo.getLength() ? USS(sTo) : nullptr, XML_by,
- sBy.getLength() ? USS(sBy) : nullptr, FSEND);
+ pValueType, XML_from,
+ sFrom.isEmpty() ? nullptr : sFrom.toUtf8().getStr(), XML_to,
+ sTo.isEmpty() ? nullptr : sTo.toUtf8().getStr(), XML_by,
+ sBy.isEmpty() ? nullptr : sBy.toUtf8().getStr(), FSEND);
bTo = sTo.isEmpty() && sFrom.isEmpty() && sBy.isEmpty();
}
@@ -1174,8 +1175,8 @@ void PPTXAnimationExport::WriteAnimationNodeAudio()
mpFS->startElementNS(XML_p, XML_tgtEl, FSEND);
mpFS->singleElementNS(XML_p, XML_sndTgt, FSNS(XML_r, XML_embed),
- sRelId.isEmpty() ? nullptr : USS(sRelId), XML_name,
- sUrl.isEmpty() ? nullptr : USS(sName), FSEND);
+ sRelId.isEmpty() ? nullptr : sRelId.toUtf8().getStr(), XML_name,
+ sUrl.isEmpty() ? nullptr : sName.toUtf8().getStr(), FSEND);
mpFS->endElementNS(XML_p, XML_tgtEl);
mpFS->endElementNS(XML_p, XML_cMediaNode);
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 2d244f2fb523..0ac1ca406f06 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -123,8 +123,8 @@ void WriteSndAc(const FSHelperPtr& pFS, const OUString& sSoundRelId, const OUStr
pFS->startElementNS(XML_p, XML_sndAc, FSEND);
pFS->startElementNS(XML_p, XML_stSnd, FSEND);
pFS->singleElementNS(XML_p, XML_snd,
- FSNS(XML_r, XML_embed), sSoundRelId.isEmpty() ? nullptr : USS(sSoundRelId),
- XML_name, sSoundName.isEmpty() ? nullptr : USS(sSoundName), FSEND);
+ FSNS(XML_r, XML_embed), sSoundRelId.isEmpty() ? nullptr : sSoundRelId.toUtf8().getStr(),
+ XML_name, sSoundName.isEmpty() ? nullptr : sSoundName.toUtf8().getStr(), FSEND);
pFS->endElement(FSNS(XML_p, XML_stSnd));
pFS->endElement(FSNS(XML_p, XML_sndAc));
}
@@ -253,7 +253,7 @@ ShapeExport& PowerPointShapeExport::WriteTextShape(const Reference< XShape >& xS
{
OUString sShapeType = xShape->getShapeType();
- SAL_INFO("sd.eppt", "shape(text) : " << USS(sShapeType));
+ SAL_INFO("sd.eppt", "shape(text) : " << sShapeType.toUtf8());
if (sShapeType == "com.sun.star.drawing.TextShape" || sShapeType == "com.sun.star.drawing.GraphicObjectShape")
{
@@ -306,7 +306,7 @@ ShapeExport& PowerPointShapeExport::WriteUnknownShape(const Reference< XShape >&
{
OUString sShapeType = xShape->getShapeType();
- SAL_INFO("sd.eppt", "shape(unknown): " << USS(sShapeType));
+ SAL_INFO("sd.eppt", "shape(unknown): " << sShapeType.toUtf8());
if (sShapeType == "com.sun.star.presentation.PageShape")
{
@@ -321,7 +321,7 @@ ShapeExport& PowerPointShapeExport::WriteUnknownShape(const Reference< XShape >&
}
}
else
- SAL_WARN("sd.eppt", "unknown shape not handled: " << USS(sShapeType));
+ SAL_WARN("sd.eppt", "unknown shape not handled: " << sShapeType.toUtf8());
return *this;
}
@@ -963,8 +963,8 @@ void PowerPointExport::WriteAuthors()
{
pFS->singleElementNS(XML_p, XML_cmAuthor,
XML_id, I32S(i.second.nId),
- XML_name, USS(i.first),
- XML_initials, USS(lcl_GetInitials(i.first)),
+ XML_name, i.first.toUtf8(),
+ XML_initials, lcl_GetInitials(i.first).toUtf8(),
XML_lastIdx, I32S(i.second.nLastIndex),
XML_clrIdx, I32S(i.second.nId),
FSEND);
@@ -1099,7 +1099,7 @@ void PowerPointExport::ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum
mPresentationFS->singleElementNS(XML_p, XML_sldId,
XML_id, I32S(GetNewSlideId()),
- FSNS(XML_r, XML_id), USS(sRelId),
+ FSNS(XML_r, XML_id), sRelId.toUtf8(),
FSEND);
if (nPageNum == mnPages - 1)
@@ -1232,7 +1232,7 @@ void PowerPointExport::AddLayoutIdAndRelation(const FSHelperPtr& pFS, sal_Int32
pFS->singleElementNS(XML_p, XML_sldLayoutId,
XML_id, I64S(GetNewSlideMasterId()),
- FSNS(XML_r, XML_id), USS(sRelId),
+ FSNS(XML_r, XML_id), sRelId.toUtf8(),
FSEND);
}
@@ -1254,7 +1254,7 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 nPageNum, Reference< XPro
mPresentationFS->singleElementNS(XML_p, XML_sldMasterId,
XML_id, OString::number(GetNewSlideMasterId()).getStr(),
- FSNS(XML_r, XML_id), USS(sRelId),
+ FSNS(XML_r, XML_id), sRelId.toUtf8(),
FSEND);
if (nPageNum == mnMasterPages - 1)
@@ -1909,7 +1909,7 @@ void PowerPointExport::WriteNotesMaster()
"notesMasters/notesMaster1.xml");
mPresentationFS->singleElementNS(XML_p, XML_notesMasterId,
- FSNS(XML_r, XML_id), USS(sRelId),
+ FSNS(XML_r, XML_id), sRelId.toUtf8(),
FSEND);
mPresentationFS->endElementNS(XML_p, XML_notesMasterIdLst);