summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-03 13:30:43 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-04 16:29:53 +0200
commita20f9a410fdd3f776f870434bc39219d5fc64b40 (patch)
tree079278e5859c5782fbe9bfcc34302d09bd8dfadd /basic
parentbd6b41bce491ac5a5f562652b7e32045cc22c35c (diff)
fdo#46808, Adapt xml::sax::XParser UNO service to new style
The xml.sax.Parser service already existed, it just did not have a new-style service to create it. Change-Id: I6f145a7504ff9e149c802f723991954a2801cbc9
Diffstat (limited to 'basic')
-rw-r--r--basic/source/uno/dlgcont.cxx20
-rw-r--r--basic/source/uno/namecont.cxx18
-rw-r--r--basic/source/uno/scriptcont.cxx12
3 files changed, 11 insertions, 39 deletions
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 2cfe035a21b7..b9ad7f19ecce 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -18,7 +18,7 @@
*/
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -32,6 +32,7 @@
#include "com/sun/star/document/XGraphicObjectResolver.hpp"
#include "dlgcont.hxx"
#include "sbmodule.hxx"
+#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/streamwrap.hxx>
#include <osl/mutex.hxx>
@@ -122,12 +123,7 @@ bool writeOasis2OOoLibraryElement(
Reference< lang::XMultiComponentFactory > xSMgr(
xContext->getServiceManager() );
- Reference< xml::sax::XParser > xParser(
- xSMgr->createInstanceWithContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.xml.sax.Parser" ) ),
- xContext ),
- UNO_QUERY );
+ Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
Reference< xml::sax::XExtendedDocumentHandler > xWriter(
xSMgr->createInstanceWithContext(
@@ -139,7 +135,7 @@ bool writeOasis2OOoLibraryElement(
Reference< io::XActiveDataSource > xSource( xWriter, UNO_QUERY );
xSource->setOutputStream( xOutput );
- if ( !xParser.is() || !xWriter.is() )
+ if ( !xWriter.is() )
{
return sal_False;
}
@@ -297,13 +293,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
// return aRetAny;
//}
- Reference< XParser > xParser( mxMSF->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
- if( !xParser.is() )
- {
- OSL_FAIL( "### couldn't create sax parser component\n" );
- return aRetAny;
- }
+ Reference< XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(mxMSF) );
Reference< XNameContainer > xDialogModel( mxMSF->createInstance
( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 77ced57a2eec..dfce89aa5101 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -41,7 +41,7 @@
#include <svtools/ehdl.hxx>
#include <basic/basmgr.hxx>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -650,13 +650,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
maLibraryPath = SvtPathOptions().GetBasicPath();
}
- Reference< XParser > xParser( mxMSF->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
- if( !xParser.is() )
- {
- SAL_WARN("basic", "couldn't create sax parser component");
- return;
- }
+ Reference< XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(mxMSF));
uno::Reference< io::XInputStream > xInput;
@@ -1603,13 +1597,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
::xmlscript::LibDescriptor& rLib, const uno::Reference< embed::XStorage >& xStorage, const OUString& aIndexFileName )
{
- Reference< XParser > xParser( mxMSF->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
- if( !xParser.is() )
- {
- SAL_WARN("basic", "couldn't create sax parser component");
- return false;
- }
+ Reference< XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(mxMSF));
sal_Bool bLink = sal_False;
bool bStorage = false;
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 393dc7771238..bbc8509d23c2 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -20,7 +20,7 @@
#include "scriptcont.hxx"
#include "sbmodule.hxx"
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -32,6 +32,7 @@
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/script/ModuleType.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <unotools/streamwrap.hxx>
@@ -238,14 +239,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
{
Any aRetAny;
- Reference< XParser > xParser( mxMSF->createInstance(
- OUString( "com.sun.star.xml.sax.Parser" ) ), UNO_QUERY );
- if( !xParser.is() )
- {
- OSL_FAIL( "### couldn't create sax parser component\n" );
- return aRetAny;
- }
-
+ Reference< XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(mxMSF) );
// Read from storage?
sal_Bool bStorage = xInStream.is();