Kaydet (Commit) d812281f authored tarafından Jelle van der Waa's avatar Jelle van der Waa Kaydeden (comit) Tor Lillqvist

fdo#57950: Remove some chained appends in xmlscript

Change-Id: I7061f59077a75b879ad42179b839894747f5ba5b
Reviewed-on: https://gerrit.libreoffice.org/5377Reviewed-by: 's avatarTor Lillqvist <tml@iki.fi>
Tested-by: 's avatarTor Lillqvist <tml@iki.fi>
üst 6e3ac01f
......@@ -80,41 +80,25 @@ Reference< xml::sax::XAttributeList > Style::createElement()
// background-color
if (_set & 0x1)
{
OUStringBuffer buf( 16 );
buf.append( (sal_Unicode)'0' );
buf.append( (sal_Unicode)'x' );
buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_backgroundColor, 16 ) );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":background-color", buf.makeStringAndClear() );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":background-color", "0x" + OUString::number(_backgroundColor,16));
}
// text-color
if (_set & 0x2)
{
OUStringBuffer buf( 16 );
buf.append( (sal_Unicode)'0' );
buf.append( (sal_Unicode)'x' );
buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_textColor, 16 ) );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":text-color", buf.makeStringAndClear() );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":text-color", "0x" + OUString::number(_textColor,16));
}
// textline-color
if (_set & 0x20)
{
OUStringBuffer buf( 16 );
buf.append( (sal_Unicode)'0' );
buf.append( (sal_Unicode)'x' );
buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_textLineColor, 16 ) );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":textline-color", buf.makeStringAndClear() );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":textline-color", "0x" + OUString::number(_textLineColor,16));
}
// fill-color
if (_set & 0x10)
{
OUStringBuffer buf( 16 );
buf.append( (sal_Unicode)'0' );
buf.append( (sal_Unicode)'x' );
buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_fillColor, 16 ) );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":fill-color", buf.makeStringAndClear() );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":fill-color", "0x" + OUString::number(_fillColor,16));
}
// border
......@@ -132,10 +116,7 @@ Reference< xml::sax::XAttributeList > Style::createElement()
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":border", "simple" );
break;
case BORDER_SIMPLE_COLOR: {
OUStringBuffer buf;
buf.appendAscii( "0x" );
buf.append( OUString::valueOf((sal_Int64)(sal_uInt64)_borderColor, 16 ) );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":border", buf.makeStringAndClear() );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":border", "0x" + OUString::number(_borderColor,16));
break;
}
default:
......@@ -535,11 +516,7 @@ void ElementDescriptor::readHexLongAttr( OUString const & rPropName, OUString co
Any a( _xProps->getPropertyValue( rPropName ) );
if (a.getValueTypeClass() == TypeClass_LONG)
{
OUStringBuffer buf( 16 );
buf.append( (sal_Unicode)'0' );
buf.append( (sal_Unicode)'x' );
buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue(), 16 ) );
addAttribute( rAttrName, buf.makeStringAndClear() );
addAttribute( rAttrName, "0x" + OUString::number((sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue(),16) );
}
}
}
......
......@@ -1444,11 +1444,7 @@ void ImportContext::importEvents(
if (getStringAttr( &aLocation, "location", xAttributes, _pImport->XMLNS_SCRIPT_UID ))
{
// prepend location
OUStringBuffer buf;
buf.append( aLocation );
buf.append( (sal_Unicode)':' );
buf.append( descr.ScriptCode );
descr.ScriptCode = buf.makeStringAndClear();
descr.ScriptCode = aLocation + ":" + descr.ScriptCode;
}
}
else if ( descr.ScriptType == "Script" )
......@@ -1458,10 +1454,7 @@ void ImportContext::importEvents(
// the protocol ) and fix it up!!
if ( descr.ScriptCode.indexOf( ':' ) == -1 )
{
OUStringBuffer buf;
buf.append( "vnd.sun.star.script:" );
buf.append( descr.ScriptCode );
descr.ScriptCode = buf.makeStringAndClear();
descr.ScriptCode = "vnd.sun.start.script:" + descr.ScriptCode;
}
}
......@@ -1525,11 +1518,7 @@ void ImportContext::importEvents(
getStringAttr( &descr.AddListenerParam, "param", xAttributes, _pImport->XMLNS_DIALOGS_UID );
}
OUStringBuffer buf;
buf.append( descr.ListenerType );
buf.appendAscii( "::" );
buf.append( descr.EventMethod );
xEvents->insertByName( buf.makeStringAndClear(), makeAny( descr ) );
xEvents->insertByName( descr.ListenerType + "::" + descr.EventMethod, makeAny( descr ) );
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment