summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-02-04 13:20:48 +0200
committerNoel Grandin <noel@peralex.com>2013-02-12 10:14:43 +0200
commita6a8a8707b6ae111f94bac094d3c2909f523ca6f (patch)
tree402b668480b3106df0d3055cff037c8a768a419c /sw/source
parentf1204419af34b1d2f0ecaa69ceeb1f8c8a7d87df (diff)
fdo#46808, convert xmloff module code to use XComponentContext
with lots of repurcussions in other modules Change-Id: I6982671eecc701b06cf85d93533e1fe618044fea
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/inc/SwXMLBlockImport.hxx4
-rw-r--r--sw/source/core/swg/SwXMLBlockImport.cxx10
-rw-r--r--sw/source/core/swg/SwXMLSectionList.cxx4
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks1.cxx27
-rw-r--r--sw/source/filter/xml/swxml.cxx4
-rw-r--r--sw/source/filter/xml/xmlimp.cxx15
-rw-r--r--sw/source/filter/xml/xmlimp.hxx2
-rw-r--r--sw/source/filter/xml/xmlitemi.cxx2
8 files changed, 25 insertions, 43 deletions
diff --git a/sw/source/core/inc/SwXMLBlockImport.hxx b/sw/source/core/inc/SwXMLBlockImport.hxx
index be3602ed94e2..27b470143fb1 100644
--- a/sw/source/core/inc/SwXMLBlockImport.hxx
+++ b/sw/source/core/inc/SwXMLBlockImport.hxx
@@ -39,7 +39,7 @@ protected:
public:
SwXMLBlockListImport(
- 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 );
SwXMLTextBlocks& getBlockList ( void )
@@ -67,7 +67,7 @@ public:
sal_Bool bTextOnly;
String &m_rText;
SwXMLTextBlockImport(
- 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, String &rNewText, sal_Bool bNewTextOnly );
SwXMLTextBlocks& getBlockList ( void )
diff --git a/sw/source/core/swg/SwXMLBlockImport.cxx b/sw/source/core/swg/SwXMLBlockImport.cxx
index e65fb2dd91c2..fc0e49376fef 100644
--- a/sw/source/core/swg/SwXMLBlockImport.cxx
+++ b/sw/source/core/swg/SwXMLBlockImport.cxx
@@ -31,11 +31,10 @@ sal_Char const sXML_np__block_list[] = "_block-list";
sal_Char const sXML_np__office[] = "_ooffice";
sal_Char const sXML_np__text[] = "_otext";
-// #110680#
SwXMLBlockListImport::SwXMLBlockListImport(
- const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
+ const uno::Reference< uno::XComponentContext > xContext,
SwXMLTextBlocks &rBlocks )
-: SvXMLImport( xServiceFactory, 0 ),
+: SvXMLImport( xContext, 0 ),
rBlockList (rBlocks)
{
GetNamespaceMap().Add( OUString ( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__block_list ) ),
@@ -63,13 +62,12 @@ SvXMLImportContext *SwXMLBlockListImport::CreateContext(
return pContext;
}
-// #110680#
SwXMLTextBlockImport::SwXMLTextBlockImport(
- const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
+ const uno::Reference< uno::XComponentContext > xContext,
SwXMLTextBlocks &rBlocks,
String & rNewText,
sal_Bool bNewTextOnly )
-: SvXMLImport(xServiceFactory, IMPORT_ALL ),
+: SvXMLImport(xContext, IMPORT_ALL ),
rBlockList ( rBlocks ),
bTextOnly ( bNewTextOnly ),
m_rText ( rNewText )
diff --git a/sw/source/core/swg/SwXMLSectionList.cxx b/sw/source/core/swg/SwXMLSectionList.cxx
index 5511c2e1b4ca..a93b4862f87a 100644
--- a/sw/source/core/swg/SwXMLSectionList.cxx
+++ b/sw/source/core/swg/SwXMLSectionList.cxx
@@ -32,9 +32,9 @@ sal_Char const sXML_np__text[] = "_otext";
// #110680#
SwXMLSectionList::SwXMLSectionList(
- const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
+ const uno::Reference< uno::XComponentContext > xContext,
std::vector<String*> &rNewSectionList)
-: SvXMLImport( xServiceFactory ),
+: SvXMLImport( xContext ),
rSectionList ( rNewSectionList )
{
GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ),
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 152014d82180..5d88455e39cf 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -98,13 +98,8 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx )
xRoot = xBlkRoot->openStorageElement( aFolderName, embed::ElementModes::READ );
uno::Reference < io::XStream > xStream = xRoot->openStreamElement( aStreamName, embed::ElementModes::READ );
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
- comphelper::getProcessServiceFactory();
- OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" );
- if( !xServiceFactory.is() )
- {
- // Throw an exception ?
- }
+ uno::Reference< uno::XComponentContext > xContext =
+ comphelper::getProcessComponentContext();
xml::sax::InputSource aParserInput;
aParserInput.sSystemId = aNames[nIdx]->aPackageName;
@@ -112,12 +107,11 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx )
aParserInput.aInputStream = xStream->getInputStream();
// get filter
- // #110680#
// uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( *this, aCur, sal_True );
- uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xServiceFactory, *this, aCur, sal_True );
+ uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xContext, *this, aCur, sal_True );
// connect parser and filter
- uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(xServiceFactory));
+ uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
xParser->setDocumentHandler( xFilter );
// parse
@@ -305,15 +299,8 @@ sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText )
}
uno::Reference < io::XStream > xContents = xRoot->openStreamElement( aStreamName, embed::ElementModes::READ );
- 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 ?
- }
xml::sax::InputSource aParserInput;
aParserInput.sSystemId = aName;
@@ -322,7 +309,7 @@ sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText )
// get filter
// #110680#
// uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( *this, rText, bTextOnly );
- uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xServiceFactory, *this, rText, bTextOnly );
+ uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xContext, *this, rText, bTextOnly );
// connect parser and filter
uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
@@ -439,8 +426,6 @@ void SwXMLTextBlocks::ReadInfo( void )
uno::Reference < container::XNameAccess > xAccess( xBlkRoot, uno::UNO_QUERY );
if ( xAccess.is() && xAccess->hasByName( sDocName ) && xBlkRoot->isStreamElement( sDocName ) )
{
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
- comphelper::getProcessServiceFactory();
uno::Reference< uno::XComponentContext > xContext =
comphelper::getProcessComponentContext();
@@ -451,7 +436,7 @@ void SwXMLTextBlocks::ReadInfo( void )
aParserInput.aInputStream = xDocStream->getInputStream();
// get filter
- uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLBlockListImport( xServiceFactory, *this );
+ uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLBlockListImport( xContext, *this );
// connect parser and filter
uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 175372d85df5..2d2f108c591e 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -1051,8 +1051,6 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con
size_t XMLReader::GetSectionList( SfxMedium& rMedium,
std::vector<String*>& rStrings ) const
{
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
- comphelper::getProcessServiceFactory();
uno::Reference< uno::XComponentContext > xContext =
comphelper::getProcessComponentContext();
uno::Reference < embed::XStorage > xStg2;
@@ -1069,7 +1067,7 @@ size_t XMLReader::GetSectionList( SfxMedium& rMedium,
aParserInput.aInputStream = xStm->getInputStream();
// get filter
- uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( xServiceFactory, rStrings );
+ uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( xContext, rStrings );
// connect parser and filter
uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 67fa1efdcb6f..e45dc1cc82d2 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -65,6 +65,7 @@
#include <xmloff/xmlmetai.hxx>
#include <xmloff/xformsimport.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/processfactory.hxx>
using ::rtl::OUString;
@@ -408,9 +409,9 @@ SvXMLImportContext *SwXMLImport::CreateContext(
}
SwXMLImport::SwXMLImport(
- const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
+ const uno::Reference< uno::XComponentContext > xContext,
sal_uInt16 nImportFlags)
-: SvXMLImport( xServiceFactory, nImportFlags ),
+: SvXMLImport( xContext, nImportFlags ),
pSttNdIdx( 0 ),
pTableItemMapper( 0 ),
pDocElemTokenMap( 0 ),
@@ -1560,7 +1561,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImport_createInstance(
const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
throw( uno::Exception )
{
- return (cppu::OWeakObject*)new SwXMLImport( rSMgr, IMPORT_ALL );
+ return (cppu::OWeakObject*)new SwXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_ALL );
}
OUString SAL_CALL SwXMLImportStyles_getImplementationName() throw()
@@ -1582,7 +1583,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImportStyles_createInstance(
throw( uno::Exception )
{
return (cppu::OWeakObject*)new SwXMLImport(
- rSMgr,
+ comphelper::getComponentContext(rSMgr),
IMPORT_STYLES | IMPORT_MASTERSTYLES | IMPORT_AUTOSTYLES |
IMPORT_FONTDECLS );
}
@@ -1606,7 +1607,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImportContent_createInstance(
throw( uno::Exception )
{
return (cppu::OWeakObject*)new SwXMLImport(
- rSMgr,
+ comphelper::getComponentContext(rSMgr),
IMPORT_AUTOSTYLES | IMPORT_CONTENT | IMPORT_SCRIPTS |
IMPORT_FONTDECLS );
}
@@ -1629,7 +1630,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImportMeta_createInstance(
const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
throw( uno::Exception )
{
- return (cppu::OWeakObject*)new SwXMLImport( rSMgr, IMPORT_META );
+ return (cppu::OWeakObject*)new SwXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_META );
}
OUString SAL_CALL SwXMLImportSettings_getImplementationName() throw()
@@ -1650,7 +1651,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImportSettings_createInstance(
const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
throw( uno::Exception )
{
- return (cppu::OWeakObject*)new SwXMLImport( rSMgr, IMPORT_SETTINGS );
+ return (cppu::OWeakObject*)new SwXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_SETTINGS );
}
diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx
index 992236015971..5e2e4959c918 100644
--- a/sw/source/filter/xml/xmlimp.hxx
+++ b/sw/source/filter/xml/xmlimp.hxx
@@ -109,7 +109,7 @@ protected:
public:
SwXMLImport(
- 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 nImportFlags = IMPORT_ALL);
~SwXMLImport() throw();
diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx
index 8359cafa58d6..3fc237af18e0 100644
--- a/sw/source/filter/xml/xmlitemi.cxx
+++ b/sw/source/filter/xml/xmlitemi.cxx
@@ -336,7 +336,7 @@ SvXMLImportContext *SwXMLItemSetContext_Impl::CreateChildContext(
void SwXMLImport::_InitItemImport()
{
- pTwipUnitConv = new SvXMLUnitConverter( comphelper::getComponentContext(getServiceFactory()),
+ pTwipUnitConv = new SvXMLUnitConverter( GetComponentContext(),
util::MeasureUnit::TWIP, util::MeasureUnit::TWIP );
xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap );