diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-04 13:20:48 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-02-12 10:14:43 +0200 |
commit | a6a8a8707b6ae111f94bac094d3c2909f523ca6f (patch) | |
tree | 402b668480b3106df0d3055cff037c8a768a419c /reportdesign | |
parent | f1204419af34b1d2f0ecaa69ceeb1f8c8a7d87df (diff) |
fdo#46808, convert xmloff module code to use XComponentContext
with lots of repurcussions in other modules
Change-Id: I6982671eecc701b06cf85d93533e1fe618044fea
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/source/filter/xml/xmlFixedContent.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlSection.cxx | 3 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlTable.cxx | 1 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlfilter.cxx | 52 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlfilter.hxx | 4 |
5 files changed, 29 insertions, 33 deletions
diff --git a/reportdesign/source/filter/xml/xmlFixedContent.cxx b/reportdesign/source/filter/xml/xmlFixedContent.cxx index 06273c372d50..1bcc317c51f5 100644 --- a/reportdesign/source/filter/xml/xmlFixedContent.cxx +++ b/reportdesign/source/filter/xml/xmlFixedContent.cxx @@ -141,7 +141,7 @@ SvXMLImportContext* OXMLFixedContent::_CreateChildContext( static const ::rtl::OUString s_sStringConcat(RTL_CONSTASCII_USTRINGPARAM(" & ")); const SvXMLTokenMap& rTokenMap = m_rImport.GetCellElemTokenMap(); - Reference<XMultiServiceFactory> xFactor = m_rImport.getServiceFactory(); + Reference<XComponentContext> xContext = m_rImport.GetComponentContext(); m_rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); const sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName ); diff --git a/reportdesign/source/filter/xml/xmlSection.cxx b/reportdesign/source/filter/xml/xmlSection.cxx index ca5419dc8299..23870a685d9f 100644 --- a/reportdesign/source/filter/xml/xmlSection.cxx +++ b/reportdesign/source/filter/xml/xmlSection.cxx @@ -116,12 +116,11 @@ SvXMLImportContext* OXMLSection::CreateChildContext( SvXMLImportContext *pContext = 0; ORptFilter& rImport = GetOwnImport(); const SvXMLTokenMap& rTokenMap = rImport.GetSectionElemTokenMap(); - uno::Reference<lang::XMultiServiceFactory> xFactor = rImport.getServiceFactory(); switch( rTokenMap.Get( _nPrefix, _rLocalName ) ) { case XML_TOK_TABLE: - pContext = new OXMLTable( rImport, _nPrefix, _rLocalName,xAttrList,m_xSection); + pContext = new OXMLTable( rImport, _nPrefix, _rLocalName, xAttrList, m_xSection); break; default: break; diff --git a/reportdesign/source/filter/xml/xmlTable.cxx b/reportdesign/source/filter/xml/xmlTable.cxx index f79deceac6cc..c908e9278229 100644 --- a/reportdesign/source/filter/xml/xmlTable.cxx +++ b/reportdesign/source/filter/xml/xmlTable.cxx @@ -130,7 +130,6 @@ SvXMLImportContext* OXMLTable::CreateChildContext( SvXMLImportContext *pContext = 0; ORptFilter& rImport = GetOwnImport(); const SvXMLTokenMap& rTokenMap = rImport.GetColumnTokenMap(); - Reference<XMultiServiceFactory> xFactor = rImport.getServiceFactory(); switch( rTokenMap.Get( _nPrefix, _rLocalName ) ) { diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index 1279e7386f93..2854a66ee6f4 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -211,7 +211,7 @@ sal_Int32 ReadThroughComponent( const uno::Reference<XComponent>& xModelComponent, const sal_Char* pStreamName, const sal_Char* pCompatibilityStreamName, - const uno::Reference<XMultiServiceFactory> & rFactory, + const uno::Reference<XComponentContext> & rxContext, const Reference< document::XGraphicObjectResolver > & _xGraphicObjectResolver, const Reference<document::XEmbeddedObjectResolver>& _xEmbeddedObjectResolver, const ::rtl::OUString& _sFilterName @@ -278,14 +278,14 @@ sal_Int32 ReadThroughComponent( aFilterCompArgs[ nArgs++ ] <<= _xProp; Reference< xml::sax::XDocumentHandler > xDocHandler( - rFactory->createInstanceWithArguments( _sFilterName, aFilterCompArgs ), + rxContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sFilterName, aFilterCompArgs, rxContext), uno::UNO_QUERY_THROW ); uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream(); // read from the stream return ReadThroughComponent( xInputStream ,xModelComponent ,pStreamName - ,comphelper::getComponentContext(rFactory) + ,rxContext ,xDocHandler ,bEncrypted ); } @@ -297,7 +297,7 @@ sal_Int32 ReadThroughComponent( //--------------------------------------------------------------------- uno::Reference< uno::XInterface > ORptImportHelper::create(uno::Reference< uno::XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptFilter(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY),IMPORT_SETTINGS )); + return static_cast< XServiceInfo* >(new ORptFilter(xContext, IMPORT_SETTINGS )); } //--------------------------------------------------------------------- ::rtl::OUString ORptImportHelper::getImplementationName_Static( ) throw (RuntimeException) @@ -314,7 +314,7 @@ Sequence< ::rtl::OUString > ORptImportHelper::getSupportedServiceNames_Static( //--------------------------------------------------------------------- Reference< XInterface > ORptContentImportHelper::create(const Reference< XComponentContext > & xContext) { - return static_cast< XServiceInfo* >(new ORptFilter(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY),IMPORT_AUTOSTYLES | IMPORT_CONTENT | IMPORT_SCRIPTS | + return static_cast< XServiceInfo* >(new ORptFilter(xContext,IMPORT_AUTOSTYLES | IMPORT_CONTENT | IMPORT_SCRIPTS | IMPORT_FONTDECLS )); } //--------------------------------------------------------------------- @@ -333,7 +333,7 @@ Sequence< ::rtl::OUString > ORptContentImportHelper::getSupportedServiceNames_St //--------------------------------------------------------------------- Reference< XInterface > ORptStylesImportHelper::create(Reference< XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptFilter(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY), + return static_cast< XServiceInfo* >(new ORptFilter(xContext, IMPORT_STYLES | IMPORT_MASTERSTYLES | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS )); } @@ -353,7 +353,7 @@ Sequence< ::rtl::OUString > ORptStylesImportHelper::getSupportedServiceNames_Sta //--------------------------------------------------------------------- Reference< XInterface > ORptMetaImportHelper::create(Reference< XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptFilter(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY), + return static_cast< XServiceInfo* >(new ORptFilter(xContext, IMPORT_META)); } //--------------------------------------------------------------------- @@ -373,8 +373,8 @@ Sequence< ::rtl::OUString > ORptMetaImportHelper::getSupportedServiceNames_Stati // - ORptFilter - // ------------- DBG_NAME(rpt_ORptFilter) -ORptFilter::ORptFilter( const uno::Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 nImportFlags ) - :SvXMLImport(_rxMSF,nImportFlags) +ORptFilter::ORptFilter( const uno::Reference< XComponentContext >& _rxContext,sal_uInt16 nImportFlags ) + :SvXMLImport(_rxContext,nImportFlags) { DBG_CTOR(rpt_ORptFilter,NULL); GetMM100UnitConverter().SetCoreMeasureUnit(util::MeasureUnit::MM_100TH); @@ -403,7 +403,7 @@ ORptFilter::~ORptFilter() throw() //------------------------------------------------------------------------------ uno::Reference< XInterface > ORptFilter::create(uno::Reference< XComponentContext > const & xContext) { - return *(new ORptFilter(uno::Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY))); + return *(new ORptFilter(xContext)); } // ----------------------------------------------------------------------------- @@ -527,19 +527,17 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) Reference< document::XGraphicObjectResolver > xGraphicObjectResolver; uno::Reference<document::XEmbeddedObjectResolver> xEmbeddedObjectResolver; - uno::Reference< lang::XMultiServiceFactory > xServiceFactory( getServiceFactory(), uno::UNO_QUERY); - if( xServiceFactory.is()) - { - uno::Sequence< uno::Any > aArgs(1); - aArgs[0] <<= xStorage; - xGraphicObjectResolver.set( - xServiceFactory->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Svx.GraphicImportHelper")), aArgs ), uno::UNO_QUERY ); - - uno::Reference< lang::XMultiServiceFactory > xReportServiceFactory( m_xReportDefinition, uno::UNO_QUERY); - aArgs[0] <<= beans::NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")),uno::makeAny(xStorage)); - xEmbeddedObjectResolver.set( xReportServiceFactory->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")),aArgs) , uno::UNO_QUERY); - } + uno::Reference< uno::XComponentContext > xContext = GetComponentContext(); + + uno::Sequence< uno::Any > aArgs(1); + aArgs[0] <<= xStorage; + xGraphicObjectResolver.set( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.Svx.GraphicImportHelper", aArgs, xContext), + uno::UNO_QUERY ); + + uno::Reference< lang::XMultiServiceFactory > xReportServiceFactory( m_xReportDefinition, uno::UNO_QUERY); + aArgs[0] <<= beans::NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")),uno::makeAny(xStorage)); + xEmbeddedObjectResolver.set( xReportServiceFactory->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")),aArgs) , uno::UNO_QUERY); static const ::rtl::OUString s_sOld(RTL_CONSTASCII_USTRINGPARAM("OldFormat")); static comphelper::PropertyMapEntry pMap[] = @@ -566,7 +564,7 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"meta.xml" ,"Meta.xml" - ,getServiceFactory() + ,GetComponentContext() ,xGraphicObjectResolver ,xEmbeddedObjectResolver ,SERVICE_METAIMPORTER @@ -590,7 +588,7 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"settings.xml" ,"Settings.xml" - ,getServiceFactory() + ,GetComponentContext() ,xGraphicObjectResolver ,xEmbeddedObjectResolver ,SERVICE_SETTINGSIMPORTER @@ -604,7 +602,7 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"styles.xml" ,"Styles.xml" - ,getServiceFactory() + ,GetComponentContext() ,xGraphicObjectResolver ,xEmbeddedObjectResolver ,SERVICE_STYLESIMPORTER @@ -618,7 +616,7 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"content.xml" ,"Content.xml" - ,getServiceFactory() + ,GetComponentContext() ,xGraphicObjectResolver ,xEmbeddedObjectResolver ,SERVICE_CONTENTIMPORTER diff --git a/reportdesign/source/filter/xml/xmlfilter.hxx b/reportdesign/source/filter/xml/xmlfilter.hxx index bb597deaeef1..c2327d2c8883 100644 --- a/reportdesign/source/filter/xml/xmlfilter.hxx +++ b/reportdesign/source/filter/xml/xmlfilter.hxx @@ -120,7 +120,7 @@ protected: virtual ~ORptFilter() throw(); public: - ORptFilter( const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 nImportFlags = IMPORT_ALL ); + ORptFilter( const Reference< XComponentContext >& _rxContext, sal_uInt16 nImportFlags = IMPORT_ALL ); // XFilter virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException); @@ -135,7 +135,7 @@ public: static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext); - inline Reference< XMultiServiceFactory > getORB() { return SvXMLImport::getServiceFactory(); } + inline Reference< XComponentContext > getORB() { return SvXMLImport::GetComponentContext(); } inline Reference<XReportDefinition> getReportDefinition() const { return m_xReportDefinition; } /** return the SdrModel of the real model * |