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 ...@@ -42,7 +42,7 @@ class XMLSCRIPT_DLLPUBLIC XMLElement
: public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XAttributeList > : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XAttributeList >
{ {
public: public:
inline XMLElement( ::rtl::OUString const & name ) inline XMLElement( OUString const & name )
SAL_THROW(()) SAL_THROW(())
: _name( name ) : _name( name )
{} {}
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
@param rAttrName qname of attribute @param rAttrName qname of attribute
@param rValue value string of element @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(()); SAL_THROW(());
/** Gets the tag name (qname) of element. /** Gets the tag name (qname) of element.
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
@return @return
qname of element qname of element
*/ */
inline ::rtl::OUString SAL_CALL getName() SAL_THROW(()) inline OUString SAL_CALL getName() SAL_THROW(())
{ return _name; } { return _name; }
/** Dumps out element (and all sub elements). /** Dumps out element (and all sub elements).
...@@ -94,22 +94,22 @@ public: ...@@ -94,22 +94,22 @@ public:
// XAttributeList // XAttributeList
virtual sal_Int16 SAL_CALL getLength() virtual sal_Int16 SAL_CALL getLength()
throw (::com::sun::star::uno::RuntimeException); 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); 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); 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); 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); 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); throw (::com::sun::star::uno::RuntimeException);
protected: protected:
::rtl::OUString _name; OUString _name;
::std::vector< ::rtl::OUString > _attrNames; ::std::vector< OUString > _attrNames;
::std::vector< ::rtl::OUString > _attrValues; ::std::vector< OUString > _attrValues;
::std::vector< ::com::sun::star::uno::Reference< ::std::vector< ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList > > _subElems; ::com::sun::star::xml::sax::XAttributeList > > _subElems;
......
...@@ -35,12 +35,12 @@ namespace xmlscript ...@@ -35,12 +35,12 @@ namespace xmlscript
// functionality from xmlscript // functionality from xmlscript
struct XMLSCRIPT_DLLPUBLIC LibDescriptor struct XMLSCRIPT_DLLPUBLIC LibDescriptor
{ {
::rtl::OUString aName; OUString aName;
::rtl::OUString aStorageURL; OUString aStorageURL;
sal_Bool bLink; sal_Bool bLink;
sal_Bool bReadOnly; sal_Bool bReadOnly;
sal_Bool bPasswordProtected; sal_Bool bPasswordProtected;
::com::sun::star::uno::Sequence< ::rtl::OUString > aElementNames; ::com::sun::star::uno::Sequence< OUString > aElementNames;
sal_Bool bPreload; sal_Bool bPreload;
}; };
......
...@@ -34,10 +34,10 @@ namespace xmlscript ...@@ -34,10 +34,10 @@ namespace xmlscript
// functionality from xmlscript // functionality from xmlscript
struct XMLSCRIPT_DLLPUBLIC ModuleDescriptor struct XMLSCRIPT_DLLPUBLIC ModuleDescriptor
{ {
::rtl::OUString aName; OUString aName;
::rtl::OUString aLanguage; OUString aLanguage;
::rtl::OUString aCode; OUString aCode;
::rtl::OUString aModuleType; // VBA OUString aModuleType; // VBA
}; };
XMLSCRIPT_DLLPUBLIC void XMLSCRIPT_DLLPUBLIC void
......
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Any.hxx"
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
namespace xmlscript namespace xmlscript
{ {
...@@ -35,7 +32,7 @@ inline void extract_throw( T * p, ::com::sun::star::uno::Any const & a ) ...@@ -35,7 +32,7 @@ inline void extract_throw( T * p, ::com::sun::star::uno::Any const & a )
if (! (a >>= *p)) if (! (a >>= *p))
{ {
throw ::com::sun::star::uno::RuntimeException( throw ::com::sun::star::uno::RuntimeException(
OUSTR("expected ") + ::getCppuType( p ).getTypeName(), "expected " + ::getCppuType( p ).getTypeName(),
::com::sun::star::uno::Reference< ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface>() ); ::com::sun::star::uno::XInterface>() );
} }
......
...@@ -45,15 +45,13 @@ const sal_Int32 UID_UNKNOWN = -1; ...@@ -45,15 +45,13 @@ const sal_Int32 UID_UNKNOWN = -1;
Sequence< OUString > getSupportedServiceNames_DocumentHandlerImpl() Sequence< OUString > getSupportedServiceNames_DocumentHandlerImpl()
{ {
OUString name( RTL_CONSTASCII_USTRINGPARAM( OUString name( "com.sun.star.xml.input.SaxDocumentHandler" );
"com.sun.star.xml.input.SaxDocumentHandler") );
return Sequence< OUString >( &name, 1 ); return Sequence< OUString >( &name, 1 );
} }
OUString getImplementationName_DocumentHandlerImpl() OUString getImplementationName_DocumentHandlerImpl()
{ {
return OUString( RTL_CONSTASCII_USTRINGPARAM( return OUString( "com.sun.star.comp.xml.input.SaxDocumentHandler" );
"com.sun.star.comp.xml.input.SaxDocumentHandler") );
} }
typedef ::boost::unordered_map< OUString, sal_Int32, OUStringHash > t_OUString2LongMap; typedef ::boost::unordered_map< OUString, sal_Int32, OUStringHash > t_OUString2LongMap;
...@@ -191,14 +189,12 @@ DocumentHandlerImpl::DocumentHandlerImpl( ...@@ -191,14 +189,12 @@ DocumentHandlerImpl::DocumentHandlerImpl(
bool bSingleThreadedUse ) bool bSingleThreadedUse )
: m_xRoot( xRoot ), : m_xRoot( xRoot ),
m_uid_count( 0 ), m_uid_count( 0 ),
m_sXMLNS_PREFIX_UNKNOWN( m_sXMLNS_PREFIX_UNKNOWN( "<<< unknown prefix >>>" ),
RTL_CONSTASCII_USTRINGPARAM("<<< unknown prefix >>>") ), m_sXMLNS( "xmlns" ),
m_sXMLNS( RTL_CONSTASCII_USTRINGPARAM("xmlns") ),
m_nLastURI_lookup( UID_UNKNOWN ), m_nLastURI_lookup( UID_UNKNOWN ),
m_aLastURI_lookup( RTL_CONSTASCII_USTRINGPARAM("<<< unknown URI >>>") ), m_aLastURI_lookup( "<<< unknown URI >>>" ),
m_nLastPrefix_lookup( UID_UNKNOWN ), m_nLastPrefix_lookup( UID_UNKNOWN ),
m_aLastPrefix_lookup( m_aLastPrefix_lookup( "<<< unknown URI >>>" ),
RTL_CONSTASCII_USTRINGPARAM("<<< unknown URI >>>") ),
m_nSkipElements( 0 ), m_nSkipElements( 0 ),
m_pMutex( 0 ) m_pMutex( 0 )
{ {
...@@ -473,10 +469,7 @@ void DocumentHandlerImpl::initialize( ...@@ -473,10 +469,7 @@ void DocumentHandlerImpl::initialize(
} }
else else
{ {
throw RuntimeException( throw RuntimeException( "missing root instance!", Reference< XInterface >() );
OUString( RTL_CONSTASCII_USTRINGPARAM(
"missing root instance!") ),
Reference< XInterface >() );
} }
} }
...@@ -504,9 +497,7 @@ OUString DocumentHandlerImpl::getUriByUid( sal_Int32 Uid ) ...@@ -504,9 +497,7 @@ OUString DocumentHandlerImpl::getUriByUid( sal_Int32 Uid )
if (iPos->second == Uid) if (iPos->second == Uid)
return iPos->first; return iPos->first;
} }
throw container::NoSuchElementException( throw container::NoSuchElementException( "no such xmlns uid!" , static_cast< OWeakObject * >(this) );
OUString( RTL_CONSTASCII_USTRINGPARAM("no such xmlns uid!") ),
static_cast< OWeakObject * >(this) );
} }
...@@ -516,8 +507,7 @@ OUString DocumentHandlerImpl::getUriByUid( sal_Int32 Uid ) ...@@ -516,8 +507,7 @@ OUString DocumentHandlerImpl::getUriByUid( sal_Int32 Uid )
void DocumentHandlerImpl::startDocument() void DocumentHandlerImpl::startDocument()
throw (xml::sax::SAXException, RuntimeException) throw (xml::sax::SAXException, RuntimeException)
{ {
m_xRoot->startDocument( m_xRoot->startDocument( static_cast< xml::input::XNamespaceMapping * >( this ) );
static_cast< xml::input::XNamespaceMapping * >( this ) );
} }
//______________________________________________________________________________ //______________________________________________________________________________
...@@ -606,8 +596,7 @@ void DocumentHandlerImpl::startElement( ...@@ -606,8 +596,7 @@ void DocumentHandlerImpl::startElement(
{ {
OUString const & rQAttributeName = pQNames[ nPos ]; OUString const & rQAttributeName = pQNames[ nPos ];
OSL_ENSURE( OSL_ENSURE(
rQAttributeName.compareToAscii( rQAttributeName.compareToAscii( "xmlns:" ) != 0,
RTL_CONSTASCII_STRINGPARAM("xmlns:") ) != 0,
"### unexpected xmlns!" ); "### unexpected xmlns!" );
// collect attribute's uid and current prefix // collect attribute's uid and current prefix
......
...@@ -53,7 +53,7 @@ struct Style ...@@ -53,7 +53,7 @@ struct Style
short _all; short _all;
short _set; short _set;
::rtl::OUString _id; OUString _id;
inline Style( short all_ ) SAL_THROW(()) inline Style( short all_ ) SAL_THROW(())
: _fontRelief( css::awt::FontRelief::NONE ) : _fontRelief( css::awt::FontRelief::NONE )
...@@ -71,7 +71,7 @@ class StyleBag ...@@ -71,7 +71,7 @@ class StyleBag
public: public:
~StyleBag() SAL_THROW(()); ~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 > void dump( css::uno::Reference< css::xml::sax::XExtendedDocumentHandler >
const & xOut ); const & xOut );
...@@ -88,7 +88,7 @@ public: ...@@ -88,7 +88,7 @@ public:
inline ElementDescriptor( inline ElementDescriptor(
css::uno::Reference< css::beans::XPropertySet > const & xProps, css::uno::Reference< css::beans::XPropertySet > const & xProps,
css::uno::Reference< css::beans::XPropertyState > const & xPropState, 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(()) SAL_THROW(())
: XMLElement( name ) : XMLElement( name )
, _xProps( xProps ) , _xProps( xProps )
...@@ -96,65 +96,65 @@ public: ...@@ -96,65 +96,65 @@ public:
, _xDocument( xDocument ) , _xDocument( xDocument )
{} {}
inline ElementDescriptor( inline ElementDescriptor(
::rtl::OUString const & name ) OUString const & name )
SAL_THROW(()) SAL_THROW(())
: XMLElement( name ) : XMLElement( name )
{} {}
template<typename T> template<typename T>
inline void read( inline void read(
::rtl::OUString const & propName, ::rtl::OUString const & attrName, OUString const & propName, OUString const & attrName,
bool forceAttribute = false ); bool forceAttribute = false );
template<typename T> template<typename T>
inline bool readProp( T * ret, ::rtl::OUString const & rPropName ); inline bool readProp( T * ret, OUString const & rPropName );
css::uno::Any readProp( ::rtl::OUString const & rPropName ); css::uno::Any readProp( OUString const & rPropName );
void readDefaults( bool supportPrintable = true, bool supportVisible = true ); void readDefaults( bool supportPrintable = true, bool supportVisible = true );
void readStringAttr( void readStringAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
inline void readDoubleAttr( inline void readDoubleAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ) OUString const & rPropName, OUString const & rAttrName )
{ read<double>( rPropName, rAttrName ); } { read<double>( rPropName, rAttrName ); }
inline void readLongAttr( inline void readLongAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName, OUString const & rPropName, OUString const & rAttrName,
bool forceAttribute = false ) bool forceAttribute = false )
{ read<sal_Int32>( rPropName, rAttrName, forceAttribute ); } { read<sal_Int32>( rPropName, rAttrName, forceAttribute ); }
void readHexLongAttr( void readHexLongAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
inline void readShortAttr( inline void readShortAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ) OUString const & rPropName, OUString const & rAttrName )
{ read<sal_Int32>( rPropName, rAttrName ); } { read<sal_Int32>( rPropName, rAttrName ); }
inline void readBoolAttr( inline void readBoolAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ) OUString const & rPropName, OUString const & rAttrName )
{ read<sal_Bool>( rPropName, rAttrName ); } { read<sal_Bool>( rPropName, rAttrName ); }
void readAlignAttr( void readAlignAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readVerticalAlignAttr( void readVerticalAlignAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readImageURLAttr( void readImageURLAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readImageAlignAttr( void readImageAlignAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readImagePositionAttr( void readImagePositionAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readDateFormatAttr( void readDateFormatAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readTimeFormatAttr( void readTimeFormatAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readOrientationAttr( void readOrientationAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readButtonTypeAttr( void readButtonTypeAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readLineEndFormatAttr( void readLineEndFormatAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readSelectionTypeAttr( void readSelectionTypeAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); OUString const & rPropName, OUString const & rAttrName );
void readDataAwareAttr( void readDataAwareAttr(
::rtl::OUString const & rAttrName ); OUString const & rAttrName );
inline void addBoolAttr( inline void addBoolAttr(
::rtl::OUString const & rAttrName, sal_Bool bValue ) OUString const & rAttrName, sal_Bool bValue )
{ addAttribute( rAttrName, ::rtl::OUString::valueOf(bValue) ); } { addAttribute( rAttrName, OUString::valueOf(bValue) ); }
void addNumberFormatAttr( void addNumberFormatAttr(
css::uno::Reference< css::beans::XPropertySet > css::uno::Reference< css::beans::XPropertySet >
const & xFormatProperties ); const & xFormatProperties );
...@@ -218,7 +218,7 @@ public: ...@@ -218,7 +218,7 @@ public:
template<typename T> template<typename T>
inline void ElementDescriptor::read( inline void ElementDescriptor::read(
::rtl::OUString const & propName, ::rtl::OUString const & attrName, OUString const & propName, OUString const & attrName,
bool forceAttribute ) bool forceAttribute )
{ {
if (forceAttribute || if (forceAttribute ||
...@@ -228,7 +228,7 @@ inline void ElementDescriptor::read( ...@@ -228,7 +228,7 @@ inline void ElementDescriptor::read(
css::uno::Any a( _xProps->getPropertyValue( propName ) ); css::uno::Any a( _xProps->getPropertyValue( propName ) );
T v = T(); T v = T();
if (a >>= v) if (a >>= v)
addAttribute( attrName, ::rtl::OUString::valueOf(v) ); addAttribute( attrName, OUString::valueOf(v) );
else else
OSL_FAIL( "### unexpected property type!" ); OSL_FAIL( "### unexpected property type!" );
} }
...@@ -236,7 +236,7 @@ inline void ElementDescriptor::read( ...@@ -236,7 +236,7 @@ inline void ElementDescriptor::read(
template<typename T> template<typename T>
inline bool ElementDescriptor::readProp( inline bool ElementDescriptor::readProp(
T * ret, ::rtl::OUString const & rPropName ) T * ret, OUString const & rPropName )
{ {
_xProps->getPropertyValue( rPropName ) >>= *ret; _xProps->getPropertyValue( rPropName ) >>= *ret;
return css::beans::PropertyState_DEFAULT_VALUE != return css::beans::PropertyState_DEFAULT_VALUE !=
......
...@@ -68,18 +68,16 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel( ...@@ -68,18 +68,16 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
if (! xSMgr.is()) if (! xSMgr.is())
{ {
throw RuntimeException( throw RuntimeException("no service manager available!",
OUString( RTL_CONSTASCII_USTRINGPARAM("no service manager available!") ),
Reference< XInterface >() ); Reference< XInterface >() );
} }
Reference< xml::sax::XExtendedDocumentHandler > xHandler( xSMgr->createInstanceWithContext( 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() ); OSL_ASSERT( xHandler.is() );
if (! xHandler.is()) if (! xHandler.is())
{ {
throw RuntimeException( throw RuntimeException("could not create sax-writer component!",
OUString( RTL_CONSTASCII_USTRINGPARAM("could not create sax-writer component!") ),
Reference< XInterface >() ); Reference< XInterface >() );
} }
...@@ -103,18 +101,16 @@ void SAL_CALL importDialogModel( ...@@ -103,18 +101,16 @@ void SAL_CALL importDialogModel(
Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
if (! xSMgr.is()) if (! xSMgr.is())
{ {
throw RuntimeException( throw RuntimeException("no service manager available!",
OUString( RTL_CONSTASCII_USTRINGPARAM("no service manager available!") ),
Reference< XInterface >() ); Reference< XInterface >() );
} }
Reference< xml::sax::XParser > xParser( xSMgr->createInstanceWithContext( 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() ); OSL_ASSERT( xParser.is() );
if (! xParser.is()) if (! xParser.is())
{ {
throw RuntimeException( throw RuntimeException("could not create sax-parser component!",
OUString( RTL_CONSTASCII_USTRINGPARAM("could not create sax-parser component!") ),
Reference< XInterface >() ); Reference< XInterface >() );
} }
...@@ -123,7 +119,7 @@ void SAL_CALL importDialogModel( ...@@ -123,7 +119,7 @@ void SAL_CALL importDialogModel(
xml::sax::InputSource source; xml::sax::InputSource source;
source.aInputStream = xInput; source.aInputStream = xInput;
source.sSystemId = OUString( RTL_CONSTASCII_USTRINGPARAM("virtual file") ); source.sSystemId = "virtual file";
xParser->parseStream( source ); 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 @@ ...@@ -32,8 +32,6 @@
#include <vector> #include <vector>
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
using namespace ::rtl; using namespace ::rtl;
using namespace ::std; using namespace ::std;
...@@ -75,11 +73,7 @@ inline bool getBoolAttr( ...@@ -75,11 +73,7 @@ inline bool getBoolAttr(
} }
else else
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException(rAttrName + ": no boolean value (true|false)!", Reference< XInterface >(), Any() );
rAttrName +
OUString( RTL_CONSTASCII_USTRINGPARAM(
": no boolean value (true|false)!") ),
Reference< XInterface >(), Any() );
} }
} }
return false; return false;
......
...@@ -45,58 +45,51 @@ SAL_CALL exportLibraryContainer( ...@@ -45,58 +45,51 @@ SAL_CALL exportLibraryContainer(
{ {
xOut->startDocument(); xOut->startDocument();
OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM( OUString aDocTypeStr(
"<!DOCTYPE library:libraries PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\"" "<!DOCTYPE library:libraries PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\""
" \"libraries.dtd\">" ) ); " \"libraries.dtd\">" );
xOut->unknown( aDocTypeStr ); xOut->unknown( aDocTypeStr );
xOut->ignorableWhitespace( OUString() ); xOut->ignorableWhitespace( OUString() );
OUString aLibrariesName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":libraries") ); OUString aLibrariesName( XMLNS_LIBRARY_PREFIX ":libraries" );
XMLElement* pLibsElement = new XMLElement( aLibrariesName ); XMLElement* pLibsElement = new XMLElement( aLibrariesName );
Reference< xml::sax::XAttributeList > xAttributes( pLibsElement ); Reference< xml::sax::XAttributeList > xAttributes( pLibsElement );
pLibsElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_LIBRARY_PREFIX) ), pLibsElement->addAttribute( "xmlns:" XMLNS_LIBRARY_PREFIX, XMLNS_LIBRARY_URI );
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_URI) ) ); pLibsElement->addAttribute( "xmlns:" XMLNS_XLINK_PREFIX, XMLNS_XLINK_URI );
pLibsElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_XLINK_PREFIX) ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_XLINK_URI) ) );
xOut->ignorableWhitespace( OUString() ); xOut->ignorableWhitespace( OUString() );
xOut->startElement( aLibrariesName, xAttributes ); xOut->startElement( aLibrariesName, xAttributes );
rtl::OUString sTrueStr(aTrueStr); OUString sTrueStr(aTrueStr);
rtl::OUString sFalseStr(aFalseStr); OUString sFalseStr(aFalseStr);
int nLibCount = pLibArray->mnLibCount; int nLibCount = pLibArray->mnLibCount;
for( sal_Int32 i = 0 ; i < nLibCount ; i++ ) for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
{ {
LibDescriptor& rLib = pLibArray->mpLibs[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 ); XMLElement* pLibElement = new XMLElement( aLibraryName );
Reference< xml::sax::XAttributeList > xLibElementAttribs; Reference< xml::sax::XAttributeList > xLibElementAttribs;
xLibElementAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement ); xLibElementAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement );
pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":name") ), pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":name", rLib.aName );
rLib.aName );
if( !rLib.aStorageURL.isEmpty() ) if( !rLib.aStorageURL.isEmpty() )
{ {
pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_XLINK_PREFIX ":href") ), pLibElement->addAttribute( XMLNS_XLINK_PREFIX ":href", rLib.aStorageURL );
rLib.aStorageURL ); pLibElement->addAttribute( XMLNS_XLINK_PREFIX ":type", "simple" );
pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_XLINK_PREFIX ":type") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("simple") ) );
} }
pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":link") ), pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":link", rLib.bLink ? sTrueStr : sFalseStr );
rLib.bLink ? sTrueStr : sFalseStr );
if( rLib.bLink ) if( rLib.bLink )
{ {
pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":readonly") ), pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":readonly", rLib.bReadOnly ? sTrueStr : sFalseStr );
rLib.bReadOnly ? sTrueStr : sFalseStr );
} }
pLibElement->dump( xOut.get() ); pLibElement->dump( xOut.get() );
...@@ -118,34 +111,30 @@ SAL_CALL exportLibrary( ...@@ -118,34 +111,30 @@ SAL_CALL exportLibrary(
{ {
xOut->startDocument(); xOut->startDocument();
OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM( OUString aDocTypeStr(
"<!DOCTYPE library:library PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\"" "<!DOCTYPE library:library PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\""
" \"library.dtd\">" ) ); " \"library.dtd\">" );
xOut->unknown( aDocTypeStr ); xOut->unknown( aDocTypeStr );
xOut->ignorableWhitespace( OUString() ); xOut->ignorableWhitespace( OUString() );
OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":library") ); OUString aLibraryName( XMLNS_LIBRARY_PREFIX ":library" );
XMLElement* pLibElement = new XMLElement( aLibraryName ); XMLElement* pLibElement = new XMLElement( aLibraryName );
Reference< xml::sax::XAttributeList > xAttributes( pLibElement ); Reference< xml::sax::XAttributeList > xAttributes( pLibElement );
pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_LIBRARY_PREFIX) ), pLibElement->addAttribute( "xmlns:" XMLNS_LIBRARY_PREFIX, XMLNS_LIBRARY_URI );
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_URI) ) );
pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":name") ), pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":name", rLib.aName );
rLib.aName );
rtl::OUString sTrueStr(aTrueStr); OUString sTrueStr(aTrueStr);
rtl::OUString sFalseStr(aFalseStr); OUString sFalseStr(aFalseStr);
pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":readonly") ), pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":readonly", rLib.bReadOnly ? sTrueStr : sFalseStr );
rLib.bReadOnly ? sTrueStr : sFalseStr );
pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":passwordprotected") ), pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":passwordprotected", rLib.bPasswordProtected ? sTrueStr : sFalseStr );
rLib.bPasswordProtected ? sTrueStr : sFalseStr );
if( rLib.bPreload ) 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(); sal_Int32 nElementCount = rLib.aElementNames.getLength();
if( nElementCount ) if( nElementCount )
...@@ -153,11 +142,11 @@ SAL_CALL exportLibrary( ...@@ -153,11 +142,11 @@ SAL_CALL exportLibrary(
const OUString* pElementNames = rLib.aElementNames.getConstArray(); const OUString* pElementNames = rLib.aElementNames.getConstArray();
for( sal_Int32 i = 0 ; i < nElementCount ; i++ ) 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; Reference< xml::sax::XAttributeList > xElementAttribs;
xElementAttribs = static_cast< xml::sax::XAttributeList* >( pElement ); 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] ); pElementNames[i] );
pLibElement->addSubElement( pElement ); pLibElement->addSubElement( pElement );
......
...@@ -80,9 +80,7 @@ Reference< xml::input::XElement > LibElementBase::startChildElement( ...@@ -80,9 +80,7 @@ Reference< xml::input::XElement > LibElementBase::startChildElement(
Reference< xml::input::XAttributes > const & /*xAttributes*/ ) Reference< xml::input::XAttributes > const & /*xAttributes*/ )
throw (xml::sax::SAXException, RuntimeException) throw (xml::sax::SAXException, RuntimeException)
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException("unexpected element!", Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected element!") ),
Reference< XInterface >(), Any() );
} }
//__________________________________________________________________________________________________ //__________________________________________________________________________________________________
...@@ -129,10 +127,8 @@ void LibraryImport::startDocument( ...@@ -129,10 +127,8 @@ void LibraryImport::startDocument(
Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping ) Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
throw (xml::sax::SAXException, RuntimeException) throw (xml::sax::SAXException, RuntimeException)
{ {
XMLNS_LIBRARY_UID = xNamespaceMapping->getUidByUri( XMLNS_LIBRARY_UID = xNamespaceMapping->getUidByUri( XMLNS_LIBRARY_URI );
OUSTR(XMLNS_LIBRARY_URI) ); XMLNS_XLINK_UID = xNamespaceMapping->getUidByUri( XMLNS_XLINK_URI );
XMLNS_XLINK_UID = xNamespaceMapping->getUidByUri(
OUSTR(XMLNS_XLINK_URI) );
} }
//__________________________________________________________________________________________________ //__________________________________________________________________________________________________
void LibraryImport::endDocument() void LibraryImport::endDocument()
...@@ -159,9 +155,7 @@ Reference< xml::input::XElement > LibraryImport::startRootElement( ...@@ -159,9 +155,7 @@ Reference< xml::input::XElement > LibraryImport::startRootElement(
{ {
if (XMLNS_LIBRARY_UID != nUid) if (XMLNS_LIBRARY_UID != nUid)
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
Reference< XInterface >(), Any() );
} }
else if ( mpLibArray && rLocalName == "libraries" ) else if ( mpLibArray && rLocalName == "libraries" )
{ {
...@@ -172,28 +166,16 @@ Reference< xml::input::XElement > LibraryImport::startRootElement( ...@@ -172,28 +166,16 @@ Reference< xml::input::XElement > LibraryImport::startRootElement(
LibDescriptor& aDesc = *mpLibDesc; LibDescriptor& aDesc = *mpLibDesc;
aDesc.bLink = aDesc.bReadOnly = aDesc.bPasswordProtected = aDesc.bPreload = sal_False; aDesc.bLink = aDesc.bReadOnly = aDesc.bPasswordProtected = aDesc.bPreload = sal_False;
aDesc.aName = xAttributes->getValueByUidName( aDesc.aName = xAttributes->getValueByUidName(XMLNS_LIBRARY_UID, "name" );
XMLNS_LIBRARY_UID, OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) ); getBoolAttr( &aDesc.bReadOnly, "readonly", xAttributes, XMLNS_LIBRARY_UID );
getBoolAttr( getBoolAttr( &aDesc.bPasswordProtected, "passwordprotected", xAttributes, XMLNS_LIBRARY_UID );
&aDesc.bReadOnly, getBoolAttr( &aDesc.bPreload, "preload", xAttributes, XMLNS_LIBRARY_UID );
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 );
return new LibraryElement( rLocalName, xAttributes, 0, this ); return new LibraryElement( rLocalName, xAttributes, 0, this );
} }
else else
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException( "illegal root element (expected libraries) given: " + rLocalName, Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM("illegal root element (expected libraries) given: ") ) +
rLocalName, Reference< XInterface >(), Any() );
} }
} }
//__________________________________________________________________________________________________ //__________________________________________________________________________________________________
...@@ -217,9 +199,7 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement( ...@@ -217,9 +199,7 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement(
{ {
if (_pImport->XMLNS_LIBRARY_UID != nUid) if (_pImport->XMLNS_LIBRARY_UID != nUid)
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
Reference< XInterface >(), Any() );
} }
// library // library
else if ( rLocalName == "library" ) else if ( rLocalName == "library" )
...@@ -227,33 +207,18 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement( ...@@ -227,33 +207,18 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement(
LibDescriptor aDesc; LibDescriptor aDesc;
aDesc.bLink = aDesc.bReadOnly = aDesc.bPasswordProtected = aDesc.bPreload = sal_False; aDesc.bLink = aDesc.bReadOnly = aDesc.bPasswordProtected = aDesc.bPreload = sal_False;
aDesc.aName = xAttributes->getValueByUidName( aDesc.aName = xAttributes->getValueByUidName(_pImport->XMLNS_LIBRARY_UID, "name" );
_pImport->XMLNS_LIBRARY_UID, aDesc.aStorageURL = xAttributes->getValueByUidName( _pImport->XMLNS_XLINK_UID, "href" );
OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) ); getBoolAttr(&aDesc.bLink, "link", xAttributes, _pImport->XMLNS_LIBRARY_UID );
aDesc.aStorageURL = xAttributes->getValueByUidName( getBoolAttr(&aDesc.bReadOnly, "readonly", xAttributes, _pImport->XMLNS_LIBRARY_UID );
_pImport->XMLNS_XLINK_UID, getBoolAttr(&aDesc.bPasswordProtected, "passwordprotected", xAttributes, _pImport->XMLNS_LIBRARY_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 );
mLibDescriptors.push_back( aDesc ); mLibDescriptors.push_back( aDesc );
return new LibraryElement( rLocalName, xAttributes, this, _pImport ); return new LibraryElement( rLocalName, xAttributes, this, _pImport );
} }
else else
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException( "expected styles ot bulletinboard element!", Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ),
Reference< XInterface >(), Any() );
} }
} }
//__________________________________________________________________________________________________ //__________________________________________________________________________________________________
...@@ -279,16 +244,12 @@ Reference< xml::input::XElement > LibraryElement::startChildElement( ...@@ -279,16 +244,12 @@ Reference< xml::input::XElement > LibraryElement::startChildElement(
{ {
if (_pImport->XMLNS_LIBRARY_UID != nUid) if (_pImport->XMLNS_LIBRARY_UID != nUid)
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
Reference< XInterface >(), Any() );
} }
// library // library
else if ( rLocalName == "element" ) else if ( rLocalName == "element" )
{ {
OUString aValue( xAttributes->getValueByUidName( OUString aValue( xAttributes->getValueByUidName(_pImport->XMLNS_LIBRARY_UID, "name" ) );
_pImport->XMLNS_LIBRARY_UID,
OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) ) );
if (!aValue.isEmpty()) if (!aValue.isEmpty())
mElements.push_back( aValue ); mElements.push_back( aValue );
...@@ -296,9 +257,7 @@ Reference< xml::input::XElement > LibraryElement::startChildElement( ...@@ -296,9 +257,7 @@ Reference< xml::input::XElement > LibraryElement::startChildElement(
} }
else else
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException( "expected styles ot bulletinboard element!", Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ),
Reference< XInterface >(), Any() );
} }
} }
//__________________________________________________________________________________________________ //__________________________________________________________________________________________________
......
...@@ -33,9 +33,6 @@ ...@@ -33,9 +33,6 @@
#include <vector> #include <vector>
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
using namespace ::rtl; using namespace ::rtl;
using namespace ::std; using namespace ::std;
using namespace ::com::sun::star; using namespace ::com::sun::star;
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
using namespace com::sun::star; using namespace com::sun::star;
using ::rtl::OUString;
namespace xmlscript namespace xmlscript
{ {
...@@ -39,26 +38,22 @@ SAL_CALL exportScriptModule( ...@@ -39,26 +38,22 @@ SAL_CALL exportScriptModule(
{ {
xOut->startDocument(); xOut->startDocument();
OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM( OUString aDocTypeStr(
"<!DOCTYPE script:module PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\"" "<!DOCTYPE script:module PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\""
" \"module.dtd\">" ) ); " \"module.dtd\">");
xOut->unknown( aDocTypeStr ); xOut->unknown( aDocTypeStr );
xOut->ignorableWhitespace( OUString() ); xOut->ignorableWhitespace( OUString() );
OUString aModuleName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":module") ); OUString aModuleName( XMLNS_SCRIPT_PREFIX ":module" );
XMLElement* pModElement = new XMLElement( aModuleName ); XMLElement* pModElement = new XMLElement( aModuleName );
Reference< xml::sax::XAttributeList > xAttributes( pModElement ); Reference< xml::sax::XAttributeList > xAttributes( pModElement );
pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_SCRIPT_PREFIX) ), pModElement->addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX, XMLNS_SCRIPT_URI );
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_URI) ) );
pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":name") ), pModElement->addAttribute( XMLNS_SCRIPT_PREFIX ":name", rMod.aName );
rMod.aName ); pModElement->addAttribute( XMLNS_SCRIPT_PREFIX ":language", rMod.aLanguage );
pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":language") ),
rMod.aLanguage );
if( !rMod.aModuleType.isEmpty() ) if( !rMod.aModuleType.isEmpty() )
pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":moduleType") ), pModElement->addAttribute( XMLNS_SCRIPT_PREFIX ":moduleType", rMod.aModuleType );
rMod.aModuleType );
xOut->ignorableWhitespace( OUString() ); xOut->ignorableWhitespace( OUString() );
xOut->startElement( aModuleName, xAttributes ); xOut->startElement( aModuleName, xAttributes );
......
...@@ -80,9 +80,7 @@ Reference< xml::input::XElement > ModuleElement::startChildElement( ...@@ -80,9 +80,7 @@ Reference< xml::input::XElement > ModuleElement::startChildElement(
Reference< xml::input::XAttributes > const & /*xAttributes*/ ) Reference< xml::input::XAttributes > const & /*xAttributes*/ )
throw (xml::sax::SAXException, RuntimeException) throw (xml::sax::SAXException, RuntimeException)
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException("unexpected element!", Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected element!") ),
Reference< XInterface >(), Any() );
} }
//__________________________________________________________________________________________________ //__________________________________________________________________________________________________
...@@ -129,12 +127,9 @@ void ModuleImport::startDocument( ...@@ -129,12 +127,9 @@ void ModuleImport::startDocument(
Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping ) Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
throw (xml::sax::SAXException, RuntimeException) throw (xml::sax::SAXException, RuntimeException)
{ {
XMLNS_SCRIPT_UID = xNamespaceMapping->getUidByUri( XMLNS_SCRIPT_UID = xNamespaceMapping->getUidByUri( XMLNS_SCRIPT_URI );
OUSTR(XMLNS_SCRIPT_URI) ); XMLNS_LIBRARY_UID = xNamespaceMapping->getUidByUri( XMLNS_LIBRARY_URI );
XMLNS_LIBRARY_UID = xNamespaceMapping->getUidByUri( XMLNS_XLINK_UID = xNamespaceMapping->getUidByUri( XMLNS_XLINK_URI );
OUSTR(XMLNS_LIBRARY_URI) );
XMLNS_XLINK_UID = xNamespaceMapping->getUidByUri(
OUSTR(XMLNS_XLINK_URI) );
} }
//__________________________________________________________________________________________________ //__________________________________________________________________________________________________
...@@ -163,31 +158,20 @@ Reference< xml::input::XElement > ModuleImport::startRootElement( ...@@ -163,31 +158,20 @@ Reference< xml::input::XElement > ModuleImport::startRootElement(
{ {
if (XMLNS_SCRIPT_UID != nUid) if (XMLNS_SCRIPT_UID != nUid)
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
Reference< XInterface >(), Any() );
} }
// window // window
else if ( rLocalName == "module" ) else if ( rLocalName == "module" )
{ {
mrModuleDesc.aName = xAttributes->getValueByUidName( mrModuleDesc.aName = xAttributes->getValueByUidName( XMLNS_SCRIPT_UID, "name" );
XMLNS_SCRIPT_UID, mrModuleDesc.aLanguage = xAttributes->getValueByUidName( XMLNS_SCRIPT_UID, "language" );
OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) ); mrModuleDesc.aModuleType = xAttributes->getValueByUidName( XMLNS_SCRIPT_UID, "moduleType" );
mrModuleDesc.aLanguage = xAttributes->getValueByUidName(
XMLNS_SCRIPT_UID,
OUString( RTL_CONSTASCII_USTRINGPARAM("language") ) );
mrModuleDesc.aModuleType = xAttributes->getValueByUidName(
XMLNS_SCRIPT_UID,
OUString( RTL_CONSTASCII_USTRINGPARAM("moduleType") ) );
return new ModuleElement( rLocalName, xAttributes, 0, this ); return new ModuleElement( rLocalName, xAttributes, 0, this );
} }
else else
{ {
throw xml::sax::SAXException( throw xml::sax::SAXException("illegal root element (expected module) given: " + rLocalName, Reference< XInterface >(), Any() );
OUString( RTL_CONSTASCII_USTRINGPARAM(
"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