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() ...@@ -80,41 +80,25 @@ Reference< xml::sax::XAttributeList > Style::createElement()
// background-color // background-color
if (_set & 0x1) if (_set & 0x1)
{ {
OUStringBuffer buf( 16 ); pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":background-color", "0x" + OUString::number(_backgroundColor,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() );
} }
// text-color // text-color
if (_set & 0x2) if (_set & 0x2)
{ {
OUStringBuffer buf( 16 ); pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":text-color", "0x" + OUString::number(_textColor,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() );
} }
// textline-color // textline-color
if (_set & 0x20) if (_set & 0x20)
{ {
OUStringBuffer buf( 16 ); pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":textline-color", "0x" + OUString::number(_textLineColor,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() );
} }
// fill-color // fill-color
if (_set & 0x10) if (_set & 0x10)
{ {
OUStringBuffer buf( 16 ); pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":fill-color", "0x" + OUString::number(_fillColor,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() );
} }
// border // border
...@@ -132,10 +116,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() ...@@ -132,10 +116,7 @@ Reference< xml::sax::XAttributeList > Style::createElement()
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":border", "simple" ); pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":border", "simple" );
break; break;
case BORDER_SIMPLE_COLOR: { case BORDER_SIMPLE_COLOR: {
OUStringBuffer buf; pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":border", "0x" + OUString::number(_borderColor,16));
buf.appendAscii( "0x" );
buf.append( OUString::valueOf((sal_Int64)(sal_uInt64)_borderColor, 16 ) );
pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":border", buf.makeStringAndClear() );
break; break;
} }
default: default:
...@@ -535,11 +516,7 @@ void ElementDescriptor::readHexLongAttr( OUString const & rPropName, OUString co ...@@ -535,11 +516,7 @@ void ElementDescriptor::readHexLongAttr( OUString const & rPropName, OUString co
Any a( _xProps->getPropertyValue( rPropName ) ); Any a( _xProps->getPropertyValue( rPropName ) );
if (a.getValueTypeClass() == TypeClass_LONG) if (a.getValueTypeClass() == TypeClass_LONG)
{ {
OUStringBuffer buf( 16 ); addAttribute( rAttrName, "0x" + OUString::number((sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue(),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() );
} }
} }
} }
......
...@@ -1444,11 +1444,7 @@ void ImportContext::importEvents( ...@@ -1444,11 +1444,7 @@ void ImportContext::importEvents(
if (getStringAttr( &aLocation, "location", xAttributes, _pImport->XMLNS_SCRIPT_UID )) if (getStringAttr( &aLocation, "location", xAttributes, _pImport->XMLNS_SCRIPT_UID ))
{ {
// prepend location // prepend location
OUStringBuffer buf; descr.ScriptCode = aLocation + ":" + descr.ScriptCode;
buf.append( aLocation );
buf.append( (sal_Unicode)':' );
buf.append( descr.ScriptCode );
descr.ScriptCode = buf.makeStringAndClear();
} }
} }
else if ( descr.ScriptType == "Script" ) else if ( descr.ScriptType == "Script" )
...@@ -1458,10 +1454,7 @@ void ImportContext::importEvents( ...@@ -1458,10 +1454,7 @@ void ImportContext::importEvents(
// the protocol ) and fix it up!! // the protocol ) and fix it up!!
if ( descr.ScriptCode.indexOf( ':' ) == -1 ) if ( descr.ScriptCode.indexOf( ':' ) == -1 )
{ {
OUStringBuffer buf; descr.ScriptCode = "vnd.sun.start.script:" + descr.ScriptCode;
buf.append( "vnd.sun.star.script:" );
buf.append( descr.ScriptCode );
descr.ScriptCode = buf.makeStringAndClear();
} }
} }
...@@ -1525,11 +1518,7 @@ void ImportContext::importEvents( ...@@ -1525,11 +1518,7 @@ void ImportContext::importEvents(
getStringAttr( &descr.AddListenerParam, "param", xAttributes, _pImport->XMLNS_DIALOGS_UID ); getStringAttr( &descr.AddListenerParam, "param", xAttributes, _pImport->XMLNS_DIALOGS_UID );
} }
OUStringBuffer buf; xEvents->insertByName( descr.ListenerType + "::" + descr.EventMethod, makeAny( descr ) );
buf.append( descr.ListenerType );
buf.appendAscii( "::" );
buf.append( descr.EventMethod );
xEvents->insertByName( buf.makeStringAndClear(), 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