diff options
author | Noel Grandin <noel@peralex.com> | 2013-06-04 08:45:46 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-06-05 08:13:22 +0200 |
commit | c0654ce02272499236f7b43920e288c5fff34d4f (patch) | |
tree | 73dd8b626c0f172e1d9e77a3477ac9f9ac7f72d2 /filter | |
parent | cee55a2c5463134c3a394bf6eda22998bc6cb2c9 (diff) |
fdo#46808, Convert XMultiServiceFactory in filter module
Change-Id: I9dcddba4f5a8a7adeddc31b5df014b0174b9745d
Diffstat (limited to 'filter')
25 files changed, 122 insertions, 145 deletions
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx index 57b5489e9866..1303b645421c 100644 --- a/filter/source/odfflatxml/OdfFlatXml.cxx +++ b/filter/source/odfflatxml/OdfFlatXml.cxx @@ -58,12 +58,12 @@ namespace filter { XExportFilter, DocumentHandlerAdapter> { private: - Reference< XMultiServiceFactory > m_rServiceFactory; + Reference< XComponentContext > m_xContext; public: - OdfFlatXml(const Reference<XMultiServiceFactory> &r) : - m_rServiceFactory(r) + OdfFlatXml(const Reference<XComponentContext> &r) : + m_xContext(r) { } @@ -122,7 +122,7 @@ OdfFlatXml::importer( if (!inputStream.is()) return sal_False; - Reference<XParser> saxParser = Parser::create(comphelper::getComponentContext(m_rServiceFactory)); + Reference<XParser> saxParser = Parser::create(m_xContext); InputSource inputSource; inputSource.sSystemId = url; @@ -165,7 +165,7 @@ OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData, if (!getDelegate().is()) { - Reference< XDocumentHandler > saxWriter( Writer::create(comphelper::getComponentContext(m_rServiceFactory)), UNO_QUERY_THROW ); + Reference< XDocumentHandler > saxWriter = Writer::create(m_xContext); setDelegate(saxWriter); } // get data source interface ... @@ -197,7 +197,7 @@ Sequence< OUString > OdfFlatXml::impl_getSupportedServiceNames() Reference< XInterface > SAL_CALL OdfFlatXml::impl_createInstance(const Reference< XMultiServiceFactory >& fact) { - return Reference<XInterface> ((OWeakObject *) new OdfFlatXml(fact)); + return Reference<XInterface> ((OWeakObject *) new OdfFlatXml( comphelper::getComponentContext(fact) )); } diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index e771a0d249b0..3ddcf0c204d2 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -90,9 +90,9 @@ using namespace ::com::sun::star::graphic; PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, const Reference< task::XStatusIndicator >& rxStatusIndicator, const Reference< task::XInteractionHandler >& rxIH, - const Reference< lang::XMultiServiceFactory >& xFactory ) : + const Reference< XComponentContext >& xContext ) : mxSrcDoc ( rxSrcDoc ), - mxMSF ( xFactory ), + mxContext ( xContext ), mxStatusIndicator ( rxStatusIndicator ), mxIH ( rxIH ), mbUseTaggedPDF ( sal_False ), @@ -303,13 +303,13 @@ void PDFExportStreamDoc::write( const Reference< XOutputStream >& xStream ) } } -static OUString getMimetypeForDocument( const Reference< XMultiServiceFactory >& xFactory, +static OUString getMimetypeForDocument( const Reference< XComponentContext >& xContext, const Reference< XComponent >& xDoc ) throw() { OUString aDocMimetype; // get document service name Reference< com::sun::star::frame::XStorable > xStore( xDoc, UNO_QUERY ); - Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(comphelper::getComponentContext( xFactory )) ); + Reference< frame::XModuleManager2 > xModuleManager = frame::ModuleManager::create(xContext); if( xStore.is() ) { OUString aDocServiceName = xModuleManager->identify( Reference< XInterface >( xStore, uno::UNO_QUERY ) ); @@ -317,9 +317,8 @@ static OUString getMimetypeForDocument( const Reference< XMultiServiceFactory >& { // get the actual filter name OUString aFilterName; - Reference< lang::XMultiServiceFactory > xConfigProvider( - configuration::theDefaultProvider::get( - comphelper::getComponentContext( xFactory ) ) ); + Reference< lang::XMultiServiceFactory > xConfigProvider = + configuration::theDefaultProvider::get( xContext ); uno::Sequence< uno::Any > aArgs( 1 ); beans::NamedValue aPathProp; aPathProp.Name = "nodepath"; @@ -341,7 +340,7 @@ static OUString getMimetypeForDocument( const Reference< XMultiServiceFactory >& // find the related type name OUString aTypeName; Reference< container::XNameAccess > xFilterFactory( - xFactory->createInstance( "com.sun.star.document.FilterFactory" ), + xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.FilterFactory", xContext), uno::UNO_QUERY ); Sequence< beans::PropertyValue > aFilterData; @@ -354,7 +353,7 @@ static OUString getMimetypeForDocument( const Reference< XMultiServiceFactory >& { // find the mediatype Reference< container::XNameAccess > xTypeDetection( - xFactory->createInstance( "com.sun.star.document.TypeDetection" ), + xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", xContext), UNO_QUERY ); Sequence< beans::PropertyValue > aTypeData; @@ -801,7 +800,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue { // export stream // get mimetype - OUString aSrcMimetype = getMimetypeForDocument( mxMSF, mxSrcDoc ); + OUString aSrcMimetype = getMimetypeForDocument( mxContext, mxSrcDoc ); pPDFWriter->AddStream( aSrcMimetype, new PDFExportStreamDoc( mxSrcDoc, aPreparedPermissionPassword ), false diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx index 0398e2ffa592..1e0449efdc97 100644 --- a/filter/source/pdf/pdfexport.hxx +++ b/filter/source/pdf/pdfexport.hxx @@ -40,7 +40,7 @@ class PDFExport private: Reference< XComponent > mxSrcDoc; - Reference< lang::XMultiServiceFactory > mxMSF; + Reference< uno::XComponentContext > mxContext; Reference< task::XStatusIndicator > mxStatusIndicator; Reference< task::XInteractionHandler > mxIH; @@ -116,7 +116,7 @@ public: PDFExport( const Reference< XComponent >& rxSrcDoc, const Reference< task::XStatusIndicator >& xStatusIndicator, const Reference< task::XInteractionHandler >& xIH, - const Reference< lang::XMultiServiceFactory >& xFact ); + const Reference< uno::XComponentContext >& xFact ); ~PDFExport(); sal_Bool ExportSelection( vcl::PDFWriter& rPDFWriter, diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx index f09ae0a9f955..67b4bdbb67f9 100644 --- a/filter/source/pdf/pdffilter.cxx +++ b/filter/source/pdf/pdffilter.cxx @@ -32,8 +32,8 @@ using namespace css::system; // - PDFFilter - // ------------- -PDFFilter::PDFFilter( const Reference< XMultiServiceFactory > &rxMSF ) : - mxMSF( rxMSF ) +PDFFilter::PDFFilter( const Reference< XComponentContext > &rxContext ) : + mxContext( rxContext ) { } @@ -120,7 +120,7 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) } if( mxSrcDoc.is() && xOStm.is() ) { - PDFExport aExport( mxSrcDoc, xStatusIndicator, xIH, mxMSF ); + PDFExport aExport( mxSrcDoc, xStatusIndicator, xIH, mxContext ); ::utl::TempFile aTempFile; aTempFile.EnableKillingFile(); @@ -247,7 +247,7 @@ Sequence< OUString > SAL_CALL PDFFilter_getSupportedServiceNames( ) throw (Runt Reference< XInterface > SAL_CALL PDFFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*) new PDFFilter( rSMgr ); + return (cppu::OWeakObject*) new PDFFilter( comphelper::getComponentContext(rSMgr) ); } // ----------------------------------------------------------------------------- diff --git a/filter/source/pdf/pdffilter.hxx b/filter/source/pdf/pdffilter.hxx index f54f5502190d..33eeeca08c13 100644 --- a/filter/source/pdf/pdffilter.hxx +++ b/filter/source/pdf/pdffilter.hxx @@ -63,7 +63,7 @@ class PDFFilter : public cppu::WeakImplHelper4 < XFilter, { private: - Reference< XMultiServiceFactory > mxMSF; + Reference< XComponentContext > mxContext; Reference< XComponent > mxSrcDoc; sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor ); @@ -87,7 +87,7 @@ protected: public: - PDFFilter( const Reference< XMultiServiceFactory >& rxMSF ); + PDFFilter( const Reference< XComponentContext >& rxContext ); virtual ~PDFFilter(); }; diff --git a/filter/source/svg/svgimport.cxx b/filter/source/svg/svgimport.cxx index 8ec38eef3471..21c7c80e8043 100644 --- a/filter/source/svg/svgimport.cxx +++ b/filter/source/svg/svgimport.cxx @@ -70,7 +70,7 @@ sal_Bool SVGFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY); xImporter->setTargetDocument(mxDstDoc); - SVGReader aReader(uno::Reference<lang::XMultiServiceFactory>(mxContext->getServiceManager(), uno::UNO_QUERY_THROW), xInputStream, xInternalHandler); + SVGReader aReader(mxContext, xInputStream, xInternalHandler); return aReader.parseAndConvert(); } diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx index b85a2ad6ed8d..5fb959b6b4b3 100644 --- a/filter/source/svg/svgreader.cxx +++ b/filter/source/svg/svgreader.cxx @@ -1878,10 +1878,10 @@ static void dumpTree( const uno::Reference<xml::dom::XElement> xElem ) #endif -SVGReader::SVGReader(const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory, +SVGReader::SVGReader(const uno::Reference<uno::XComponentContext>& xContext, const uno::Reference<io::XInputStream>& xInputStream, const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler) : - m_xServiceFactory( xServiceFactory ), + m_xContext( xContext ), m_xInputStream( xInputStream ), m_xDocumentHandler( xDocumentHandler ) { @@ -1889,7 +1889,7 @@ SVGReader::SVGReader(const uno::Reference<lang::XMultiServiceFactory>& xServ sal_Bool SVGReader::parseAndConvert() { - uno::Reference<xml::dom::XDocumentBuilder> xDomBuilder(xml::dom::DocumentBuilder::create(comphelper::getComponentContext(m_xServiceFactory))); + uno::Reference<xml::dom::XDocumentBuilder> xDomBuilder = xml::dom::DocumentBuilder::create(m_xContext); uno::Reference<xml::dom::XDocument> xDom( xDomBuilder->parse(m_xInputStream), diff --git a/filter/source/svg/svgreader.hxx b/filter/source/svg/svgreader.hxx index baf3304be7f2..d7c4d3a58f90 100644 --- a/filter/source/svg/svgreader.hxx +++ b/filter/source/svg/svgreader.hxx @@ -24,12 +24,12 @@ namespace svgi class SVGReader { - const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; + const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; const ::com::sun::star::uno::Reference< com::sun::star::io::XInputStream > m_xInputStream; const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xDocumentHandler; public: - FILTER_DLLPUBLIC SVGReader( const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xServiceFactory, + FILTER_DLLPUBLIC SVGReader( const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& xContext, const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& xInputStream, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler ); diff --git a/filter/source/svg/test/svg2odf.cxx b/filter/source/svg/test/svg2odf.cxx index 83952bd40fcb..1aaf4e118ba9 100644 --- a/filter/source/svg/test/svg2odf.cxx +++ b/filter/source/svg/test/svg2odf.cxx @@ -115,7 +115,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) return 1; } - svgi::SVGReader aReader(xFactory, + svgi::SVGReader aReader(xCtx, uno::Reference<io::XInputStream>( new comphelper::OSLInputStreamWrapper(aInputFile)), svgi::createSerializer(new OutputWrap(aDstURL))); diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx index c0b017cfc489..19dfbb1f620b 100644 --- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx +++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx @@ -85,7 +85,7 @@ sal_Bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< ::com::sun::star } OUString sXMLImportService ( udImport ); - Reference < XParser > xSaxParser = Parser::create( comphelper::getComponentContext(mxMSF) ); + Reference < XParser > xSaxParser = Parser::create( mxContext ); Sequence< Any > aAnys(1); OUString aBaseURI; @@ -111,7 +111,7 @@ sal_Bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< ::com::sun::star aAnys[0] <<= xInfoSet; - Reference < XDocumentHandler > xHandler( mxMSF->createInstanceWithArguments( sXMLImportService, aAnys ), UNO_QUERY ); + Reference < XDocumentHandler > xHandler( mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( sXMLImportService, aAnys, mxContext ), UNO_QUERY ); if(! xHandler.is()) { OSL_FAIL("XMLReader::Read: %s Unable to create service instance xHandler\n" ); return sal_False; @@ -126,7 +126,7 @@ sal_Bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< ::com::sun::star //********************* // Creating a ConverterBridge instance //********************* - Reference< XInterface > xConvBridge(mxMSF->createInstance( udConvertClass ), UNO_QUERY); + Reference< XInterface > xConvBridge(mxContext->getServiceManager()->createInstanceWithContext(udConvertClass, mxContext), UNO_QUERY); if(! xConvBridge.is()){ OSL_FAIL( "XMLReader::Read: %s service missing\n" ); return sal_False; @@ -160,8 +160,8 @@ sal_Bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< ::com::sun::star //Load the Styles from the Template URL Supplied in the TypeDetection file if(msTemplateName.indexOf(OUString( "file:" ))==-1) { - Reference< XConfigManager >xCfgMgr ( mxMSF->createInstance( - OUString( "com.sun.star.config.SpecialConfigManager" ) ), UNO_QUERY ); + Reference< XConfigManager >xCfgMgr ( mxContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.config.SpecialConfigManager", mxContext ), UNO_QUERY ); OUString PathString(xCfgMgr->substituteVariables(OUString("$(progurl)"))); PathString = PathString.concat(OUString( "/" )); msTemplateName=PathString.concat(msTemplateName); @@ -223,7 +223,7 @@ sal_Bool SAL_CALL XmlFilterAdaptor::exportImpl( const Sequence< ::com::sun::star xStatusIndicator->start(OUString( "Saving :" ),nProgressRange); // Set up converter bridge. - Reference< com::sun::star::xml::XExportFilter > xConverter(mxMSF->createInstance(udConvertClass ), UNO_QUERY); + Reference< com::sun::star::xml::XExportFilter > xConverter(mxContext->getServiceManager()->createInstanceWithContext( udConvertClass, mxContext ), UNO_QUERY); if(! xConverter.is()){ OSL_FAIL( "xml export sub service missing" ); return sal_False; @@ -288,8 +288,8 @@ sal_Bool SAL_CALL XmlFilterAdaptor::exportImpl( const Sequence< ::com::sun::star OUString( "BaseURI" ), makeAny( aBaseURI )); aAnys[1] <<= xInfoSet; - Reference< XExporter > xExporter( mxMSF->createInstanceWithArguments ( - udExport, aAnys ), UNO_QUERY_THROW ); + Reference< XExporter > xExporter( mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( + udExport, aAnys, mxContext ), UNO_QUERY_THROW ); // attach to source document xExporter->setSourceDocument( mxDoc ); @@ -398,7 +398,7 @@ Sequence< OUString > SAL_CALL XmlFilterAdaptor_getSupportedServiceNames( ) Reference< XInterface > SAL_CALL XmlFilterAdaptor_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*) new XmlFilterAdaptor( rSMgr ); + return (cppu::OWeakObject*) new XmlFilterAdaptor( comphelper::getComponentContext(rSMgr) ); } // XServiceInfo diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx index 68df79320d91..4ffaf0f79b99 100644 --- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx +++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/implbase5.hxx> @@ -41,26 +42,18 @@ enum FilterType * member calls */ class XmlFilterAdaptor : public cppu::WeakImplHelper5 - < - com::sun::star::document::XFilter, - com::sun::star::document::XExporter, - com::sun::star::document::XImporter, - com::sun::star::lang::XInitialization, - com::sun::star::lang::XServiceInfo - > - { protected: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc; @@ -73,20 +66,17 @@ protected: FilterType meType; sal_Bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) - throw (::com::sun::star::uno::RuntimeException); sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) - throw (::com::sun::star::uno::RuntimeException); public: - XmlFilterAdaptor( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF) - - : mxMSF( rxMSF ) {} + XmlFilterAdaptor( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext) + : mxContext( rxContext ) {} virtual ~XmlFilterAdaptor() {} @@ -95,11 +85,9 @@ public: // XFilter virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) - throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL cancel( ) - throw (::com::sun::star::uno::RuntimeException); @@ -107,7 +95,6 @@ public: // XExporter virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) - throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx index 12cc401854b3..e8be7db4414b 100644 --- a/filter/source/xsltdialog/typedetectionimport.cxx +++ b/filter/source/xsltdialog/typedetectionimport.cxx @@ -35,9 +35,8 @@ using namespace com::sun::star; using namespace std; -TypeDetectionImporter::TypeDetectionImporter( Reference< XMultiServiceFactory >& xMSF ) -: mxMSF(xMSF), - sRootNode( "oor:component-data" ), +TypeDetectionImporter::TypeDetectionImporter() +: sRootNode( "oor:component-data" ), sNode( "node" ), sName( "oor:name" ), sProp( "prop" ), @@ -57,13 +56,13 @@ TypeDetectionImporter::~TypeDetectionImporter (void ) { } -void TypeDetectionImporter::doImport( Reference< XMultiServiceFactory >& xMSF, Reference< XInputStream > xIS, XMLFilterVector& rFilters ) +void TypeDetectionImporter::doImport( const Reference< XComponentContext >& rxContext, Reference< XInputStream > xIS, XMLFilterVector& rFilters ) { try { - Reference< XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(xMSF) ); + Reference< XParser > xParser = xml::sax::Parser::create( rxContext ); - TypeDetectionImporter* pImporter = new TypeDetectionImporter( xMSF ); + TypeDetectionImporter* pImporter = new TypeDetectionImporter; Reference < XDocumentHandler > xDocHandler( pImporter ); xParser->setDocumentHandler( xDocHandler ); diff --git a/filter/source/xsltdialog/typedetectionimport.hxx b/filter/source/xsltdialog/typedetectionimport.hxx index 73d1077946e2..8e1f0296dd7e 100644 --- a/filter/source/xsltdialog/typedetectionimport.hxx +++ b/filter/source/xsltdialog/typedetectionimport.hxx @@ -61,10 +61,10 @@ typedef std::vector< Node* > NodeVector; class TypeDetectionImporter : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler > { public: - TypeDetectionImporter( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); + TypeDetectionImporter(); virtual ~TypeDetectionImporter( void ); - static void doImport( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF, com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xOS, XMLFilterVector& rFilters ); + static void doImport( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xOS, XMLFilterVector& rFilters ); virtual void SAL_CALL startDocument( ) throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); @@ -88,8 +88,6 @@ private: filter_info_impl* createFilterForNode( Node * pNode ); Node* findTypeNode( const OUString& rType ); - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF; - std::stack< ImportState > maStack; PropertyMap maPropertyMap; diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 7c692405ce37..6aa7ace9f884 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -67,7 +67,7 @@ class XMLFilterDialogComponent : public XMLFilterDialogComponentBase, public XTerminateListener { public: - XMLFilterDialogComponent( const Reference< XMultiServiceFactory >& rxMSF ); + XMLFilterDialogComponent( const Reference< XComponentContext >& rxContext ); virtual ~XMLFilterDialogComponent(); protected: @@ -104,7 +104,7 @@ protected: private: com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxParent; /// parent window - com::sun::star::uno::Reference< XMultiServiceFactory > mxMSF; + com::sun::star::uno::Reference< XComponentContext > mxContext; XMLFilterSettingsDialog* mpDialog; }; @@ -121,12 +121,12 @@ ResMgr* getXSLTDialogResMgr() return pXSLTResMgr; } -XMLFilterDialogComponent::XMLFilterDialogComponent( const com::sun::star::uno::Reference< XMultiServiceFactory >& rxMSF ) : +XMLFilterDialogComponent::XMLFilterDialogComponent( const com::sun::star::uno::Reference< XComponentContext >& rxContext ) : OComponentHelper( maMutex ), - mxMSF( rxMSF ), + mxContext( rxContext ), mpDialog( NULL ) { - Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(mxMSF) ); + Reference< XDesktop2 > xDesktop = Desktop::create( rxContext ); Reference< XTerminateListener > xListener( this ); xDesktop->addTerminateListener( xListener ); } @@ -218,7 +218,7 @@ sal_Bool SAL_CALL XMLFilterDialogComponent_supportsService( const OUString& Serv Reference< XInterface > SAL_CALL XMLFilterDialogComponent_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception ) { - return (OWeakObject*)new XMLFilterDialogComponent( rSMgr ); + return (OWeakObject*)new XMLFilterDialogComponent( comphelper::getComponentContext(rSMgr) ); } //------------------------------------------------------------------------- @@ -359,7 +359,7 @@ sal_Int16 SAL_CALL XMLFilterDialogComponent::execute( ) throw(RuntimeException) pParent = VCLUnoHelper::GetWindow(mxParent); Reference< XComponent > xComp( this ); - mpDialog = new XMLFilterSettingsDialog(pParent, mxMSF); + mpDialog = new XMLFilterSettingsDialog(pParent, mxContext); mpDialog->Execute(); } else if( !mpDialog->IsVisible() ) diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx index 12241c771286..a0c6159d09de 100644 --- a/filter/source/xsltdialog/xmlfilterjar.cxx +++ b/filter/source/xsltdialog/xmlfilterjar.cxx @@ -60,8 +60,8 @@ using namespace com::sun::star::io; using ::rtl::Uri; -XMLFilterJarHelper::XMLFilterJarHelper( Reference< XMultiServiceFactory >& xMSF ) -: mxMSF( xMSF ), +XMLFilterJarHelper::XMLFilterJarHelper( const Reference< XComponentContext >& rxContext ) +: mxContext( rxContext ), sVndSunStarPackage( "vnd.sun.star.Package:" ), sXSLTPath( "$(user)/xslt/" ), sTemplatePath( "$(user)/template/" ), @@ -71,7 +71,7 @@ XMLFilterJarHelper::XMLFilterJarHelper( Reference< XMultiServiceFactory >& xMSF { try { - Reference< XConfigManager > xCfgMgr( xMSF->createInstance(OUString( "com.sun.star.config.SpecialConfigManager" )), UNO_QUERY ); + Reference< XConfigManager > xCfgMgr( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.config.SpecialConfigManager", rxContext ), UNO_QUERY ); if( xCfgMgr.is() ) { sProgPath = xCfgMgr->substituteVariables( sProgPath ); @@ -166,9 +166,9 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilt aArguments[ 1 ] <<= aArg; Reference< XHierarchicalNameAccess > xIfc( - mxMSF->createInstanceWithArguments( - OUString( "com.sun.star.packages.comp.ZipPackage" ), - aArguments ), UNO_QUERY ); + mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.packages.comp.ZipPackage", + aArguments, mxContext ), UNO_QUERY ); if( xIfc.is() ) { @@ -220,8 +220,7 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilt /* osl::File::RC rc = */ aOutputFile.open( osl_File_OpenFlag_Write ); Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) ); - Reference<XComponentContext> xContext( comphelper::getComponentContext(mxMSF) ); - TypeDetectionExporter aExporter( xContext ); + TypeDetectionExporter aExporter( mxContext ); aExporter.doExport(xOS,rFilters); } @@ -266,9 +265,9 @@ void XMLFilterJarHelper::openPackage( const OUString& rPackageURL, XMLFilterVect aArguments[ 1 ] <<= aArg; Reference< XHierarchicalNameAccess > xIfc( - mxMSF->createInstanceWithArguments( - OUString( "com.sun.star.packages.comp.ZipPackage" ), - aArguments ), UNO_QUERY ); + mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.packages.comp.ZipPackage", + aArguments, mxContext ), UNO_QUERY ); if( xIfc.is() ) { @@ -290,7 +289,7 @@ void XMLFilterJarHelper::openPackage( const OUString& rPackageURL, XMLFilterVect Reference< XInputStream > xIS( xTypeDetection->getInputStream() ); XMLFilterVector aFilters; - TypeDetectionImporter::doImport( mxMSF, xIS, aFilters ); + TypeDetectionImporter::doImport( mxContext, xIS, aFilters ); // copy all files used by the filters imported from the // typedetection to office/user/xslt diff --git a/filter/source/xsltdialog/xmlfilterjar.hxx b/filter/source/xsltdialog/xmlfilterjar.hxx index 8aea9d5c7cbd..6681e186684a 100644 --- a/filter/source/xsltdialog/xmlfilterjar.hxx +++ b/filter/source/xsltdialog/xmlfilterjar.hxx @@ -32,7 +32,7 @@ typedef std::vector< filter_info_impl* > XMLFilterVector; class XMLFilterJarHelper { public: - XMLFilterJarHelper( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); + XMLFilterJarHelper( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); bool savePackage( const OUString& rPackageURL, const XMLFilterVector& rFilters ); void openPackage( const OUString& rPackageURL, XMLFilterVector& rFilters ); @@ -43,7 +43,7 @@ private: bool copyFile( com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > xIfc, OUString& rURL, const OUString& rTargetURL ); bool copyFiles( com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > xIfc, filter_info_impl* pFilter ); - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; OUString sVndSunStarPackage; OUString sXSLTPath; diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 6356298cf881..cad9278be875 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -55,9 +55,9 @@ using namespace com::sun::star::util; using ::rtl::Uri; XMLFilterSettingsDialog::XMLFilterSettingsDialog(Window* pParent, - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF) + const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext) : ModelessDialog(pParent, "XMLFilterSettingsDialog", "filter/ui/xmlfiltersettings.ui") - , mxMSF( rxMSF ) + , mxContext( rxContext ) , m_bIsClosable(true) , m_sTemplatePath("$(user)/template/") , m_sDocTypePrefix("doctype:") @@ -89,11 +89,11 @@ XMLFilterSettingsDialog::XMLFilterSettingsDialog(Window* pParent, try { - mxFilterContainer = Reference< XNameContainer >::query( rxMSF->createInstance( "com.sun.star.document.FilterFactory" ) ); - mxTypeDetection = Reference< XNameContainer >::query( rxMSF->createInstance( "com.sun.star.document.TypeDetection" ) ); - mxExtendedTypeDetection = Reference< XNameContainer >::query( rxMSF->createInstance( "com.sun.star.document.ExtendedTypeDetectionFactory" ) ); + mxFilterContainer = Reference< XNameContainer >::query( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.FilterFactory", rxContext ) ); + mxTypeDetection = Reference< XNameContainer >::query( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.TypeDetection", rxContext ) ); + mxExtendedTypeDetection = Reference< XNameContainer >::query( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.ExtendedTypeDetectionFactory", rxContext ) ); - Reference< XConfigManager > xCfgMgr( mxMSF->createInstance( "com.sun.star.config.SpecialConfigManager" ), UNO_QUERY ); + Reference< XConfigManager > xCfgMgr( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.config.SpecialConfigManager", rxContext ), UNO_QUERY ); if( xCfgMgr.is() ) { m_sTemplatePath = xCfgMgr->substituteVariables( m_sTemplatePath ); @@ -233,7 +233,7 @@ void XMLFilterSettingsDialog::onNew() aTempInfo.maDocumentService = "com.sun.star.text.TextDocument"; // execute XML Filter Dialog - XMLFilterTabDialog aDlg( this, *getXSLTDialogResMgr(), mxMSF, &aTempInfo ); + XMLFilterTabDialog aDlg( this, *getXSLTDialogResMgr(), mxContext, &aTempInfo ); if ( aDlg.Execute() == RET_OK ) { // insert the new filter @@ -254,7 +254,7 @@ void XMLFilterSettingsDialog::onEdit() filter_info_impl* pOldInfo = (filter_info_impl*)pEntry->GetUserData(); // execute XML Filter Dialog - XMLFilterTabDialog aDlg( this, *getXSLTDialogResMgr(), mxMSF, pOldInfo ); + XMLFilterTabDialog aDlg( this, *getXSLTDialogResMgr(), mxContext, pOldInfo ); if ( aDlg.Execute() == RET_OK ) { filter_info_impl* pNewInfo = aDlg.getNewFilterInfo(); @@ -781,7 +781,7 @@ void XMLFilterSettingsDialog::onTest() { filter_info_impl* pInfo = (filter_info_impl*)pEntry->GetUserData(); - XMLFilterTestDialog aDlg(this, mxMSF); + XMLFilterTestDialog aDlg(this, mxContext); aDlg.test( *pInfo ); } } @@ -910,7 +910,7 @@ void XMLFilterSettingsDialog::onSave() if ( aDlg.Execute() == ERRCODE_NONE ) { - XMLFilterJarHelper aJarHelper( mxMSF ); + XMLFilterJarHelper aJarHelper( mxContext ); aJarHelper.savePackage( aDlg.GetPath(), aFilters ); INetURLObject aURL( aDlg.GetPath() ); @@ -958,7 +958,7 @@ void XMLFilterSettingsDialog::onOpen() { OUString aURL( aDlg.GetPath() ); - XMLFilterJarHelper aJarHelper( mxMSF ); + XMLFilterJarHelper aJarHelper( mxContext ); aJarHelper.openPackage( aURL, aFilters ); int nFilters = 0; diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx index 80176e02128c..bf3b1c457afb 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx @@ -86,7 +86,7 @@ class XMLFilterSettingsDialog : public ModelessDialog { public: XMLFilterSettingsDialog(Window* pParent, - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF); + const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext); DECL_LINK(ClickHdl_Impl, PushButton * ); DECL_LINK(SelectionChangedHdl_Impl, void * ); @@ -120,7 +120,7 @@ private: private: - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxFilterContainer; com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxTypeDetection; com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxExtendedTypeDetection; diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index 78a1505b9012..6ed8e501433e 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -38,9 +38,9 @@ using namespace com::sun::star::container; using namespace com::sun::star::beans; using namespace com::sun::star::lang; -XMLFilterTabDialog::XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const Reference< XMultiServiceFactory >& rxMSF, const filter_info_impl* pInfo ) : +XMLFilterTabDialog::XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const Reference< XComponentContext >& rxContext, const filter_info_impl* pInfo ) : TabDialog( pParent, ResId( DLG_XML_FILTER_TABDIALOG, rResMgr ) ), - mxMSF( rxMSF ), + mxContext( rxContext ), mrResMgr( rResMgr ), maTabCtrl( this, ResId( 1, rResMgr ) ), maOKBtn( this ), @@ -82,7 +82,7 @@ XMLFilterTabDialog::XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const aCtrlSiz = aSiz; } - mpXSLTPage = new XMLFilterTabPageXSLT( &maTabCtrl, mrResMgr, mxMSF ); + mpXSLTPage = new XMLFilterTabPageXSLT( &maTabCtrl, mrResMgr, mxContext ); mpXSLTPage->SetInfo( mpNewInfo ); maTabCtrl.SetTabPage( RID_XML_FILTER_TABPAGE_XSLT, mpXSLTPage ); @@ -133,7 +133,7 @@ bool XMLFilterTabDialog::onOk() { try { - Reference< XNameAccess > xFilterContainer( mxMSF->createInstance( "com.sun.star.document.FilterFactory" ), UNO_QUERY ); + Reference< XNameAccess > xFilterContainer( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.FilterFactory", mxContext ), UNO_QUERY ); if( xFilterContainer.is() ) { if( xFilterContainer->hasByName( mpNewInfo->maFilterName ) ) @@ -165,7 +165,7 @@ bool XMLFilterTabDialog::onOk() { try { - Reference< XNameAccess > xFilterContainer( mxMSF->createInstance( "com.sun.star.document.FilterFactory" ), UNO_QUERY ); + Reference< XNameAccess > xFilterContainer( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.FilterFactory", mxContext ), UNO_QUERY ); if( xFilterContainer.is() ) { Sequence< OUString > aFilterNames( xFilterContainer->getElementNames() ); diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.hxx b/filter/source/xsltdialog/xmlfiltertabdialog.hxx index 2d0189278073..f7af2fc9dd3d 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.hxx @@ -34,7 +34,7 @@ class XMLFilterTabPageXSLT; class XMLFilterTabDialog: public TabDialog { public: - XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF, const filter_info_impl* pInfo ); + XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo ); virtual ~XMLFilterTabDialog(); ResMgr& getResMgr() { return mrResMgr; } @@ -44,7 +44,7 @@ public: filter_info_impl* getNewFilterInfo() const; private: - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; DECL_LINK( ActivatePageHdl, TabControl * ); DECL_LINK( DeactivatePageHdl, TabControl * ); diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx index bc6652db7b22..04bc14139ef2 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx @@ -35,7 +35,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; -XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, const css::uno::Reference< XMultiServiceFactory >& rxMSF ) : +XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, const css::uno::Reference< XComponentContext >& rxContext ) : TabPage( pParent, ResId( RID_XML_FILTER_TABPAGE_XSLT, rResMgr ) ), maFTDocType( this, ResId( FT_XML_DOCTYPE, rResMgr ) ), @@ -66,7 +66,7 @@ XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, co try { - css::uno::Reference< XConfigManager > xCfgMgr( rxMSF->createInstance( "com.sun.star.config.SpecialConfigManager" ), UNO_QUERY ); + css::uno::Reference< XConfigManager > xCfgMgr( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.config.SpecialConfigManager", rxContext ), UNO_QUERY ); if( xCfgMgr.is() ) sInstPath = xCfgMgr->substituteVariables( sInstPath ); } diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx index 062637e1f02b..57e1b19028e3 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx @@ -33,7 +33,7 @@ class filter_info_impl; class XMLFilterTabPageXSLT : public TabPage { public: - XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); virtual ~XMLFilterTabPageXSLT(); bool FillInfo( filter_info_impl* pInfo ); diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 807393253b0b..0490c3fded1b 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -134,9 +134,9 @@ static bool checkComponent( Reference< XComponent >& rxComponent, const OUString } XMLFilterTestDialog::XMLFilterTestDialog(Window* pParent, - const Reference<XMultiServiceFactory>& rxMSF) + const Reference<XComponentContext>& rxContext) : ModalDialog(pParent, "TestXMLFilterDialog", "filter/ui/testxmlfilter.ui") - , mxMSF(rxMSF) + , mxContext(rxContext) , m_pFilterInfo(NULL) { get(m_pExport, "export"); @@ -166,7 +166,7 @@ XMLFilterTestDialog::XMLFilterTestDialog(Window* pParent, try { - mxGlobalBroadcaster = Reference < XEventBroadcaster >( GlobalEventBroadcaster::create(comphelper::getComponentContext(mxMSF)), UNO_QUERY_THROW ); + mxGlobalBroadcaster = GlobalEventBroadcaster::create(mxContext); mxGlobalEventListener = new GlobalEventListenerImpl( this ); mxGlobalBroadcaster->addEventListener( mxGlobalEventListener ); } @@ -295,8 +295,8 @@ void XMLFilterTestDialog::onExportBrowse() com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); - Reference< XNameAccess > xFilterContainer( mxMSF->createInstance( OUString( "com.sun.star.document.FilterFactory" ) ), UNO_QUERY ); - Reference< XNameAccess > xTypeDetection( mxMSF->createInstance( OUString( "com.sun.star.document.TypeDetection" ) ), UNO_QUERY ); + Reference< XNameAccess > xFilterContainer( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.FilterFactory", mxContext ), UNO_QUERY ); + Reference< XNameAccess > xTypeDetection( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.TypeDetection", mxContext ), UNO_QUERY ); if( xFilterContainer.is() && xTypeDetection.is() ) { Sequence< OUString > aFilterNames( xFilterContainer->getElementNames() ); @@ -400,8 +400,8 @@ void XMLFilterTestDialog::onExportBrowse() { m_sExportRecentFile = aDlg.GetPath(); - Reference< XDesktop2 > xLoader = Desktop::create( comphelper::getComponentContext(mxMSF) ); - Reference< XInteractionHandler2 > xInter( InteractionHandler::createWithParent(comphelper::getComponentContext(mxMSF), 0) ); + Reference< XDesktop2 > xLoader = Desktop::create( mxContext ); + Reference< XInteractionHandler2 > xInter = InteractionHandler::createWithParent(mxContext, 0); OUString aFrame( "_default" ); Sequence< PropertyValue > aArguments(1); aArguments[0].Name = OUString( "InteractionHandler" ); @@ -463,7 +463,7 @@ void XMLFilterTestDialog::doExport( Reference< XComponent > xComp ) aSourceData[i++].Value <<= m_pFilterInfo->maDocType; } - Reference< XExportFilter > xExporter( mxMSF->createInstance( OUString( "com.sun.star.documentconversion.XSLTFilter" ) ), UNO_QUERY ); + Reference< XExportFilter > xExporter( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.documentconversion.XSLTFilter", mxContext ), UNO_QUERY ); Reference< XDocumentHandler > xHandler( xExporter, UNO_QUERY ); if( xHandler.is() ) { @@ -495,7 +495,7 @@ void XMLFilterTestDialog::doExport( Reference< XComponent > xComp ) // *pArgs++ <<= xInfoSet; *pArgs <<= xHandler; - Reference< XFilter > xFilter( mxMSF->createInstanceWithArguments( pAppInfo->maXMLExporter, aArgs ), UNO_QUERY ); + Reference< XFilter > xFilter( mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( pAppInfo->maXMLExporter, aArgs, mxContext ), UNO_QUERY ); if( xFilter.is() ) { Reference< XExporter > xExporter2( xFilter, UNO_QUERY ); @@ -585,8 +585,8 @@ void XMLFilterTestDialog::import( const OUString& rURL ) { try { - Reference< XDesktop2 > xLoader = Desktop::create( comphelper::getComponentContext(mxMSF) ); - Reference< XInteractionHandler2 > xInter( InteractionHandler::createWithParent(comphelper::getComponentContext(mxMSF), 0) ); + Reference< XDesktop2 > xLoader = Desktop::create( mxContext ); + Reference< XInteractionHandler2 > xInter = InteractionHandler::createWithParent(mxContext, 0); OUString aFrame( "_default" ); Sequence< PropertyValue > aArguments(2); @@ -604,7 +604,7 @@ void XMLFilterTestDialog::import( const OUString& rURL ) TempFile aTempFile(lead, &ext); OUString aTempFileURL( aTempFile.GetURL() ); - Reference< XImportFilter > xImporter( mxMSF->createInstance( OUString( "com.sun.star.documentconversion.XSLTFilter" ) ), UNO_QUERY ); + Reference< XImportFilter > xImporter( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.documentconversion.XSLTFilter", mxContext ), UNO_QUERY ); if( xImporter.is() ) { osl::File aInputFile( rURL ); @@ -624,7 +624,7 @@ void XMLFilterTestDialog::import( const OUString& rURL ) aSourceData[i ].Name = OUString( "Indent" ); aSourceData[i++].Value <<= (sal_Bool)sal_True; - Reference< XWriter > xWriter = Writer::create( comphelper::getComponentContext(mxMSF) ); + Reference< XWriter > xWriter = Writer::create( mxContext ); File aOutputFile( aTempFileURL ); aOutputFile.open( osl_File_OpenFlag_Write ); @@ -678,7 +678,7 @@ Reference< XComponent > XMLFilterTestDialog::getFrontMostDocument( const OUStrin try { - Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(mxMSF) ); + Reference< XDesktop2 > xDesktop = Desktop::create( mxContext ); Reference< XComponent > xTest( mxLastFocusModel ); if( checkComponent( xTest, rServiceName ) ) { diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.hxx b/filter/source/xsltdialog/xmlfiltertestdialog.hxx index 51732137cda0..fd1b2b9e7905 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.hxx @@ -35,7 +35,7 @@ class XMLFilterTestDialog : public ModalDialog { public: XMLFilterTestDialog(Window* pParent, - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF); + const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext); virtual ~XMLFilterTestDialog(); void test( const filter_info_impl& rFilterInfo ); @@ -57,7 +57,7 @@ private: void doExport( com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp ); private: - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; com::sun::star::uno::Reference< com::sun::star::document::XEventBroadcaster > mxGlobalBroadcaster; com::sun::star::uno::Reference< com::sun::star::document::XEventListener > mxGlobalEventListener; com::sun::star::uno::WeakReference< com::sun::star::lang::XComponent > mxLastFocusModel; diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index 41f7ac95a39a..140713fa0635 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -106,7 +106,7 @@ namespace XSLT private: // the UNO ServiceFactory - css::uno::Reference<XMultiServiceFactory> m_rServiceFactory; + css::uno::Reference<XComponentContext> m_xContext; // DocumentHandler interface of the css::xml::sax::Writer service css::uno::Reference<XOutputStream> m_rOutputStream; @@ -129,7 +129,7 @@ namespace XSLT public: // ctor... - XSLTFilter(const css::uno::Reference<XMultiServiceFactory> &r); + XSLTFilter(const css::uno::Reference<XComponentContext> &r); ~XSLTFilter(); @@ -163,8 +163,8 @@ namespace XSLT endDocument() throw (SAXException, RuntimeException); }; - XSLTFilter::XSLTFilter(const css::uno::Reference<XMultiServiceFactory> &r): -m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) + XSLTFilter::XSLTFilter(const css::uno::Reference<XComponentContext> &r): + m_xContext(r), m_bTerminated(sal_False), m_bError(sal_False) { m_cTransformed = osl_createCondition(); } @@ -185,10 +185,8 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) OUString sExpandedUrl; try { - css::uno::Reference<XComponentContext> xContext( - comphelper::getComponentContext(m_rServiceFactory)); css::uno::Reference<XMacroExpander> - xMacroExpander = theMacroExpander::get(xContext); + xMacroExpander = theMacroExpander::get(m_xContext); sExpandedUrl = xMacroExpander->expandMacros(sUrl); sal_Int32 nPos = sExpandedUrl.indexOf( "vnd.sun.star.expand:" ); if (nPos != -1) @@ -214,8 +212,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) { try { - xTransformer = xslt::XSLT2Transformer::create( - comphelper::getComponentContext(m_rServiceFactory), rArgs); + xTransformer = xslt::XSLT2Transformer::create(m_xContext, rArgs); } catch (const Exception&) { @@ -230,8 +227,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) // filter does not need it if (!xTransformer.is()) { - xTransformer = xslt::XSLTTransformer::create( - comphelper::getComponentContext(m_rServiceFactory), rArgs); + xTransformer = xslt::XSLTTransformer::create(m_xContext, rArgs); } return xTransformer; @@ -269,9 +265,8 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) XSLTFilter::rel2abs(const OUString& s) { - css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getComponentContext(m_rServiceFactory) ); css::uno::Reference<XStringSubstitution> - subs(css::util::PathSubstitution::create(xContext)); + subs(css::util::PathSubstitution::create(m_xContext)); OUString aWorkingDir(subs->getSubstituteVariableValue(OUString( "$(progurl)"))); INetURLObject aObj(aWorkingDir); aObj.setFinalSlash(); @@ -318,7 +313,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) // create SAX parser that will read the document file // and provide events to xHandler passed to this call - css::uno::Reference<XParser> xSaxParser = Parser::create(comphelper::getComponentContext(m_rServiceFactory)); + css::uno::Reference<XParser> xSaxParser = Parser::create(m_xContext); // create transformer Sequence<Any> args(3); @@ -353,7 +348,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) // create pipe css::uno::Reference<XOutputStream> pipeout( - Pipe::create(comphelper::getComponentContext(m_rServiceFactory)), + Pipe::create(m_xContext), UNO_QUERY); css::uno::Reference<XInputStream> pipein(pipeout, UNO_QUERY); @@ -459,7 +454,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) { // get the document writer setDelegate(css::uno::Reference<XExtendedDocumentHandler>( - Writer::create(comphelper::getComponentContext(m_rServiceFactory)), + Writer::create(m_xContext), UNO_QUERY_THROW)); } @@ -493,7 +488,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) // create pipe css::uno::Reference<XOutputStream> pipeout( - Pipe::create(comphelper::getComponentContext(m_rServiceFactory)), + Pipe::create(m_xContext), UNO_QUERY); css::uno::Reference<XInputStream> pipein(pipeout, UNO_QUERY); @@ -567,7 +562,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) static css::uno::Reference<XInterface> SAL_CALL CreateFilterInstance(const css::uno::Reference<XMultiServiceFactory> &r) { - return css::uno::Reference<XInterface> ((OWeakObject *) new XSLTFilter(r)); + return css::uno::Reference<XInterface> ((OWeakObject *) new XSLTFilter( comphelper::getComponentContext(r) )); } } |