Use OUString function variants that take a (narrow) string literal

...instead of going via an OUString temporary created from a char16_t string
literal

Change-Id: I9bdc1fe5e92988fbe227534a183c0c5a86ebc2a1
This commit is contained in:
Stephan Bergmann
2017-04-06 13:13:06 +02:00
parent 882dc72e67
commit 68d5dbf34d

View File

@@ -268,55 +268,55 @@ STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, B
*/ */
void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, Any &rAny) void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, Any &rAny)
{ {
if(ouName.equals(u"CharBackColor") || if(ouName == "CharBackColor" ||
ouName.equals(u"CharColor") || ouName == "CharColor" ||
ouName.equals(u"ParaAdjust") || ouName == "ParaAdjust" ||
ouName.equals(u"ParaFirstLineIndent") || ouName == "ParaFirstLineIndent" ||
ouName.equals(u"ParaLeftMargin") || ouName == "ParaLeftMargin" ||
ouName.equals(u"ParaRightMargin") || ouName == "ParaRightMargin" ||
ouName.equals(u"ParaTopMargin") || ouName == "ParaTopMargin" ||
ouName.equals(u"ParaBottomMargin") || ouName == "ParaBottomMargin" ||
ouName.equals(u"CharFontPitch") ) ouName == "CharFontPitch" )
{ {
// Convert to int. // Convert to int.
// NOTE: CharFontPitch is not implemented in java file. // NOTE: CharFontPitch is not implemented in java file.
sal_Int32 nValue = ouValue.toInt32(); sal_Int32 nValue = ouValue.toInt32();
rAny.setValue(&nValue, cppu::UnoType<sal_Int32>::get()); rAny.setValue(&nValue, cppu::UnoType<sal_Int32>::get());
} }
else if(ouName.equals(u"CharShadowed") || else if(ouName == "CharShadowed" ||
ouName.equals(u"CharContoured") ) ouName == "CharContoured" )
{ {
// Convert to boolean. // Convert to boolean.
rAny <<= ouValue.toBoolean(); rAny <<= ouValue.toBoolean();
} }
else if(ouName.equals(u"CharEscapement") || else if(ouName == "CharEscapement" ||
ouName.equals(u"CharStrikeout") || ouName == "CharStrikeout" ||
ouName.equals(u"CharUnderline") || ouName == "CharUnderline" ||
ouName.equals(u"CharFontPitch") ) ouName == "CharFontPitch" )
{ {
// Convert to short. // Convert to short.
short nValue = (short)ouValue.toInt32(); short nValue = (short)ouValue.toInt32();
rAny.setValue(&nValue, cppu::UnoType<short>::get()); rAny.setValue(&nValue, cppu::UnoType<short>::get());
} }
else if(ouName.equals(u"CharHeight") || else if(ouName == "CharHeight" ||
ouName.equals(u"CharWeight") ) ouName == "CharWeight" )
{ {
// Convert to float. // Convert to float.
float fValue = ouValue.toFloat(); float fValue = ouValue.toFloat();
rAny.setValue(&fValue, cppu::UnoType<float>::get()); rAny.setValue(&fValue, cppu::UnoType<float>::get());
} }
else if(ouName.equals(u"CharFontName") ) else if(ouName == "CharFontName" )
{ {
// Convert to string. // Convert to string.
rAny.setValue(&ouValue, cppu::UnoType<rtl::OUString>::get()); rAny.setValue(&ouValue, cppu::UnoType<rtl::OUString>::get());
} }
else if(ouName.equals(u"CharPosture") ) else if(ouName == "CharPosture" )
{ {
// Convert to FontSlant. // Convert to FontSlant.
css::awt::FontSlant fontSlant = (css::awt::FontSlant)ouValue.toInt32(); css::awt::FontSlant fontSlant = (css::awt::FontSlant)ouValue.toInt32();
rAny.setValue(&fontSlant, cppu::UnoType<css::awt::FontSlant>::get()); rAny.setValue(&fontSlant, cppu::UnoType<css::awt::FontSlant>::get());
} }
else if(ouName.equals(u"ParaTabStops") ) else if(ouName == "ParaTabStops" )
{ {
// Convert to the Sequence with TabStop element. // Convert to the Sequence with TabStop element.
@@ -328,7 +328,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
do do
{ {
// Position. // Position.
pos = ouValue.indexOf(u"Position=", pos); pos = ouValue.indexOf("Position=", pos);
if(pos != -1) if(pos != -1)
{ {
posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "Position=". posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "Position=".
@@ -339,7 +339,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
pos = posComma + 1; pos = posComma + 1;
// TabAlign. // TabAlign.
pos = ouValue.indexOf(u"TabAlign=", pos); pos = ouValue.indexOf("TabAlign=", pos);
if(pos != -1) if(pos != -1)
{ {
posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=". posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=".
@@ -350,7 +350,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
pos = posComma + 1; pos = posComma + 1;
// DecimalChar. // DecimalChar.
pos = ouValue.indexOf(u"DecimalChar=", pos); pos = ouValue.indexOf("DecimalChar=", pos);
if(pos != -1) if(pos != -1)
{ {
posComma = ouValue.indexOf(',', pos + 11); // 11 = length of "TabAlign=". posComma = ouValue.indexOf(',', pos + 11); // 11 = length of "TabAlign=".
@@ -361,7 +361,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
pos = posComma + 1; pos = posComma + 1;
// FillChar. // FillChar.
pos = ouValue.indexOf(u"FillChar=", pos); pos = ouValue.indexOf("FillChar=", pos);
if(pos != -1) if(pos != -1)
{ {
posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=". posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=".
@@ -425,14 +425,14 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
// Assign to Any object. // Assign to Any object.
rAny.setValue(&seqTabStop, cppu::UnoType<Sequence< css::style::TabStop >>::get()); rAny.setValue(&seqTabStop, cppu::UnoType<Sequence< css::style::TabStop >>::get());
} }
else if(ouName.equals(u"ParaLineSpacing") ) else if(ouName == "ParaLineSpacing" )
{ {
// Parse value string. // Parse value string.
css::style::LineSpacing lineSpacing; css::style::LineSpacing lineSpacing;
::rtl::OUString ouSubValue; ::rtl::OUString ouSubValue;
sal_Int32 pos = 0, posComma = 0; sal_Int32 pos = 0, posComma = 0;
pos = ouValue.indexOf(u"Mode=", pos); pos = ouValue.indexOf("Mode=", pos);
if(pos != -1) if(pos != -1)
{ {
posComma = ouValue.indexOf(',', pos + 5); // 5 = length of "Mode=". posComma = ouValue.indexOf(',', pos + 5); // 5 = length of "Mode=".
@@ -442,7 +442,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
lineSpacing.Mode = (sal_Int16)ouSubValue.toInt32(); lineSpacing.Mode = (sal_Int16)ouSubValue.toInt32();
pos = posComma + 1; pos = posComma + 1;
pos = ouValue.indexOf(u"Height=", pos); pos = ouValue.indexOf("Height=", pos);
if(pos != -1) if(pos != -1)
{ {
ouSubValue = ouValue.copy(pos + 7, ouValue.getLength() - pos - 7); ouSubValue = ouValue.copy(pos + 7, ouValue.getLength() - pos - 7);