diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-03 13:30:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-04 16:29:53 +0200 |
commit | a20f9a410fdd3f776f870434bc39219d5fc64b40 (patch) | |
tree | 079278e5859c5782fbe9bfcc34302d09bd8dfadd /sfx2 | |
parent | bd6b41bce491ac5a5f562652b7e32045cc22c35c (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 'sfx2')
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplateslocal.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplateslocal.hxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 4 |
5 files changed, 13 insertions, 19 deletions
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 8c717ed7c45d..0b97c0b8e19a 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -44,7 +44,7 @@ #include "com/sun/star/document/XImporter.hpp" #include "com/sun/star/document/XExporter.hpp" #include "com/sun/star/document/XFilter.hpp" -#include "com/sun/star/xml/sax/XParser.hpp" +#include "com/sun/star/xml/sax/Parser.hpp" #include "com/sun/star/xml/dom/XDocument.hpp" #include "com/sun/star/xml/dom/XElement.hpp" #include "com/sun/star/xml/dom/DocumentBuilder.hpp" @@ -1918,13 +1918,7 @@ SfxDocumentMetaData::loadFromStorage( // create DOM parser service css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( m_xContext->getServiceManager()); - css::uno::Reference<css::xml::sax::XParser> xParser ( - xMsf->createInstanceWithContext(::rtl::OUString( - "com.sun.star.xml.sax.Parser"), m_xContext), - css::uno::UNO_QUERY_THROW); - if (!xParser.is()) throw css::uno::RuntimeException( - ::rtl::OUString("SfxDocumentMetaData::loadFromStorage:" - " cannot create Parser service"), *this); + css::uno::Reference<css::xml::sax::XParser> xParser = css::xml::sax::Parser::create(m_xContext); css::xml::sax::InputSource input; input.aInputStream = xInStream; diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 75e294ca2b00..76a4f5db6257 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1307,7 +1307,7 @@ uno::Sequence< beans::StringPair > SfxDocTplService_Impl::ReadUINamesForTemplate { uno::Reference< io::XInputStream > xLocStream = aLocContent.openStream(); if ( xLocStream.is() ) - aUINames = DocTemplLocaleHelper::ReadGroupLocalizationSequence( xLocStream, mxFactory ); + aUINames = DocTemplLocaleHelper::ReadGroupLocalizationSequence( xLocStream, comphelper::getComponentContext(mxFactory) ); } catch( uno::Exception& ) {} diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx index 71ee17ea78ba..82452dc14a39 100644 --- a/sfx2/source/doc/doctemplateslocal.cxx +++ b/sfx2/source/doc/doctemplateslocal.cxx @@ -21,7 +21,7 @@ #include <com/sun/star/beans/StringPair.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/xml/sax/XParser.hpp> +#include <com/sun/star/xml/sax/Parser.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -32,11 +32,11 @@ using namespace ::com::sun::star; // ----------------------------------- -uno::Sequence< beans::StringPair > DocTemplLocaleHelper::ReadGroupLocalizationSequence( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< lang::XMultiServiceFactory > xFactory ) +uno::Sequence< beans::StringPair > DocTemplLocaleHelper::ReadGroupLocalizationSequence( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< uno::XComponentContext > xContext ) throw( uno::Exception ) { ::rtl::OUString aStringID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "groupuinames.xml" ) ); - return ReadLocalizationSequence_Impl( xInStream, aStringID, xFactory ); + return ReadLocalizationSequence_Impl( xInStream, aStringID, xContext ); } // ----------------------------------- @@ -92,15 +92,15 @@ void SAL_CALL DocTemplLocaleHelper::WriteGroupLocalizationSequence( const uno::R // ================================================================================== // ----------------------------------- -uno::Sequence< beans::StringPair > SAL_CALL DocTemplLocaleHelper::ReadLocalizationSequence_Impl( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, const uno::Reference< lang::XMultiServiceFactory > xFactory ) +uno::Sequence< beans::StringPair > SAL_CALL DocTemplLocaleHelper::ReadLocalizationSequence_Impl( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, const uno::Reference< uno::XComponentContext > xContext ) throw( uno::Exception ) { - if ( !xFactory.is() || !xInStream.is() ) + if ( !xContext.is() || !xInStream.is() ) throw uno::RuntimeException(); uno::Sequence< beans::StringPair > aResult; - uno::Reference< xml::sax::XParser > xParser( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ) ) ), uno::UNO_QUERY_THROW ); + uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext ); DocTemplLocaleHelper* pHelper = new DocTemplLocaleHelper(); uno::Reference< xml::sax::XDocumentHandler > xHelper( static_cast< xml::sax::XDocumentHandler* >( pHelper ) ); diff --git a/sfx2/source/doc/doctemplateslocal.hxx b/sfx2/source/doc/doctemplateslocal.hxx index 49327eab3b75..ba0f58af2b86 100644 --- a/sfx2/source/doc/doctemplateslocal.hxx +++ b/sfx2/source/doc/doctemplateslocal.hxx @@ -41,7 +41,7 @@ class DocTemplLocaleHelper : public cppu::WeakImplHelper1 < com::sun::star::xml: DocTemplLocaleHelper(); // must not be created directly ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > GetParsingResult(); - static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > SAL_CALL ReadLocalizationSequence_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory ) + static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > SAL_CALL ReadLocalizationSequence_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext ) throw( ::com::sun::star::uno::Exception ); public: @@ -52,7 +52,7 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > ReadGroupLocalizationSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory ) + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext ) throw( ::com::sun::star::uno::Exception ); // writes sequence of elements ( GroupName, GroupUIName ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 2ef4d8b5bede..f7c5f30cbdfe 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3382,11 +3382,11 @@ uno::Reference< ui::XUIConfigurationManager > SAL_CALL SfxBaseModel::getUIConfig xOOo1ConfigStorage = getDocumentSubStorage( aOOo1UIConfigFolderName, embed::ElementModes::READ ); if ( xOOo1ConfigStorage.is() ) { - uno::Reference< lang::XMultiServiceFactory > xServiceMgr( ::comphelper::getProcessServiceFactory() ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); uno::Sequence< uno::Reference< container::XIndexContainer > > rToolbars; sal_Bool bImported = framework::UIConfigurationImporterOOo1x::ImportCustomToolbars( - xNewUIConfMan, rToolbars, xServiceMgr, xOOo1ConfigStorage ); + xNewUIConfMan, rToolbars, xContext, xOOo1ConfigStorage ); if ( bImported ) { SfxObjectShell* pObjShell = SfxBaseModel::GetObjectShell(); |