diff options
author | Olivier Hallot <olivier.hallot@alta.org.br> | 2012-09-01 12:44:39 -0300 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@alta.org.br> | 2012-09-05 22:13:17 +0000 |
commit | c75af8578d921040e1baf8414edd7239969bcd45 (patch) | |
tree | 2c9310a3da94d1859fd80f03a7217bbfec938b67 /xmlscript/source/xmllib_imexp | |
parent | 72fa23ba0e13e6cf8a7ffb0476863d4399af0da1 (diff) |
kill RTL_CONSTASCII_USTRINGPARAM in xmlscript
Plus rtl::OUString cleanup
Only on rebased files
Change-Id: Icddaa20742cc45f08e5a48790447fcf8865f4bd6
Reviewed-on: https://gerrit.libreoffice.org/527
Reviewed-by: Olivier Hallot <olivier.hallot@alta.org.br>
Tested-by: Olivier Hallot <olivier.hallot@alta.org.br>
Diffstat (limited to 'xmlscript/source/xmllib_imexp')
-rw-r--r-- | xmlscript/source/xmllib_imexp/imp_share.hxx | 8 | ||||
-rw-r--r-- | xmlscript/source/xmllib_imexp/xmllib_export.cxx | 61 | ||||
-rw-r--r-- | xmlscript/source/xmllib_imexp/xmllib_import.cxx | 79 |
3 files changed, 45 insertions, 103 deletions
diff --git a/xmlscript/source/xmllib_imexp/imp_share.hxx b/xmlscript/source/xmllib_imexp/imp_share.hxx index a3d8b4ac2602..bbeeea6bcc31 100644 --- a/xmlscript/source/xmllib_imexp/imp_share.hxx +++ b/xmlscript/source/xmllib_imexp/imp_share.hxx @@ -32,8 +32,6 @@ #include <vector> -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) - using namespace ::rtl; using namespace ::std; @@ -75,11 +73,7 @@ inline bool getBoolAttr( } else { - throw xml::sax::SAXException( - rAttrName + - OUString( RTL_CONSTASCII_USTRINGPARAM( - ": no boolean value (true|false)!") ), - Reference< XInterface >(), Any() ); + throw xml::sax::SAXException(rAttrName + ": no boolean value (true|false)!", Reference< XInterface >(), Any() ); } } return false; diff --git a/xmlscript/source/xmllib_imexp/xmllib_export.cxx b/xmlscript/source/xmllib_imexp/xmllib_export.cxx index 469638d77dd1..9f0cb742cf91 100644 --- a/xmlscript/source/xmllib_imexp/xmllib_export.cxx +++ b/xmlscript/source/xmllib_imexp/xmllib_export.cxx @@ -45,58 +45,51 @@ SAL_CALL exportLibraryContainer( { xOut->startDocument(); - OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM( + OUString aDocTypeStr( "<!DOCTYPE library:libraries PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\"" - " \"libraries.dtd\">" ) ); + " \"libraries.dtd\">" ); xOut->unknown( aDocTypeStr ); xOut->ignorableWhitespace( OUString() ); - OUString aLibrariesName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":libraries") ); + OUString aLibrariesName( XMLNS_LIBRARY_PREFIX ":libraries" ); XMLElement* pLibsElement = new XMLElement( aLibrariesName ); Reference< xml::sax::XAttributeList > xAttributes( pLibsElement ); - pLibsElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_LIBRARY_PREFIX) ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_URI) ) ); - pLibsElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_XLINK_PREFIX) ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_XLINK_URI) ) ); + pLibsElement->addAttribute( "xmlns:" XMLNS_LIBRARY_PREFIX, XMLNS_LIBRARY_URI ); + pLibsElement->addAttribute( "xmlns:" XMLNS_XLINK_PREFIX, XMLNS_XLINK_URI ); xOut->ignorableWhitespace( OUString() ); xOut->startElement( aLibrariesName, xAttributes ); - rtl::OUString sTrueStr(aTrueStr); - rtl::OUString sFalseStr(aFalseStr); + OUString sTrueStr(aTrueStr); + OUString sFalseStr(aFalseStr); int nLibCount = pLibArray->mnLibCount; for( sal_Int32 i = 0 ; i < nLibCount ; i++ ) { LibDescriptor& rLib = pLibArray->mpLibs[i]; - OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":library") ); + OUString aLibraryName( XMLNS_LIBRARY_PREFIX ":library" ); XMLElement* pLibElement = new XMLElement( aLibraryName ); Reference< xml::sax::XAttributeList > xLibElementAttribs; xLibElementAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement ); - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":name") ), - rLib.aName ); + pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":name", rLib.aName ); if( !rLib.aStorageURL.isEmpty() ) { - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_XLINK_PREFIX ":href") ), - rLib.aStorageURL ); - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_XLINK_PREFIX ":type") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("simple") ) ); + pLibElement->addAttribute( XMLNS_XLINK_PREFIX ":href", rLib.aStorageURL ); + pLibElement->addAttribute( XMLNS_XLINK_PREFIX ":type", "simple" ); } - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":link") ), - rLib.bLink ? sTrueStr : sFalseStr ); + pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":link", rLib.bLink ? sTrueStr : sFalseStr ); if( rLib.bLink ) { - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":readonly") ), - rLib.bReadOnly ? sTrueStr : sFalseStr ); + pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":readonly", rLib.bReadOnly ? sTrueStr : sFalseStr ); } pLibElement->dump( xOut.get() ); @@ -118,34 +111,30 @@ SAL_CALL exportLibrary( { xOut->startDocument(); - OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM( + OUString aDocTypeStr( "<!DOCTYPE library:library PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\"" - " \"library.dtd\">" ) ); + " \"library.dtd\">" ); xOut->unknown( aDocTypeStr ); xOut->ignorableWhitespace( OUString() ); - OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":library") ); + OUString aLibraryName( XMLNS_LIBRARY_PREFIX ":library" ); XMLElement* pLibElement = new XMLElement( aLibraryName ); Reference< xml::sax::XAttributeList > xAttributes( pLibElement ); - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_LIBRARY_PREFIX) ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_URI) ) ); + pLibElement->addAttribute( "xmlns:" XMLNS_LIBRARY_PREFIX, XMLNS_LIBRARY_URI ); - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":name") ), - rLib.aName ); + pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":name", rLib.aName ); - rtl::OUString sTrueStr(aTrueStr); - rtl::OUString sFalseStr(aFalseStr); + OUString sTrueStr(aTrueStr); + OUString sFalseStr(aFalseStr); - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":readonly") ), - rLib.bReadOnly ? sTrueStr : sFalseStr ); + pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":readonly", rLib.bReadOnly ? sTrueStr : sFalseStr ); - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":passwordprotected") ), - rLib.bPasswordProtected ? sTrueStr : sFalseStr ); + pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":passwordprotected", rLib.bPasswordProtected ? sTrueStr : sFalseStr ); if( rLib.bPreload ) - pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":preload") ), sTrueStr ); + pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":preload", sTrueStr ); sal_Int32 nElementCount = rLib.aElementNames.getLength(); if( nElementCount ) @@ -153,11 +142,11 @@ SAL_CALL exportLibrary( const OUString* pElementNames = rLib.aElementNames.getConstArray(); for( sal_Int32 i = 0 ; i < nElementCount ; i++ ) { - XMLElement* pElement = new XMLElement( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":element" ) ) ); + XMLElement* pElement = new XMLElement( XMLNS_LIBRARY_PREFIX ":element" ); Reference< xml::sax::XAttributeList > xElementAttribs; xElementAttribs = static_cast< xml::sax::XAttributeList* >( pElement ); - pElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":name") ), + pElement->addAttribute( OUString( XMLNS_LIBRARY_PREFIX ":name" ), pElementNames[i] ); pLibElement->addSubElement( pElement ); diff --git a/xmlscript/source/xmllib_imexp/xmllib_import.cxx b/xmlscript/source/xmllib_imexp/xmllib_import.cxx index 11de9a427c69..0a0e08bae9e4 100644 --- a/xmlscript/source/xmllib_imexp/xmllib_import.cxx +++ b/xmlscript/source/xmllib_imexp/xmllib_import.cxx @@ -80,9 +80,7 @@ Reference< xml::input::XElement > LibElementBase::startChildElement( Reference< xml::input::XAttributes > const & /*xAttributes*/ ) throw (xml::sax::SAXException, RuntimeException) { - throw xml::sax::SAXException( - OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected element!") ), - Reference< XInterface >(), Any() ); + throw xml::sax::SAXException("unexpected element!", Reference< XInterface >(), Any() ); } //__________________________________________________________________________________________________ @@ -129,10 +127,8 @@ void LibraryImport::startDocument( Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping ) throw (xml::sax::SAXException, RuntimeException) { - XMLNS_LIBRARY_UID = xNamespaceMapping->getUidByUri( - OUSTR(XMLNS_LIBRARY_URI) ); - XMLNS_XLINK_UID = xNamespaceMapping->getUidByUri( - OUSTR(XMLNS_XLINK_URI) ); + XMLNS_LIBRARY_UID = xNamespaceMapping->getUidByUri( XMLNS_LIBRARY_URI ); + XMLNS_XLINK_UID = xNamespaceMapping->getUidByUri( XMLNS_XLINK_URI ); } //__________________________________________________________________________________________________ void LibraryImport::endDocument() @@ -159,9 +155,7 @@ Reference< xml::input::XElement > LibraryImport::startRootElement( { if (XMLNS_LIBRARY_UID != nUid) { - throw xml::sax::SAXException( - OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), - Reference< XInterface >(), Any() ); + throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } else if ( mpLibArray && rLocalName == "libraries" ) { @@ -172,28 +166,16 @@ Reference< xml::input::XElement > LibraryImport::startRootElement( LibDescriptor& aDesc = *mpLibDesc; aDesc.bLink = aDesc.bReadOnly = aDesc.bPasswordProtected = aDesc.bPreload = sal_False; - aDesc.aName = xAttributes->getValueByUidName( - XMLNS_LIBRARY_UID, OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) ); - getBoolAttr( - &aDesc.bReadOnly, - OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), xAttributes, - XMLNS_LIBRARY_UID ); - getBoolAttr( - &aDesc.bPasswordProtected, - OUString( RTL_CONSTASCII_USTRINGPARAM("passwordprotected") ), - xAttributes, XMLNS_LIBRARY_UID ); - getBoolAttr( - &aDesc.bPreload, - OUString( RTL_CONSTASCII_USTRINGPARAM("preload") ), - xAttributes, XMLNS_LIBRARY_UID ); + aDesc.aName = xAttributes->getValueByUidName(XMLNS_LIBRARY_UID, "name" ); + getBoolAttr( &aDesc.bReadOnly, "readonly", xAttributes, XMLNS_LIBRARY_UID ); + getBoolAttr( &aDesc.bPasswordProtected, "passwordprotected", xAttributes, XMLNS_LIBRARY_UID ); + getBoolAttr( &aDesc.bPreload, "preload", xAttributes, XMLNS_LIBRARY_UID ); return new LibraryElement( rLocalName, xAttributes, 0, this ); } else { - throw xml::sax::SAXException( - OUString( RTL_CONSTASCII_USTRINGPARAM("illegal root element (expected libraries) given: ") ) + - rLocalName, Reference< XInterface >(), Any() ); + throw xml::sax::SAXException( "illegal root element (expected libraries) given: " + rLocalName, Reference< XInterface >(), Any() ); } } //__________________________________________________________________________________________________ @@ -217,9 +199,7 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement( { if (_pImport->XMLNS_LIBRARY_UID != nUid) { - throw xml::sax::SAXException( - OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), - Reference< XInterface >(), Any() ); + throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } // library else if ( rLocalName == "library" ) @@ -227,33 +207,18 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement( LibDescriptor aDesc; aDesc.bLink = aDesc.bReadOnly = aDesc.bPasswordProtected = aDesc.bPreload = sal_False; - aDesc.aName = xAttributes->getValueByUidName( - _pImport->XMLNS_LIBRARY_UID, - OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) ); - aDesc.aStorageURL = xAttributes->getValueByUidName( - _pImport->XMLNS_XLINK_UID, - OUString( RTL_CONSTASCII_USTRINGPARAM("href") ) ); - getBoolAttr( - &aDesc.bLink, - OUString( RTL_CONSTASCII_USTRINGPARAM("link") ), - xAttributes, _pImport->XMLNS_LIBRARY_UID ); - getBoolAttr( - &aDesc.bReadOnly, - OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), - xAttributes, _pImport->XMLNS_LIBRARY_UID ); - getBoolAttr( - &aDesc.bPasswordProtected, - OUString( RTL_CONSTASCII_USTRINGPARAM("passwordprotected") ), - xAttributes, _pImport->XMLNS_LIBRARY_UID ); + aDesc.aName = xAttributes->getValueByUidName(_pImport->XMLNS_LIBRARY_UID, "name" ); + aDesc.aStorageURL = xAttributes->getValueByUidName( _pImport->XMLNS_XLINK_UID, "href" ); + getBoolAttr(&aDesc.bLink, "link", xAttributes, _pImport->XMLNS_LIBRARY_UID ); + getBoolAttr(&aDesc.bReadOnly, "readonly", xAttributes, _pImport->XMLNS_LIBRARY_UID ); + getBoolAttr(&aDesc.bPasswordProtected, "passwordprotected", xAttributes, _pImport->XMLNS_LIBRARY_UID ); mLibDescriptors.push_back( aDesc ); return new LibraryElement( rLocalName, xAttributes, this, _pImport ); } else { - throw xml::sax::SAXException( - OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ), - Reference< XInterface >(), Any() ); + throw xml::sax::SAXException( "expected styles ot bulletinboard element!", Reference< XInterface >(), Any() ); } } //__________________________________________________________________________________________________ @@ -279,16 +244,12 @@ Reference< xml::input::XElement > LibraryElement::startChildElement( { if (_pImport->XMLNS_LIBRARY_UID != nUid) { - throw xml::sax::SAXException( - OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), - Reference< XInterface >(), Any() ); + throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } // library else if ( rLocalName == "element" ) { - OUString aValue( xAttributes->getValueByUidName( - _pImport->XMLNS_LIBRARY_UID, - OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) ) ); + OUString aValue( xAttributes->getValueByUidName(_pImport->XMLNS_LIBRARY_UID, "name" ) ); if (!aValue.isEmpty()) mElements.push_back( aValue ); @@ -296,9 +257,7 @@ Reference< xml::input::XElement > LibraryElement::startChildElement( } else { - throw xml::sax::SAXException( - OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ), - Reference< XInterface >(), Any() ); + throw xml::sax::SAXException( "expected styles ot bulletinboard element!", Reference< XInterface >(), Any() ); } } //__________________________________________________________________________________________________ |