[Libreoffice-commits] .: 5 commits - chart2/source comphelper/inc comphelper/source connectivity/inc connectivity/source cui/source dbaccess/source embeddedobj/source extensions/source filter/source framework/inc offapi/com offapi/type_reference offapi/UnoApi_offapi.mk oox/source reportdesign/source sc/source sd/source sfx2/source starmath/source ucb/source writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Dec 9 22:30:06 PST 2012
chart2/source/model/filter/XMLFilter.cxx | 12
chart2/source/model/main/ChartModel_Persistence.cxx | 16 -
comphelper/inc/comphelper/storagehelper.hxx | 32 +-
comphelper/source/misc/storagehelper.cxx | 51 +---
connectivity/inc/connectivity/dbtools.hxx | 4
connectivity/inc/connectivity/sqlerror.hxx | 5
connectivity/inc/connectivity/sqlparse.hxx | 4
connectivity/source/commontools/dbmetadata.cxx | 6
connectivity/source/commontools/dbtools.cxx | 2
connectivity/source/commontools/dbtools2.cxx | 7
connectivity/source/commontools/sqlerror.cxx | 15 -
connectivity/source/cpool/ZPoolCollection.cxx | 26 --
connectivity/source/cpool/ZPoolCollection.hxx | 12
connectivity/source/drivers/evoab2/NResultSet.cxx | 2
connectivity/source/drivers/hsqldb/HDriver.cxx | 7
connectivity/source/drivers/mork/MConnection.cxx | 3
connectivity/source/drivers/mozab/MConnection.cxx | 3
connectivity/source/drivers/mysql/YDriver.cxx | 25 -
connectivity/source/drivers/mysql/Yservices.cxx | 31 +-
connectivity/source/inc/mysql/YDriver.hxx | 7
connectivity/source/manager/mdrivermanager.hxx | 5
connectivity/source/parse/sqlnode.cxx | 4
cui/source/customize/acccfg.cxx | 6
cui/source/options/sdbcdriverenum.cxx | 31 +-
dbaccess/source/core/api/RowSetBase.cxx | 2
dbaccess/source/core/dataaccess/ContentHelper.cxx | 2
dbaccess/source/core/dataaccess/ModelImpl.cxx | 58 ++--
dbaccess/source/core/dataaccess/connection.cxx | 2
dbaccess/source/core/dataaccess/databasedocument.cxx | 2
dbaccess/source/core/dataaccess/datasource.cxx | 5
dbaccess/source/core/dataaccess/documentcontainer.cxx | 7
dbaccess/source/filter/xml/dbloader2.cxx | 4
dbaccess/source/inc/stringconstants.hrc | 1
dbaccess/source/inc/stringconstants.inc | 2
dbaccess/source/sdbtools/connection/objectnames.cxx | 6
dbaccess/source/ui/app/AppControllerGen.cxx | 2
dbaccess/source/ui/browser/brwctrlr.cxx | 2
dbaccess/source/ui/browser/dbloader.cxx | 32 +-
dbaccess/source/ui/dlg/DbAdminImpl.cxx | 13 -
dbaccess/source/ui/uno/copytablewizard.cxx | 8
embeddedobj/source/commonembedding/persistence.cxx | 12
extensions/source/abpilot/admininvokationimpl.cxx | 14 -
extensions/source/abpilot/admininvokationimpl.hxx | 8
extensions/source/abpilot/admininvokationpage.cxx | 3
extensions/source/abpilot/typeselectionpage.cxx | 6
filter/source/msfilter/msdffimp.cxx | 67 ++---
framework/inc/services.h | 1
offapi/UnoApi_offapi.mk | 3
offapi/com/sun/star/sdb/ReportDesign.idl | 39 +++
offapi/com/sun/star/sdbc/ConnectionPool.idl | 4
offapi/com/sun/star/sdbc/XConnectionPool.idl | 42 +++
offapi/com/sun/star/sdbc/XDriverManager2.idl | 4
offapi/type_reference/types.rdb |binary
oox/source/helper/zipstorage.cxx | 6
reportdesign/source/core/api/ReportDefinition.cxx | 8
reportdesign/source/core/api/ReportEngineJFree.cxx | 4
reportdesign/source/filter/xml/dbloader2.cxx | 2
sc/source/ui/docshell/docsh8.cxx | 18 -
sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx | 126 ++++------
sfx2/source/control/templateabstractview.cxx | 125 ++++-----
sfx2/source/doc/DocumentMetadataAccess.cxx | 6
sfx2/source/doc/SfxDocumentMetaData.cxx | 6
starmath/source/view.cxx | 2
ucb/source/ucp/tdoc/tdoc_provider.cxx | 10
ucb/source/ucp/tdoc/tdoc_provider.hxx | 2
ucb/source/ucp/tdoc/tdoc_storage.cxx | 24 -
ucb/source/ucp/tdoc/tdoc_storage.hxx | 4
writerfilter/source/dmapper/DomainMapper.cxx | 3
writerfilter/source/ooxml/OOXMLStreamImpl.cxx | 3
69 files changed, 513 insertions(+), 503 deletions(-)
New commits:
commit 24f0aa76c005d1506a6d13945c39dafc6e9b8d91
Author: Noel Grandin <noel at peralex.com>
Date: Mon Dec 3 16:33:30 2012 +0200
fdo#46808, use service constructor for embed::StorageFactory
Change-Id: I26cd1cf86118122f392f16801a646df753a7df26
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 10a565a..c832d4a 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/StorageFactory.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
@@ -101,10 +102,7 @@ uno::Reference< embed::XStorage > lcl_getWriteStorage(
}
else
{
- Reference< lang::XSingleServiceFactory > xStorageFact(
- xContext->getServiceManager()->createInstanceWithContext(
- C2U("com.sun.star.embed.StorageFactory"),
- xContext ), uno::UNO_QUERY_THROW );
+ Reference< lang::XSingleServiceFactory > xStorageFact( embed::StorageFactory::create( xContext ) );
::std::vector< beans::PropertyValue > aPropertiesForStorage;
@@ -188,11 +186,7 @@ uno::Reference< embed::XStorage > lcl_getReadStorage(
return xStorage;
// convert XInputStream to XStorage via the storage factory
- Reference< lang::XSingleServiceFactory > xStorageFact(
- xContext->getServiceManager()->createInstanceWithContext(
- C2U("com.sun.star.embed.StorageFactory"),
- xContext ),
- uno::UNO_QUERY_THROW );
+ Reference< lang::XSingleServiceFactory > xStorageFact( embed::StorageFactory::create( xContext ) );
Sequence< uno::Any > aStorageArgs( 3 );
aStorageArgs[0] <<= xStream;
aStorageArgs[1] <<= (embed::ElementModes::READ | embed::ElementModes::NOCREATE);
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index 1e4d1f4..0e638ec 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/StorageFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -118,11 +119,7 @@ Reference< embed::XStorage > lcl_createStorage(
::ucbhelper::Content( rURL, Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext()).openStream(),
uno::UNO_QUERY );
- Reference< lang::XSingleServiceFactory > xStorageFact(
- xContext->getServiceManager()->createInstanceWithContext(
- C2U("com.sun.star.embed.StorageFactory"),
- xContext ),
- uno::UNO_QUERY_THROW );
+ Reference< lang::XSingleServiceFactory > xStorageFact( embed::StorageFactory::create( xContext ) );
Sequence< uno::Any > aStorageArgs( 3 );
aStorageArgs[0] <<= xStream;
aStorageArgs[1] <<= embed::ElementModes::READWRITE;
@@ -311,13 +308,12 @@ void SAL_CALL ChartModel::storeToURL(
{
if( m_xContext.is() && aMediaDescriptorHelper.ISSET_OutputStream )
{
- Reference< lang::XMultiServiceFactory > xFact( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
Reference< io::XStream > xStream(
io::TempFile::create(m_xContext), uno::UNO_QUERY_THROW );
Reference< io::XInputStream > xInputStream( xStream->getInputStream());
Reference< embed::XStorage > xStorage(
- ::comphelper::OStorageHelper::GetStorageFromStream( xStream, embed::ElementModes::READWRITE, xFact ));
+ ::comphelper::OStorageHelper::GetStorageFromStream( xStream, embed::ElementModes::READWRITE, m_xContext ));
if( xStorage.is())
{
impl_store( aReducedMediaDescriptor, xStorage );
@@ -528,11 +524,7 @@ void SAL_CALL ChartModel::load(
return;
}
- Reference< lang::XSingleServiceFactory > xStorageFact(
- m_xContext->getServiceManager()->createInstanceWithContext(
- C2U("com.sun.star.embed.StorageFactory"),
- m_xContext ),
- uno::UNO_QUERY_THROW );
+ Reference< lang::XSingleServiceFactory > xStorageFact( embed::StorageFactory::create(m_xContext) );
if( aMDHelper.ISSET_Stream )
{
diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx
index f26f997..e98a407 100644
--- a/comphelper/inc/comphelper/storagehelper.hxx
+++ b/comphelper/inc/comphelper/storagehelper.hxx
@@ -71,8 +71,8 @@ class COMPHELPER_DLLPUBLIC OStorageHelper
public:
static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >
GetStorageFactory(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSF
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
throw ( ::com::sun::star::uno::Exception );
static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >
@@ -83,8 +83,8 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
GetTemporaryStorage(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
throw ( ::com::sun::star::uno::Exception );
/// this one will only return Storage
@@ -92,8 +92,8 @@ public:
GetStorageFromURL(
const ::rtl::OUString& aURL,
sal_Int32 nStorageMode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xrxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
throw ( ::com::sun::star::uno::Exception );
/// this one will return either Storage or FileSystemStorage
@@ -109,16 +109,16 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
GetStorageFromInputStream(
const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
throw ( ::com::sun::star::uno::Exception );
static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
GetStorageFromStream(
const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream,
sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
throw ( ::com::sun::star::uno::Exception );
static void CopyInputToOutput(
@@ -147,8 +147,8 @@ public:
const ::rtl::OUString& aFormat,
const ::rtl::OUString& aURL,
sal_Int32 nStorageMode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(),
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >(),
sal_Bool bRepairStorage = sal_False )
throw ( ::com::sun::star::uno::Exception );
@@ -156,8 +156,8 @@ public:
GetStorageOfFormatFromInputStream(
const ::rtl::OUString& aFormat,
const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(),
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >(),
sal_Bool bRepairStorage = sal_False )
throw ( ::com::sun::star::uno::Exception );
@@ -166,8 +166,8 @@ public:
const ::rtl::OUString& aFormat,
const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream,
sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(),
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >(),
sal_Bool bRepairStorage = sal_False )
throw ( ::com::sun::star::uno::Exception );
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index e4a1048..888a8b3 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/StorageFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -49,26 +50,12 @@ namespace comphelper {
// ----------------------------------------------------------------------
uno::Reference< lang::XSingleServiceFactory > OStorageHelper::GetStorageFactory(
- const uno::Reference< lang::XMultiServiceFactory >& xSF )
+ const uno::Reference< uno::XComponentContext >& rxContext )
throw ( uno::Exception )
{
- uno::Reference< lang::XMultiServiceFactory > xFactory = xSF.is() ? xSF : ::comphelper::getProcessServiceFactory();
- if ( !xFactory.is() )
- throw uno::RuntimeException();
-
- rtl::OUString sService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory"));
-
- uno::Reference < lang::XSingleServiceFactory > xStorageFactory(
- xFactory->createInstance(sService), uno::UNO_QUERY);
-
- if ( !xStorageFactory.is() )
- {
- throw uno::RuntimeException(rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("Could not load: ")) + sService,
- uno::Reference< uno::XInterface >());
- }
+ uno::Reference< uno::XComponentContext> xContext = rxContext.is() ? rxContext : ::comphelper::getProcessComponentContext();
- return xStorageFactory;
+ return embed::StorageFactory::create( xContext );
}
// ----------------------------------------------------------------------
@@ -97,10 +84,10 @@ uno::Reference< lang::XSingleServiceFactory > OStorageHelper::GetFileSystemStora
// ----------------------------------------------------------------------
uno::Reference< embed::XStorage > OStorageHelper::GetTemporaryStorage(
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< uno::XComponentContext >& rxContext )
throw ( uno::Exception )
{
- uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( xFactory )->createInstance(),
+ uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstance(),
uno::UNO_QUERY );
if ( !xTempStorage.is() )
throw uno::RuntimeException();
@@ -112,14 +99,14 @@ uno::Reference< embed::XStorage > OStorageHelper::GetTemporaryStorage(
uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromURL(
const ::rtl::OUString& aURL,
sal_Int32 nStorageMode,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< uno::XComponentContext >& rxContext )
throw ( uno::Exception )
{
uno::Sequence< uno::Any > aArgs( 2 );
aArgs[0] <<= aURL;
aArgs[1] <<= nStorageMode;
- uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( xFactory )->createInstanceWithArguments( aArgs ),
+ uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
uno::UNO_QUERY );
if ( !xTempStorage.is() )
throw uno::RuntimeException();
@@ -144,7 +131,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromURL2(
uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > (),
getProcessComponentContext() );
if (aCntnt.isDocument()) {
- xFact = GetStorageFactory( xFactory );
+ xFact = GetStorageFactory( comphelper::getComponentContext(xFactory) );
} else {
xFact = GetFileSystemStorageFactory( xFactory );
}
@@ -163,14 +150,14 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromURL2(
// ----------------------------------------------------------------------
uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromInputStream(
const uno::Reference < io::XInputStream >& xStream,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< uno::XComponentContext >& rxContext )
throw ( uno::Exception )
{
uno::Sequence< uno::Any > aArgs( 2 );
aArgs[0] <<= xStream;
aArgs[1] <<= embed::ElementModes::READ;
- uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( xFactory )->createInstanceWithArguments( aArgs ),
+ uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
uno::UNO_QUERY );
if ( !xTempStorage.is() )
throw uno::RuntimeException();
@@ -182,14 +169,14 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromInputStream(
uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromStream(
const uno::Reference < io::XStream >& xStream,
sal_Int32 nStorageMode,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< uno::XComponentContext >& rxContext )
throw ( uno::Exception )
{
uno::Sequence< uno::Any > aArgs( 2 );
aArgs[0] <<= xStream;
aArgs[1] <<= nStorageMode;
- uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( xFactory )->createInstanceWithArguments( aArgs ),
+ uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
uno::UNO_QUERY );
if ( !xTempStorage.is() )
throw uno::RuntimeException();
@@ -311,7 +298,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL(
const ::rtl::OUString& aFormat,
const ::rtl::OUString& aURL,
sal_Int32 nStorageMode,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference< uno::XComponentContext >& rxContext,
sal_Bool bRepairStorage )
throw ( uno::Exception )
{
@@ -330,7 +317,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL(
aArgs[1] <<= nStorageMode;
aArgs[2] <<= aProps;
- uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( xFactory )->createInstanceWithArguments( aArgs ),
+ uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
uno::UNO_QUERY );
if ( !xTempStorage.is() )
throw uno::RuntimeException();
@@ -342,7 +329,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL(
uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStream(
const ::rtl::OUString& aFormat,
const uno::Reference < io::XInputStream >& xStream,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference< uno::XComponentContext >& rxContext,
sal_Bool bRepairStorage )
throw ( uno::Exception )
{
@@ -361,7 +348,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStr
aArgs[1] <<= embed::ElementModes::READ;
aArgs[2] <<= aProps;
- uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( xFactory )->createInstanceWithArguments( aArgs ),
+ uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
uno::UNO_QUERY );
if ( !xTempStorage.is() )
throw uno::RuntimeException();
@@ -374,7 +361,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream(
const ::rtl::OUString& aFormat,
const uno::Reference < io::XStream >& xStream,
sal_Int32 nStorageMode,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference< uno::XComponentContext >& rxContext,
sal_Bool bRepairStorage )
throw ( uno::Exception )
{
@@ -393,7 +380,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream(
aArgs[1] <<= nStorageMode;
aArgs[2] <<= aProps;
- uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( xFactory )->createInstanceWithArguments( aArgs ),
+ uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
uno::UNO_QUERY );
if ( !xTempStorage.is() )
throw uno::RuntimeException();
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 931a025..a0bac71 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -31,6 +31,7 @@
#include <sfx2/sfxresid.hxx>
#include <svl/stritem.hxx>
#include "svtools/treelistentry.hxx"
+#include <com/sun/star/embed/StorageFactory.hpp>
#include <sal/macros.h>
@@ -74,7 +75,6 @@ using namespace com::sun::star;
//-----------------------------------------------
-static ::rtl::OUString SERVICE_STORAGEFACTORY (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory" ));
static ::rtl::OUString SERVICE_UICONFIGMGR (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager" ));
static ::rtl::OUString SERVICE_DESKTOP (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ));
static ::rtl::OUString SERVICE_GLOBALACCCFG (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.GlobalAcceleratorConfiguration" ));
@@ -1232,7 +1232,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, LoadHdl)
{
// URL doesn't point to a loaded document, try to access it as a single storage
// dont forget to release the storage afterwards!
- css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory( css::embed::StorageFactory::create( comphelper::getComponentContext(m_xSMGR) ) );
css::uno::Sequence< css::uno::Any > lArgs(2);
lArgs[0] <<= sCfgName;
lArgs[1] <<= css::embed::ElementModes::READ;
@@ -1315,7 +1315,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SaveHdl)
else
{
// URL doesn't point to a loaded document, try to access it as a single storage
- css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory( css::embed::StorageFactory::create( comphelper::getComponentContext(m_xSMGR) ) );
css::uno::Sequence< css::uno::Any > lArgs(2);
lArgs[0] <<= sCfgName;
lArgs[1] <<= css::embed::ElementModes::WRITE;
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index de74b4f..01546fa 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
+#include <com/sun/star/embed/StorageFactory.hpp>
#include <com/sun/star/sdb/BooleanComparisonMode.hpp>
#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
#include <com/sun/star/script/DocumentDialogLibraryContainer.hpp>
@@ -816,7 +817,7 @@ void ODatabaseModelImpl::disposeStorages() SAL_THROW(())
Reference< XSingleServiceFactory > ODatabaseModelImpl::createStorageFactory() const
{
- return Reference< XSingleServiceFactory >( m_aContext.createComponent( "com.sun.star.embed.StorageFactory" ), UNO_QUERY_THROW );
+ return StorageFactory::create( m_aContext.getUNOContext() );
}
void ODatabaseModelImpl::commitRootStorage()
@@ -834,46 +835,43 @@ Reference< XStorage > ODatabaseModelImpl::getOrCreateRootStorage()
{
if ( !m_xDocumentStorage.is() )
{
- Reference< XSingleServiceFactory> xStorageFactory = createStorageFactory();
- if ( xStorageFactory.is() )
+ Reference< XSingleServiceFactory> xStorageFactory = StorageFactory::create( m_aContext.getUNOContext() );
+ Any aSource;
+ aSource = m_aMediaDescriptor.get( "Stream" );
+ if ( !aSource.hasValue() )
+ aSource = m_aMediaDescriptor.get( "InputStream" );
+ if ( !aSource.hasValue() && !m_sDocFileLocation.isEmpty() )
+ aSource <<= m_sDocFileLocation;
+ // TODO: shouldn't we also check URL?
+
+ OSL_ENSURE( aSource.hasValue(), "ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from!" );
+
+ if ( aSource.hasValue() )
{
- Any aSource;
- aSource = m_aMediaDescriptor.get( "Stream" );
- if ( !aSource.hasValue() )
- aSource = m_aMediaDescriptor.get( "InputStream" );
- if ( !aSource.hasValue() && !m_sDocFileLocation.isEmpty() )
- aSource <<= m_sDocFileLocation;
- // TODO: shouldn't we also check URL?
+ Sequence< Any > aStorageCreationArgs(2);
+ aStorageCreationArgs[0] = aSource;
+ aStorageCreationArgs[1] <<= ElementModes::READWRITE;
- OSL_ENSURE( aSource.hasValue(), "ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from!" );
-
- if ( aSource.hasValue() )
+ Reference< XStorage > xDocumentStorage;
+ try
{
- Sequence< Any > aStorageCreationArgs(2);
- aStorageCreationArgs[0] = aSource;
- aStorageCreationArgs[1] <<= ElementModes::READWRITE;
-
- Reference< XStorage > xDocumentStorage;
+ xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ m_bDocumentReadOnly = sal_True;
+ aStorageCreationArgs[1] <<= ElementModes::READ;
try
{
xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), UNO_QUERY_THROW );
}
catch( const Exception& )
{
- m_bDocumentReadOnly = sal_True;
- aStorageCreationArgs[1] <<= ElementModes::READ;
- try
- {
- xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), UNO_QUERY_THROW );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
+ DBG_UNHANDLED_EXCEPTION();
}
-
- impl_switchToStorage_throw( xDocumentStorage );
}
+
+ impl_switchToStorage_throw( xDocumentStorage );
}
}
return m_xDocumentStorage.getTyped();
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index d17291a..ece5bc4 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -538,7 +538,7 @@ void SAL_CALL ODatabaseDocument::initNew( ) throw (DoubleInitializationExceptio
// create a temporary storage
Reference< XStorage > xTempStor( ::comphelper::OStorageHelper::GetTemporaryStorage(
- m_pImpl->m_aContext.getLegacyServiceFactory() ) );
+ m_pImpl->m_aContext.getUNOContext() ) );
// store therein
impl_storeToStorage_throw( xTempStor, Sequence< PropertyValue >(), aGuard );
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index 5d6db82..e75835c 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -136,7 +136,7 @@ DBTypeDetection::DBTypeDetection(const Reference< XMultiServiceFactory >& _rxFac
{
bStreamFromDescr = sal_True;
xStorageProperties.set( ::comphelper::OStorageHelper::GetStorageFromInputStream(
- xInStream, m_aContext.getLegacyServiceFactory() ), UNO_QUERY );
+ xInStream, m_aContext.getUNOContext() ), UNO_QUERY );
}
else
{
@@ -146,7 +146,7 @@ DBTypeDetection::DBTypeDetection(const Reference< XMultiServiceFactory >& _rxFac
if ( !sFileLocation.isEmpty() )
{
xStorageProperties.set( ::comphelper::OStorageHelper::GetStorageFromURL(
- sFileLocation, ElementModes::READ, m_aContext.getLegacyServiceFactory() ), UNO_QUERY );
+ sFileLocation, ElementModes::READ, m_aContext.getUNOContext() ), UNO_QUERY );
}
}
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index a54f3a9..abb8418 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/embed/XOptimizedStorage.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/EmbedUpdateModes.hpp>
+#include <com/sun/star/embed/StorageFactory.hpp>
#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XStorable.hpp>
@@ -119,18 +120,15 @@ uno::Sequence< beans::PropertyValue > addAsTemplate( const uno::Sequence< beans:
//------------------------------------------------------
uno::Reference< io::XInputStream > createTempInpStreamFromStor(
const uno::Reference< embed::XStorage >& xStorage,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< uno::XComponentContext >& xContext )
{
OSL_ENSURE( xStorage.is(), "The storage can not be empty!" );
uno::Reference< io::XInputStream > xResult;
- uno::Reference < io::XStream > xTempStream( io::TempFile::create(comphelper::getComponentContext(xFactory)),
- uno::UNO_QUERY_THROW );
+ uno::Reference < io::XStream > xTempStream( io::TempFile::create(xContext), uno::UNO_QUERY_THROW );
- uno::Reference < lang::XSingleServiceFactory > xStorageFactory(
- xFactory->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" )) ),
- uno::UNO_QUERY );
+ uno::Reference < lang::XSingleServiceFactory > xStorageFactory( embed::StorageFactory::create(xContext) );
uno::Sequence< uno::Any > aArgs( 2 );
aArgs[0] <<= xTempStream;
@@ -509,7 +507,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag
uno::Reference< io::XInputStream > xTempInpStream;
if ( !xDoc.is() )
{
- xTempInpStream = createTempInpStreamFromStor( xSourceStorage, m_xFactory );
+ xTempInpStream = createTempInpStreamFromStor( xSourceStorage, comphelper::getComponentContext(m_xFactory) );
if ( !xTempInpStream.is() )
throw uno::RuntimeException();
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 861be9d..5462151 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -2702,47 +2702,44 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem
( new ::comphelper::SequenceInputStream( aXMLDataSeq ) );
try
{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
- if ( xFactory.is() )
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ ::com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage
+ ( ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(
+ OFOPXML_STORAGE_FORMAT_STRING, xInputStream, xContext, sal_True ) );
+ if ( xStorage.is() )
{
- ::com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage
- ( ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(
- OFOPXML_STORAGE_FORMAT_STRING, xInputStream, xFactory, sal_True ) );
- if ( xStorage.is() )
+ const rtl::OUString sDRS( RTL_CONSTASCII_USTRINGPARAM ( "drs" ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ xStorageDRS( xStorage->openStorageElement( sDRS, ::com::sun::star::embed::ElementModes::SEEKABLEREAD ) );
+ if ( xStorageDRS.is() )
{
- const rtl::OUString sDRS( RTL_CONSTASCII_USTRINGPARAM ( "drs" ) );
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
- xStorageDRS( xStorage->openStorageElement( sDRS, ::com::sun::star::embed::ElementModes::SEEKABLEREAD ) );
- if ( xStorageDRS.is() )
+ const rtl::OUString sShapeXML( RTL_CONSTASCII_USTRINGPARAM ( "shapexml.xml" ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xShapeXMLStream( xStorageDRS->openStreamElement( sShapeXML, ::com::sun::star::embed::ElementModes::SEEKABLEREAD ) );
+ if ( xShapeXMLStream.is() )
{
- const rtl::OUString sShapeXML( RTL_CONSTASCII_USTRINGPARAM ( "shapexml.xml" ) );
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xShapeXMLStream( xStorageDRS->openStreamElement( sShapeXML, ::com::sun::star::embed::ElementModes::SEEKABLEREAD ) );
- if ( xShapeXMLStream.is() )
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xShapeXMLInputStream( xShapeXMLStream->getInputStream() );
+ if ( xShapeXMLInputStream.is() )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xShapeXMLInputStream( xShapeXMLStream->getInputStream() );
- if ( xShapeXMLInputStream.is() )
- {
- ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
- sal_Int32 nBytesRead = xShapeXMLInputStream->readBytes( aSeq, 0x7fffffff );
- if ( nBytesRead )
- { // for only one property I spare to use a XML parser at this point, this
- // should be enhanced if needed
-
- bRotateTextWithShape = sal_True; // using the correct xml default
- const char* pArry = reinterpret_cast< char* >( aSeq.getArray() );
- const char* pUpright = "upright=";
- const char* pEnd = pArry + nBytesRead;
- const char* pPtr = pArry;
- while( ( pPtr + 12 ) < pEnd )
+ ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
+ sal_Int32 nBytesRead = xShapeXMLInputStream->readBytes( aSeq, 0x7fffffff );
+ if ( nBytesRead )
+ { // for only one property I spare to use a XML parser at this point, this
+ // should be enhanced if needed
+
+ bRotateTextWithShape = sal_True; // using the correct xml default
+ const char* pArry = reinterpret_cast< char* >( aSeq.getArray() );
+ const char* pUpright = "upright=";
+ const char* pEnd = pArry + nBytesRead;
+ const char* pPtr = pArry;
+ while( ( pPtr + 12 ) < pEnd )
+ {
+ if ( !memcmp( pUpright, pPtr, 8 ) )
{
- if ( !memcmp( pUpright, pPtr, 8 ) )
- {
- bRotateTextWithShape = ( pPtr[ 9 ] != '1' ) && ( pPtr[ 9 ] != 't' );
- break;
- }
- else
- pPtr++;
+ bRotateTextWithShape = ( pPtr[ 9 ] != '1' ) && ( pPtr[ 9 ] != 't' );
+ break;
}
+ else
+ pPtr++;
}
}
}
diff --git a/framework/inc/services.h b/framework/inc/services.h
index e32de32..beae088 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -68,7 +68,6 @@ namespace framework{
#define SERVICENAME_GLOBALACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.GlobalAcceleratorConfiguration")
#define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration")
#define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration")
-#define SERVICENAME_STORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.StorageFactory" )
#define SERVICENAME_FILESYSTEMSTORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.FileSystemStorageFactory" )
#define SERVICENAME_PACKAGESTRUCTURECREATOR DECLARE_ASCII("com.sun.star.embed.PackageStructureCreator" )
#define SERVICENAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.ui.ToolBarFactory" )
diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx
index 1845afd..0e16107 100644
--- a/oox/source/helper/zipstorage.cxx
+++ b/oox/source/helper/zipstorage.cxx
@@ -62,9 +62,8 @@ ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const R
TODO: #i105410# switch to 'OFOPXMLFormat' and use its
implementation of relations handling.
*/
- Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW );
mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(
- ZIP_STORAGE_FORMAT_STRING, rxInStream, xFactory,
+ ZIP_STORAGE_FORMAT_STRING, rxInStream, rxContext,
sal_False ); // DEV300_m80: Was sal_True, but DOCX and others did not load
}
catch (Exception const& e)
@@ -81,10 +80,9 @@ ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const R
// create base storage object
if( rxContext.is() ) try
{
- Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW );
const sal_Int32 nOpenMode = ElementModes::READWRITE | ElementModes::TRUNCATE;
mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream(
- OFOPXML_STORAGE_FORMAT_STRING, rxStream, nOpenMode, xFactory, sal_True );
+ OFOPXML_STORAGE_FORMAT_STRING, rxStream, nOpenMode, rxContext, sal_True );
}
catch (Exception const& e)
{
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 3fc9edb..92267c3 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/embed/EntryInitModes.hpp>
#include <com/sun/star/embed/XEmbedPersist.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/StorageFactory.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
@@ -1813,12 +1814,7 @@ void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue
1
);
- uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
- m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" ) ),
- m_aProps->m_xContext ),
- uno::UNO_QUERY_THROW
- );
+ uno::Reference< lang::XSingleServiceFactory > xStorageFactory( embed::StorageFactory::create( m_aProps->m_xContext ) );
// open read-write per default, unless told otherwise in the MediaDescriptor
uno::Reference< embed::XStorage > xDocumentStorage;
diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx
index 27b26e3..4af87c1 100644
--- a/reportdesign/source/core/api/ReportEngineJFree.cxx
+++ b/reportdesign/source/core/api/ReportEngineJFree.cxx
@@ -178,7 +178,7 @@ void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task
else
sExt = rtl::OUString(".rpt");
- uno::Reference< embed::XStorage > xTemp = OStorageHelper::GetTemporaryStorage(/*sFileTemp,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,*/uno::Reference< lang::XMultiServiceFactory >(m_xContext->getServiceManager(),uno::UNO_QUERY));
+ uno::Reference< embed::XStorage > xTemp = OStorageHelper::GetTemporaryStorage(/*sFileTemp,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,*/ m_xContext);
utl::DisposableComponent aTemp(xTemp);
uno::Sequence< beans::PropertyValue > aEmpty;
uno::Reference< beans::XPropertySet> xStorageProp(xTemp,uno::UNO_QUERY);
@@ -210,7 +210,7 @@ void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task
sFileURL = aTestFile.GetURL();
}
- uno::Reference< embed::XStorage > xOut = OStorageHelper::GetStorageFromURL(sFileURL,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,uno::Reference< lang::XMultiServiceFactory >(m_xContext->getServiceManager(),uno::UNO_QUERY));
+ uno::Reference< embed::XStorage > xOut = OStorageHelper::GetStorageFromURL(sFileURL,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, m_xContext);
utl::DisposableComponent aOut(xOut);
xStorageProp.set(xOut,uno::UNO_QUERY);
if ( xStorageProp.is() )
diff --git a/reportdesign/source/filter/xml/dbloader2.cxx b/reportdesign/source/filter/xml/dbloader2.cxx
index 71fc576..72408c5 100644
--- a/reportdesign/source/filter/xml/dbloader2.cxx
+++ b/reportdesign/source/filter/xml/dbloader2.cxx
@@ -60,7 +60,7 @@ ORptTypeDetection::ORptTypeDetection(Reference< XComponentContext > const & xCon
{
try
{
- Reference<XPropertySet> xProp(::comphelper::OStorageHelper::GetStorageFromURL(sTemp,ElementModes::READ,Reference< XMultiServiceFactory >(m_xContext->getServiceManager(),UNO_QUERY)),UNO_QUERY);
+ Reference<XPropertySet> xProp(::comphelper::OStorageHelper::GetStorageFromURL(sTemp,ElementModes::READ, m_xContext),UNO_QUERY);
if ( xProp.is() )
{
::rtl::OUString sMediaType;
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx
index b387af6..7bc2713 100644
--- a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx
+++ b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx
@@ -30,6 +30,7 @@
#include <vcl/image.hxx>
#include <vcl/pngread.hxx>
#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/StorageFactory.hpp>
#include <tools/diagnose_ex.h>
using namespace ::com::sun::star;
@@ -112,93 +113,84 @@ Image TemplatePreviewProvider::operator() (
// Load the thumbnail from a template document.
uno::Reference<io::XInputStream> xIStream;
- uno::Reference< lang::XMultiServiceFactory > xServiceManager (
- ::comphelper::getProcessServiceFactory());
- if (xServiceManager.is())
+ uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
+ try
{
+ uno::Reference<lang::XSingleServiceFactory> xStorageFactory = embed::StorageFactory::create(xContext);
+
+ uno::Sequence<uno::Any> aArgs (2);
+ aArgs[0] <<= msURL;
+ aArgs[1] <<= embed::ElementModes::READ;
+ uno::Reference<embed::XStorage> xDocStorage (
+ xStorageFactory->createInstanceWithArguments(aArgs),
+ uno::UNO_QUERY);
+
try
{
- uno::Reference<lang::XSingleServiceFactory> xStorageFactory(
- xServiceManager->createInstance( "com.sun.star.embed.StorageFactory"),
- uno::UNO_QUERY);
-
- if (xStorageFactory.is())
+ if (xDocStorage.is())
{
- uno::Sequence<uno::Any> aArgs (2);
- aArgs[0] <<= msURL;
- aArgs[1] <<= embed::ElementModes::READ;
- uno::Reference<embed::XStorage> xDocStorage (
- xStorageFactory->createInstanceWithArguments(aArgs),
- uno::UNO_QUERY);
-
- try
- {
- if (xDocStorage.is())
- {
- uno::Reference<embed::XStorage> xStorage (
- xDocStorage->openStorageElement(
- "Thumbnails",
- embed::ElementModes::READ));
- if (xStorage.is())
- {
- uno::Reference<io::XStream> xThumbnailCopy (
- xStorage->cloneStreamElement("thumbnail.png"));
- if (xThumbnailCopy.is())
- xIStream = xThumbnailCopy->getInputStream();
- }
- }
- }
- catch (const uno::Exception& rException)
+ uno::Reference<embed::XStorage> xStorage (
+ xDocStorage->openStorageElement(
+ "Thumbnails",
+ embed::ElementModes::READ));
+ if (xStorage.is())
{
- OSL_TRACE (
- "caught exception while trying to access Thumbnail/thumbnail.png of %s: %s",
- ::rtl::OUStringToOString(msURL,
- RTL_TEXTENCODING_UTF8).getStr(),
- ::rtl::OUStringToOString(rException.Message,
- RTL_TEXTENCODING_UTF8).getStr());
+ uno::Reference<io::XStream> xThumbnailCopy (
+ xStorage->cloneStreamElement("thumbnail.png"));
+ if (xThumbnailCopy.is())
+ xIStream = xThumbnailCopy->getInputStream();
}
+ }
+ }
+ catch (const uno::Exception& rException)
+ {
+ OSL_TRACE (
+ "caught exception while trying to access Thumbnail/thumbnail.png of %s: %s",
+ ::rtl::OUStringToOString(msURL,
+ RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(rException.Message,
+ RTL_TEXTENCODING_UTF8).getStr());
+ }
- try
- {
- // An (older) implementation had a bug - The storage
- // name was "Thumbnail" instead of "Thumbnails". The
- // old name is still used as fallback but this code can
- // be removed soon.
- if ( ! xIStream.is())
- {
- uno::Reference<embed::XStorage> xStorage (
- xDocStorage->openStorageElement( "Thumbnail",
- embed::ElementModes::READ));
- if (xStorage.is())
- {
- uno::Reference<io::XStream> xThumbnailCopy (
- xStorage->cloneStreamElement("thumbnail.png"));
- if (xThumbnailCopy.is())
- xIStream = xThumbnailCopy->getInputStream();
- }
- }
- }
- catch (const uno::Exception& rException)
+ try
+ {
+ // An (older) implementation had a bug - The storage
+ // name was "Thumbnail" instead of "Thumbnails". The
+ // old name is still used as fallback but this code can
+ // be removed soon.
+ if ( ! xIStream.is())
+ {
+ uno::Reference<embed::XStorage> xStorage (
+ xDocStorage->openStorageElement( "Thumbnail",
+ embed::ElementModes::READ));
+ if (xStorage.is())
{
- OSL_TRACE (
- "caught exception while trying to access Thumbnails/thumbnail.png of %s: %s",
- ::rtl::OUStringToOString(msURL,
- RTL_TEXTENCODING_UTF8).getStr(),
- ::rtl::OUStringToOString(rException.Message,
- RTL_TEXTENCODING_UTF8).getStr());
+ uno::Reference<io::XStream> xThumbnailCopy (
+ xStorage->cloneStreamElement("thumbnail.png"));
+ if (xThumbnailCopy.is())
+ xIStream = xThumbnailCopy->getInputStream();
}
}
}
catch (const uno::Exception& rException)
{
OSL_TRACE (
- "caught exception while trying to access tuhmbnail of %s: %s",
+ "caught exception while trying to access Thumbnails/thumbnail.png of %s: %s",
::rtl::OUStringToOString(msURL,
RTL_TEXTENCODING_UTF8).getStr(),
::rtl::OUStringToOString(rException.Message,
RTL_TEXTENCODING_UTF8).getStr());
}
}
+ catch (const uno::Exception& rException)
+ {
+ OSL_TRACE (
+ "caught exception while trying to access tuhmbnail of %s: %s",
+ ::rtl::OUStringToOString(msURL,
+ RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(rException.Message,
+ RTL_TEXTENCODING_UTF8).getStr());
+ }
// Extract the image from the stream.
BitmapEx aThumbnail;
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 0baed64..dd00449 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -17,6 +17,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/StorageFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
@@ -176,93 +177,85 @@ BitmapEx TemplateAbstractView::fetchThumbnail (const OUString &msURL, long width
// Load the thumbnail from a template document.
uno::Reference<io::XInputStream> xIStream;
- uno::Reference< lang::XMultiServiceFactory > xServiceManager (comphelper::getProcessServiceFactory());
+ uno::Reference< uno::XComponentContext > xContext (comphelper::getProcessComponentContext());
- if (xServiceManager.is())
+ try
{
+ uno::Reference<lang::XSingleServiceFactory> xStorageFactory = embed::StorageFactory::create( xContext );
+
+ uno::Sequence<uno::Any> aArgs (2);
+ aArgs[0] <<= msURL;
+ aArgs[1] <<= embed::ElementModes::READ;
+ uno::Reference<embed::XStorage> xDocStorage (
+ xStorageFactory->createInstanceWithArguments(aArgs),
+ uno::UNO_QUERY);
+
try
{
- uno::Reference<lang::XSingleServiceFactory> xStorageFactory(
- xServiceManager->createInstance( "com.sun.star.embed.StorageFactory"),
- uno::UNO_QUERY);
-
- if (xStorageFactory.is())
+ if (xDocStorage.is())
{
- uno::Sequence<uno::Any> aArgs (2);
- aArgs[0] <<= msURL;
- aArgs[1] <<= embed::ElementModes::READ;
- uno::Reference<embed::XStorage> xDocStorage (
- xStorageFactory->createInstanceWithArguments(aArgs),
- uno::UNO_QUERY);
-
- try
+ uno::Reference<embed::XStorage> xStorage (
+ xDocStorage->openStorageElement(
+ "Thumbnails",
+ embed::ElementModes::READ));
+ if (xStorage.is())
{
- if (xDocStorage.is())
- {
- uno::Reference<embed::XStorage> xStorage (
- xDocStorage->openStorageElement(
- "Thumbnails",
- embed::ElementModes::READ));
- if (xStorage.is())
- {
- uno::Reference<io::XStream> xThumbnailCopy (
- xStorage->cloneStreamElement("thumbnail.png"));
- if (xThumbnailCopy.is())
- xIStream = xThumbnailCopy->getInputStream();
- }
- }
- }
- catch (const uno::Exception& rException)
- {
- OSL_TRACE (
- "caught exception while trying to access Thumbnail/thumbnail.png of %s: %s",
- ::rtl::OUStringToOString(msURL,
- RTL_TEXTENCODING_UTF8).getStr(),
- ::rtl::OUStringToOString(rException.Message,
- RTL_TEXTENCODING_UTF8).getStr());
+ uno::Reference<io::XStream> xThumbnailCopy (
+ xStorage->cloneStreamElement("thumbnail.png"));
+ if (xThumbnailCopy.is())
+ xIStream = xThumbnailCopy->getInputStream();
}
+ }
+ }
+ catch (const uno::Exception& rException)
+ {
+ OSL_TRACE (
+ "caught exception while trying to access Thumbnail/thumbnail.png of %s: %s",
+ ::rtl::OUStringToOString(msURL,
+ RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(rException.Message,
+ RTL_TEXTENCODING_UTF8).getStr());
+ }
- try
- {
- // An (older) implementation had a bug - The storage
- // name was "Thumbnail" instead of "Thumbnails". The
- // old name is still used as fallback but this code can
- // be removed soon.
- if ( ! xIStream.is())
- {
- uno::Reference<embed::XStorage> xStorage (
- xDocStorage->openStorageElement( "Thumbnail",
- embed::ElementModes::READ));
- if (xStorage.is())
- {
- uno::Reference<io::XStream> xThumbnailCopy (
- xStorage->cloneStreamElement("thumbnail.png"));
- if (xThumbnailCopy.is())
- xIStream = xThumbnailCopy->getInputStream();
- }
- }
- }
- catch (const uno::Exception& rException)
+ try
+ {
+ // An (older) implementation had a bug - The storage
+ // name was "Thumbnail" instead of "Thumbnails". The
+ // old name is still used as fallback but this code can
+ // be removed soon.
+ if ( ! xIStream.is())
+ {
+ uno::Reference<embed::XStorage> xStorage (
+ xDocStorage->openStorageElement( "Thumbnail",
+ embed::ElementModes::READ));
+ if (xStorage.is())
{
- OSL_TRACE (
- "caught exception while trying to access Thumbnails/thumbnail.png of %s: %s",
- ::rtl::OUStringToOString(msURL,
- RTL_TEXTENCODING_UTF8).getStr(),
- ::rtl::OUStringToOString(rException.Message,
- RTL_TEXTENCODING_UTF8).getStr());
+ uno::Reference<io::XStream> xThumbnailCopy (
+ xStorage->cloneStreamElement("thumbnail.png"));
+ if (xThumbnailCopy.is())
+ xIStream = xThumbnailCopy->getInputStream();
}
}
}
catch (const uno::Exception& rException)
{
OSL_TRACE (
- "caught exception while trying to access tuhmbnail of %s: %s",
+ "caught exception while trying to access Thumbnails/thumbnail.png of %s: %s",
::rtl::OUStringToOString(msURL,
RTL_TEXTENCODING_UTF8).getStr(),
::rtl::OUStringToOString(rException.Message,
RTL_TEXTENCODING_UTF8).getStr());
}
}
+ catch (const uno::Exception& rException)
+ {
+ OSL_TRACE (
+ "caught exception while trying to access tuhmbnail of %s: %s",
+ ::rtl::OUStringToOString(msURL,
+ RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(rException.Message,
+ RTL_TEXTENCODING_UTF8).getStr());
+ }
// Extract the image from the stream.
BitmapEx aThumbnail;
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index 8ee9bfd..f0dd1f0 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -1290,12 +1290,12 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
}
uno::Reference<embed::XStorage> xStorage;
try {
- const uno::Reference<lang::XMultiServiceFactory> xMsf (
- m_pImpl->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
if (xIn.is()) {
xStorage = ::comphelper::OStorageHelper::GetStorageFromInputStream(
- xIn, xMsf);
+ xIn, m_pImpl->m_xContext);
} else { // fallback to url
+ const uno::Reference<lang::XMultiServiceFactory> xMsf (
+ m_pImpl->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
xStorage = ::comphelper::OStorageHelper::GetStorageFromURL2(
URL, embed::ElementModes::READ, xMsf);
}
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index c412578..ae61ed7 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -2054,15 +2054,13 @@ SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL,
md[ ::comphelper::MediaDescriptor::PROP_INPUTSTREAM() ] >>= xIn;
}
css::uno::Reference<css::embed::XStorage> xStorage;
- css::uno::Reference<css::lang::XMultiServiceFactory> xMsf (
- m_xContext->getServiceManager(), css::uno::UNO_QUERY_THROW);
try {
if (xIn.is()) {
xStorage = ::comphelper::OStorageHelper::GetStorageFromInputStream(
- xIn, xMsf);
+ xIn, m_xContext);
} else { // fallback to url parameter
xStorage = ::comphelper::OStorageHelper::GetStorageFromURL(
- URL, css::embed::ElementModes::READ, xMsf);
+ URL, css::embed::ElementModes::READ, m_xContext);
}
} catch (const css::uno::RuntimeException &) {
throw;
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index f2713f5..8214774 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1640,7 +1640,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
try
{
uno::Reference < embed::XStorage > xStorage =
- ::comphelper::OStorageHelper::GetStorageFromInputStream( xStrm, ::comphelper::getProcessServiceFactory() );
+ ::comphelper::OStorageHelper::GetStorageFromInputStream( xStrm, ::comphelper::getProcessComponentContext() );
uno::Reference < beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY );
SfxMedium aMedium( xStorage, OUString() );
Insert( aMedium );
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx
index d5fbb0b..7a9c223 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx
@@ -50,10 +50,10 @@ using namespace tdoc_ucp;
//=========================================================================
ContentProvider::ContentProvider(
- const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
-: ::ucbhelper::ContentProviderImplHelper( comphelper::getComponentContext(xSMgr) ),
- m_xDocsMgr( new OfficeDocumentsManager( comphelper::getComponentContext(xSMgr), this ) ),
- m_xStgElemFac( new StorageElementFactory( xSMgr, m_xDocsMgr ) )
+ const uno::Reference< uno::XComponentContext >& rxContext )
+: ::ucbhelper::ContentProviderImplHelper( rxContext ),
+ m_xDocsMgr( new OfficeDocumentsManager( rxContext, this ) ),
+ m_xStgElemFac( new StorageElementFactory( rxContext, m_xDocsMgr ) )
{
}
@@ -95,7 +95,7 @@ XTYPEPROVIDER_IMPL_4( ContentProvider,
//
//=========================================================================
-XSERVICEINFO_IMPL_1(
+XSERVICEINFO_IMPL_1_CTX(
ContentProvider,
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.comp.ucb.TransientDocumentsContentProvider" ) ),
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.hxx b/ucb/source/ucp/tdoc/tdoc_provider.hxx
index eaa3fd8..69bc2b2 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.hxx
@@ -64,7 +64,7 @@ class ContentProvider :
{
public:
ContentProvider( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+ com::sun::star::uno::XComponentContext >& rxContext );
virtual ~ContentProvider();
// XInterface
diff --git a/ucb/source/ucp/tdoc/tdoc_storage.cxx b/ucb/source/ucp/tdoc/tdoc_storage.cxx
index dd86cff..e31a877 100644
--- a/ucb/source/ucp/tdoc/tdoc_storage.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_storage.cxx
@@ -21,7 +21,7 @@
#include "com/sun/star/beans/XPropertySet.hpp"
#include "com/sun/star/embed/ElementModes.hpp"
-#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/embed/StorageFactory.hpp"
#include "comphelper/processfactory.hxx"
#include "tdoc_uri.hxx"
@@ -43,10 +43,10 @@ using namespace tdoc_ucp;
//=========================================================================
StorageElementFactory::StorageElementFactory(
- const uno::Reference< lang::XMultiServiceFactory > & xSMgr,
+ const uno::Reference< uno::XComponentContext > & rxContext,
const rtl::Reference< OfficeDocumentsManager > & xDocsMgr )
: m_xDocsMgr( xDocsMgr ),
- m_xSMgr( xSMgr )
+ m_xContext( rxContext )
{
}
@@ -65,13 +65,9 @@ StorageElementFactory::createTemporaryStorage()
{
uno::Reference< embed::XStorage > xStorage;
uno::Reference< lang::XSingleServiceFactory > xStorageFac;
- if ( m_xSMgr.is() )
+ if ( m_xContext.is() )
{
- xStorageFac = uno::Reference< lang::XSingleServiceFactory >(
- m_xSMgr->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.embed.StorageFactory" ) ) ),
- uno::UNO_QUERY );
+ xStorageFac = embed::StorageFactory::create( m_xContext );
}
OSL_ENSURE( xStorageFac.is(), "Can't create storage factory!" );
@@ -185,7 +181,7 @@ StorageElementFactory::createStorage( const rtl::OUString & rUri,
|| ( eMode == READ_WRITE_CREATE ) );
std::auto_ptr< Storage > xElement(
- new Storage( comphelper::getComponentContext(m_xSMgr), this, aUriKey, xParentStorage, xStorage ) );
+ new Storage( m_xContext, this, aUriKey, xParentStorage, xStorage ) );
aIt = m_aMap.insert(
StorageMap::value_type(
@@ -234,8 +230,7 @@ StorageElementFactory::createStorage( const rtl::OUString & rUri,
return xStorage;
}
- aIt->second
- = new Storage( comphelper::getComponentContext(m_xSMgr), this, aUriKey, xParentStorage, xStorage );
+ aIt->second = new Storage( m_xContext, this, aUriKey, xParentStorage, xStorage );
aIt->second->m_aContainerIt = aIt;
return aIt->second;
}
@@ -312,8 +307,7 @@ StorageElementFactory::createOutputStream( const rtl::OUString & rUri,
// and even no writable instance if there is already another
// read-only instance!)
return uno::Reference< io::XOutputStream >(
- new OutputStream(
- comphelper::getComponentContext(m_xSMgr), rUri, xParentStorage, xStream->getOutputStream() ) );
+ new OutputStream( m_xContext, rUri, xParentStorage, xStream->getOutputStream() ) );
}
//=========================================================================
@@ -353,7 +347,7 @@ StorageElementFactory::createStream( const rtl::OUString & rUri,
}
return uno::Reference< io::XStream >(
- new Stream( comphelper::getComponentContext(m_xSMgr), rUri, xParentStorage, xStream ) );
+ new Stream( m_xContext, rUri, xParentStorage, xStream ) );
}
//=========================================================================
diff --git a/ucb/source/ucp/tdoc/tdoc_storage.hxx b/ucb/source/ucp/tdoc/tdoc_storage.hxx
index 2dc5dc0..9904ab9 100644
--- a/ucb/source/ucp/tdoc/tdoc_storage.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_storage.hxx
@@ -45,7 +45,7 @@ namespace tdoc_ucp {
public:
StorageElementFactory(
const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > & xSMgr,
+ com::sun::star::uno::XComponentContext > & rxContext,
const rtl::Reference< OfficeDocumentsManager > & xDocsMgr );
~StorageElementFactory();
@@ -156,7 +156,7 @@ namespace tdoc_ucp {
osl::Mutex m_aMutex;
rtl::Reference< OfficeDocumentsManager > m_xDocsMgr;
com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ com::sun::star::uno::XComponentContext > m_xContext;
};
} // namespace tdoc_ucp
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 5ae8e13..dd61686 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -103,9 +103,8 @@ LoggedStream(dmapper_logger, "DomainMapper"),
//import document properties
try
{
- uno::Reference< lang::XMultiServiceFactory > xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW);
uno::Reference< embed::XStorage > xDocumentStorage =
- (comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(OFOPXML_STORAGE_FORMAT_STRING, xInputStream, xFactory, bRepairStorage ));
+ (comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(OFOPXML_STORAGE_FORMAT_STRING, xInputStream, xContext, bRepairStorage ));
uno::Reference< uno::XInterface > xTemp = xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.document.OOXMLDocumentPropertiesImporter",
diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
index a8c62bf..96f37bd 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
@@ -40,10 +40,9 @@ OOXMLStreamImpl::OOXMLStreamImpl
StreamType_t nType, bool bRepairStorage)
: mxContext(xContext), mxStorageStream(xStorageStream), mnStreamType(nType)
{
- uno::Reference< lang::XMultiServiceFactory > xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW);
mxStorage.set
(comphelper::OStorageHelper::GetStorageOfFormatFromInputStream
- (OFOPXML_STORAGE_FORMAT_STRING, mxStorageStream, xFactory, bRepairStorage));
+ (OFOPXML_STORAGE_FORMAT_STRING, mxStorageStream, xContext, bRepairStorage));
mxRelationshipAccess.set(mxStorage, uno::UNO_QUERY_THROW);
init();
commit b9a4a0b9658015a0d55c42de1f5e56941e20d268
Author: Noel Grandin <noel at peralex.com>
Date: Mon Dec 3 13:55:06 2012 +0200
fdo#46808, Convert connectivity::SQLError to use XComponentContext...
...instead of comphelper::ComponentContext.
Change-Id: I40384c2d7cfcabd06506321d686dd8e7c7c5f266
diff --git a/connectivity/inc/connectivity/sqlerror.hxx b/connectivity/inc/connectivity/sqlerror.hxx
index 9cfaffc..fae9b2a 100644
--- a/connectivity/inc/connectivity/sqlerror.hxx
+++ b/connectivity/inc/connectivity/sqlerror.hxx
@@ -21,8 +21,7 @@
#define CONNECTIVITY_SQLERROR_HXX
#include <com/sun/star/sdbc/SQLException.hpp>
-
-#include <comphelper/componentcontext.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
@@ -82,7 +81,7 @@ namespace connectivity
public:
- explicit SQLError( const ::comphelper::ComponentContext& _rContext );
+ explicit SQLError( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _rxContext );
~SQLError();
/** returns the message associated with a given error condition, after (optionally) replacing
diff --git a/connectivity/inc/connectivity/sqlparse.hxx b/connectivity/inc/connectivity/sqlparse.hxx
index e67aa7d..45357d2 100644
--- a/connectivity/inc/connectivity/sqlparse.hxx
+++ b/connectivity/inc/connectivity/sqlparse.hxx
@@ -124,8 +124,8 @@ namespace connectivity
::com::sun::star::lang::Locale aLocale;
::connectivity::SQLError aErrors;
- OSQLParser_Data( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory )
- :aErrors( _xServiceFactory )
+ OSQLParser_Data( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext )
+ :aErrors( _rxContext )
{
}
};
diff --git a/connectivity/source/commontools/sqlerror.cxx b/connectivity/source/commontools/sqlerror.cxx
index 90cbd97..7a10ad2 100644
--- a/connectivity/source/commontools/sqlerror.cxx
+++ b/connectivity/source/commontools/sqlerror.cxx
@@ -42,6 +42,7 @@ namespace connectivity
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::makeAny;
using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::uno::Type;
/** === end UNO using === **/
@@ -58,7 +59,7 @@ namespace connectivity
class SQLError_Impl
{
public:
- SQLError_Impl( const ::comphelper::ComponentContext& _rContext );
+ SQLError_Impl( const Reference<XComponentContext> & _rxContext );
~SQLError_Impl();
// versions of the public SQLError methods which are just delegated to this impl-class
@@ -90,7 +91,7 @@ namespace connectivity
private:
::osl::Mutex m_aMutex;
- ::comphelper::ComponentContext m_aContext;
+ Reference<XComponentContext> m_aContext;
::std::auto_ptr< ::comphelper::OfficeResourceBundle > m_pResources;
bool m_bAttemptedInit;
};
@@ -99,8 +100,8 @@ namespace connectivity
//= SQLError_Impl - implementation
//====================================================================
//--------------------------------------------------------------------
- SQLError_Impl::SQLError_Impl( const ::comphelper::ComponentContext& _rContext )
- :m_aContext( _rContext )
+ SQLError_Impl::SQLError_Impl( const Reference<XComponentContext> & _rxContext )
+ :m_aContext( _rxContext )
,m_pResources( )
,m_bAttemptedInit( false )
{
@@ -278,7 +279,7 @@ namespace connectivity
::osl::MutexGuard aGuard( m_aMutex );
m_bAttemptedInit = true;
- m_pResources.reset( new ::comphelper::OfficeResourceBundle( m_aContext.getUNOContext(), "sdberr" ) );
+ m_pResources.reset( new ::comphelper::OfficeResourceBundle( m_aContext, "sdberr" ) );
return m_pResources.get() != NULL;
}
@@ -286,8 +287,8 @@ namespace connectivity
//= SQLError
//====================================================================
//--------------------------------------------------------------------
- SQLError::SQLError( const ::comphelper::ComponentContext& _rContext )
- :m_pImpl( new SQLError_Impl( _rContext ) )
+ SQLError::SQLError( const Reference<XComponentContext> & _rxContext )
+ :m_pImpl( new SQLError_Impl( _rxContext ) )
{
}
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx
index b5f4640..9b220dc 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.cxx
@@ -519,7 +519,7 @@ void OEvoabResultSet::construct( const QueryData& _rData )
case eFilterNone:
if ( !isLocal( pBook ) )
{
- SQLError aErrorFactory( m_pConnection->getDriver().getMSFactory() );
+ SQLError aErrorFactory( comphelper::getComponentContext(m_pConnection->getDriver().getMSFactory()) );
SQLException aAsException = aErrorFactory.getSQLException( ErrorCondition::DATA_CANNOT_SELECT_UNFILTERED, *this );
m_aWarnings.appendWarning( SQLWarning(
aAsException.Message,
diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx
index 47525d2..9c9c8ed 100644
--- a/connectivity/source/drivers/mork/MConnection.cxx
+++ b/connectivity/source/drivers/mork/MConnection.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/sdbc/TransactionIsolation.hpp>
#include <comphelper/officeresourcebundle.hxx>
+#include <comphelper/processfactory.hxx>
using namespace dbtools;
@@ -382,7 +383,7 @@ void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Refer
if ( _rError.getErrorCondition() != 0 )
{
- SQLError aErrorHelper( getDriver()->getFactory() );
+ SQLError aErrorHelper( comphelper::getComponentContext(getDriver()->getFactory()) );
::rtl::OUString sParameter( _rError.getParameter() );
if ( !sParameter.isEmpty() )
aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter );
diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx
index 5ccf57b..af6d57b 100644
--- a/connectivity/source/drivers/mozab/MConnection.cxx
+++ b/connectivity/source/drivers/mozab/MConnection.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/sdbc/TransactionIsolation.hpp>
#include <comphelper/officeresourcebundle.hxx>
+#include <comphelper/processfactory.hxx>
#if OSL_DEBUG_LEVEL > 0
# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
@@ -571,7 +572,7 @@ void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Refer
if ( _rError.getErrorCondition() != 0 )
{
- SQLError aErrorHelper( getDriver()->getMSFactory() );
+ SQLError aErrorHelper( comphelper::getComponentContext(getDriver()->getMSFactory()) );
::rtl::OUString sParameter( _rError.getParameter() );
if ( !sParameter.isEmpty() )
aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter );
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 73fd510..ae9f3f1 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -571,7 +571,7 @@ bool OSQLParseNode::impl_parseTableNameNodeToString_throw( ::rtl::OUStringBuffer
}
else
{
- SQLError aErrors( ::comphelper::getProcessServiceFactory() );
+ SQLError aErrors( ::comphelper::getProcessComponentContext() );
aErrors.raiseException( sdb::ErrorCondition::PARSER_CYCLIC_SUB_QUERIES );
}
}
@@ -1263,7 +1263,7 @@ OSQLParseNode* OSQLParser::predicateTree(::rtl::OUString& rErrorMessage, const :
OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const IParseContext* _pContext)
:m_pContext(_pContext)
,m_pParseTree(NULL)
- ,m_pData( new OSQLParser_Data( uno::Reference<lang::XMultiServiceFactory>(rxContext->getServiceManager(), uno::UNO_QUERY_THROW) ) )
+ ,m_pData( new OSQLParser_Data( rxContext ) )
,m_nFormatKey(0)
,m_nDateFormatKey(0)
,m_xContext(rxContext)
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 8b4087d..e9a12da 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -91,7 +91,7 @@ ORowSetBase::ORowSetBase( const ::comphelper::ComponentContext& _rContext, ::cpp
,m_rBHelper(_rBHelper)
,m_pEmptyCollection( NULL )
,m_aContext( _rContext )
- ,m_aErrors( _rContext )
+ ,m_aErrors( _rContext.getUNOContext() )
,m_nLastColumnIndex(-1)
,m_nDeletedPosition(-1)
,m_nResultSetType( ResultSetType::FORWARD_ONLY )
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index 204cee0..20a535f 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -69,7 +69,7 @@ OContentHelper::OContentHelper(const Reference< XMultiServiceFactory >& _xORB
,m_aPropertyChangeListeners(m_aMutex)
,m_xParentContainer(_xParentContainer)
,m_aContext( _xORB )
- ,m_aErrorHelper( m_aContext )
+ ,m_aErrorHelper( m_aContext.getUNOContext() )
,m_pImpl(_pImpl)
,m_nCommandId(0)
{
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 54cda92..311263d 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -34,6 +34,7 @@
#include "datasource.hxx"
#include <comphelper/classids.hxx>
#include <comphelper/mimeconfighelper.hxx>
+#include <comphelper/processfactory.hxx>
#include <connectivity/sqlerror.hxx>
#include "core_resource.hxx"
#include "core_resource.hrc"
@@ -66,8 +67,8 @@ class LocalNameApproval : public IContainerApprove
::connectivity::SQLError m_aErrors;
public:
- LocalNameApproval( const Reference< XMultiServiceFactory >& _rxFactory )
- :m_aErrors( ::comphelper::ComponentContext( _rxFactory ) )
+ LocalNameApproval( const Reference< XComponentContext >& _rxContext )
+ :m_aErrors( _rxContext )
{
}
virtual ~LocalNameApproval()
@@ -105,7 +106,7 @@ ODocumentContainer::ODocumentContainer(const Reference< XMultiServiceFactory >&
registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED,
&m_pImpl->m_aProps.aTitle, ::getCppuType(&m_pImpl->m_aProps.aTitle));
- setElementApproval( PContainerApprove( new LocalNameApproval ( _xORB ) ) );
+ setElementApproval( PContainerApprove( new LocalNameApproval ( comphelper::getComponentContext(_xORB) ) ) );
}
ODocumentContainer::~ODocumentContainer()
diff --git a/dbaccess/source/sdbtools/connection/objectnames.cxx b/dbaccess/source/sdbtools/connection/objectnames.cxx
index a4c1e5e..edad066 100644
--- a/dbaccess/source/sdbtools/connection/objectnames.cxx
+++ b/dbaccess/source/sdbtools/connection/objectnames.cxx
@@ -108,7 +108,7 @@ namespace sdbtools
if ( validateName( _rName ) )
return;
- ::connectivity::SQLError aErrors( m_aContext );
+ ::connectivity::SQLError aErrors( m_aContext.getUNOContext() );
SQLException aError( aErrors.getSQLException( ErrorCondition::DB_OBJECT_NAME_IS_USED, m_xConnection, _rName ) );
::dbtools::DatabaseMetaData aMeta( m_xConnection );
@@ -162,7 +162,7 @@ namespace sdbtools
if ( validateName( _rName ) )
return;
- ::connectivity::SQLError aErrors( m_aContext );
+ ::connectivity::SQLError aErrors( m_aContext.getUNOContext() );
aErrors.raiseException( ErrorCondition::DB_INVALID_SQL_NAME, m_xConnection, _rName );
}
};
@@ -211,7 +211,7 @@ namespace sdbtools
::connectivity::ErrorCondition nErrorCondition = validateName_getErrorCondition( _rName );
if ( nErrorCondition != 0 )
{
- ::connectivity::SQLError aErrors( m_aContext );
+ ::connectivity::SQLError aErrors( m_aContext.getUNOContext() );
aErrors.raiseException( nErrorCondition, m_xConnection );
}
}
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index cb84668..659ff0f 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -449,7 +449,7 @@ void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int
// ensure we're connected
if ( !isConnected() )
{
- SQLError aError( getORB() );
+ SQLError aError( comphelper::getComponentContext(getORB()) );
aError.raiseException( ErrorCondition::DB_NOT_CONNECTED, *this );
}
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index ccd75ae..fc7237e 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -697,7 +697,7 @@ void SbaXDataBrowserController::onStartLoading( const Reference< XLoadable >& _r
// -----------------------------------------------------------------------------
void SbaXDataBrowserController::impl_checkForCannotSelectUnfiltered( const SQLExceptionInfo& _rError )
{
- ::connectivity::SQLError aError( getORB() );
+ ::connectivity::SQLError aError( comphelper::getComponentContext(getORB()) );
::connectivity::ErrorCode nErrorCode( aError.getErrorCode( ErrorCondition::DATA_CANNOT_SELECT_UNFILTERED ) );
if ( ((const SQLException*)_rError)->ErrorCode == nErrorCode )
{
commit 9fc4553b6433fbb6565a5b946c4256c0bfe345f1
Author: Noel Grandin <noel at peralex.com>
Date: Thu Dec 6 16:37:57 2012 +0200
fdo#46808, Adapt sdbc::DriverManager UNO service to new style
Change-Id: Ic2be6bd08aaabc81d0fbe0269ca577868defe934
diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx
index fb1ff42..1fd66e9 100644
--- a/connectivity/inc/connectivity/dbtools.hxx
+++ b/connectivity/inc/connectivity/dbtools.hxx
@@ -716,7 +716,7 @@ namespace dbtools
The URL used to connect to the database.
@param _xConnection
The connection used to find the correct driver.
- @param _rxFactory
+ @param _rxContext
Used to create the drivermanager.
@return
The datadefintion object.
@@ -724,7 +724,7 @@ namespace dbtools
OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> getDataDefinitionByURLAndConnection(
const ::rtl::OUString& _rsUrl,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
/** returns the table privileges to the given parameters
@param _xMetaData
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index d9cc23c..06aed4e 100644
--- a/connectivity/source/commontools/dbmetadata.cxx
+++ b/connectivity/source/commontools/dbmetadata.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
#include <com/sun/star/sdbc/XDriverAccess.hpp>
+#include <com/sun/star/sdbc/DriverManager.hpp>
#include <tools/diagnose_ex.h>
#include <comphelper/namedvaluecollection.hxx>
@@ -67,6 +68,8 @@ namespace dbtools
using ::com::sun::star::sdbcx::XUsersSupplier;
using ::com::sun::star::sdbcx::XDataDefinitionSupplier;
using ::com::sun::star::sdbc::XDriverAccess;
+ using ::com::sun::star::sdbc::DriverManager;
+ using ::com::sun::star::sdbc::XDriverManager2;
using ::com::sun::star::uno::UNO_SET_THROW;
/** === end UNO using === **/
namespace BooleanComparisonMode = ::com::sun::star::sdb::BooleanComparisonMode;
@@ -376,8 +379,7 @@ namespace dbtools
if ( !xUsersSupp.is() )
{
// - or at the driver manager
- Reference< XDriverAccess > xDriverManager(
- _rContext.createComponent( "com.sun.star.sdbc.DriverManager" ), UNO_QUERY_THROW );
+ Reference< XDriverManager2 > xDriverManager = DriverManager::create( _rContext.getUNOContext() );
Reference< XDataDefinitionSupplier > xDriver( xDriverManager->getDriverByURL( m_pImpl->xConnectionMetaData->getURL() ), UNO_QUERY );
if ( xDriver.is() )
xUsersSupp.set( xDriver->getDataDefinitionByConnection( m_pImpl->xConnection ), UNO_QUERY );
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index 4092e9e..acfb227 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/DriverManager.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
@@ -636,14 +637,12 @@ sal_Bool isDataSourcePropertyEnabled(const Reference<XInterface>& _xProp,const :
Reference< XTablesSupplier> getDataDefinitionByURLAndConnection(
const ::rtl::OUString& _rsUrl,
const Reference< XConnection>& _xConnection,
- const Reference< XMultiServiceFactory>& _rxFactory)
+ const Reference< XComponentContext >& _rxContext)
{
Reference< XTablesSupplier> xTablesSup;
try
{
- Reference< XDriverAccess> xManager(
- _rxFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.DriverManager")) ),
- UNO_QUERY_THROW );
+ Reference< XDriverManager2 > xManager = DriverManager::create( _rxContext );
Reference< XDataDefinitionSupplier > xSupp( xManager->getDriverByURL( _rsUrl ), UNO_QUERY );
if ( xSupp.is() )
diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx
index 68b5448..b7d0abd 100644
--- a/connectivity/source/cpool/ZPoolCollection.cxx
+++ b/connectivity/source/cpool/ZPoolCollection.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/reflection/ProxyFactory.hpp>
+#include <com/sun/star/sdbc/DriverManager.hpp>
#include <comphelper/extract.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -75,9 +76,7 @@ OPoolCollection::OPoolCollection(const Reference< XMultiServiceFactory >& _rxF
:m_xServiceFactory(_rxFactory)
{
// bootstrap all objects supporting the .sdb.Driver service
- m_xManager = Reference< XDriverManager >(m_xServiceFactory->createInstance(::rtl::OUString("com.sun.star.sdbc.DriverManager") ), UNO_QUERY);
- m_xDriverAccess = Reference< XDriverAccess >(m_xManager, UNO_QUERY);
- OSL_ENSURE(m_xDriverAccess.is(), "have no (or an invalid) driver manager!");
+ m_xManager = DriverManager::create( comphelper::getComponentContext(m_xServiceFactory) );
m_xProxyFactory = ProxyFactory::create( comphelper::getComponentContext(m_xServiceFactory) );
@@ -277,20 +276,17 @@ sal_Bool OPoolCollection::isPoolingEnabledByUrl(const ::rtl::OUString& _sUrl,
Reference< XInterface >& _rxDriverNode)
{
sal_Bool bEnabled = sal_False;
- if (m_xDriverAccess.is())
+ _rxDriver = m_xManager->getDriverByURL(_sUrl);
+ if (_rxDriver.is() && isPoolingEnabled())
{
- _rxDriver = m_xDriverAccess->getDriverByURL(_sUrl);
- if (_rxDriver.is() && isPoolingEnabled())
- {
- Reference< XServiceInfo > xSerivceInfo(_rxDriver,UNO_QUERY);
- OSL_ENSURE(xSerivceInfo.is(),"Each driver should have a XServiceInfo interface!");
+ Reference< XServiceInfo > xSerivceInfo(_rxDriver,UNO_QUERY);
+ OSL_ENSURE(xSerivceInfo.is(),"Each driver should have a XServiceInfo interface!");
- if(xSerivceInfo.is())
- {
- // look for the implementation name of the driver
- _rsImplName = xSerivceInfo->getImplementationName();
- bEnabled = isDriverPoolingEnabled(_rsImplName,_rxDriverNode);
- }
+ if(xSerivceInfo.is())
+ {
+ // look for the implementation name of the driver
+ _rsImplName = xSerivceInfo->getImplementationName();
+ bEnabled = isDriverPoolingEnabled(_rsImplName,_rxDriverNode);
}
}
return bEnabled;
diff --git a/connectivity/source/cpool/ZPoolCollection.hxx b/connectivity/source/cpool/ZPoolCollection.hxx
index 20108fd..6fb05bb 100644
--- a/connectivity/source/cpool/ZPoolCollection.hxx
+++ b/connectivity/source/cpool/ZPoolCollection.hxx
@@ -22,6 +22,7 @@
#include <cppuhelper/implbase4.hxx>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/sdbc/XDriverManager2.hpp>
#include <com/sun/star/sdbc/XConnectionPool.hpp>
#include <com/sun/star/sdbc/XPooledConnection.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -65,8 +66,7 @@ namespace connectivity
::osl::Mutex m_aMutex;
OConnectionPools m_aPools; // the driver pools
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverManager > m_xManager;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverAccess > m_xDriverAccess;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverManager2 > m_xManager;
::com::sun::star::uno::Reference< ::com::sun::star::reflection::XProxyFactory > m_xProxyFactory;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xConfigNode; // config node for generel connection pooling
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> m_xDesktop;
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 471d67b..a805bfc 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -22,6 +22,7 @@
#include <osl/diagnose.h>
#include "connectivity/dbexception.hxx"
#include <com/sun/star/configuration/theDefaultProvider.hpp>
+#include <com/sun/star/sdbc/DriverManager.hpp>
#include <com/sun/star/sdbc/XDriverAccess.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -130,10 +131,8 @@ namespace connectivity
if ( !m_xDriver.is() )
{
::rtl::OUString sURL("jdbc:hsqldb:db");
- Reference<XDriverAccess> xDriverAccess(m_xFactory->createInstance(::rtl::OUString("com.sun.star.sdbc.DriverManager") ),UNO_QUERY);
- OSL_ENSURE(xDriverAccess.is(),"Could not load driver manager!");
- if ( xDriverAccess.is() )
- m_xDriver = xDriverAccess->getDriverByURL(sURL);
+ Reference<XDriverManager2> xDriverAccess = DriverManager::create( comphelper::getComponentContext(m_xFactory) );
+ m_xDriver = xDriverAccess->getDriverByURL(sURL);
}
return m_xDriver;
diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx
index 941f47c..600a985 100644
--- a/connectivity/source/drivers/mysql/YDriver.cxx
+++ b/connectivity/source/drivers/mysql/YDriver.cxx
@@ -21,9 +21,11 @@
#include "mysql/YCatalog.hxx"
#include <osl/diagnose.h>
#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/processfactory.hxx>
#include "connectivity/dbexception.hxx"
#include <connectivity/dbcharset.hxx>
-#include <com/sun/star/sdbc/XDriverAccess.hpp>
+#include <com/sun/star/sdbc/DriverManager.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include "TConnection.hxx"
#include "resource/common_res.hrc"
#include "resource/sharedresources.hxx"
@@ -43,7 +45,7 @@ namespace connectivity
{
Reference< XInterface > SAL_CALL ODriverDelegator_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFac) throw( Exception )
{
- return *(new ODriverDelegator(_rxFac));
+ return *(new ODriverDelegator( comphelper::getComponentContext(_rxFac) ));
}
}
@@ -52,9 +54,9 @@ namespace connectivity
//= ODriverDelegator
//====================================================================
//--------------------------------------------------------------------
- ODriverDelegator::ODriverDelegator(const Reference< XMultiServiceFactory >& _rxFactory)
+ ODriverDelegator::ODriverDelegator(const Reference< XComponentContext >& _rxContext)
: ODriverDelegator_BASE(m_aMutex)
- ,m_xFactory(_rxFactory)
+ ,m_xContext(_rxContext)
{
}
@@ -140,13 +142,10 @@ namespace connectivity
return sNewUrl;
}
//--------------------------------------------------------------------
- Reference< XDriver > lcl_loadDriver(const Reference< XMultiServiceFactory >& _rxFactory,const ::rtl::OUString& _sUrl)
+ Reference< XDriver > lcl_loadDriver(const Reference< XComponentContext >& _rxContext,const ::rtl::OUString& _sUrl)
{
- Reference<XDriverAccess> xDriverAccess(_rxFactory->createInstance(::rtl::OUString("com.sun.star.sdbc.DriverManager") ),UNO_QUERY);
- OSL_ENSURE(xDriverAccess.is(),"Could not load driver manager!");
- Reference< XDriver > xDriver;
- if ( xDriverAccess.is() )
- xDriver = xDriverAccess->getDriverByURL(_sUrl);
+ Reference<XDriverManager2> xDriverAccess = DriverManager::create(_rxContext);
+ Reference< XDriver > xDriver = xDriverAccess->getDriverByURL(_sUrl);
return xDriver;
}
//--------------------------------------------------------------------
@@ -219,13 +218,13 @@ namespace connectivity
if ( eType == D_ODBC )
{
if ( !m_xODBCDriver.is() )
- m_xODBCDriver = lcl_loadDriver(m_xFactory,sCuttedUrl);
+ m_xODBCDriver = lcl_loadDriver(m_xContext,sCuttedUrl);
xDriver = m_xODBCDriver;
} // if ( bIsODBC )
else if ( eType == D_NATIVE )
{
if ( !m_xNativeDriver.is() )
- m_xNativeDriver = lcl_loadDriver(m_xFactory,sCuttedUrl);
+ m_xNativeDriver = lcl_loadDriver(m_xContext,sCuttedUrl);
xDriver = m_xNativeDriver;
}
else
@@ -236,7 +235,7 @@ namespace connectivity
TJDBCDrivers::iterator aFind = m_aJdbcDrivers.find(sDriverClass);
if ( aFind == m_aJdbcDrivers.end() )
- aFind = m_aJdbcDrivers.insert(TJDBCDrivers::value_type(sDriverClass,lcl_loadDriver(m_xFactory,sCuttedUrl))).first;
+ aFind = m_aJdbcDrivers.insert(TJDBCDrivers::value_type(sDriverClass,lcl_loadDriver(m_xContext,sCuttedUrl))).first;
xDriver = aFind->second;
}
diff --git a/connectivity/source/drivers/mysql/Yservices.cxx b/connectivity/source/drivers/mysql/Yservices.cxx
index ee2be92..ff6fe08 100644
--- a/connectivity/source/drivers/mysql/Yservices.cxx
+++ b/connectivity/source/drivers/mysql/Yservices.cxx
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list