Kaydet (Commit) c75af857 authored tarafından Olivier Hallot's avatar Olivier Hallot

kill RTL_CONSTASCII_USTRINGPARAM in xmlscript

Plus rtl::OUString cleanup
Only on rebased files

Change-Id: Icddaa20742cc45f08e5a48790447fcf8865f4bd6
Reviewed-on: https://gerrit.libreoffice.org/527Reviewed-by: 's avatarOlivier Hallot <olivier.hallot@alta.org.br>
Tested-by: 's avatarOlivier Hallot <olivier.hallot@alta.org.br>
üst 72fa23ba
......@@ -42,7 +42,7 @@ class XMLSCRIPT_DLLPUBLIC XMLElement
: public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XAttributeList >
{
public:
inline XMLElement( ::rtl::OUString const & name )
inline XMLElement( OUString const & name )
SAL_THROW(())
: _name( name )
{}
......@@ -67,7 +67,7 @@ public:
@param rAttrName qname of attribute
@param rValue value string of element
*/
void SAL_CALL addAttribute( ::rtl::OUString const & rAttrName, ::rtl::OUString const & rValue )
void SAL_CALL addAttribute( OUString const & rAttrName, OUString const & rValue )
SAL_THROW(());
/** Gets the tag name (qname) of element.
......@@ -75,7 +75,7 @@ public:
@return
qname of element
*/
inline ::rtl::OUString SAL_CALL getName() SAL_THROW(())
inline OUString SAL_CALL getName() SAL_THROW(())
{ return _name; }
/** Dumps out element (and all sub elements).
......@@ -94,22 +94,22 @@ public:
// XAttributeList
virtual sal_Int16 SAL_CALL getLength()
throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getNameByIndex( sal_Int16 nPos )
virtual OUString SAL_CALL getNameByIndex( sal_Int16 nPos )
throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getTypeByIndex( sal_Int16 nPos )
virtual OUString SAL_CALL getTypeByIndex( sal_Int16 nPos )
throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getTypeByName( ::rtl::OUString const & rName )
virtual OUString SAL_CALL getTypeByName( OUString const & rName )
throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getValueByIndex( sal_Int16 nPos )
virtual OUString SAL_CALL getValueByIndex( sal_Int16 nPos )
throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getValueByName( ::rtl::OUString const & rName )
virtual OUString SAL_CALL getValueByName( OUString const & rName )
throw (::com::sun::star::uno::RuntimeException);
protected:
::rtl::OUString _name;
OUString _name;
::std::vector< ::rtl::OUString > _attrNames;
::std::vector< ::rtl::OUString > _attrValues;
::std::vector< OUString > _attrNames;
::std::vector< OUString > _attrValues;
::std::vector< ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList > > _subElems;
......
......@@ -35,12 +35,12 @@ namespace xmlscript
// functionality from xmlscript
struct XMLSCRIPT_DLLPUBLIC LibDescriptor
{
::rtl::OUString aName;
::rtl::OUString aStorageURL;
OUString aName;
OUString aStorageURL;
sal_Bool bLink;
sal_Bool bReadOnly;
sal_Bool bPasswordProtected;
::com::sun::star::uno::Sequence< ::rtl::OUString > aElementNames;
::com::sun::star::uno::Sequence< OUString > aElementNames;
sal_Bool bPreload;
};
......
......@@ -34,10 +34,10 @@ namespace xmlscript
// functionality from xmlscript
struct XMLSCRIPT_DLLPUBLIC ModuleDescriptor
{
::rtl::OUString aName;
::rtl::OUString aLanguage;
::rtl::OUString aCode;
::rtl::OUString aModuleType; // VBA
OUString aName;
OUString aLanguage;
OUString aCode;
OUString aModuleType; // VBA
};
XMLSCRIPT_DLLPUBLIC void
......
......@@ -22,9 +22,6 @@
#include "com/sun/star/uno/Any.hxx"
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
namespace xmlscript
{
......@@ -35,7 +32,7 @@ inline void extract_throw( T * p, ::com::sun::star::uno::Any const & a )
if (! (a >>= *p))
{
throw ::com::sun::star::uno::RuntimeException(
OUSTR("expected ") + ::getCppuType( p ).getTypeName(),
"expected " + ::getCppuType( p ).getTypeName(),
::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface>() );
}
......
......@@ -45,15 +45,13 @@ const sal_Int32 UID_UNKNOWN = -1;
Sequence< OUString > getSupportedServiceNames_DocumentHandlerImpl()
{
OUString name( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.xml.input.SaxDocumentHandler") );
OUString name( "com.sun.star.xml.input.SaxDocumentHandler" );
return Sequence< OUString >( &name, 1 );
}
OUString getImplementationName_DocumentHandlerImpl()
{
return OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.comp.xml.input.SaxDocumentHandler") );
return OUString( "com.sun.star.comp.xml.input.SaxDocumentHandler" );
}
typedef ::boost::unordered_map< OUString, sal_Int32, OUStringHash > t_OUString2LongMap;
......@@ -191,14 +189,12 @@ DocumentHandlerImpl::DocumentHandlerImpl(
bool bSingleThreadedUse )
: m_xRoot( xRoot ),
m_uid_count( 0 ),
m_sXMLNS_PREFIX_UNKNOWN(
RTL_CONSTASCII_USTRINGPARAM("<<< unknown prefix >>>") ),
m_sXMLNS( RTL_CONSTASCII_USTRINGPARAM("xmlns") ),
m_sXMLNS_PREFIX_UNKNOWN( "<<< unknown prefix >>>" ),
m_sXMLNS( "xmlns" ),
m_nLastURI_lookup( UID_UNKNOWN ),
m_aLastURI_lookup( RTL_CONSTASCII_USTRINGPARAM("<<< unknown URI >>>") ),
m_aLastURI_lookup( "<<< unknown URI >>>" ),
m_nLastPrefix_lookup( UID_UNKNOWN ),
m_aLastPrefix_lookup(
RTL_CONSTASCII_USTRINGPARAM("<<< unknown URI >>>") ),
m_aLastPrefix_lookup( "<<< unknown URI >>>" ),
m_nSkipElements( 0 ),
m_pMutex( 0 )
{
......@@ -473,10 +469,7 @@ void DocumentHandlerImpl::initialize(
}
else
{
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM(
"missing root instance!") ),
Reference< XInterface >() );
throw RuntimeException( "missing root instance!", Reference< XInterface >() );
}
}
......@@ -504,9 +497,7 @@ OUString DocumentHandlerImpl::getUriByUid( sal_Int32 Uid )
if (iPos->second == Uid)
return iPos->first;
}
throw container::NoSuchElementException(
OUString( RTL_CONSTASCII_USTRINGPARAM("no such xmlns uid!") ),
static_cast< OWeakObject * >(this) );
throw container::NoSuchElementException( "no such xmlns uid!" , static_cast< OWeakObject * >(this) );
}
......@@ -516,8 +507,7 @@ OUString DocumentHandlerImpl::getUriByUid( sal_Int32 Uid )
void DocumentHandlerImpl::startDocument()
throw (xml::sax::SAXException, RuntimeException)
{
m_xRoot->startDocument(
static_cast< xml::input::XNamespaceMapping * >( this ) );
m_xRoot->startDocument( static_cast< xml::input::XNamespaceMapping * >( this ) );
}
//______________________________________________________________________________
......@@ -606,8 +596,7 @@ void DocumentHandlerImpl::startElement(
{
OUString const & rQAttributeName = pQNames[ nPos ];
OSL_ENSURE(
rQAttributeName.compareToAscii(
RTL_CONSTASCII_STRINGPARAM("xmlns:") ) != 0,
rQAttributeName.compareToAscii( "xmlns:" ) != 0,
"### unexpected xmlns!" );
// collect attribute's uid and current prefix
......
......@@ -53,7 +53,7 @@ struct Style
short _all;
short _set;
::rtl::OUString _id;
OUString _id;
inline Style( short all_ ) SAL_THROW(())
: _fontRelief( css::awt::FontRelief::NONE )
......@@ -71,7 +71,7 @@ class StyleBag
public:
~StyleBag() SAL_THROW(());
::rtl::OUString getStyleId( Style const & rStyle ) SAL_THROW(());
OUString getStyleId( Style const & rStyle ) SAL_THROW(());
void dump( css::uno::Reference< css::xml::sax::XExtendedDocumentHandler >
const & xOut );
......@@ -88,7 +88,7 @@ public:
inline ElementDescriptor(
css::uno::Reference< css::beans::XPropertySet > const & xProps,
css::uno::Reference< css::beans::XPropertyState > const & xPropState,
::rtl::OUString const & name, css::uno::Reference< css::frame::XModel > const & xDocument )
OUString const & name, css::uno::Reference< css::frame::XModel > const & xDocument )
SAL_THROW(())
: XMLElement( name )
, _xProps( xProps )
......@@ -96,65 +96,65 @@ public:
, _xDocument( xDocument )
{}
inline ElementDescriptor(
::rtl::OUString const & name )
OUString const & name )
SAL_THROW(())
: XMLElement( name )
{}
template<typename T>
inline void read(
::rtl::OUString const & propName, ::rtl::OUString const & attrName,
OUString const & propName, OUString const & attrName,
bool forceAttribute = false );
template<typename T>
inline bool readProp( T * ret, ::rtl::OUString const & rPropName );
css::uno::Any readProp( ::rtl::OUString const & rPropName );
inline bool readProp( T * ret, OUString const & rPropName );
css::uno::Any readProp( OUString const & rPropName );
void readDefaults( bool supportPrintable = true, bool supportVisible = true );
void readStringAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
inline void readDoubleAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName )
OUString const & rPropName, OUString const & rAttrName )
{ read<double>( rPropName, rAttrName ); }
inline void readLongAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
OUString const & rPropName, OUString const & rAttrName,
bool forceAttribute = false )
{ read<sal_Int32>( rPropName, rAttrName, forceAttribute ); }
void readHexLongAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
inline void readShortAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName )
OUString const & rPropName, OUString const & rAttrName )
{ read<sal_Int32>( rPropName, rAttrName ); }
inline void readBoolAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName )
OUString const & rPropName, OUString const & rAttrName )
{ read<sal_Bool>( rPropName, rAttrName ); }
void readAlignAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readVerticalAlignAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readImageURLAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readImageAlignAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readImagePositionAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readDateFormatAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readTimeFormatAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readOrientationAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readButtonTypeAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readLineEndFormatAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readSelectionTypeAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
OUString const & rPropName, OUString const & rAttrName );
void readDataAwareAttr(
::rtl::OUString const & rAttrName );
OUString const & rAttrName );
inline void addBoolAttr(
::rtl::OUString const & rAttrName, sal_Bool bValue )
{ addAttribute( rAttrName, ::rtl::OUString::valueOf(bValue) ); }
OUString const & rAttrName, sal_Bool bValue )
{ addAttribute( rAttrName, OUString::valueOf(bValue) ); }
void addNumberFormatAttr(
css::uno::Reference< css::beans::XPropertySet >
const & xFormatProperties );
......@@ -218,7 +218,7 @@ public:
template<typename T>
inline void ElementDescriptor::read(
::rtl::OUString const & propName, ::rtl::OUString const & attrName,
OUString const & propName, OUString const & attrName,
bool forceAttribute )
{
if (forceAttribute ||
......@@ -228,7 +228,7 @@ inline void ElementDescriptor::read(
css::uno::Any a( _xProps->getPropertyValue( propName ) );
T v = T();
if (a >>= v)
addAttribute( attrName, ::rtl::OUString::valueOf(v) );
addAttribute( attrName, OUString::valueOf(v) );
else
OSL_FAIL( "### unexpected property type!" );
}
......@@ -236,7 +236,7 @@ inline void ElementDescriptor::read(
template<typename T>
inline bool ElementDescriptor::readProp(
T * ret, ::rtl::OUString const & rPropName )
T * ret, OUString const & rPropName )
{
_xProps->getPropertyValue( rPropName ) >>= *ret;
return css::beans::PropertyState_DEFAULT_VALUE !=
......
......@@ -68,18 +68,16 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
if (! xSMgr.is())
{
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM("no service manager available!") ),
throw RuntimeException("no service manager available!",
Reference< XInterface >() );
}
Reference< xml::sax::XExtendedDocumentHandler > xHandler( xSMgr->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ), xContext ), UNO_QUERY );
"com.sun.star.xml.sax.Writer", xContext ), UNO_QUERY );
OSL_ASSERT( xHandler.is() );
if (! xHandler.is())
{
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM("could not create sax-writer component!") ),
throw RuntimeException("could not create sax-writer component!",
Reference< XInterface >() );
}
......@@ -103,18 +101,16 @@ void SAL_CALL importDialogModel(
Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
if (! xSMgr.is())
{
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM("no service manager available!") ),
throw RuntimeException("no service manager available!",
Reference< XInterface >() );
}
Reference< xml::sax::XParser > xParser( xSMgr->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ), xContext ), UNO_QUERY );
"com.sun.star.xml.sax.Parser", xContext ), UNO_QUERY );
OSL_ASSERT( xParser.is() );
if (! xParser.is())
{
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM("could not create sax-parser component!") ),
throw RuntimeException("could not create sax-parser component!",
Reference< XInterface >() );
}
......@@ -123,7 +119,7 @@ void SAL_CALL importDialogModel(
xml::sax::InputSource source;
source.aInputStream = xInput;
source.sSystemId = OUString( RTL_CONSTASCII_USTRINGPARAM("virtual file") );
source.sSystemId = "virtual file";
xParser->parseStream( source );
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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;
......
......@@ -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 );
......
......@@ -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() );
}
}
//__________________________________________________________________________________________________
......
......@@ -33,9 +33,6 @@
#include <vector>
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
using namespace ::rtl;
using namespace ::std;
using namespace ::com::sun::star;
......
......@@ -24,7 +24,6 @@
using namespace com::sun::star::uno;
using namespace com::sun::star;
using ::rtl::OUString;
namespace xmlscript
{
......@@ -39,26 +38,22 @@ SAL_CALL exportScriptModule(
{
xOut->startDocument();
OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM(
OUString aDocTypeStr(
"<!DOCTYPE script:module PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\""
" \"module.dtd\">" ) );
" \"module.dtd\">");
xOut->unknown( aDocTypeStr );
xOut->ignorableWhitespace( OUString() );
OUString aModuleName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":module") );
OUString aModuleName( XMLNS_SCRIPT_PREFIX ":module" );
XMLElement* pModElement = new XMLElement( aModuleName );
Reference< xml::sax::XAttributeList > xAttributes( pModElement );
pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_SCRIPT_PREFIX) ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_URI) ) );
pModElement->addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX, XMLNS_SCRIPT_URI );
pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":name") ),
rMod.aName );
pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":language") ),
rMod.aLanguage );
pModElement->addAttribute( XMLNS_SCRIPT_PREFIX ":name", rMod.aName );
pModElement->addAttribute( XMLNS_SCRIPT_PREFIX ":language", rMod.aLanguage );
if( !rMod.aModuleType.isEmpty() )
pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":moduleType") ),
rMod.aModuleType );
pModElement->addAttribute( XMLNS_SCRIPT_PREFIX ":moduleType", rMod.aModuleType );
xOut->ignorableWhitespace( OUString() );
xOut->startElement( aModuleName, xAttributes );
......
......@@ -80,9 +80,7 @@ Reference< xml::input::XElement > ModuleElement::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,12 +127,9 @@ void ModuleImport::startDocument(
Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
throw (xml::sax::SAXException, RuntimeException)
{
XMLNS_SCRIPT_UID = xNamespaceMapping->getUidByUri(
OUSTR(XMLNS_SCRIPT_URI) );
XMLNS_LIBRARY_UID = xNamespaceMapping->getUidByUri(
OUSTR(XMLNS_LIBRARY_URI) );
XMLNS_XLINK_UID = xNamespaceMapping->getUidByUri(
OUSTR(XMLNS_XLINK_URI) );
XMLNS_SCRIPT_UID = xNamespaceMapping->getUidByUri( XMLNS_SCRIPT_URI );
XMLNS_LIBRARY_UID = xNamespaceMapping->getUidByUri( XMLNS_LIBRARY_URI );
XMLNS_XLINK_UID = xNamespaceMapping->getUidByUri( XMLNS_XLINK_URI );
}
//__________________________________________________________________________________________________
......@@ -163,31 +158,20 @@ Reference< xml::input::XElement > ModuleImport::startRootElement(
{
if (XMLNS_SCRIPT_UID != nUid)
{
throw xml::sax::SAXException(
OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
Reference< XInterface >(), Any() );
throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
}
// window
else if ( rLocalName == "module" )
{
mrModuleDesc.aName = xAttributes->getValueByUidName(
XMLNS_SCRIPT_UID,
OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) );
mrModuleDesc.aLanguage = xAttributes->getValueByUidName(
XMLNS_SCRIPT_UID,
OUString( RTL_CONSTASCII_USTRINGPARAM("language") ) );
mrModuleDesc.aModuleType = xAttributes->getValueByUidName(
XMLNS_SCRIPT_UID,
OUString( RTL_CONSTASCII_USTRINGPARAM("moduleType") ) );
mrModuleDesc.aName = xAttributes->getValueByUidName( XMLNS_SCRIPT_UID, "name" );
mrModuleDesc.aLanguage = xAttributes->getValueByUidName( XMLNS_SCRIPT_UID, "language" );
mrModuleDesc.aModuleType = xAttributes->getValueByUidName( XMLNS_SCRIPT_UID, "moduleType" );
return new ModuleElement( rLocalName, xAttributes, 0, this );
}
else
{
throw xml::sax::SAXException(
OUString( RTL_CONSTASCII_USTRINGPARAM(
"illegal root element (expected module) given: ") ) +
rLocalName, Reference< XInterface >(), Any() );
throw xml::sax::SAXException("illegal root element (expected module) given: " + rLocalName, Reference< XInterface >(), Any() );
}
}
//__________________________________________________________________________________________________
......
This diff is collapsed.
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