summaryrefslogtreecommitdiff
path: root/xmlscript
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@vdwaa.nl>2013-08-12 22:11:38 +0200
committerTor Lillqvist <tml@iki.fi>2013-08-16 11:07:48 +0000
commitd812281f96b03866c5d367380409c266b9bb8d05 (patch)
treeee58d34a4cd925e19310cec986467939503a2c86 /xmlscript
parent6e3ac01f850228afb5c6cb1a33b101693aea8712 (diff)
fdo#57950: Remove some chained appends in xmlscript
Change-Id: I7061f59077a75b879ad42179b839894747f5ba5b Reviewed-on: https://gerrit.libreoffice.org/5377 Reviewed-by: Tor Lillqvist <tml@iki.fi> Tested-by: Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'xmlscript')
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx35
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_import.cxx17
2 files changed, 9 insertions, 43 deletions
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 450d18ed1c88..0f7c5b02b01e 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -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) );
}
}
}
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index b05ea5b10e5e..ef41489e5434 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -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 ) );
}
}
}