diff options
author | Noel Grandin <noel@peralex.com> | 2013-01-16 17:12:47 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-02-11 08:02:11 +0200 |
commit | e5fdaec54a54e42b487c37e6b01493bcdfc30b4c (patch) | |
tree | 26421d24cee78af24feb748fc52845f279dd299e /sw/source | |
parent | c4d051c5dbee532264e1bfc2ccdb337c6dcf83ed (diff) |
fdo#46808, Adapt document::XML*BasicExporter UNO services to new style
The services are
document::XMLBasicExporter
document::XMLOasisBasicExporter
Change-Id: Ifd93e5735cae94d34904d79769cdb3edf587fe43
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/inc/SwXMLBlockExport.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLBlockExport.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks1.cxx | 30 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/xml/xmliteme.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlitemi.cxx | 3 |
7 files changed, 25 insertions, 49 deletions
diff --git a/sw/source/core/inc/SwXMLBlockExport.hxx b/sw/source/core/inc/SwXMLBlockExport.hxx index bd50c7b0a5e9..10597655f56e 100644 --- a/sw/source/core/inc/SwXMLBlockExport.hxx +++ b/sw/source/core/inc/SwXMLBlockExport.hxx @@ -32,7 +32,7 @@ private: public: SwXMLBlockListExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, SwXMLTextBlocks & rBlocks, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler); @@ -51,7 +51,7 @@ private: public: SwXMLTextBlockExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, SwXMLTextBlocks & rBlocks, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler); diff --git a/sw/source/core/swg/SwXMLBlockExport.cxx b/sw/source/core/swg/SwXMLBlockExport.cxx index a4c82e4d6675..9239474f68bc 100644 --- a/sw/source/core/swg/SwXMLBlockExport.cxx +++ b/sw/source/core/swg/SwXMLBlockExport.cxx @@ -29,11 +29,11 @@ using ::rtl::OUString; // #110680# SwXMLBlockListExport::SwXMLBlockListExport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, SwXMLTextBlocks & rBlocks, const rtl::OUString &rFileName, uno::Reference< xml::sax::XDocumentHandler> &rHandler) -: SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ), +: SvXMLExport( xContext, rFileName, util::MeasureUnit::CM, rHandler ), rBlockList(rBlocks) { _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST ), @@ -80,11 +80,11 @@ sal_uInt32 SwXMLBlockListExport::exportDoc(enum XMLTokenEnum ) // #110680# SwXMLTextBlockExport::SwXMLTextBlockExport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, SwXMLTextBlocks & rBlocks, const rtl::OUString &rFileName, uno::Reference< xml::sax::XDocumentHandler> &rHandler) -: SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ), +: SvXMLExport( xContext, rFileName, util::MeasureUnit::CM, rHandler ), rBlockList(rBlocks) { _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST ), diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index ddff63fd9a79..152014d82180 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -370,16 +370,8 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const String& rShort, const String& , String aFolderName( rPackageName ); String aStreamName = aFolderName + rtl::OUString(".xml"); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - OSL_ENSURE( xServiceFactory.is(), - "XMLReader::Read: got no service manager" ); - if( !xServiceFactory.is() ) - { - // Throw an exception ? - } uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); sal_uLong nRes = 0; @@ -402,9 +394,7 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const String& rShort, const String& , uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY); - // #110680# - // SwXMLTextBlockExport aExp(*this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler); - SwXMLTextBlockExport aExp( xServiceFactory, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler); + SwXMLTextBlockExport aExp( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler); aExp.exportDoc( rText ); @@ -453,12 +443,6 @@ void SwXMLTextBlocks::ReadInfo( void ) comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - OSL_ENSURE( xServiceFactory.is(), - "XMLReader::Read: got no service manager" ); - if( !xServiceFactory.is() ) - { - // Throw an exception ? - } xml::sax::InputSource aParserInput; aParserInput.sSystemId = sDocName; @@ -467,8 +451,6 @@ void SwXMLTextBlocks::ReadInfo( void ) aParserInput.aInputStream = xDocStream->getInputStream(); // get filter - // #110680# - // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLBlockListImport( *this ); uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLBlockListImport( xServiceFactory, *this ); // connect parser and filter @@ -502,16 +484,8 @@ void SwXMLTextBlocks::WriteInfo( void ) { if ( xBlkRoot.is() || 0 == OpenFile ( sal_False ) ) { - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - OSL_ENSURE( xServiceFactory.is(), - "XMLReader::Read: got no service manager" ); - if( !xServiceFactory.is() ) - { - // Throw an exception ? - } uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); OUString sDocName( RTL_CONSTASCII_USTRINGPARAM( XMLN_BLOCKLIST ) ); @@ -540,7 +514,7 @@ void SwXMLTextBlocks::WriteInfo( void ) uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY); - SwXMLBlockListExport aExp( xServiceFactory, *this, OUString(RTL_CONSTASCII_USTRINGPARAM(XMLN_BLOCKLIST)), xHandler); + SwXMLBlockListExport aExp( xContext, *this, OUString(RTL_CONSTASCII_USTRINGPARAM(XMLN_BLOCKLIST)), xHandler); aExp.exportDoc( XML_BLOCK_LIST ); diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 2d2d90388eb0..1d508071057c 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -80,9 +80,9 @@ using namespace ::com::sun::star::xforms; using namespace ::xmloff::token; SwXMLExport::SwXMLExport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, sal_uInt16 nExportFlags) -: SvXMLExport( util::MeasureUnit::INCH, xServiceFactory, XML_TEXT, +: SvXMLExport( util::MeasureUnit::INCH, xContext, XML_TEXT, nExportFlags ), pTableItemMapper( 0 ), pTableLines( 0 ), @@ -537,7 +537,7 @@ Reference< XInterface > SAL_CALL SwXMLExportOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_ALL); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_ALL); } OUString SAL_CALL SwXMLExportStylesOOO_getImplementationName() throw() @@ -558,7 +558,7 @@ Reference< XInterface > SAL_CALL SwXMLExportStylesOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES | EXPORT_FONTDECLS ); } @@ -581,7 +581,7 @@ Reference< XInterface > SAL_CALL SwXMLExportContentOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport(rSMgr, + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_SCRIPTS | EXPORT_FONTDECLS ); } @@ -604,7 +604,7 @@ Reference< XInterface > SAL_CALL SwXMLExportMetaOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_META); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_META); } OUString SAL_CALL SwXMLExportSettingsOOO_getImplementationName() throw() @@ -625,7 +625,7 @@ Reference< XInterface > SAL_CALL SwXMLExportSettingsOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_SETTINGS); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_SETTINGS); } // OASIS @@ -647,7 +647,7 @@ Reference< XInterface > SAL_CALL SwXMLExport_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_ALL|EXPORT_OASIS); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_ALL|EXPORT_OASIS); } OUString SAL_CALL SwXMLExportStyles_getImplementationName() throw() @@ -668,7 +668,7 @@ Reference< XInterface > SAL_CALL SwXMLExportStyles_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES | EXPORT_FONTDECLS|EXPORT_OASIS ); } @@ -692,7 +692,7 @@ Reference< XInterface > SAL_CALL SwXMLExportContent_createInstance( throw( Exception ) { return (cppu::OWeakObject*)new SwXMLExport( - rSMgr, + comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_SCRIPTS | EXPORT_FONTDECLS|EXPORT_OASIS ); } @@ -715,7 +715,7 @@ Reference< XInterface > SAL_CALL SwXMLExportMeta_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport(rSMgr, EXPORT_META|EXPORT_OASIS); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_META|EXPORT_OASIS); } OUString SAL_CALL SwXMLExportSettings_getImplementationName() throw() @@ -736,7 +736,7 @@ Reference< XInterface > SAL_CALL SwXMLExportSettings_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport(rSMgr, EXPORT_SETTINGS|EXPORT_OASIS); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_SETTINGS|EXPORT_OASIS); } namespace diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx index 9015bc6e152d..9af8a5cee5c8 100644 --- a/sw/source/filter/xml/xmlexp.hxx +++ b/sw/source/filter/xml/xmlexp.hxx @@ -118,7 +118,7 @@ protected: public: SwXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, sal_uInt16 nExportFlags = EXPORT_ALL); virtual ~SwXMLExport(); diff --git a/sw/source/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx index d17c101d30ce..d0235e96acec 100644 --- a/sw/source/filter/xml/xmliteme.cxx +++ b/sw/source/filter/xml/xmliteme.cxx @@ -41,6 +41,7 @@ #include "swrect.hxx" #include "xmlexp.hxx" #include <editeng/memberids.hrc> +#include <comphelper/processfactory.hxx> using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -222,7 +223,7 @@ inline void SwXMLTableItemMapper_Impl::SetAbsWidth( sal_uInt32 nAbs ) void SwXMLExport::_InitItemExport() { - pTwipUnitConv = new SvXMLUnitConverter(getServiceFactory(), + pTwipUnitConv = new SvXMLUnitConverter(getComponentContext(), util::MeasureUnit::TWIP, GetMM100UnitConverter().GetXMLMeasureUnit()); xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap ); diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx index 0c505beb868a..8359cafa58d6 100644 --- a/sw/source/filter/xml/xmlitemi.cxx +++ b/sw/source/filter/xml/xmlitemi.cxx @@ -38,6 +38,7 @@ #include <editeng/memberids.hrc> #include <svx/unomid.hxx> +#include <comphelper/processfactory.hxx> #include <hintids.hxx> #include <paratr.hxx> @@ -335,7 +336,7 @@ SvXMLImportContext *SwXMLItemSetContext_Impl::CreateChildContext( void SwXMLImport::_InitItemImport() { - pTwipUnitConv = new SvXMLUnitConverter( getServiceFactory(), + pTwipUnitConv = new SvXMLUnitConverter( comphelper::getComponentContext(getServiceFactory()), util::MeasureUnit::TWIP, util::MeasureUnit::TWIP ); xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap ); |