summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--avmedia/source/framework/mediaitem.cxx3
-rw-r--r--basctl/source/basicide/moduldl2.cxx8
-rw-r--r--basebmp/test/bmpdemo.cxx16
-rw-r--r--basic/CppunitTest_basic_enable.mk1
-rw-r--r--basic/CppunitTest_basic_nested_struct.mk1
-rw-r--r--basic/source/runtime/iosys.cxx2
-rw-r--r--canvas/workben/canvasdemo.cxx16
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx3
-rw-r--r--comphelper/source/misc/mediadescriptor.cxx6
-rw-r--r--comphelper/source/misc/storagehelper.cxx3
-rw-r--r--connectivity/source/drivers/dbase/DDatabaseMetaData.cxx3
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx17
-rw-r--r--connectivity/source/drivers/file/FConnection.cxx9
-rw-r--r--connectivity/source/drivers/file/FDatabaseMetaData.cxx32
-rw-r--r--connectivity/workben/testmoz/main.cxx15
-rw-r--r--connectivity/workben/testmoz/mozthread.cxx1
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx2
-rw-r--r--cui/source/dialogs/multifil.cxx30
-rw-r--r--cui/source/options/doclinkdialog.cxx4
-rw-r--r--cui/source/options/optjava.cxx1
-rw-r--r--cui/source/options/optlingu.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx2
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationdialog.cxx24
-rw-r--r--dbaccess/source/filter/xml/dbloader2.cxx1
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx4
-rw-r--r--dbaccess/source/ui/dlg/dbfindex.cxx5
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx4
-rw-r--r--desktop/source/app/app.cxx5
-rw-r--r--desktop/source/app/appinit.cxx102
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx2
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx10
-rw-r--r--desktop/source/deployment/manager/dp_informationprovider.cxx2
-rw-r--r--desktop/source/deployment/manager/dp_manager.cxx25
-rw-r--r--desktop/source/deployment/manager/dp_properties.cxx14
-rw-r--r--desktop/source/deployment/manager/dp_properties.hxx7
-rw-r--r--desktop/source/deployment/misc/dp_descriptioninfoset.cxx2
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx5
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx8
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx18
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx6
-rw-r--r--desktop/source/deployment/registry/dp_backenddb.cxx5
-rw-r--r--desktop/source/deployment/registry/executable/dp_executable.cxx3
-rw-r--r--desktop/source/deployment/registry/help/dp_help.cxx3
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx23
-rw-r--r--desktop/source/deployment/registry/script/dp_lib_container.cxx2
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_misc.cxx14
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_shared.h14
-rw-r--r--editeng/source/misc/svxacorr.cxx4
-rw-r--r--extensions/source/bibliography/datman.cxx7
-rw-r--r--extensions/source/plugin/base/xplugin.cxx4
-rw-r--r--extensions/source/update/check/updateprotocoltest.cxx6
-rw-r--r--extensions/source/update/feed/test/updatefeedtest.cxx6
-rw-r--r--extensions/source/update/feed/updatefeed.cxx2
-rw-r--r--fileaccess/Library_fileacc.mk1
-rw-r--r--fileaccess/prj/build.lst2
-rw-r--r--fileaccess/source/FileAccess.cxx37
-rw-r--r--filter/source/msfilter/msdffimp.cxx3
-rw-r--r--filter/source/xmlfilterdetect/fdcomp.cxx50
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.cxx42
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.hxx42
-rw-r--r--forms/source/xforms/submission/submission_get.cxx2
-rw-r--r--forms/source/xforms/submission/submission_post.cxx2
-rw-r--r--forms/source/xforms/submission/submission_put.cxx2
-rw-r--r--fpicker/source/office/fpsmartcontent.cxx2
-rw-r--r--fpicker/source/office/iodlg.cxx20
-rw-r--r--framework/inc/services.h1
-rw-r--r--framework/inc/services/autorecovery.hxx4
-rw-r--r--framework/source/loadenv/loadenv.cxx4
-rw-r--r--framework/source/services/autorecovery.cxx6
-rw-r--r--hwpfilter/source/hwpreader.hxx23
-rw-r--r--linguistic/source/convdiclist.cxx5
-rw-r--r--linguistic/source/misc.cxx2
-rw-r--r--linguistic/source/misc2.cxx3
-rw-r--r--lotuswordpro/source/filter/LotusWordProImportFilter.cxx3
-rw-r--r--odk/examples/DevelopersGuide/UCB/Helper.java10
-rw-r--r--odk/examples/java/Inspector/TDocSupplier.java15
-rw-r--r--offapi/com/sun/star/ucb/UniversalContentBroker.idl39
-rw-r--r--offapi/com/sun/star/ucb/XUniversalContentBroker.idl22
-rw-r--r--package/inc/ZipPackage.hxx2
-rw-r--r--package/source/zippackage/ZipPackage.cxx67
-rw-r--r--package/source/zippackage/zipfileaccess.cxx7
-rw-r--r--padmin/source/pamain.cxx29
-rw-r--r--qadevOOo/tests/java/ifc/ucb/_XSortedDynamicResultSetFactory.java2
-rw-r--r--qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java2
-rw-r--r--qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java2
-rw-r--r--qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java2
-rw-r--r--qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java2
-rw-r--r--reportdesign/source/filter/xml/dbloader2.hxx1
-rw-r--r--sc/qa/unit/ucalc.cxx2
-rw-r--r--sc/source/core/data/globalx.cxx4
-rw-r--r--sc/source/ui/docshell/docsh8.cxx9
-rw-r--r--scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java21
-rw-r--r--scripting/source/inc/util/MiscUtils.hxx4
-rw-r--r--sd/CppunitTest_sd_uimpress.mk1
-rw-r--r--sd/source/filter/eppt/epptso.cxx2
-rw-r--r--sd/source/filter/eppt/pptexsoundcollection.cxx8
-rw-r--r--sd/source/ui/dlg/TemplateScanner.cxx6
-rw-r--r--sfx2/source/appl/appinit.cxx1
-rw-r--r--sfx2/source/appl/newhelp.cxx4
-rw-r--r--sfx2/source/appl/sfxhelp.cxx3
-rw-r--r--sfx2/source/appl/xpackcreator.cxx3
-rw-r--r--sfx2/source/bastyp/helper.cxx11
-rw-r--r--sfx2/source/control/templateremoteview.cxx4
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx5
-rw-r--r--sfx2/source/doc/docfile.cxx41
-rw-r--r--sfx2/source/doc/doctempl.cxx18
-rw-r--r--sfx2/source/doc/doctemplates.cxx68
-rw-r--r--sfx2/source/doc/objstor.cxx4
-rw-r--r--sfx2/source/doc/printhelper.cxx8
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx3
-rw-r--r--slideshow/test/demoshow.cxx12
-rw-r--r--sot/source/sdstor/storage.cxx2
-rw-r--r--sot/source/sdstor/ucbstorage.cxx18
-rw-r--r--svl/qa/unit/test_URIHelper.cxx16
-rw-r--r--svl/source/fsstor/fsfactory.cxx9
-rw-r--r--svl/source/fsstor/fsstorage.cxx31
-rw-r--r--svl/source/misc/documentlockfile.cxx8
-rw-r--r--svl/source/misc/fstathelper.cxx10
-rw-r--r--svl/source/misc/sharecontrolfile.cxx2
-rw-r--r--svl/source/misc/urihelper.cxx37
-rw-r--r--svtools/CppunitTest_svtools_filters_test.mk1
-rw-r--r--svtools/langsupport/langsupport.cxx1
-rw-r--r--svtools/source/contnr/contentenumeration.cxx4
-rw-r--r--svtools/source/contnr/fileview.cxx14
-rw-r--r--svtools/source/control/inettbc.cxx3
-rw-r--r--svtools/source/dialogs/ServerDetailsControls.cxx2
-rw-r--r--svtools/source/filter/filter.cxx6
-rw-r--r--svtools/source/misc/imagemgr.cxx4
-rw-r--r--svtools/source/misc/templatefoldercache.cxx2
-rw-r--r--svx/Executable_gengal.bin.mk1
-rw-r--r--svx/source/gallery2/galbrws1.cxx4
-rw-r--r--svx/source/gallery2/gallery1.cxx10
-rw-r--r--svx/source/gallery2/galmisc.cxx10
-rw-r--r--svx/source/gallery2/galtheme.cxx4
-rw-r--r--svx/source/gengal/gengal.cxx21
-rw-r--r--svx/source/svdraw/svdoashp.cxx1
-rw-r--r--svx/source/svdraw/svdogrp.cxx2
-rw-r--r--svx/source/svdraw/svdomedia.cxx8
-rw-r--r--svx/source/svdraw/svdotxln.cxx35
-rw-r--r--svx/workben/msview/msview.cxx15
-rw-r--r--sw/source/core/unocore/swunohelper.cxx23
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx8
-rw-r--r--sw/source/ui/misc/glossary.cxx3
-rw-r--r--test/Library_subsequenttest.mk1
-rw-r--r--test/Library_test.mk1
-rw-r--r--test/source/bootstrapfixture.cxx32
-rw-r--r--ucb/Library_ucpftp1.mk1
-rw-r--r--ucb/qa/complex/tdoc/CheckContentProvider.java8
-rw-r--r--ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java2
-rw-r--r--ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java2
-rw-r--r--ucb/qa/complex/ucb/UCB.java28
-rw-r--r--ucb/source/core/ucb.cxx39
-rw-r--r--ucb/source/core/ucb.hxx1
-rw-r--r--ucb/source/ucp/expand/ucpexpand.cxx5
-rw-r--r--ucb/source/ucp/ext/ucpext_content.cxx4
-rw-r--r--ucb/source/ucp/ext/ucpext_datasupplier.cxx2
-rw-r--r--ucb/source/ucp/ftp/ftpcontentprovider.cxx24
-rw-r--r--ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java1
-rw-r--r--ucbhelper/Package_inc.mk2
-rw-r--r--ucbhelper/inc/ucbhelper/configurationkeys.hxx32
-rw-r--r--ucbhelper/inc/ucbhelper/content.hxx14
-rw-r--r--ucbhelper/inc/ucbhelper/contentbroker.hxx170
-rw-r--r--ucbhelper/inc/ucbhelper/fileidentifierconverter.hxx10
-rw-r--r--ucbhelper/source/client/content.cxx298
-rw-r--r--ucbhelper/source/client/contentbroker.cxx343
-rw-r--r--ucbhelper/source/client/fileidentifierconverter.cxx14
-rw-r--r--unotest/source/cpp/bootstrapfixturebase.cxx1
-rw-r--r--unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx1
-rw-r--r--unotools/source/ucbhelper/localfilehelper.cxx103
-rw-r--r--unotools/source/ucbhelper/tempfile.cxx50
-rw-r--r--unotools/source/ucbhelper/ucbhelper.cxx27
-rw-r--r--unotools/source/ucbhelper/ucblockbytes.cxx10
-rw-r--r--unotools/source/ucbhelper/ucbstreamhelper.cxx147
-rw-r--r--unoxml/source/dom/documentbuilder.cxx3
-rw-r--r--vcl/source/gdi/impgraph.cxx14
-rw-r--r--vcl/test/canvasbitmaptest.cxx2
-rw-r--r--vcl/workben/outdevgrind.cxx11
-rw-r--r--vcl/workben/svpclient.cxx21
-rw-r--r--wizards/com/sun/star/wizards/common/UCB.java5
-rw-r--r--writerfilter/CppunitTest_writerfilter_doctok.mk1
-rw-r--r--writerfilter/CppunitTest_writerfilter_rtftok.mk1
-rw-r--r--writerfilter/Library_writerfilter.mk1
-rw-r--r--writerfilter/Library_writerfilter_uno.mk1
-rw-r--r--writerfilter/prj/build.lst2
-rw-r--r--writerfilter/qa/cppunittests/doctok/testdoctok.cxx36
-rw-r--r--writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx146
-rw-r--r--writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx53
-rw-r--r--writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx143
-rw-r--r--writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx56
-rw-r--r--writerperfect/source/writer/MSWorksImportFilter.cxx2
-rw-r--r--writerperfect/source/writer/WordPerfectImportFilter.cxx2
-rw-r--r--xmlsecurity/tools/standalone/csfit/helper.cxx21
-rw-r--r--xmlsecurity/tools/standalone/csfit/helper.hxx2
-rw-r--r--xmlsecurity/tools/standalone/mscsfit/helper.cxx22
-rw-r--r--xmlsecurity/tools/standalone/mscsfit/helper.hxx2
-rw-r--r--xmlsecurity/workben/signaturetest.cxx15
196 files changed, 1151 insertions, 2313 deletions
diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx
index 014ea2dabc7c..591d5dba909f 100644
--- a/avmedia/source/framework/mediaitem.cxx
+++ b/avmedia/source/framework/mediaitem.cxx
@@ -444,7 +444,8 @@ bool EmbedMedia(uno::Reference<frame::XModel> const& xModel,
try
{
::ucbhelper::Content sourceContent(rSourceURL,
- uno::Reference<ucb::XCommandEnvironment>());
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext());
uno::Reference<document::XStorageBasedDocument> const xSBD(xModel,
uno::UNO_QUERY_THROW);
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 18f6bfdd2522..5500ae02a656 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -1314,7 +1314,7 @@ void LibPage::ExportAsPackage( const String& aLibName )
Reference< XCommandEnvironment > xCmdEnv =
static_cast<XCommandEnvironment*>( new OLibCommandEnvironment( xHandler ) );
- ::ucbhelper::Content sourceContent( aSourcePath, xCmdEnv );
+ ::ucbhelper::Content sourceContent( aSourcePath, xCmdEnv, comphelper::getProcessComponentContext() );
::rtl::OUStringBuffer buf;
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.zip://") );
@@ -1328,7 +1328,7 @@ void LibPage::ExportAsPackage( const String& aLibName )
if( xSFA->exists( aPackageURL ) )
xSFA->kill( aPackageURL );
- ::ucbhelper::Content destFolderContent( destFolder, xCmdEnv );
+ ::ucbhelper::Content destFolderContent( destFolder, xCmdEnv, comphelper::getProcessComponentContext() );
destFolderContent.transferContent(
sourceContent, ::ucbhelper::InsertOperation_COPY,
OUString(), NameClash::OVERWRITE );
@@ -1369,10 +1369,10 @@ void LibPage::ExportAsPackage( const String& aLibName )
true, INetURLObject::LAST_SEGMENT, true, INetURLObject::ENCODE_ALL );
// write buffered pipe data to content:
- ::ucbhelper::Content manifestContent( aMetaInfInetObj.GetMainURL( INetURLObject::NO_DECODE ), xCmdEnv );
+ ::ucbhelper::Content manifestContent( aMetaInfInetObj.GetMainURL( INetURLObject::NO_DECODE ), xCmdEnv, comphelper::getProcessComponentContext() );
manifestContent.writeStream( Reference<io::XInputStream>( xPipe, UNO_QUERY_THROW ), true );
- ::ucbhelper::Content MetaInfContent( aMetaInfFolder, xCmdEnv );
+ ::ucbhelper::Content MetaInfContent( aMetaInfFolder, xCmdEnv, comphelper::getProcessComponentContext() );
destFolderContent.transferContent(
MetaInfContent, ::ucbhelper::InsertOperation_COPY,
OUString(), NameClash::OVERWRITE );
diff --git a/basebmp/test/bmpdemo.cxx b/basebmp/test/bmpdemo.cxx
index 8ea327089550..18f4cab399ac 100644
--- a/basebmp/test/bmpdemo.cxx
+++ b/basebmp/test/bmpdemo.cxx
@@ -28,9 +28,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
-
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
@@ -1222,17 +1220,13 @@ void TestApp::Main()
exit( 1 );
}
- // Create UCB.
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= rtl::OUString(UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= rtl::OUString(UCB_CONFIGURATION_KEY2_OFFICE );
- ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
+ // Create UCB (for backwards compatibility, in case some code still uses
+ // plain createInstance w/o args directly to obtain an instance):
+ ::ucb::UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() );
TestWindow pWindow;
pWindow.Execute();
-
- // clean up UCB
- ::ucbhelper::ContentBroker::deinitialize();
}
TestApp aDemoApp;
diff --git a/basic/CppunitTest_basic_enable.mk b/basic/CppunitTest_basic_enable.mk
index b0ab5fd1498d..f6c72f5c8206 100644
--- a/basic/CppunitTest_basic_enable.mk
+++ b/basic/CppunitTest_basic_enable.mk
@@ -53,5 +53,6 @@ $(eval $(call gb_CppunitTest_use_ure,basic_enable))
$(eval $(call gb_CppunitTest_use_components,basic_enable,\
configmgr/source/configmgr \
ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
))
$(eval $(call gb_CppunitTest_use_configuration,basic_enable))
diff --git a/basic/CppunitTest_basic_nested_struct.mk b/basic/CppunitTest_basic_nested_struct.mk
index b6e421cbb499..78aee47899e3 100644
--- a/basic/CppunitTest_basic_nested_struct.mk
+++ b/basic/CppunitTest_basic_nested_struct.mk
@@ -54,6 +54,7 @@ $(eval $(call gb_CppunitTest_use_ure,basic_nested_struct))
$(eval $(call gb_CppunitTest_use_components,basic_nested_struct,\
configmgr/source/configmgr \
ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
))
$(eval $(call gb_CppunitTest_use_configuration,basic_nested_struct))
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 4ac4fa400c15..ea1b0f7c11d6 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -285,7 +285,7 @@ bool hasUno( void )
}
else
{
- Reference< XUniversalContentBroker > xManager = UniversalContentBroker::createDefault(xContext);
+ Reference< XUniversalContentBroker > xManager = UniversalContentBroker::create(xContext);
if ( !( xManager->queryContentProvider( ::rtl::OUString("file:///" ) ).is() ) )
{
diff --git a/canvas/workben/canvasdemo.cxx b/canvas/workben/canvasdemo.cxx
index 1aa919f28d40..11de6f7db9f3 100644
--- a/canvas/workben/canvasdemo.cxx
+++ b/canvas/workben/canvasdemo.cxx
@@ -35,9 +35,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
-
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
@@ -686,19 +684,15 @@ void DemoApp::Main()
exit( 1 );
}
- // Create UCB.
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= rtl::OUString(UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= rtl::OUString(UCB_CONFIGURATION_KEY2_OFFICE );
- ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
+ // Create UCB (for backwards compatibility, in case some code still uses
+ // plain createInstance w/o args directly to obtain an instance):
+ ::ucb::UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() );
InitVCL( xFactory );
TestWindow pWindow;
pWindow.Execute();
DeInitVCL();
-
- // clean up UCB
- ::ucbhelper::ContentBroker::deinitialize();
}
DemoApp aDemoApp;
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index cd6aff745e07..1e4d1f4264f5 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -46,6 +46,7 @@
#include <ucbhelper/content.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/cvtgrf.hxx>
+#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <vcl/svapp.hxx>
@@ -114,7 +115,7 @@ Reference< embed::XStorage > lcl_createStorage(
try
{
Reference< io::XStream > xStream(
- ::ucbhelper::Content( rURL, Reference< ::com::sun::star::ucb::XCommandEnvironment >()).openStream(),
+ ::ucbhelper::Content( rURL, Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext()).openStream(),
uno::UNO_QUERY );
Reference< lang::XSingleServiceFactory > xStorageFact(
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 311ff5e0dc76..dd91d9e716b5 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -353,7 +353,7 @@ sal_Bool MediaDescriptor::isStreamReadOnly() const
bReadOnly = sal_True;
else
{
- ::ucbhelper::Content aContent(xContent, css::uno::Reference< css::ucb::XCommandEnvironment >());
+ ::ucbhelper::Content aContent(xContent, css::uno::Reference< css::ucb::XCommandEnvironment >(), getProcessComponentContext());
aContent.getPropertyValue(CONTENTPROP_ISREADONLY) >>= bReadOnly;
}
}
@@ -526,7 +526,7 @@ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference
xSeek->seek( 0 );
// a content for the URL
- ::ucbhelper::Content aContent( sURL, xCommandEnv );
+ ::ucbhelper::Content aContent( sURL, xCommandEnv, getProcessComponentContext() );
// use post command
css::ucb::PostCommandArgument2 aPostArgument;
@@ -579,7 +579,7 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const ::rtl::OUString& sURL, s
css::uno::Reference< css::ucb::XContent > xContent;
try
{
- aContent = ::ucbhelper::Content(sURL, xCommandEnv);
+ aContent = ::ucbhelper::Content(sURL, xCommandEnv, getProcessComponentContext());
xContent = aContent.get();
}
catch(const css::uno::RuntimeException&)
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index 785d4b26dea2..e4a1048622c7 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -141,7 +141,8 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromURL2(
uno::Reference< lang::XSingleServiceFactory > xFact;
try {
::ucbhelper::Content aCntnt( aURL,
- uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > (),
+ getProcessComponentContext() );
if (aCntnt.isDocument()) {
xFact = GetStorageFactory( xFactory );
} else {
diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
index f453e9b20bc2..9cd9613a082d 100644
--- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
@@ -30,6 +30,7 @@
#include "dbase/DIndex.hxx"
#include "connectivity/FValue.hxx"
#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
#include <comphelper/types.hxx>
#include <ucbhelper/content.hxx>
#include <rtl/logfile.hxx>
@@ -378,7 +379,7 @@ sal_Bool SAL_CALL ODbaseDatabaseMetaData::isReadOnly( ) throw(SQLException, Run
sal_Bool bReadOnly = sal_False;
static ::rtl::OUString sReadOnly( "IsReadOnly" );
- ::ucbhelper::Content aFile(m_pConnection->getContent(),Reference< XCommandEnvironment >());
+ ::ucbhelper::Content aFile(m_pConnection->getContent(),Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
aFile.getPropertyValue(sReadOnly) >>= bReadOnly;
return bReadOnly;
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 9bd6c0e868fc..28d4436931ec 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -29,6 +29,7 @@
#include <tools/config.hxx>
#include "dbase/DIndex.hxx"
#include "dbase/DIndexes.hxx"
+#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <svl/zforlist.hxx>
#include <unotools/syslocale.hxx>
@@ -694,7 +695,7 @@ void ODbaseTable::refreshIndexes()
aURL.setName(rtl::OStringToOUString(aIndexName, m_eEncoding));
try
{
- Content aCnt(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aCnt(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
if (aCnt.isDocument())
{
aVector.push_back(aURL.getBase());
@@ -1051,7 +1052,7 @@ sal_Bool ODbaseTable::CreateImpl()
try
{
- Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
if (aContent.isDocument())
{
// Only if the file exists with length > 0 raise an error
@@ -1078,7 +1079,7 @@ sal_Bool ODbaseTable::CreateImpl()
{
try
{
- Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
aContent.executeCommand( rtl::OUString("delete"),bool2any( sal_True ) );
}
catch(const Exception&) // an exception is thrown when no file exists
@@ -1091,7 +1092,7 @@ sal_Bool ODbaseTable::CreateImpl()
{
String aExt = aURL.getExtension();
aURL.setExtension(rtl::OUString("dbt")); // extension for memo file
- Content aMemo1Content(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aMemo1Content(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
sal_Bool bMemoAlreadyExists = sal_False;
try
@@ -1106,7 +1107,7 @@ sal_Bool ODbaseTable::CreateImpl()
aURL.setExtension(aExt); // kill dbf file
try
{
- Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
aMemoContent.executeCommand( rtl::OUString("delete"),bool2any( sal_True ) );
}
catch(const Exception&)
@@ -1122,7 +1123,7 @@ sal_Bool ODbaseTable::CreateImpl()
if (!CreateMemoFile(aURL))
{
aURL.setExtension(aExt); // kill dbf file
- Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
aMemoContent.executeCommand( rtl::OUString("delete"),bool2any( sal_True ) );
return sal_False;
}
@@ -1460,7 +1461,7 @@ sal_Bool ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMem
// as the inf file does not necessarily exist, we aren't allowed to use UCBContentHelper::Kill
try
{
- ::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment > () );
+ ::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
aDeleteContent.executeCommand( ::rtl::OUString("delete"), makeAny( sal_Bool( sal_True ) ) );
}
catch(const Exception&)
@@ -2319,7 +2320,7 @@ namespace
try
{
- Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
Sequence< PropertyValue > aProps( 1 );
aProps[0].Name = ::rtl::OUString("Title");
diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx
index 4aa2cffc1242..2fa26d5b3a95 100644
--- a/connectivity/source/drivers/file/FConnection.cxx
+++ b/connectivity/source/drivers/file/FConnection.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "sal/config.h"
+
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/typeprovider.hxx>
#include "file/FConnection.hxx"
#include "file/FDatabaseMetaData.hxx"
@@ -157,7 +160,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
::ucbhelper::Content aFile;
try
{
- aFile = ::ucbhelper::Content(getURL(),Reference< XCommandEnvironment >());
+ aFile = ::ucbhelper::Content(getURL(), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
}
catch(ContentCreationException& e)
{
@@ -182,7 +185,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
Reference<XContentIdentifier> xIdent = xParent->getIdentifier();
m_xContent = xParent;
- ::ucbhelper::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >());
+ ::ucbhelper::Content aParent(xIdent->getContentIdentifier(), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
m_xDir = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
}
else
@@ -398,7 +401,7 @@ Reference< XDynamicResultSet > OConnection::getDir() const
try
{
Reference<XContentIdentifier> xIdent = getContent()->getIdentifier();
- ::ucbhelper::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >());
+ ::ucbhelper::Content aParent(xIdent->getContentIdentifier(), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
xContent = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
}
catch(Exception&)
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index 61998d2a23aa..86ea5f2b1c9c 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -24,18 +24,17 @@
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#include <com/sun/star/ucb/SearchRecursion.hpp>
#include <com/sun/star/ucb/SearchCommandArgument.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <tools/urlobj.hxx>
#include "file/FDriver.hxx"
#include "file/FTable.hxx"
#include <comphelper/extract.hxx>
-#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
+#include <comphelper/processfactory.hxx>
#include <tools/debug.hxx>
#include <rtl/logfile.hxx>
-
+#include <ucbhelper/content.hxx>
using namespace com::sun::star::ucb;
using namespace connectivity::file;
@@ -94,14 +93,14 @@ namespace
INetURLObject aContentURL( _rFolderOrDoc );
::ucbhelper::Content aContent1;
{
- ::ucbhelper::Content aFolderOrDoc( _rFolderOrDoc, Reference< XCommandEnvironment >() );
+ ::ucbhelper::Content aFolderOrDoc( _rFolderOrDoc, Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
if ( aFolderOrDoc.isDocument() )
aContent1 = aFolderOrDoc;
else
{
aContentURL = INetURLObject( _rFolderOrDoc, INetURLObject::WAS_ENCODED );
aContentURL.Append( _rDocName );
- aContent1 = ::ucbhelper::Content( aContentURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
+ aContent1 = ::ucbhelper::Content( aContentURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
}
}
@@ -125,7 +124,7 @@ namespace
::ucbhelper::Content aContent2;
try
{
- aContent2 = ::ucbhelper::Content( aURL2.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
+ aContent2 = ::ucbhelper::Content( aURL2.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
bCanAccess = aContent2.isDocument();
}
catch( const Exception& )
@@ -144,20 +143,13 @@ namespace
Reference< XContentIdentifier > xID1 = xContent1->getIdentifier();
Reference< XContentIdentifier > xID2 = xContent2->getIdentifier();
OSL_ENSURE( xID1.is() && xID2.is(), "isCaseSensitiveParentFolder: invalid ID interfaces!" );
- if ( xID1.is() && xID2.is() )
+ if ( xID1.is() && xID2.is()
+ && ( UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() )->
+ compareContentIds( xID1, xID2 ) == 0 ) )
{
- // get a generic content provider
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- Reference< XContentProvider > xProvider;
- if ( pBroker )
- xProvider = pBroker->getContentProviderInterface();
- OSL_ENSURE( xProvider.is(), "isCaseSensitiveParentFolder: invalid content broker!" );
- if ( xProvider.is() )
- {
- if ( 0 == xProvider->compareContentIds( xID1, xID2 ) )
- // finally, we know that the folder is not case-sensitive ....
- nIsCS = 0;
- }
+ // finally, we know that the folder is not case-sensitive ....
+ nIsCS = 0;
}
}
}
diff --git a/connectivity/workben/testmoz/main.cxx b/connectivity/workben/testmoz/main.cxx
index 2faf51609b2f..10e9bc8af060 100644
--- a/connectivity/workben/testmoz/main.cxx
+++ b/connectivity/workben/testmoz/main.cxx
@@ -41,7 +41,6 @@
#include <com/sun/star/uno/Any.hxx>
#include "connectivity/sqlnode.hxx"
-#include <ucbhelper/contentbroker.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/process.h>
@@ -49,9 +48,8 @@
#include <cppuhelper/bootstrap.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/registry/XImplementationRegistration.hpp>
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
-#include <ucbhelper/content.hxx>
#include <osl/module.h>
#include <stdio.h>
@@ -76,7 +74,6 @@ using ::rtl::OUStringBuffer;
using ::rtl::OUStringToOString;
#define OUtoCStr( x ) (OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US ).getStr())
-Reference< XContentProviderManager > globalUcb;
#define PRINTSTR(x) printf("%s",x);
int autoTest(Reference<XResultSet> &xRes);
@@ -258,17 +255,13 @@ Reference< XMultiServiceFactory > InitializeFac( void )
// Create unconfigured Ucb:
- Sequence< Any > aArgs;
- ::ucb::ContentBroker::initialize( xSMgr, aArgs );
- Reference< XContentProviderManager > xUcb =
- ucb::ContentBroker::get()->getContentProviderManagerInterface();
+ Reference< XUniversalContentBroker > xUcb
+ ( xSMgr->createInstance( OUString("com.sun.star.ucb.UniversalContentBroker") ), UNO_QUERY_THROW );
Reference< XContentProvider > xFileProvider
- ( xSMgr->createInstance( OUString("com.sun.star.ucb.FileContentProvider") ), UNO_QUERY );
+ ( xSMgr->createInstance( OUString("com.sun.star.ucb.FileContentProvider") ), UNO_QUERY_THROW );
xUcb->registerContentProvider( xFileProvider, OUString("file"), sal_True );
-
- globalUcb = xUcb;
return xSMgr;
}
diff --git a/connectivity/workben/testmoz/mozthread.cxx b/connectivity/workben/testmoz/mozthread.cxx
index 00e369a79b45..738582a3bc32 100644
--- a/connectivity/workben/testmoz/mozthread.cxx
+++ b/connectivity/workben/testmoz/mozthread.cxx
@@ -41,7 +41,6 @@
#include <com/sun/star/uno/Any.hxx>
#include "connectivity/sqlnode.hxx"
-#include <ucbhelper/contentbroker.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/process.h>
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 51f83198fa31..1b7690a97632 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -138,7 +138,7 @@ void SearchThread::ImplSearch( const INetURLObject& rStartURL,
try
{
::com::sun::star::uno::Reference< XCommandEnvironment > xEnv;
- Content aCnt( rStartURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
+ Content aCnt( rStartURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext() );
Sequence< OUString > aProps( 2 );
aProps.getArray()[ 0 ] = OUString(RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ));
diff --git a/cui/source/dialogs/multifil.cxx b/cui/source/dialogs/multifil.cxx
index 3137db1dce50..847fa845bc44 100644
--- a/cui/source/dialogs/multifil.cxx
+++ b/cui/source/dialogs/multifil.cxx
@@ -26,6 +26,9 @@
*
************************************************************************/
+#include "sal/config.h"
+
+#include <comphelper/processfactory.hxx>
#include <tools/shl.hxx>
#include <vcl/msgbox.hxx>
#include <sfx2/filedlghelper.hxx>
@@ -40,8 +43,7 @@
#include <cuires.hrc>
// #97807# -------------
-#include <com/sun/star/ucb/XContentProvider.hpp>
-#include <ucbhelper/contentbroker.hxx>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
@@ -66,7 +68,7 @@ IMPL_LINK( SvxMultiFileDialog, AddHdl_Impl, PushButton *, pBtn )
// #97807# URL content comparison of entries -----------
INetURLObject aFile( aDlg.GetPath() );
String sInsFile = aFile.getFSysPath( INetURLObject::FSYS_DETECT );
- ::ucbhelper::Content aContent( aFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
+ ::ucbhelper::Content aContent( aFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
Reference< XContent > xContent = aContent.get();
OSL_ENSURE( xContent.is(), "AddHdl_Impl: invalid content interface!" );
Reference< XContentIdentifier > xID = xContent->getIdentifier();
@@ -90,7 +92,7 @@ IMPL_LINK( SvxMultiFileDialog, AddHdl_Impl, PushButton *, pBtn )
if( aCur == aFileContentMap.end() ) // look for File Content in aFileContentMap, but not find it.
{
INetURLObject aVFile( sVFile, INetURLObject::FSYS_DETECT );
- aFileContentMap[sVFile] = ::ucbhelper::Content( aVFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
+ aFileContentMap[sVFile] = ::ucbhelper::Content( aVFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
VContent = aFileContentMap.find( sVFile )->second;
}
else
@@ -99,21 +101,13 @@ IMPL_LINK( SvxMultiFileDialog, AddHdl_Impl, PushButton *, pBtn )
OSL_ENSURE( xVContent.is(), "AddHdl_Impl: invalid content interface!" );
xVID = xVContent->getIdentifier();
OSL_ENSURE( xVID.is(), "AddHdl_Impl: invalid ID interface!" );
- if ( xID.is() && xVID.is() )
+ if ( xID.is() && xVID.is()
+ && ( UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() )->
+ compareContentIds( xID, xVID ) == 0 ) )
{
- // get a generic content provider
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- Reference< XContentProvider > xProvider;
- if ( pBroker )
- xProvider = pBroker->getContentProviderInterface();
- if ( xProvider.is() )
- {
- if ( 0 == xProvider->compareContentIds( xID, xVID ) )
- {
- bDuplicated = sal_True;
- break;
- }
- }
+ bDuplicated = sal_True;
+ break;
}
}
} // end of if the entries are more than zero.
diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx
index a672523e553b..d8f68ff4efbc 100644
--- a/cui/source/options/doclinkdialog.cxx
+++ b/cui/source/options/doclinkdialog.cxx
@@ -30,7 +30,7 @@
#include "doclinkdialog.hrc"
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-
+#include <comphelper/processfactory.hxx>
#include <cuires.hrc>
#include <svl/filenotation.hxx>
#include <vcl/msgbox.hxx>
@@ -120,7 +120,7 @@ namespace svx
sal_Bool bFileExists = sal_False;
try
{
- ::ucbhelper::Content aFile(sURL, Reference< XCommandEnvironment >());
+ ::ucbhelper::Content aFile(sURL, Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
if (aFile.isDocument())
bFileExists = sal_True;
}
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index c1d6bfb9fdd0..da379c2abb0d 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -44,7 +44,6 @@
#include <sfx2/filedlghelper.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index d26f97a1fd20..bf6e37dd10b6 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -174,7 +174,7 @@ sal_Bool KillFile_Impl( const String& rURL )
sal_Bool bRet = sal_True;
try
{
- Content aCnt( rURL, uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ Content aCnt( rURL, uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
aCnt.executeCommand( OUString("delete"), makeAny( sal_Bool( sal_True ) ) );
}
catch( ::com::sun::star::ucb::CommandAbortedException& )
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 63df72b72d83..bb37110ae416 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -319,7 +319,7 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUStrin
try
{
- ::ucbhelper::Content aContent( _sURL, NULL );
+ ::ucbhelper::Content aContent( _sURL, NULL, comphelper::getProcessComponentContext() );
if ( !aContent.isDocument() )
throw InteractiveIOException(
_sURL, *this, InteractionClassification_ERROR, IOErrorCode_NO_FILE
diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
index bd759075ff59..c4826fe4628c 100644
--- a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
@@ -34,8 +34,8 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -44,7 +44,6 @@
#include <svl/filenotation.hxx>
#include <tools/diagnose_ex.h>
#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <vcl/msgbox.hxx>
#include <list>
@@ -63,6 +62,7 @@ namespace dbmm
/** === begin UNO using === **/
using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
@@ -88,17 +88,17 @@ namespace dbmm
using ::com::sun::star::lang::EventObject;
using ::com::sun::star::frame::XComponentLoader;
using ::com::sun::star::util::XModifiable;
+ using ::com::sun::star::ucb::UniversalContentBroker;
using ::com::sun::star::ucb::XCommandEnvironment;
using ::com::sun::star::ucb::XContent;
using ::com::sun::star::ucb::XContentIdentifier;
- using ::com::sun::star::ucb::XContentProvider;
/** === end UNO using === **/
//====================================================================
//= helper
//====================================================================
//--------------------------------------------------------------------
- static void lcl_getControllers_throw( const Reference< XModel2 >& _rxDocument,
+ static void lcl_getControllers_throw(const Reference< XModel2 >& _rxDocument,
::std::list< Reference< XController2 > >& _out_rControllers )
{
_out_rControllers.clear();
@@ -396,7 +396,9 @@ namespace dbmm
//--------------------------------------------------------------------
namespace
{
- bool lcl_equalURLs_nothrow( const ::rtl::OUString& _lhs, const ::rtl::OUString _rhs )
+ bool lcl_equalURLs_nothrow(
+ const Reference< XComponentContext >& context,
+ const ::rtl::OUString& _lhs, const ::rtl::OUString _rhs )
{
// the cheap situation: the URLs are equal
if ( _lhs == _rhs )
@@ -405,18 +407,14 @@ namespace dbmm
bool bEqual = true;
try
{
- ::ucbhelper::Content aContentLHS = ::ucbhelper::Content( _lhs, Reference< XCommandEnvironment >() );
- ::ucbhelper::Content aContentRHS = ::ucbhelper::Content( _rhs, Reference< XCommandEnvironment >() );
+ ::ucbhelper::Content aContentLHS = ::ucbhelper::Content( _lhs, Reference< XCommandEnvironment >(), context );
+ ::ucbhelper::Content aContentRHS = ::ucbhelper::Content( _rhs, Reference< XCommandEnvironment >(), context );
Reference< XContent > xContentLHS( aContentLHS.get(), UNO_SET_THROW );
Reference< XContent > xContentRHS( aContentRHS.get(), UNO_SET_THROW );
Reference< XContentIdentifier > xID1( xContentLHS->getIdentifier(), UNO_SET_THROW );
Reference< XContentIdentifier > xID2( xContentRHS->getIdentifier(), UNO_SET_THROW );
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- Reference< XContentProvider > xProvider(
- pBroker ? pBroker->getContentProviderInterface() : Reference< XContentProvider >(), UNO_SET_THROW );
-
- bEqual = ( 0 == xProvider->compareContentIds( xID1, xID2 ) );
+ bEqual = UniversalContentBroker::create(context)->compareContentIds( xID1, xID2 ) == 0;
}
catch( const Exception& )
{
@@ -440,7 +438,7 @@ namespace dbmm
try
{
// check that the backup location isn't the same as the document itself
- if ( lcl_equalURLs_nothrow( sBackupLocation, m_pData->xDocumentModel->getURL() ) )
+ if ( lcl_equalURLs_nothrow( m_pData->aContext.getUNOContext(), sBackupLocation, m_pData->xDocumentModel->getURL() ) )
{
ErrorBox aErrorBox( const_cast< MacroMigrationDialog* >( this ), MacroMigrationResId( ERR_INVALID_BACKUP_LOCATION ) );
aErrorBox.Execute();
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index f3ebf33738ca..bad3711e4ceb 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -67,7 +67,6 @@
#include <tools/diagnose_ex.h>
#include <ucbhelper/commandenvironment.hxx>
#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 4bf7ce20b638..26b32f24a33a 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -530,7 +530,7 @@ DBG_NAME(OConnectionHelper)
Reference< XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
try
{
- aCheckExistence = ::ucbhelper::Content(_rURL, xCmdEnv );
+ aCheckExistence = ::ucbhelper::Content(_rURL, xCmdEnv, comphelper::getProcessComponentContext());
bExists = bIsFile? aCheckExistence.isDocument(): aCheckExistence.isFolder();
eExists = bExists? PATH_EXIST: PATH_NOT_EXIST;
}
@@ -596,7 +596,7 @@ DBG_NAME(OConnectionHelper)
{
// the parent content
Reference< XCommandEnvironment > xEmptyEnv;
- ::ucbhelper::Content aParent(aParser.GetMainURL(INetURLObject::NO_DECODE), xEmptyEnv);
+ ::ucbhelper::Content aParent(aParser.GetMainURL(INetURLObject::NO_DECODE), xEmptyEnv, comphelper::getProcessComponentContext());
::rtl::OUString sContentType;
if ( INET_PROT_FILE == eProtocol )
diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx
index 9dd99164ef6f..8e5dce8294cd 100644
--- a/dbaccess/source/ui/dlg/dbfindex.cxx
+++ b/dbaccess/source/ui/dlg/dbfindex.cxx
@@ -18,6 +18,7 @@
*/
#include "dbfindex.hxx"
+#include <comphelper/processfactory.hxx>
#include <tools/config.hxx>
#include <sfx2/app.hxx>
#include "moduledbu.hxx"
@@ -298,7 +299,7 @@ void ODbaseIndexDialog::Init()
sal_Bool bFolder=sal_True;
try
{
- aFile = ::ucbhelper::Content(m_aDSN,Reference< ::com::sun::star::ucb::XCommandEnvironment >());
+ aFile = ::ucbhelper::Content(m_aDSN,Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext());
bFolder = aFile.isFolder();
}
catch(Exception&)
@@ -489,7 +490,7 @@ void OTableInfo::WriteInfFile( const String& rDSN ) const
{
try
{
- ::ucbhelper::Content aContent(aURL.GetURLNoPass(),Reference<XCommandEnvironment>());
+ ::ucbhelper::Content aContent(aURL.GetURLNoPass(),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
aContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),makeAny( sal_Bool( sal_True ) ) );
}
catch (const Exception& e )
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 6f61a4bbf7af..578e6e054113 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -68,6 +68,7 @@
#include "dlgattr.hrc"
#include "TypeInfo.hxx"
#include "FieldDescriptions.hxx"
+#include <comphelper/processfactory.hxx>
#include <comphelper/stl_types.hxx>
#include <comphelper/componentcontext.hxx>
@@ -1228,7 +1229,8 @@ namespace
try
{
::ucbhelper::Content aCnt( INetURLObject( _rURL ).GetMainURL( INetURLObject::NO_DECODE ),
- Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
if ( ( aCnt.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorName")) ) >>= sAnchor ) )
{
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 7208345650d3..1781d66b1e1a 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -94,7 +94,6 @@
#include <sfx2/app.hxx>
#include <svl/itemset.hxx>
#include <svl/eitem.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <svtools/fontsubstconfig.hxx>
#include <svtools/accessibilityoptions.hxx>
@@ -1769,10 +1768,6 @@ int Desktop::doShutdown()
pExecGlobals->pPathOptions.reset( 0 );
RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- dispose path/language options" );
- RTL_LOGFILE_CONTEXT_TRACE( aLog, "-> deinit ucb" );
- ::ucbhelper::ContentBroker::deinitialize();
- RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- deinit ucb" );
-
sal_Bool bRR = pExecGlobals->bRestartRequested;
delete pExecGlobals, pExecGlobals = NULL;
diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx
index 4b33cb29fa6d..64a882959468 100644
--- a/desktop/source/app/appinit.cxx
+++ b/desktop/source/app/appinit.cxx
@@ -42,18 +42,16 @@
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
-#include <com/sun/star/ucb/XContentProviderFactory.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
+#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
#include <uno/current_context.hxx>
#include <cppuhelper/servicefactory.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <osl/file.hxx>
#include <osl/module.h>
-#include <osl/security.hxx>
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/bootstrap.hxx>
-#include <ucbhelper/configurationkeys.hxx>
#include <tools/rcid.h>
@@ -63,7 +61,6 @@
#include <unotools/localfilehelper.hxx>
#include <unotools/ucbhelper.hxx>
#include <unotools/tempfile.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <vcl/svapp.hxx>
#include <unotools/startoptions.hxx>
#include <unotools/pathoptions.hxx>
@@ -84,83 +81,34 @@ namespace desktop
// -----------------------------------------------------------------------------
-static bool configureUcb()
+static void configureUcb()
{
RTL_LOGFILE_CONTEXT( aLog, "desktop (sb93797) ::configureUcb" );
- Reference< XMultiServiceFactory >
- xServiceFactory( comphelper::getProcessServiceFactory() );
- if (!xServiceFactory.is())
- {
- OSL_FAIL("configureUcb(): No XMultiServiceFactory");
- return false;
- }
-
- rtl::OUString aPipe;
- osl::Security().getUserIdent(aPipe);
-
- rtl::OUStringBuffer aPortal;
- Sequence< Any > aArgs(2);
- aArgs[0]
- <<= rtl::OUString(UCB_CONFIGURATION_KEY1_LOCAL);
- aArgs[1]
- <<= rtl::OUString(UCB_CONFIGURATION_KEY2_OFFICE);
-
- bool ret =
- ::ucbhelper::ContentBroker::initialize( xServiceFactory, aArgs ) != false;
+ // For backwards compatibility, in case some code still uses plain
+ // createInstance w/o args directly to obtain an instance:
+ UniversalContentBroker::create(comphelper::getProcessComponentContext());
#ifdef GNOME_VFS_ENABLED
- // register GnomeUCP if necessary
- ::ucbhelper::ContentBroker* cb = ::ucbhelper::ContentBroker::get();
- if(cb)
+ // Instantiate GNOME-VFS UCP in the thread that initialized GNOME in order
+ // to avoid a deadlock that may occure in case the UCP gets initialized from
+ // a different thread (which may happen when calling remotely via UNO); this
+ // is not a fix, just a workaround:
+ Reference< XCurrentContext > xCurrentContext(getCurrentContext());
+ Any aValue(xCurrentContext->getValueByName("system.desktop-environment"));
+ OUString aDesktopEnvironment;
+ if ((aValue >>= aDesktopEnvironment) && aDesktopEnvironment == "GNOME")
{
- try
- {
- Reference< XCurrentContext > xCurrentContext(
- getCurrentContext());
- if (xCurrentContext.is())
- {
- Any aValue = xCurrentContext->getValueByName(
- rtl::OUString( "system.desktop-environment" )
- );
- rtl::OUString aDesktopEnvironment;
- if ( (aValue >>= aDesktopEnvironment) && aDesktopEnvironment == "GNOME" )
- {
- Reference<XContentProviderManager> xCPM =
- cb->getContentProviderManagerInterface();
-
-
- //Instanciate GNOME-VFS-UCP in the thread that initialized
- // GNOME in order to avoid a deadlock that may occure in case UCP gets initialized from
- // a different thread. The latter may happen when calling the Office remotely via UNO.
- // THIS IS NOT A FIX, JUST A WORKAROUND!
-
- try
- {
- Reference<XContentProvider> xCP(
- xServiceFactory->createInstance(
- rtl::OUString(
- "com.sun.star.ucb.GnomeVFSContentProvider")),
- UNO_QUERY);
- if(xCP.is())
- xCPM->registerContentProvider(
- xCP,
- rtl::OUString(".*"),
- false);
- }
- catch (...)
- {
- }
- }
- }
- }
- catch (const RuntimeException &)
- {
- }
+ UniversalContentBroker::create(
+ comphelper::getProcessComponentContext())->
+ registerContentProvider(
+ Reference<XContentProvider>(
+ comphelper::getProcessServiceFactory()->createInstance(
+ "com.sun.star.ucb.GnomeVFSContentProvider"),
+ UNO_QUERY_THROW),
+ ".*", false);
}
#endif // GNOME_VFS_ENABLED
-
- return ret;
}
Reference< XMultiServiceFactory > Desktop::CreateApplicationServiceManager()
@@ -228,11 +176,7 @@ void Desktop::RegisterServices()
createAcceptor(*i);
}
- if ( !configureUcb() )
- {
- OSL_FAIL( "Can't configure UCB" );
- throw com::sun::star::uno::Exception(rtl::OUString("RegisterServices, configureUcb"), NULL);
- }
+ configureUcb();
CreateTemporaryDirectory();
m_bServicesRegistered = true;
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index 7795e3093cc3..323778d4c642 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -875,7 +875,7 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv
uno::Any anyTitle;
try
{
- anyTitle = ::ucbhelper::Content( rPackageURL, rCmdEnv.get() ).getPropertyValue( OUSTR("Title") );
+ anyTitle = ::ucbhelper::Content( rPackageURL, rCmdEnv.get(), m_xContext ).getPropertyValue( OUSTR("Title") );
}
catch ( const uno::Exception & )
{
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index b3c21b4db52e..de78275bb205 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -112,12 +112,12 @@ OUString CompIdentifiers::getName(::std::vector<Reference<deploy::XPackage> > co
return extension->getDisplayName();
}
-void writeLastModified(OUString & url, Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+void writeLastModified(OUString & url, Reference<ucb::XCommandEnvironment> const & xCmdEnv, Reference< uno::XComponentContext > const & xContext)
{
//Write the lastmodified file
try {
::rtl::Bootstrap::expandMacros(url);
- ::ucbhelper::Content ucbStamp(url, xCmdEnv );
+ ::ucbhelper::Content ucbStamp(url, xCmdEnv, xContext);
dp_misc::erase_path( url, xCmdEnv );
::rtl::OString stamp("1" );
Reference<css::io::XInputStream> xData(
@@ -589,7 +589,7 @@ bool ExtensionManager::doChecksForAddExtension(
}
//Prevent showing the license if requested.
Reference<ucb::XCommandEnvironment> _xCmdEnv(xCmdEnv);
- ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>());
+ ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>(), m_xContext);
dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL()));
const ::boost::optional<dp_misc::SimpleLicenseAttributes> licenseAttributes =
@@ -1315,10 +1315,10 @@ sal_Bool ExtensionManager::synchronize(
}
OUString lastSyncBundled(RTL_CONSTASCII_USTRINGPARAM(
"$BUNDLED_EXTENSIONS_USER/lastsynchronized"));
- writeLastModified(lastSyncBundled, xCmdEnv);
+ writeLastModified(lastSyncBundled, xCmdEnv, m_xContext);
OUString lastSyncShared(RTL_CONSTASCII_USTRINGPARAM(
"$SHARED_EXTENSIONS_USER/lastsynchronized"));
- writeLastModified(lastSyncShared, xCmdEnv);
+ writeLastModified(lastSyncShared, xCmdEnv, m_xContext);
return bModified;
} catch ( const deploy::DeploymentException& ) {
throw;
diff --git a/desktop/source/deployment/manager/dp_informationprovider.cxx b/desktop/source/deployment/manager/dp_informationprovider.cxx
index 14f5bfa396fc..c0c7498b634f 100644
--- a/desktop/source/deployment/manager/dp_informationprovider.cxx
+++ b/desktop/source/deployment/manager/dp_informationprovider.cxx
@@ -163,7 +163,7 @@ PackageInformationProvider::getPackageLocation( const rtl::OUString& _sExtension
}
if ( !aLocationURL.isEmpty() )
{
- ::ucbhelper::Content aContent( aLocationURL, NULL );
+ ::ucbhelper::Content aContent( aLocationURL, NULL, mxContext );
aLocationURL = aContent.getURL();
}
return aLocationURL;
diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
index c07109bbe78d..ae34f2e67b91 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -101,9 +101,10 @@ struct MatchTempDir
namespace {
OUString getExtensionFolder(OUString const & parentFolder,
- Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv,
+ Reference<uno::XComponentContext> const & xContext)
{
- ::ucbhelper::Content tempFolder( parentFolder, xCmdEnv );
+ ::ucbhelper::Content tempFolder( parentFolder, xCmdEnv, xContext );
Reference<sdbc::XResultSet> xResultSet(
StrTitle::createCursor (tempFolder, ::ucbhelper::INCLUDE_FOLDERS_ONLY ) );
@@ -147,7 +148,7 @@ void PackageManagerImpl::initActivationLayer(
::ucbhelper::Content sourceContent(
Reference<XContentAccess>(
xResultSet, UNO_QUERY_THROW )->queryContent(),
- xCmdEnv );
+ xCmdEnv, m_xComponentContext );
OUString mediaType( detectMediaType( sourceContent,
false /* no throw */) );
@@ -193,7 +194,7 @@ void PackageManagerImpl::initActivationLayer(
// clean up activation layer, scan for zombie temp dirs:
ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() );
- ::ucbhelper::Content tempFolder( m_activePackages_expanded, xCmdEnv );
+ ::ucbhelper::Content tempFolder( m_activePackages_expanded, xCmdEnv, m_xComponentContext );
Reference<sdbc::XResultSet> xResultSet(
StrTitle::createCursor (tempFolder,
::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) );
@@ -265,7 +266,7 @@ void PackageManagerImpl::initActivationLayer(
::osl::Security aSecurity;
aSecurity.getUserName( aUserName );
ucbhelper::Content remFileContent(
- url + OUSTR("removed"), Reference<XCommandEnvironment>());
+ url + OUSTR("removed"), Reference<XCommandEnvironment>(), m_xComponentContext);
::rtl::ByteSequence data = dp_misc::readFile(remFileContent);
::rtl::OString osData(reinterpret_cast<const sal_Char*>(data.getConstArray()),
data.getLength());
@@ -646,7 +647,7 @@ OUString PackageManagerImpl::insertToActivationLayer(
}
buf.append( static_cast<sal_Unicode>('/') );
sourceContent = ::ucbhelper::Content(
- buf.makeStringAndClear(), xCmdEnv );
+ buf.makeStringAndClear(), xCmdEnv, m_xComponentContext );
}
if (! destFolderContent.transferContent(
sourceContent, ::ucbhelper::InsertOperation_COPY,
@@ -667,7 +668,7 @@ OUString PackageManagerImpl::insertToActivationLayer(
dbData->version = info.getVersion();
//No write the properties file next to the extension
- ExtensionProperties props(sFolderUrl, properties, xCmdEnv);
+ ExtensionProperties props(sFolderUrl, properties, xCmdEnv, m_xComponentContext);
props.write();
return destFolder;
}
@@ -773,7 +774,7 @@ Reference<deployment::XPackage> PackageManagerImpl::addPackage(
OUSTR("UCB transferContent() failed!"), 0 );
// set media-type:
::ucbhelper::Content docContent(
- makeURL( m_context, title_enc ), xCmdEnv );
+ makeURL( m_context, title_enc ), xCmdEnv, m_xComponentContext );
//TODO #i73136#: using title instead of id can lead to
// clashes, but the whole m_activePackages.getLength()==0
// case (i.e., document-relative deployment) currently does
@@ -915,7 +916,7 @@ void PackageManagerImpl::removePackage(
OSL_ASSERT(!val.temporaryName.isEmpty());
OUString url(makeURL(m_activePackages_expanded,
val.temporaryName + OUSTR("removed")));
- ::ucbhelper::Content contentRemoved(url, xCmdEnv );
+ ::ucbhelper::Content contentRemoved(url, xCmdEnv, m_xComponentContext);
OUString aUserName;
::osl::Security aSecurity;
aSecurity.getUserName( aUserName );
@@ -1332,7 +1333,7 @@ bool PackageManagerImpl::synchronizeAddedExtensions(
NULL, m_activePackages_expanded, Reference<css::ucb::XCommandEnvironment>(), false))
return bModified;
- ::ucbhelper::Content tempFolder( m_activePackages_expanded, xCmdEnv );
+ ::ucbhelper::Content tempFolder( m_activePackages_expanded, xCmdEnv, m_xComponentContext );
Reference<sdbc::XResultSet> xResultSet(
StrTitle::createCursor( tempFolder,
::ucbhelper::INCLUDE_FOLDERS_ONLY ) );
@@ -1381,7 +1382,7 @@ bool PackageManagerImpl::synchronizeAddedExtensions(
continue;
sExtFolder = getExtensionFolder(
m_activePackages_expanded +
- OUString(OUSTR("/")) + titleEncoded + OUSTR("_"), xCmdEnv);
+ OUString(OUSTR("/")) + titleEncoded + OUSTR("_"), xCmdEnv, m_xComponentContext);
url = makeURLAppendSysPathSegment(m_activePackages_expanded, title);
url = makeURLAppendSysPathSegment(url, sExtFolder);
}
@@ -1416,7 +1417,7 @@ bool PackageManagerImpl::synchronizeAddedExtensions(
dp_misc::getDescriptionInfoset(url);
::boost::optional<dp_misc::SimpleLicenseAttributes>
attr = info.getSimpleLicenseAttributes();
- ExtensionProperties props(url,xCmdEnv);
+ ExtensionProperties props(url, xCmdEnv, m_xComponentContext);
bool bNoLicense = false;
if (attr && attr->suppressIfRequired && props.isSuppressedLicense())
bNoLicense = true;
diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx
index 4f11eeadca90..aa1b4c5ebfc5 100644
--- a/desktop/source/deployment/manager/dp_properties.cxx
+++ b/desktop/source/deployment/manager/dp_properties.cxx
@@ -55,8 +55,9 @@ namespace dp_manager {
//Reading the file
ExtensionProperties::ExtensionProperties(
OUString const & urlExtension,
- Reference<ucb::XCommandEnvironment> const & xCmdEnv) :
- m_xCmdEnv(xCmdEnv)
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv,
+ Reference<uno::XComponentContext> const & xContext) :
+ m_xCmdEnv(xCmdEnv), m_xContext(xContext)
{
m_propFileUrl = urlExtension + OUSTR("properties");
@@ -64,7 +65,7 @@ ExtensionProperties::ExtensionProperties(
if (! dp_misc::create_ucb_content(NULL, m_propFileUrl, 0, false))
return;
- ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv);
+ ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv, m_xContext);
dp_misc::readProperties(props, contentProps);
typedef ::std::list< ::std::pair< OUString, OUString> >::const_iterator CI;
@@ -79,8 +80,9 @@ ExtensionProperties::ExtensionProperties(
ExtensionProperties::ExtensionProperties(
OUString const & urlExtension,
uno::Sequence<css::beans::NamedValue> const & properties,
- Reference<ucb::XCommandEnvironment> const & xCmdEnv) :
- m_xCmdEnv(xCmdEnv)
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv,
+ Reference<uno::XComponentContext> const & xContext) :
+ m_xCmdEnv(xCmdEnv), m_xContext(xContext)
{
m_propFileUrl = urlExtension + OUSTR("properties");
@@ -120,7 +122,7 @@ OUString ExtensionProperties::getPropertyValue(css::beans::NamedValue const & v)
}
void ExtensionProperties::write()
{
- ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv);
+ ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv, m_xContext);
::rtl::OUStringBuffer buf;
if (m_prop_suppress_license)
diff --git a/desktop/source/deployment/manager/dp_properties.hxx b/desktop/source/deployment/manager/dp_properties.hxx
index 3e85adf5b7a0..25a0594114da 100644
--- a/desktop/source/deployment/manager/dp_properties.hxx
+++ b/desktop/source/deployment/manager/dp_properties.hxx
@@ -41,6 +41,7 @@ class ExtensionProperties
protected:
::rtl::OUString m_propFileUrl;
const css::uno::Reference<css::ucb::XCommandEnvironment> m_xCmdEnv;
+ const css::uno::Reference<css::uno::XComponentContext> m_xContext;
::boost::optional< ::rtl::OUString> m_prop_suppress_license;
::boost::optional< ::rtl::OUString> m_prop_extension_update;
@@ -49,11 +50,13 @@ public:
virtual ~ExtensionProperties() {};
ExtensionProperties(::rtl::OUString const & urlExtension,
- css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
+ css::uno::Reference<css::uno::XComponentContext> const & xContext);
ExtensionProperties(::rtl::OUString const & urlExtension,
css::uno::Sequence<css::beans::NamedValue> const & properties,
- css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
+ css::uno::Reference<css::uno::XComponentContext> const & xContext);
void write();
diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
index c63744bba0cb..48054bd77102 100644
--- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
+++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
@@ -201,7 +201,7 @@ ExtensionDescription::ExtensionDescription(
Reference<css::ucb::XCommandEnvironment> xFilter =
static_cast<css::ucb::XCommandEnvironment*>(
new FileDoesNotExistFilter(xCmdEnv));
- ::ucbhelper::Content descContent(sDescriptionUri, xFilter);
+ ::ucbhelper::Content descContent(sDescriptionUri, xFilter, xContext);
//throws an com::sun::star::uno::Exception if the file is not available
Reference<css::io::XInputStream> xIn;
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index 9ec87c0f123f..f8ca15915d15 100644
--- a/desktop/source/deployment/misc/dp_ucb.cxx
+++ b/desktop/source/deployment/misc/dp_ucb.cxx
@@ -38,7 +38,7 @@
#include "com/sun/star/ucb/CommandFailedException.hpp"
#include "com/sun/star/ucb/ContentInfo.hpp"
#include "com/sun/star/ucb/ContentInfoAttribute.hpp"
-
+#include "comphelper/processfactory.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -63,7 +63,8 @@ bool create_ucb_content(
// raise no such file dialogs, else no interaction for
// passwords, ...? xxx todo
::ucbhelper::Content ucbContent(
- url, Reference<XCommandEnvironment>() );
+ url, Reference<XCommandEnvironment>(),
+ comphelper::getProcessComponentContext() );
ucbContent.isFolder();
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 1243087297b7..52bc86b89612 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -448,7 +448,7 @@ void BackendImpl::initServiceRdbFiles()
{
const Reference<XCommandEnvironment> xCmdEnv;
- ::ucbhelper::Content cacheDir( getCachePath(), xCmdEnv );
+ ::ucbhelper::Content cacheDir( getCachePath(), xCmdEnv, m_xComponentContext );
::ucbhelper::Content oldRDB;
// switch common rdb:
if (!m_commonRDB_orig.isEmpty())
@@ -697,7 +697,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString name;
if (!bRemoved)
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ ::ucbhelper::Content ucbContent( url, xCmdEnv, m_xComponentContext );
name = StrTitle::getTitle( ucbContent );
}
@@ -1004,7 +1004,7 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
buf2.getLength() ) ) );
::ucbhelper::Content ucb_content(
makeURL( getCachePath(), getPlatformString() + OUSTR("rc") ),
- xCmdEnv );
+ xCmdEnv, m_xComponentContext );
ucb_content.writeStream( xData, true /* replace existing */ );
}
for (t_stringlist::iterator i(m_components.begin());
@@ -1035,7 +1035,7 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
reinterpret_cast<sal_Int8 const *>(buf.getStr()),
buf.getLength() ) ) );
::ucbhelper::Content ucb_content(
- makeURL( getCachePath(), OUSTR("unorc") ), xCmdEnv );
+ makeURL( getCachePath(), OUSTR("unorc") ), xCmdEnv, m_xComponentContext );
ucb_content.writeStream( xData, true /* replace existing */ );
m_unorc_modified = false;
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index b0fb42597a43..c1019bacefe4 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -349,11 +349,11 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString name;
if (!bRemoved)
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ ::ucbhelper::Content ucbContent( url, xCmdEnv, m_xComponentContext );
name = StrTitle::getTitle( ucbContent );
}
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ ::ucbhelper::Content ucbContent( url, xCmdEnv, m_xComponentContext );
if (subType.EqualsIgnoreCaseAscii(
"vnd.sun.star.configuration-data"))
{
@@ -483,7 +483,7 @@ void BackendImpl::configmgrini_flush(
reinterpret_cast<sal_Int8 const *>(buf.getStr()),
buf.getLength() ) ) );
::ucbhelper::Content ucb_content(
- makeURL( getCachePath(), OUSTR("configmgr.ini") ), xCmdEnv );
+ makeURL( getCachePath(), OUSTR("configmgr.ini") ), xCmdEnv, m_xComponentContext );
ucb_content.writeStream( xData, true /* replace existing */ );
m_configmgrini_modified = false;
@@ -616,10 +616,10 @@ OUString encodeForXml( OUString const & text )
//______________________________________________________________________________
OUString replaceOrigin(
- OUString const & url, OUString const & destFolder, Reference< XCommandEnvironment > const & xCmdEnv, bool & out_replaced)
+ OUString const & url, OUString const & destFolder, Reference< XCommandEnvironment > const & xCmdEnv, Reference< XComponentContext > const & xContext, bool & out_replaced)
{
// looking for %origin%:
- ::ucbhelper::Content ucb_content( url, xCmdEnv );
+ ::ucbhelper::Content ucb_content( url, xCmdEnv, xContext );
::rtl::ByteSequence bytes( readFile( ucb_content ) );
::rtl::ByteSequence filtered( bytes.getLength() * 2,
::rtl::BYTESEQ_NODEFAULT );
@@ -694,7 +694,7 @@ OUString replaceOrigin(
newUrl = destFolder + url.copy(i);
}
- ucbhelper::Content(newUrl, xCmdEnv).writeStream(
+ ucbhelper::Content(newUrl, xCmdEnv, xContext).writeStream(
xmlscript::createInputStream(filtered), true);
out_replaced = true;
return newUrl;
@@ -726,7 +726,7 @@ void BackendImpl::PackageImpl::processPackage_(
{
const OUString sModFolder = that->createFolder(OUString(), xCmdEnv);
bool out_replaced = false;
- url = replaceOrigin(url, sModFolder, xCmdEnv, out_replaced);
+ url = replaceOrigin(url, sModFolder, xCmdEnv, that->getComponentContext(), out_replaced);
if (out_replaced)
data.dataUrl = sModFolder;
else
@@ -783,7 +783,7 @@ void BackendImpl::PackageImpl::processPackage_(
const OUString sModFolder = that->createFolder(OUString(), xCmdEnv);
bool out_replaced = false;
url_replaced = replaceOrigin(
- url2, sModFolder, xCmdEnv, out_replaced);
+ url2, sModFolder, xCmdEnv, that->getComponentContext(), out_replaced);
if (out_replaced)
data.dataUrl = sModFolder;
else
@@ -799,7 +799,7 @@ void BackendImpl::PackageImpl::processPackage_(
{
::ucbhelper::Content(
makeURL( that->getCachePath(), OUSTR("registry") ),
- xCmdEnv ).executeCommand(
+ xCmdEnv, that->getComponentContext() ).executeCommand(
OUSTR("delete"), Any( true /* delete physically */ ) );
}
catch(const Exception&)
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index a3979bcad890..023430c72764 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -270,7 +270,7 @@ void PackageRegistryBackend::deleteUnusedFolders(
{
const OUString sDataFolder = makeURL(getCachePath(), relUrl);
::ucbhelper::Content tempFolder(
- sDataFolder, Reference<ucb::XCommandEnvironment>());
+ sDataFolder, Reference<ucb::XCommandEnvironment>(), m_xComponentContext);
Reference<sdbc::XResultSet> xResultSet(
StrTitle::createCursor( tempFolder, ::ucbhelper::INCLUDE_FOLDERS_ONLY ) );
@@ -578,8 +578,8 @@ void Package::exportTo(
if (m_bRemoved)
throw deployment::ExtensionRemovedException();
- ::ucbhelper::Content destFolder( destFolderURL, xCmdEnv );
- ::ucbhelper::Content sourceContent( getURL(), xCmdEnv );
+ ::ucbhelper::Content destFolder( destFolderURL, xCmdEnv, getMyBackend()->getComponentContext() );
+ ::ucbhelper::Content sourceContent( getURL(), xCmdEnv, getMyBackend()->getComponentContext() );
if (! destFolder.transferContent(
sourceContent, ::ucbhelper::InsertOperation_COPY,
newTitle, nameClashAction ))
diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx
index 4616c2a82aee..4c1105036210 100644
--- a/desktop/source/deployment/registry/dp_backenddb.cxx
+++ b/desktop/source/deployment/registry/dp_backenddb.cxx
@@ -70,7 +70,7 @@ void BackendDb::save()
const Reference<css::io::XInputStream> xData(
::xmlscript::createInputStream(bytes));
- ::ucbhelper::Content ucbDb(m_urlDb, 0);
+ ::ucbhelper::Content ucbDb(m_urlDb, 0, m_xContext);
ucbDb.writeStream(xData, true /*replace existing*/);
}
@@ -86,7 +86,8 @@ css::uno::Reference<css::xml::dom::XDocument> BackendDb::getDocument()
if (err == ::osl::File::E_None)
{
::ucbhelper::Content descContent(
- m_urlDb, css::uno::Reference<css::ucb::XCommandEnvironment>());
+ m_urlDb, css::uno::Reference<css::ucb::XCommandEnvironment>(),
+ m_xContext);
Reference<css::io::XInputStream> xIn = descContent.openStream();
m_doc = xDocBuilder->parse(xIn);
}
diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx
index 17c056d6443b..f8006532f36d 100644
--- a/desktop/source/deployment/registry/executable/dp_executable.cxx
+++ b/desktop/source/deployment/registry/executable/dp_executable.cxx
@@ -187,7 +187,8 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString name;
if (!bRemoved)
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ ::ucbhelper::Content ucbContent(
+ url, xCmdEnv, getComponentContext() );
name = StrTitle::getTitle( ucbContent );
}
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.executable"))
diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx
index ba3b785b3673..b094d20ec523 100644
--- a/desktop/source/deployment/registry/help/dp_help.cxx
+++ b/desktop/source/deployment/registry/help/dp_help.cxx
@@ -203,7 +203,8 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString name;
if (!bRemoved)
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ ::ucbhelper::Content ucbContent(
+ url, xCmdEnv, getComponentContext() );
name = StrTitle::getTitle( ucbContent );
}
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index ea4e345b22cd..cd1fd3066c42 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -437,7 +437,8 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString name;
if (!bRemoved)
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ ::ucbhelper::Content ucbContent(
+ url, xCmdEnv, getComponentContext() );
name = StrTitle::getTitle( ucbContent );
}
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.package-bundle")) {
@@ -589,7 +590,8 @@ OUString BackendImpl::PackageImpl::getTextFromURL(
{
try
{
- ::ucbhelper::Content descContent(licenseUrl, xCmdEnv);
+ ::ucbhelper::Content descContent(
+ licenseUrl, xCmdEnv, getMyBackend()->getComponentContext());
::rtl::ByteSequence seq = dp_misc::readFile(descContent);
return OUString( reinterpret_cast<sal_Char const *>(
seq.getConstArray()), seq.getLength(), RTL_TEXTENCODING_UTF8);
@@ -1047,7 +1049,8 @@ void BackendImpl::PackageImpl::exportTo(
if (m_bRemoved)
throw deployment::ExtensionRemovedException();
- ::ucbhelper::Content sourceContent( m_url_expanded, xCmdEnv );
+ ::ucbhelper::Content sourceContent(
+ m_url_expanded, xCmdEnv, getMyBackend()->getComponentContext() );
OUString title(newTitle);
if (title.isEmpty())
sourceContent.getPropertyValue( OUSTR( "Title" ) ) >>= title;
@@ -1089,7 +1092,8 @@ void BackendImpl::PackageImpl::exportTo(
buf.append( static_cast<sal_Unicode>('/') );
OUString destFolder( buf.makeStringAndClear() );
- ::ucbhelper::Content destFolderContent( destFolder, xCmdEnv );
+ ::ucbhelper::Content destFolderContent(
+ destFolder, xCmdEnv, getMyBackend()->getComponentContext() );
{
// transfer every item of folder into zip:
Reference<sdbc::XResultSet> xResultSet(
@@ -1101,7 +1105,8 @@ void BackendImpl::PackageImpl::exportTo(
{
::ucbhelper::Content subContent(
Reference<ucb::XContentAccess>(
- xResultSet, UNO_QUERY_THROW )->queryContent(), xCmdEnv );
+ xResultSet, UNO_QUERY_THROW )->queryContent(),
+ xCmdEnv, getMyBackend()->getComponentContext() );
if (! destFolderContent.transferContent(
subContent, ::ucbhelper::InsertOperation_COPY,
OUString(), ucb::NameClash::OVERWRITE ))
@@ -1156,7 +1161,8 @@ void BackendImpl::PackageImpl::exportTo(
OUString fullPath;
if (url_.getLength() > baseURLlen)
fullPath = url_.copy( baseURLlen + 1 );
- ::ucbhelper::Content ucbContent( url_, xCmdEnv );
+ ::ucbhelper::Content ucbContent(
+ url_, xCmdEnv, getMyBackend()->getComponentContext() );
if (ucbContent.getPropertyValue(strIsFolder).get<bool>())
fullPath += OUSTR("/");
Sequence<beans::PropertyValue> attribs( 2 );
@@ -1190,7 +1196,7 @@ void BackendImpl::PackageImpl::exportTo(
// write buffered pipe data to content:
::ucbhelper::Content manifestContent(
makeURL( metainfFolderContent.getURL(), OUSTR("manifest.xml") ),
- xCmdEnv );
+ xCmdEnv, getMyBackend()->getComponentContext() );
manifestContent.writeStream(
Reference<io::XInputStream>( xPipe, UNO_QUERY_THROW ),
true /* replace existing */ );
@@ -1553,7 +1559,8 @@ void BackendImpl::PackageImpl::scanLegacyBundle(
Reference<ucb::XCommandEnvironment> const & xCmdEnv,
bool skip_registration )
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ ::ucbhelper::Content ucbContent(
+ url, xCmdEnv, getMyBackend()->getComponentContext() );
// check for platform paths:
const OUString title( StrTitle::getTitle( ucbContent ) );
diff --git a/desktop/source/deployment/registry/script/dp_lib_container.cxx b/desktop/source/deployment/registry/script/dp_lib_container.cxx
index 8240feafc7c3..bb9b968287af 100644
--- a/desktop/source/deployment/registry/script/dp_lib_container.cxx
+++ b/desktop/source/deployment/registry/script/dp_lib_container.cxx
@@ -62,7 +62,7 @@ OUString LibraryContainer::get_libname(
Reference<XComponentContext> const & xContext )
{
::xmlscript::LibDescriptor import;
- ::ucbhelper::Content ucb_content( url, xCmdEnv );
+ ::ucbhelper::Content ucb_content( url, xCmdEnv, xContext );
xml_parse( ::xmlscript::importLibrary( import ), ucb_content, xContext );
if (import.aName.isEmpty()) {
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index 52b4ab884a1b..a034828646be 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -41,11 +41,10 @@
#include "osl/file.hxx"
#include "osl/thread.hxx"
#include "tools/getprocessworkingdir.hxx"
-#include "ucbhelper/contentbroker.hxx"
-#include "ucbhelper/configurationkeys.hxx"
#include "comphelper/processfactory.hxx"
#include "unotools/configmgr.hxx"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/ucb/UniversalContentBroker.hpp"
#include "cppuhelper/bootstrap.hxx"
#include "comphelper/sequence.hxx"
#include <stdio.h>
@@ -384,15 +383,10 @@ Reference<XComponentContext> bootstrapStandAlone(
// set global process service factory used by unotools config helpers
::comphelper::setProcessServiceFactory( xServiceManager );
- // initialize the ucbhelper ucb,
- // because the package implementation uses it
- Sequence<Any> ucb_args( 2 );
- ucb_args[ 0 ] <<= OUSTR(UCB_CONFIGURATION_KEY1_LOCAL);
- ucb_args[ 1 ] <<= OUSTR(UCB_CONFIGURATION_KEY2_OFFICE);
- if (! ::ucbhelper::ContentBroker::initialize( xServiceManager, ucb_args ))
- throw RuntimeException( OUSTR("cannot initialize UCB!"), 0 );
+ // Initialize the UCB (for backwards compatibility, in case some code still
+ // uses plain createInstance w/o args directly to obtain an instance):
+ UniversalContentBroker::create( xContext );
- disposeGuard.setDeinitUCB();
return xContext;
}
diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h
index 400e2835199e..c8cdc3c51a78 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_shared.h
+++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h
@@ -35,8 +35,6 @@
#include "tools/resmgr.hxx"
#include "rtl/ustring.hxx"
#include "unotools/configmgr.hxx"
-#include "ucbhelper/contentbroker.hxx"
-
#define APP_NAME "unopkg"
@@ -126,14 +124,10 @@ bool isBootstrapVariable(sal_uInt32 * pIndex);
class DisposeGuard
{
css::uno::Reference<css::lang::XComponent> m_xComp;
- bool m_bDeinitUCB;
+
public:
- DisposeGuard(): m_bDeinitUCB(false) {}
inline ~DisposeGuard()
{
- if (m_bDeinitUCB)
- ::ucbhelper::ContentBroker::deinitialize();
-
if (m_xComp.is())
m_xComp->dispose();
}
@@ -143,12 +137,6 @@ public:
{
m_xComp = xComp;
}
-
- inline void setDeinitUCB()
- {
- m_bDeinitUCB = true;
- }
-
};
//==============================================================================
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 7729bd1f37cb..ed83e4d592aa 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2351,7 +2351,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
sal_Unicode cSlash = '/';
xub_StrLen nSlashPos = sMain.SearchBackward(cSlash);
sMain.Erase(nSlashPos);
- ::ucbhelper::Content aNewContent( sMain, uno::Reference< XCommandEnvironment > ());
+ ::ucbhelper::Content aNewContent( sMain, uno::Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
Any aAny;
TransferInfo aInfo;
aInfo.NameClash = NameClash::OVERWRITE;
@@ -2405,7 +2405,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
xDstStg = 0;
try
{
- ::ucbhelper::Content aContent ( aDest.GetMainURL( INetURLObject::DECODE_TO_IURI ), uno::Reference < XCommandEnvironment > ());
+ ::ucbhelper::Content aContent ( aDest.GetMainURL( INetURLObject::DECODE_TO_IURI ), uno::Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
aContent.executeCommand ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "delete" ) ), makeAny ( sal_Bool (sal_True ) ) );
}
catch (...)
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index 58dd7e40fabe..2b04564d3538 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -50,11 +50,6 @@
#include <com/sun/star/form/XGridColumnFactory.hpp>
#include <com/sun/star/io/XDataInputStream.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
-#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentidentifier.hxx>
#include <comphelper/container.hxx>
#include <svl/urihelper.hxx>
#include <svtools/svtabbx.hxx>
@@ -91,9 +86,7 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::lang;
-using namespace ::ucb;
#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx
index f799acae6ca1..9192f2f67252 100644
--- a/extensions/source/plugin/base/xplugin.cxx
+++ b/extensions/source/plugin/base/xplugin.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/plugin/PluginManager.hpp>
#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
#include <plugin/impl.hxx>
#include <tools/fsys.hxx>
#include <ucbhelper/content.hxx>
@@ -1039,7 +1040,8 @@ void PluginInputStream::load()
m_pContent =
new ::ucbhelper::Content(
aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI),
- uno::Reference< com::sun::star::ucb::XCommandEnvironment >()
+ uno::Reference< com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext()
);
m_pContent->openStream( static_cast< XOutputStream* >( this ) );
}
diff --git a/extensions/source/update/check/updateprotocoltest.cxx b/extensions/source/update/check/updateprotocoltest.cxx
index a1556769567f..69113b9a98c3 100644
--- a/extensions/source/update/check/updateprotocoltest.cxx
+++ b/extensions/source/update/check/updateprotocoltest.cxx
@@ -48,9 +48,9 @@ SAL_IMPLEMENT_MAIN()
// create the initial component context
uno::Reference< uno::XComponentContext > rComponentContext = cppu::defaultBootstrap_InitialComponentContext();
- // initialize UCB
- uno::Reference< uno::XUniversalContentBroker > xUCB =
- UniversalContentBroker::createWithKeys(rComponentContext, theArguments, "Local", "Office");
+ // initialize UCB (for backwards compatibility, in case some code still uses
+ // plain createInstance w/o args directly to obtain an instance):
+ com::sun::star::ucb::UniversalContentBroker::create(rComponentContext);
rtl::OUString aURL;
diff --git a/extensions/source/update/feed/test/updatefeedtest.cxx b/extensions/source/update/feed/test/updatefeedtest.cxx
index 71c0508b70aa..c2bedb087a2b 100644
--- a/extensions/source/update/feed/test/updatefeedtest.cxx
+++ b/extensions/source/update/feed/test/updatefeedtest.cxx
@@ -55,9 +55,9 @@ SAL_IMPLEMENT_MAIN()
// create the initial component context
uno::Reference< uno::XComponentContext > rComponentContext = cppu::defaultBootstrap_InitialComponentContext();
- // initialize UCB
- uno::Reference< uno::XUniversalContentBroker > xUCB =
- ucb::UniversalContentBroker::createWithKeys(rComponentContext, "Local", "Office");
+ // initialize UCB (for backwards compatibility, in case some code still uses
+ // plain createInstance w/o args directly to obtain an instance):
+ ucb::UniversalContentBroker::create(rComponentContext);
// retrieve the update information provider
uno::Reference< deployment::XUpdateInformationProvider > rUpdateInformationProvider =
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index 646e2f07236d..65016a64af66 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -408,7 +408,7 @@ UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentCo
uno::Reference< uno::XInterface > ());
uno::Reference< ucb::XUniversalContentBroker > xUniversalContentBroker =
- ucb::UniversalContentBroker::createDefault(xContext);
+ ucb::UniversalContentBroker::create(xContext);
uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder(
xml::dom::DocumentBuilder::create(xContext));
diff --git a/fileaccess/Library_fileacc.mk b/fileaccess/Library_fileacc.mk
index 88ca91d609dc..2b44b1618cc1 100644
--- a/fileaccess/Library_fileacc.mk
+++ b/fileaccess/Library_fileacc.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_Library_set_include,fileacc,\
$(eval $(call gb_Library_use_sdk_api,fileacc))
$(eval $(call gb_Library_use_libraries,fileacc,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/fileaccess/prj/build.lst b/fileaccess/prj/build.lst
index 8ec9888a16c0..41db40625d56 100644
--- a/fileaccess/prj/build.lst
+++ b/fileaccess/prj/build.lst
@@ -1,2 +1,2 @@
-fa fileaccess : unotools DESKTOP:rdbmaker tools ucbhelper LIBXSLT:libxslt NULL
+fa fileaccess : comphelper unotools DESKTOP:rdbmaker tools ucbhelper LIBXSLT:libxslt NULL
fa fileaccess\prj nmake - all fa_prj NULL
diff --git a/fileaccess/source/FileAccess.cxx b/fileaccess/source/FileAccess.cxx
index 254fea2606fe..72e964f9f94f 100644
--- a/fileaccess/source/FileAccess.cxx
+++ b/fileaccess/source/FileAccess.cxx
@@ -21,7 +21,7 @@
#include <osl/diagnose.h>
#include <uno/mapping.hxx>
-
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -294,8 +294,8 @@ void OFileAccess::transferImpl( const rtl::OUString& rSource,
}
- ucbhelper::Content aDestPath( aDestURL, mxEnvironment );
- ucbhelper::Content aSrc ( aSourceURL, mxEnvironment );
+ ucbhelper::Content aDestPath( aDestURL, mxEnvironment, comphelper::getProcessComponentContext() );
+ ucbhelper::Content aSrc ( aSourceURL, mxEnvironment, comphelper::getProcessComponentContext() );
try
{
@@ -329,7 +329,7 @@ void OFileAccess::kill( const rtl::OUString& FileURL )
{
// SfxContentHelper::Kill
INetURLObject aDeleteObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aDeleteObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aDeleteObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
try
{
aCnt.executeCommand( rtl::OUString("delete" ), makeAny( sal_Bool( sal_True ) ) );
@@ -347,7 +347,7 @@ sal_Bool OFileAccess::isFolder( const rtl::OUString& FileURL )
try
{
INetURLObject aURLObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
bRet = aCnt.isFolder();
}
catch (const Exception &) {}
@@ -358,7 +358,7 @@ sal_Bool OFileAccess::isReadOnly( const rtl::OUString& FileURL )
throw(CommandAbortedException, Exception, RuntimeException)
{
INetURLObject aURLObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
Any aRetAny = aCnt.getPropertyValue( rtl::OUString( "IsReadOnly" ) );
sal_Bool bRet = sal_False;
aRetAny >>= bRet;
@@ -369,7 +369,7 @@ void OFileAccess::setReadOnly( const rtl::OUString& FileURL, sal_Bool bReadOnly
throw(CommandAbortedException, Exception, RuntimeException)
{
INetURLObject aURLObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
Any aAny;
aAny <<= bReadOnly;
aCnt.setPropertyValue( rtl::OUString( "IsReadOnly" ), aAny );
@@ -398,7 +398,7 @@ void OFileAccess::createFolder( const rtl::OUString& NewFolderURL )
}
}
- ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo();
sal_Int32 nCount = aInfo.getLength();
@@ -451,7 +451,7 @@ sal_Int32 OFileAccess::getSize( const rtl::OUString& FileURL )
sal_Int32 nSize = 0;
sal_Int64 nTemp = 0;
INetURLObject aObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
aCnt.getPropertyValue( rtl::OUString("Size" ) ) >>= nTemp;
nSize = (sal_Int32)nTemp;
return nSize;
@@ -461,7 +461,7 @@ rtl::OUString OFileAccess::getContentType( const rtl::OUString& FileURL )
throw(CommandAbortedException, Exception, RuntimeException)
{
INetURLObject aObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
Reference< XContent > xContent = aCnt.get();
rtl::OUString aTypeStr = xContent->getContentType();
@@ -475,7 +475,7 @@ DateTime OFileAccess::getDateTimeModified( const rtl::OUString& FileURL )
DateTime aDateTime;
Reference< XCommandEnvironment > aCmdEnv;
- ucbhelper::Content aYoung( aFileObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv );
+ ucbhelper::Content aYoung( aFileObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext() );
aYoung.getPropertyValue( rtl::OUString("DateModified" ) ) >>= aDateTime;
return aDateTime;
}
@@ -490,7 +490,7 @@ Sequence< rtl::OUString > OFileAccess::getFolderContents( const rtl::OUString& F
StringList_Impl* pFiles = NULL;
INetURLObject aFolderObj( FolderURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
Reference< XResultSet > xResultSet;
Sequence< rtl::OUString > aProps(0);
@@ -562,7 +562,7 @@ Reference< XInputStream > OFileAccess::openFileRead( const rtl::OUString& FileUR
{
Reference< XInputStream > xRet;
INetURLObject aObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
Reference< XActiveDataSink > xSink = (XActiveDataSink*)(new OActiveDataSink());
@@ -606,7 +606,7 @@ Reference< XStream > OFileAccess::openFileReadWrite( const rtl::OUString& FileUR
aCmdArg <<= aArg;
INetURLObject aFileObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aFileObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aFileObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
// Be silent...
Reference< XInteractionHandler > xIH;
@@ -668,7 +668,7 @@ bool OFileAccess::createNewFile( const rtl::OUString & rParentURL,
const Reference< XInputStream >& data )
throw ( Exception )
{
- ucbhelper::Content aParentCnt( rParentURL, mxEnvironment );
+ ucbhelper::Content aParentCnt( rParentURL, mxEnvironment, comphelper::getProcessComponentContext() );
Sequence< ContentInfo > aInfo = aParentCnt.queryCreatableContentsInfo();
sal_Int32 nCount = aInfo.getLength();
@@ -729,7 +729,8 @@ void SAL_CALL OFileAccess::writeFile( const rtl::OUString& FileURL,
try
{
ucbhelper::Content aCnt(
- aURL.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ aURL.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment,
+ comphelper::getProcessComponentContext() );
try
{
@@ -775,7 +776,7 @@ sal_Bool OFileAccess::isHidden( const ::rtl::OUString& FileURL )
throw(CommandAbortedException, Exception, RuntimeException)
{
INetURLObject aURLObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
Any aRetAny = aCnt.getPropertyValue( rtl::OUString( "IsHidden" ) );
sal_Bool bRet = sal_False;
aRetAny >>= bRet;
@@ -786,7 +787,7 @@ void OFileAccess::setHidden( const ::rtl::OUString& FileURL, sal_Bool bHidden )
throw(CommandAbortedException, Exception, RuntimeException)
{
INetURLObject aURLObj( FileURL, INET_PROT_FILE );
- ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
+ ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
Any aAny;
aAny <<= bHidden;
aCnt.setPropertyValue( rtl::OUString( "IsHidden" ), aAny );
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 501d04bcb936..4a50aa9d8b98 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -125,9 +125,6 @@
#include <svx/svx3ditems.hxx>
#include <svx/svdoashp.hxx>
#include <svx/sdasaitm.hxx>
-#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
-
#include "svx/EnhancedCustomShapeTypeNames.hxx"
#include "svx/EnhancedCustomShapeGeometry.hxx"
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
diff --git a/filter/source/xmlfilterdetect/fdcomp.cxx b/filter/source/xmlfilterdetect/fdcomp.cxx
index a031a33488a5..f20ff3a617ba 100644
--- a/filter/source/xmlfilterdetect/fdcomp.cxx
+++ b/filter/source/xmlfilterdetect/fdcomp.cxx
@@ -26,42 +26,30 @@
*
************************************************************************/
-#include <stdio.h>
-#include <osl/mutex.hxx>
-#include <osl/thread.h>
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include "filterdetect.hxx"
+#include "sal/config.h"
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "sal/types.h"
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
- const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
-{
- void * pRet = 0;
- OUString implName = OUString::createFromAscii( pImplName );
- if ( pServiceManager && implName.equals(FilterDetect_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- FilterDetect_createInstance, FilterDetect_getSupportedServiceNames() ) );
+#include "filterdetect.hxx"
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
+namespace {
- return pRet;
+static cppu::ImplementationEntry const services[] = {
+ { &FilterDetect_createInstance, &FilterDetect_getImplementationName,
+ &FilterDetect_getSupportedServiceNames,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ char const * pImplName, void * pServiceManager, void * pRegistryKey)
+{
+ return cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, services);
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx
index 0e79ca4aaec0..9e7959ddf7aa 100644
--- a/filter/source/xmlfilterdetect/filterdetect.cxx
+++ b/filter/source/xmlfilterdetect/filterdetect.cxx
@@ -33,7 +33,6 @@
#include <cstring>
#include "filterdetect.hxx"
#include <osl/diagnose.h>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -47,27 +46,21 @@
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/style/XStyleLoader.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
-
#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/commandenvironment.hxx>
-#include <unotools/ucbhelper.hxx>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-
-
using rtl::OUString;
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Reference;
using com::sun::star::uno::Any;
using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
using com::sun::star::uno::Exception;
using com::sun::star::uno::RuntimeException;
-using com::sun::star::lang::XMultiServiceFactory;
using com::sun::star::io::XActiveDataSource;
using com::sun::star::io::XOutputStream;
using com::sun::star::beans::PropertyValue;
@@ -80,7 +73,6 @@ using com::sun::star::document::XImporter;
using com::sun::star::xml::sax::InputSource;
using com::sun::star::xml::sax::XDocumentHandler;
using com::sun::star::xml::sax::XParser;
-using com::sun::star::task::XInteractionHandler;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star;
@@ -167,10 +159,11 @@ bool isXMLStream(const ::rtl::OString& aHeaderStrm)
}
try
{
- Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
if (!xInStream.is())
{
- ::ucbhelper::Content aContent(sUrl,xEnv);
+ ::ucbhelper::Content aContent(
+ sUrl, Reference< com::sun::star::ucb::XCommandEnvironment >(),
+ mxCtx);
xInStream = aContent.openStream();
if (!xInStream.is())
{
@@ -189,7 +182,7 @@ bool isXMLStream(const ::rtl::OString& aHeaderStrm)
return ::rtl::OUString();
// test typedetect code
- Reference <XNameAccess> xTypeCont(mxMSF->createInstance(OUString( "com.sun.star.document.TypeDetection" )),UNO_QUERY);
+ Reference <XNameAccess> xTypeCont(mxCtx->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", mxCtx), UNO_QUERY);
Sequence < ::rtl::OUString > myTypes= xTypeCont->getElementNames();
nLength = myTypes.getLength();
@@ -270,32 +263,21 @@ void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments )
OUString FilterDetect_getImplementationName ()
- throw (RuntimeException)
{
return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.filters.XMLFilterDetect" ) );
}
#define SERVICE_NAME1 "com.sun.star.document.ExtendedTypeDetection"
-sal_Bool SAL_CALL FilterDetect_supportsService( const OUString& ServiceName )
- throw (RuntimeException)
-{
- return ServiceName == SERVICE_NAME1;
-}
-Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( )
- throw (RuntimeException)
+Sequence< OUString > FilterDetect_getSupportedServiceNames()
{
- Sequence < OUString > aRet(2);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+ Sequence < OUString > aRet(1);
+ aRet[0] = SERVICE_NAME1;
return aRet;
}
-#undef SERVICE_NAME1
-#undef SERVICE_NAME2
-Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
- throw( Exception )
+Reference< XInterface > FilterDetect_createInstance( const Reference< XComponentContext > & context)
{
- return (cppu::OWeakObject*) new FilterDetect( rSMgr );
+ return static_cast< cppu::OWeakObject * >( new FilterDetect( context ) );
}
// XServiceInfo
@@ -307,7 +289,7 @@ OUString SAL_CALL FilterDetect::getImplementationName( )
sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName )
throw (RuntimeException)
{
- return FilterDetect_supportsService( rServiceName );
+ return rServiceName == SERVICE_NAME1;
}
Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames( )
throw (RuntimeException)
diff --git a/filter/source/xmlfilterdetect/filterdetect.hxx b/filter/source/xmlfilterdetect/filterdetect.hxx
index 7dc327932be2..8c2dba8b82dc 100644
--- a/filter/source/xmlfilterdetect/filterdetect.hxx
+++ b/filter/source/xmlfilterdetect/filterdetect.hxx
@@ -31,7 +31,9 @@
#include <cppuhelper/implbase3.hxx>
-
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
enum FilterType
{
@@ -60,7 +62,7 @@ class FilterDetect : public cppu::WeakImplHelper3
protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCtx;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
@@ -86,9 +88,9 @@ protected:
public:
- FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+ FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxCtx)
- : mxMSF( rxMSF ) {}
+ : mxCtx( rxCtx ) {}
virtual ~FilterDetect() {}
@@ -126,33 +128,15 @@ public:
};
+OUString SAL_CALL FilterDetect_getImplementationName();
+com::sun::star::uno::Sequence< OUString > SAL_CALL
+FilterDetect_getSupportedServiceNames();
-::rtl::OUString FilterDetect_getImplementationName()
-
- throw ( ::com::sun::star::uno::RuntimeException );
-
-
-
-sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceName )
-
- throw ( ::com::sun::star::uno::RuntimeException );
-
-
-
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL FilterDetect_getSupportedServiceNames( )
-
- throw ( ::com::sun::star::uno::RuntimeException );
-
-
-
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-
-SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
-
- throw ( ::com::sun::star::uno::Exception );
-
-
+com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
+FilterDetect_createInstance(
+ com::sun::star::uno::Reference<
+ com::sun::star::uno::XComponentContext > const & context);
#endif
diff --git a/forms/source/xforms/submission/submission_get.cxx b/forms/source/xforms/submission/submission_get.cxx
index ed515834bfab..e7934a1bb594 100644
--- a/forms/source/xforms/submission/submission_get.cxx
+++ b/forms/source/xforms/submission/submission_get.cxx
@@ -98,7 +98,7 @@ CSubmission::SubmissionResult CSubmissionGet::submit(const CSS::uno::Reference<
aUTF8QueryURL.append(aQueryString.makeStringAndClear());
}
OUString aQueryURL = OStringToOUString(aUTF8QueryURL.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
- ucbhelper::Content aContent(aQueryURL, aEnvironment);
+ ucbhelper::Content aContent(aQueryURL, aEnvironment, comphelper::ComponentContext(m_aFactory).getUNOContext());
CSS::uno::Reference< XOutputStream > aPipe( CSS::io::Pipe::create(comphelper::ComponentContext(m_aFactory).getUNOContext()), UNO_QUERY_THROW );
aContent.openStream(aPipe);
// get reply
diff --git a/forms/source/xforms/submission/submission_post.cxx b/forms/source/xforms/submission/submission_post.cxx
index ca72e41272c1..da0d35c2f6ec 100644
--- a/forms/source/xforms/submission/submission_post.cxx
+++ b/forms/source/xforms/submission/submission_post.cxx
@@ -61,7 +61,7 @@ CSubmission::SubmissionResult CSubmissionPost::submit(const CSS::uno::Reference<
auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment));
try {
- ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment);
+ ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment, comphelper::getProcessComponentContext());
// use post command
OUString aCommandName(RTL_CONSTASCII_USTRINGPARAM("post"));
diff --git a/forms/source/xforms/submission/submission_put.cxx b/forms/source/xforms/submission/submission_put.cxx
index 8536a43d6403..e1b8d024a9a2 100644
--- a/forms/source/xforms/submission/submission_put.cxx
+++ b/forms/source/xforms/submission/submission_put.cxx
@@ -57,7 +57,7 @@ CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference<
auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment));
try {
- ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment);
+ ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment, comphelper::getProcessComponentContext());
// insert serialized data to content -> PUT
CSS::uno::Reference< XInputStream > aInStream = apSerialization->getInputStream();
diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx
index 56bb084a5afe..5de4395ed362 100644
--- a/fpicker/source/office/fpsmartcontent.cxx
+++ b/fpicker/source/office/fpsmartcontent.cxx
@@ -150,7 +150,7 @@ namespace svt
{
try
{
- m_pContent = new ::ucbhelper::Content( _rURL, m_xCmdEnv );
+ m_pContent = new ::ucbhelper::Content( _rURL, m_xCmdEnv, comphelper::getProcessComponentContext() );
m_eState = UNKNOWN;
// from now on, the state is unknown -> we cannot know for sure if the content
// is really valid (some UCP's only tell this when asking for properties, not upon
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 7b6ebe1cad24..46e2b708f506 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -30,7 +30,6 @@
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
#include <unotools/ucbhelper.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include "svtools/ehdl.hxx"
#include "svl/urihelper.hxx"
#include "unotools/pathoptions.hxx"
@@ -52,7 +51,7 @@
#include "svtools/QueryFolderName.hxx"
#include <rtl/ustring.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/ControlActions.hpp>
@@ -273,17 +272,11 @@ namespace
//=================================================================
try
{
- // get the content provider manager
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- Reference< XContentProviderManager > xProviderManager;
- if ( pBroker )
- xProviderManager = pBroker->getContentProviderManagerInterface();
-
- //=================================================================
// get the provider for the current scheme
- Reference< XContentProvider > xProvider;
- if ( xProviderManager.is() )
- xProvider = xProviderManager->queryContentProvider( _rForURL );
+ Reference< XContentProvider > xProvider(
+ UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() )->
+ queryContentProvider( _rForURL ) );
DBG_ASSERT( xProvider.is(), "lcl_getHomeDirectory: could not find a (valid) content provider for the current URL!" );
Reference< XPropertySet > xProviderProps( xProvider, UNO_QUERY );
@@ -2072,7 +2065,8 @@ short SvtFileDialog::PrepareExecute()
INetURLObject aStdDir( GetStandardDir() );
::ucbhelper::Content aCnt( rtl::OUString( aStdDir.GetMainURL(
INetURLObject::NO_DECODE ) ),
- Reference< XCommandEnvironment >() );
+ Reference< XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
Sequence< rtl::OUString > aProps(2);
aProps[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "IsVolume" ));
aProps[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "IsRemoveable" ));
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 1e2dcce488b2..dbdd10183b9f 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -51,7 +51,6 @@ namespace framework{
#define SERVICENAME_CFGREADACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationAccess" ) // provides readonly access to the configuration
#define SERVICENAME_CONTENTHANDLER DECLARE_ASCII("com.sun.star.frame.ContentHandler" )
#define SERVICENAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.frame.ContentHandlerFactory" )
-#define SERVICENAME_UCBCONTENTBROKER DECLARE_ASCII("com.sun.star.ucb.UniversalContentBroker" )
#define SERVICENAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.task.StatusIndicatorFactory" )
#define SERVICENAME_UIINTERACTIONHANDLER DECLARE_ASCII("com.sun.star.task.InteractionHandler" )
#define SERVICENAME_JOBEXECUTOR DECLARE_ASCII("com.sun.star.task.JobExecutor" )
diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx
index 4a9495dc506b..9f7c61c681c8 100644
--- a/framework/inc/services/autorecovery.hxx
+++ b/framework/inc/services/autorecovery.hxx
@@ -1031,7 +1031,7 @@ class AutoRecovery : public css::lang::XTypeProvider
@param sURL
the url of the file, which should be removed.
*/
- static void st_impl_removeFile(const ::rtl::OUString& sURL);
+ void st_impl_removeFile(const ::rtl::OUString& sURL);
//---------------------------------------
/** try to remove ".lock" file from disc if office will be terminated
@@ -1040,7 +1040,7 @@ class AutoRecovery : public css::lang::XTypeProvider
This method has to be handled "optional". So every error inside
has to be ignored ! This method CANT FAIL ... it can forget something only .-)
*/
- static void st_impl_removeLockFile();
+ void st_impl_removeLockFile();
};
} // namespace framework
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 1b6c35aef734..6a0eb041f964 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -48,7 +48,7 @@
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -703,7 +703,7 @@ LoadEnv::EContentType LoadEnv::classifyContent(const ::rtl::OUString&
// (v) Last but not least the UCB is used inside office to
// load contents. He has a special configuration to know
// which URL schemata can be used inside office.
- css::uno::Reference< css::ucb::XContentProviderManager > xUCB(xSMGR->createInstance(SERVICENAME_UCBCONTENTBROKER), css::uno::UNO_QUERY);
+ css::uno::Reference< css::ucb::XUniversalContentBroker > xUCB(css::ucb::UniversalContentBroker::create(comphelper::ComponentContext(xSMGR).getUNOContext()));
if (xUCB->queryContentProvider(sURL).is())
return E_CAN_BE_LOADED;
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 6131fb5ce573..529060d6ec98 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3227,7 +3227,7 @@ AutoRecovery::EFailureSafeResult AutoRecovery::implts_copyFile(const ::rtl::OUSt
try
{
- aTargetContent = ::ucbhelper::Content(sTargetPath, xEnvironment);
+ aTargetContent = ::ucbhelper::Content(sTargetPath, xEnvironment, comphelper::ComponentContext(m_xSMGR).getUNOContext());
}
catch(const css::uno::Exception&)
{
@@ -3239,7 +3239,7 @@ AutoRecovery::EFailureSafeResult AutoRecovery::implts_copyFile(const ::rtl::OUSt
try
{
- ::ucbhelper::Content::create(sSource, xEnvironment, aSourceContent);
+ ::ucbhelper::Content::create(sSource, xEnvironment, comphelper::ComponentContext(m_xSMGR).getUNOContext(), aSourceContent);
aTargetContent.transferContent(aSourceContent, ::ucbhelper::InsertOperation_COPY, sTargetName, nNameClash);
}
catch(const css::uno::Exception&)
@@ -3627,7 +3627,7 @@ void AutoRecovery::st_impl_removeFile(const ::rtl::OUString& sURL)
try
{
- ::ucbhelper::Content aContent = ::ucbhelper::Content(sURL, css::uno::Reference< css::ucb::XCommandEnvironment >());
+ ::ucbhelper::Content aContent = ::ucbhelper::Content(sURL, css::uno::Reference< css::ucb::XCommandEnvironment >(), comphelper::ComponentContext(m_xSMGR).getUNOContext());
aContent.executeCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), css::uno::makeAny(sal_True));
}
catch(const css::uno::Exception&)
diff --git a/hwpfilter/source/hwpreader.hxx b/hwpfilter/source/hwpreader.hxx
index eb759d01713b..825094b7909a 100644
--- a/hwpfilter/source/hwpreader.hxx
+++ b/hwpfilter/source/hwpreader.hxx
@@ -31,14 +31,6 @@
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
-#include <com/sun/star/ucb/XContentIdentifier.hpp>
-#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
-#include <com/sun/star/ucb/OpenMode.hpp>
-#include <com/sun/star/ucb/XCommandProcessor.hpp>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XActiveDataControl.hpp>
@@ -53,7 +45,6 @@
using namespace ::rtl;
using namespace ::cppu;
-using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::io;
@@ -101,13 +92,8 @@ public:
{
m_rxDocumentHandler = xHandler;
}
- void setUCB( Reference< XInterface > xUCB )
- {
- rUCB = xUCB;
- }
private:
Reference< XDocumentHandler > m_rxDocumentHandler;
- Reference< XInterface > rUCB;
Reference< XAttributeList > rList;
AttributeListImpl *pList;
HWPFile hwpfile;
@@ -227,15 +213,6 @@ HwpImportFilter::HwpImportFilter( const Reference< XMultiServiceFactory > xFact
HwpReader *p = new HwpReader;
p->setDocumentHandler( xHandler );
- Sequence< Any > aArgs( 2 );
- aArgs[0] <<= OUString("Local");
- aArgs[1] <<= OUString("Office");
- Reference< XInterface > xUCB
- ( xFact->createInstanceWithArguments
- (OUString("com.sun.star.ucb.UniversalContentBroker"),
- aArgs));
- p->setUCB( xUCB );
-
Reference< XImporter > xImporter = Reference< XImporter >( xHandler, UNO_QUERY );
rImporter = xImporter;
Reference< XFilter > xFilter = Reference< XFilter >( p );
diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx
index 101d5830f565..0dabd641744e 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -44,7 +44,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-
+#include <comphelper/processfactory.hxx>
#include <ucbhelper/content.hxx>
#include "convdiclist.hxx"
@@ -314,7 +314,8 @@ void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName )
try
{
::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ),
- uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
aCnt.executeCommand( "delete", makeAny( sal_Bool( sal_True ) ) );
}
catch( ::com::sun::star::ucb::CommandAbortedException& )
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 1513371f44d1..89bbd8df5656 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -432,7 +432,7 @@ sal_Bool IsReadOnly( const String &rURL, sal_Bool *pbExist )
try
{
uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > xCmdEnv;
- ::ucbhelper::Content aContent( rURL, xCmdEnv );
+ ::ucbhelper::Content aContent( rURL, xCmdEnv, comphelper::getProcessComponentContext() );
bExists = aContent.isDocument();
if (bExists)
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index 40633659eec7..d4daf2d151c9 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -59,7 +59,8 @@ sal_Bool FileExists( const String &rMainURL )
try
{
::ucbhelper::Content aContent( rMainURL,
- uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >());
+ uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext());
bExists = aContent.isDocument();
}
catch (uno::Exception &)
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
index 1bfcc70796a1..548a32b2a003 100644
--- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/componentcontext.hxx>
#include <xmloff/attrlist.hxx>
#include <ucbhelper/content.hxx>
@@ -322,7 +323,7 @@ OUString SAL_CALL LotusWordProImportFilter::detect( com::sun::star::uno::Sequenc
{
try
{
- ::ucbhelper::Content aContent(sURL, xEnv);
+ ::ucbhelper::Content aContent(sURL, xEnv, comphelper::ComponentContext(mxMSF).getUNOContext());
xInputStream = aContent.openStream();
}
catch ( Exception& )
diff --git a/odk/examples/DevelopersGuide/UCB/Helper.java b/odk/examples/DevelopersGuide/UCB/Helper.java
index 103f6cddcdbd..c203904749bc 100644
--- a/odk/examples/DevelopersGuide/UCB/Helper.java
+++ b/odk/examples/DevelopersGuide/UCB/Helper.java
@@ -35,9 +35,8 @@
import java.io.File;
import java.io.FileOutputStream;
-import com.sun.star.lang.XMultiComponentFactory;
-
import com.sun.star.ucb.Command;
+import com.sun.star.ucb.UniversalContentBroker;
import com.sun.star.ucb.XContent;
import com.sun.star.ucb.XContentProvider;
import com.sun.star.ucb.XContentIdentifier;
@@ -77,11 +76,8 @@ public class Helper {
System.out.println("Connected to a running office ...");
}
- XMultiComponentFactory xMCF = m_xContext.getServiceManager();
-
- m_ucb = (XInterface)UnoRuntime.queryInterface(XInterface.class,
- xMCF.createInstanceWithContext(
- "com.sun.star.ucb.UniversalContentBroker", m_xContext));
+ m_ucb = (XInterface)UnoRuntime.queryInterface(
+ XInterface.class, UniversalContentBroker.create(m_xContext));
}
/**
diff --git a/odk/examples/java/Inspector/TDocSupplier.java b/odk/examples/java/Inspector/TDocSupplier.java
index 4d3d02538cec..c0afd57170a1 100644
--- a/odk/examples/java/Inspector/TDocSupplier.java
+++ b/odk/examples/java/Inspector/TDocSupplier.java
@@ -41,12 +41,12 @@ import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.sdbc.XRow;
import com.sun.star.ucb.Command;
+import com.sun.star.ucb.UniversalContentBroker;
import com.sun.star.ucb.XCommandProcessor;
import com.sun.star.ucb.XContent;
import com.sun.star.ucb.XContentIdentifier;
-import com.sun.star.ucb.XContentIdentifierFactory;
-import com.sun.star.ucb.XContentProvider;
import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.ucb.XUniversalContentBroker;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import javax.swing.JOptionPane;
@@ -105,14 +105,9 @@ public class TDocSupplier {
private XRow getXRowOfTDocUrl(String _sTDocUrl, String _sPropertyName){
try{
- String[] keys = new String[2];
- keys[ 0 ] = "Local";
- keys[ 1 ] = "Office";
- Object oUCB = getXMultiComponentFactory().createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", keys, getXComponentContext() );
- XContentIdentifierFactory xIdFactory = (XContentIdentifierFactory)UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB);
- XContentProvider xProvider = (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, oUCB);
- XContentIdentifier xId = xIdFactory.createContentIdentifier(_sTDocUrl);
- XContent xContent = xProvider.queryContent(xId);
+ XUniversalContentBroker xUCB = UniversalContentBroker.create( getXComponentContext() );
+ XContentIdentifier xId = xUCB.createContentIdentifier(_sTDocUrl);
+ XContent xContent = xUCB.queryContent(xId);
XCommandProcessor xCmdProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
Property aProperty = new Property();
aProperty.Name = _sPropertyName; // "DocumentModel"; //DocumentModel
diff --git a/offapi/com/sun/star/ucb/UniversalContentBroker.idl b/offapi/com/sun/star/ucb/UniversalContentBroker.idl
index 6d764341a275..04afce250300 100644
--- a/offapi/com/sun/star/ucb/UniversalContentBroker.idl
+++ b/offapi/com/sun/star/ucb/UniversalContentBroker.idl
@@ -36,20 +36,39 @@ module com { module sun { module star { module ucb {
/** is a one-instance service that provides access to a set of
<type>Content</type>s via <type>ContentProvider</type>s.
- <p>If the instance is created with two arguments of type string,
- these two strings are used to configure the newly instantiated broker;
- see the description of the required
- <type scope="com::sun::star::lang">XInitialization</type> interface for
- details.
-
- <p>If the instance is created without arguments, the newly instantiated
- broker is not configured.
+ <p>Traditionally, this service implements
+ <type scope="com::sun::star::lang">XInitialization</type> and needed to be
+ instantiated once with two arguments via
+ <method scope="com::sun::star::lang">XMultiComponentFactory::createInstanceWithArgumentsAndContext</method>
+ for configuration before it could be obtained via plain
+ <method scope="com::sun::star::lang">XMultiComponentFactory::createInstanceWithContext</method>.
+
+ <p>However, the only pair of initialization arguments used in practice is
+ <code>"Local"</code>/<code>"Office"</code>, so this service is simplified
+ now to automatically configure itself with that argument pair upon first
+ instantiation.
+
+ <p>(For backwards compatibility, the service implementation still supports
+ <type scope="com::sun::star::lang">XInitialization</type> and can still
+ explicitly be initialized via
+ <method scope="com::sun::star::lang">XMultiComponentFactory::createInstanceWithArgumentsAndContext</method>
+ with two arguments of type string. These strings are used as a pair of keys
+ to retrieve a set of content provider descriptions from the configuration
+ management (stored at
+ <code>org.openoffice.ucb.Configuration.ContentProviders.<var>key<sub>1</sub></var>.SecondaryKeys.<var>key<sub>2</sub></var>.ProviderData</code>
+ within the configuration management's hierarchy). The retrieved
+ descriptions are in turn used to register the corresponding content provider
+ services at the broker.)
*/
published service UniversalContentBroker : XUniversalContentBroker
{
- createDefault();
+ /** The (default) constructor.
- createWithKeys([in] string primaryConfigKey, [in] string secondaryConfigKey);
+ <p>(This default constructor is only mentioned explicitly for technical
+ reasons, so that its implementation calls the service implementation's
+ <method scope="com::sun::star::lang">XInitialization::initialize</method>.)
+ */
+ create();
};
diff --git a/offapi/com/sun/star/ucb/XUniversalContentBroker.idl b/offapi/com/sun/star/ucb/XUniversalContentBroker.idl
index ff0313e2fc89..7058999082df 100644
--- a/offapi/com/sun/star/ucb/XUniversalContentBroker.idl
+++ b/offapi/com/sun/star/ucb/XUniversalContentBroker.idl
@@ -25,8 +25,6 @@
#include <com/sun/star/ucb/XContentProviderManager.idl>
#include <com/sun/star/ucb/XContentProvider.idl>
#include <com/sun/star/ucb/XContentIdentifierFactory.idl>
-#include <com/sun/star/lang/XInitialization.idl>
-
module com { module sun { module star { module ucb {
@@ -75,26 +73,6 @@ published interface XUniversalContentBroker
*/
interface com::sun::star::ucb::XContentIdentifierFactory;
- /** supports the configuration of a newly created broker.
-
- <p>The
- <member scope="com::sun::star::lang">XInitialization::initialize</member>
- method should be called with two arguments of type string. These strings
- are used as a pair of keys to retrieve a set of content provider
- descriptions from the configuration management (stored at
- <code>org.openoffice.ucb.Configuration.ContentProviders.<var>key<sub>1</sub></var>.SecondaryKeys.<var>key<sub>2</sub></var>.ProviderData</code>
- within the configuration management's hierarchy). The retrieved
- descriptions are in turn used to register the corresponding content
- provider services at the broker.
-
- <p>Typical values for the pair of strings would be
- <code>"Local"</code>/<code>"Office"</code>, to configure a broker that
- contains all the relevant content providers.
-
- <p>This interface is required.
- */
- interface com::sun::star::lang::XInitialization;
-
/** Enables the caller to execute commands at the broker.
Is an enhanced version of <type>XCommandProcessor</type> that has an
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index b39ff2998403..c22976ec3e19 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -106,6 +106,8 @@ protected:
ZipPackageFolder *m_pRootFolder;
ZipFile *m_pZipFile;
+ sal_Bool isLocalFile() const;
+
void parseManifest();
void parseContentType();
void getZipFileContents();
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index bc941a61b7f3..a9c4ba0db6fd 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -49,6 +49,7 @@
#include <com/sun/star/ucb/OpenMode.hpp>
#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
@@ -65,13 +66,12 @@
#include <rtl/logfile.hxx>
#include <rtl/instance.hxx>
#include <osl/time.h>
-#include <osl/file.hxx>
#include "com/sun/star/io/XAsyncOutputMonitor.hpp"
+#include <cstring>
#include <memory>
#include <vector>
-#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/fileidentifierconverter.hxx>
#include <comphelper/componentcontext.hxx>
#include <comphelper/seekableinput.hxx>
@@ -100,37 +100,6 @@ using namespace com::sun::star::packages::zip::ZipConstants;
#define LOGFILE_AUTHOR "mg115289"
-
-namespace {
-
-sal_Bool isLocalFile_Impl( OUString aURL )
-{
- OUString aSystemPath;
- ContentBroker* pBroker = ContentBroker::get();
- if ( !pBroker )
- {
- OUString aRet;
- if ( FileBase::getSystemPathFromFileURL( aURL, aRet ) == FileBase::E_None )
- aSystemPath = aRet;
- }
- else
- {
- uno::Reference< XContentProviderManager > xManager =
- pBroker->getContentProviderManagerInterface();
- try
- {
- aSystemPath = getSystemPathFromFileURL( xManager, aURL );
- }
- catch ( Exception& )
- {
- }
- }
-
- return ( !aSystemPath.isEmpty() );
-}
-
-}
-
//===========================================================================
class ActiveDataStreamer : public ::cppu::WeakImplHelper1< XActiveDataStreamer >
@@ -203,6 +172,22 @@ ZipPackage::~ZipPackage( void )
// during m_pRootFolder dieing by refcount.
}
+sal_Bool ZipPackage::isLocalFile() const
+{
+ OUString aSystemPath;
+ uno::Reference< XUniversalContentBroker > xUcb(
+ UniversalContentBroker::create(
+ comphelper::ComponentContext( m_xFactory ).getUNOContext() ) );
+ try
+ {
+ aSystemPath = getSystemPathFromFileURL( xUcb, m_aURL );
+ }
+ catch ( Exception& )
+ {
+ }
+ return !aSystemPath.isEmpty();
+}
+
//--------------------------------------------------------
void ZipPackage::parseManifest()
{
@@ -646,7 +631,9 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
else
m_aURL = aParamUrl;
- Content aContent ( m_aURL, uno::Reference < XCommandEnvironment >() );
+ Content aContent(
+ m_aURL, uno::Reference< XCommandEnvironment >(),
+ comphelper::ComponentContext( m_xFactory ).getUNOContext() );
Any aAny = aContent.getPropertyValue("Size");
sal_uInt64 aSize = 0;
// kind of optimisation: treat empty files as nonexistent files
@@ -1153,7 +1140,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
uno::Reference < io::XOutputStream > xTempOut;
uno::Reference< io::XActiveDataStreamer > xSink;
- if ( m_eMode == e_IMode_URL && !m_pZipFile && isLocalFile_Impl( m_aURL ) )
+ if ( m_eMode == e_IMode_URL && !m_pZipFile && isLocalFile() )
{
xSink = openOriginalForOutput();
if( xSink.is() )
@@ -1331,7 +1318,9 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
{
// open and truncate the original file
- Content aOriginalContent ( m_aURL, uno::Reference < XCommandEnvironment >() );
+ Content aOriginalContent(
+ m_aURL, uno::Reference< XCommandEnvironment >(),
+ comphelper::ComponentContext( m_xFactory ).getUNOContext() );
uno::Reference< XActiveDataStreamer > xSink = new ActiveDataStreamer;
if ( m_eMode == e_IMode_URL )
@@ -1462,7 +1451,7 @@ void SAL_CALL ZipPackage::commitChanges()
uno::Reference< XOutputStream > aOrigFileStream;
sal_Bool bCanBeCorrupted = sal_False;
- if( isLocalFile_Impl( m_aURL ) )
+ if( isLocalFile() )
{
// write directly in case of local file
uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > xSimpleAccess(
@@ -1512,7 +1501,9 @@ void SAL_CALL ZipPackage::commitChanges()
throw uno::RuntimeException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
OUString sTargetFolder = m_aURL.copy ( 0, m_aURL.lastIndexOf ( static_cast < sal_Unicode > ( '/' ) ) );
- Content aContent ( sTargetFolder, uno::Reference < XCommandEnvironment > () );
+ Content aContent(
+ sTargetFolder, uno::Reference< XCommandEnvironment >(),
+ comphelper::ComponentContext( m_xFactory ).getUNOContext() );
OUString sTempURL;
Any aAny = xPropSet->getPropertyValue ("Uri");
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index 5339b84ccd2b..64f244c9d69c 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -23,7 +23,7 @@
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-
+#include <comphelper/componentcontext.hxx>
#include <zipfileaccess.hxx>
#include <ZipEnumeration.hxx>
#include <ZipPackageSink.hxx>
@@ -185,7 +185,10 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
if ( ( aArguments[0] >>= aParamURL ) )
{
- ::ucbhelper::Content aContent ( aParamURL, uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aContent(
+ aParamURL,
+ uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::ComponentContext( m_xFactory ).getUNOContext() );
uno::Reference < io::XActiveDataSink > xSink = new ZipPackageSink;
if ( aContent.openStream ( xSink ) )
{
diff --git a/padmin/source/pamain.cxx b/padmin/source/pamain.cxx
index bbfd616ed4c4..4eb997a0697e 100644
--- a/padmin/source/pamain.cxx
+++ b/padmin/source/pamain.cxx
@@ -30,12 +30,11 @@
#include "cppuhelper/bootstrap.hxx"
#include "comphelper/processfactory.hxx"
-#include "ucbhelper/contentbroker.hxx"
-#include "ucbhelper/configurationkeys.hxx"
#include "unotools/configmgr.hxx"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/ucb/UniversalContentBroker.hpp"
using namespace padmin;
using namespace cppu;
@@ -108,24 +107,9 @@ int MyApp::Main()
com::sun::star::uno::setCurrentContext(
new DesktopContext( com::sun::star::uno::getCurrentContext() ) );
- /*
- * Create UCB.
- */
- Sequence< Any > aArgs( 2 );
- aArgs[ 0 ] <<= OUString( UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= OUString( UCB_CONFIGURATION_KEY2_OFFICE );
-#if OSL_DEBUG_LEVEL > 1
- sal_Bool bSuccess =
-#endif
- ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
-
-#if OSL_DEBUG_LEVEL > 1
- if ( !bSuccess )
- {
- fprintf( stderr, "Error creating UCB, installation must be in disorder. Exiting.\n" );
- exit( 1 );
- }
-#endif
+ // Create UCB (for backwards compatibility, in case some code still uses
+ // plain createInstance w/o args directly to obtain an instance):
+ com::sun::star::ucb::UniversalContentBroker::create(xCtx);
/*
* Initialize the Java UNO AccessBridge if accessibility is turned on
@@ -148,11 +132,6 @@ int MyApp::Main()
delete pPADialog;
/*
- * clean up UCB
- */
- ::ucbhelper::ContentBroker::deinitialize();
-
- /*
* clean up UNO
*/
try
diff --git a/qadevOOo/tests/java/ifc/ucb/_XSortedDynamicResultSetFactory.java b/qadevOOo/tests/java/ifc/ucb/_XSortedDynamicResultSetFactory.java
index 688df54b7e75..ef0fdb62c174 100644
--- a/qadevOOo/tests/java/ifc/ucb/_XSortedDynamicResultSetFactory.java
+++ b/qadevOOo/tests/java/ifc/ucb/_XSortedDynamicResultSetFactory.java
@@ -74,7 +74,7 @@ public class _XSortedDynamicResultSetFactory extends MultiMethodTest {
try {
Object oUCB = xMSF.createInstanceWithArguments
("com.sun.star.ucb.UniversalContentBroker",
- new Object[] {"Local", "Office"}) ;
+ new Object[0]) ;
XContentIdentifierFactory ciFac = UnoRuntime.queryInterface
(XContentIdentifierFactory.class,oUCB) ;
diff --git a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java
index fbf6a94db84d..d55bc7db403d 100644
--- a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java
+++ b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java
@@ -102,7 +102,7 @@ public class CachedContentResultSetFactory extends TestCase {
try {
Object oUCB = xMSF.createInstanceWithArguments
("com.sun.star.ucb.UniversalContentBroker",
- new Object[] {"Local", "Office"}) ;
+ new Object[0]) ;
XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ;
diff --git a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java
index 27db3a10d8d4..b206180a6609 100644
--- a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java
+++ b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java
@@ -100,7 +100,7 @@ public class CachedContentResultSetStubFactory extends TestCase {
try {
Object oUCB = xMSF.createInstanceWithArguments
("com.sun.star.ucb.UniversalContentBroker",
- new Object[] {"Local", "Office"}) ;
+ new Object[0]) ;
XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ;
diff --git a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java
index 68e053daebb2..2f3d93cf0252 100644
--- a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java
+++ b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java
@@ -100,7 +100,7 @@ public class CachedDynamicResultSetFactory extends TestCase {
try {
Object oUCB = xMSF.createInstanceWithArguments
("com.sun.star.ucb.UniversalContentBroker",
- new Object[] {"Local", "Office"}) ;
+ new Object[0]) ;
XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ;
diff --git a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java
index af216c672a3f..f42a9ab839a1 100644
--- a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java
+++ b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java
@@ -97,7 +97,7 @@ public class CachedDynamicResultSetStubFactory extends TestCase {
try {
Object oUCB = xMSF.createInstanceWithArguments
("com.sun.star.ucb.UniversalContentBroker",
- new Object[] {"Local", "Office"}) ;
+ new Object[0]) ;
XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ;
diff --git a/reportdesign/source/filter/xml/dbloader2.hxx b/reportdesign/source/filter/xml/dbloader2.hxx
index 404a24ed24a2..b7f3b4259a1c 100644
--- a/reportdesign/source/filter/xml/dbloader2.hxx
+++ b/reportdesign/source/filter/xml/dbloader2.hxx
@@ -64,7 +64,6 @@
#include <comphelper/types.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <osl/file.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <sfx2/docfile.hxx>
#include <unotools/moduleoptions.hxx>
#include <comphelper/stl_types.hxx>
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a6d51157228c..0dd8e4ea4a22 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -81,8 +81,6 @@
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
#include <com/sun/star/sheet/GeneralFunction.hpp>
-#include <ucbhelper/contentbroker.hxx>
-
#include <iostream>
#include <vector>
diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx
index 5793a122fd07..5c00e72d893f 100644
--- a/sc/source/core/data/globalx.cxx
+++ b/sc/source/core/data/globalx.cxx
@@ -29,7 +29,6 @@
#include "callform.hxx"
#include "global.hxx"
#include <tools/urlobj.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/content.hxx>
#include <unotools/localfilehelper.hxx>
@@ -79,7 +78,8 @@ void ScGlobal::InitAddIns()
try
{
::ucbhelper::Content aCnt( aObj.GetMainURL(INetURLObject::NO_DECODE),
- Reference< XCommandEnvironment > () );
+ Reference< XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
Reference< sdbc::XResultSet > xResultSet;
Sequence< rtl::OUString > aProps;
try
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 96f0a7b83ebe..63330ba9e907 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -187,7 +187,8 @@ bool ScDocShell::MoveFile( const INetURLObject& rSourceObj, const INetURLObject&
try
{
::ucbhelper::Content aDestPath( aDestPathObj.GetMainURL(INetURLObject::NO_DECODE),
- uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
uno::Reference< ::com::sun::star::ucb::XCommandInfo > xInfo = aDestPath.getCommands();
rtl::OUString aTransferName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "transfer" ));
if ( xInfo->hasCommandByName( aTransferName ) )
@@ -220,7 +221,8 @@ bool ScDocShell::KillFile( const INetURLObject& rURL )
try
{
::ucbhelper::Content aCnt( rURL.GetMainURL(INetURLObject::NO_DECODE),
- uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
aCnt.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "delete" )),
comphelper::makeBoolAny( sal_True ) );
}
@@ -239,7 +241,8 @@ bool ScDocShell::IsDocument( const INetURLObject& rURL )
try
{
::ucbhelper::Content aCnt( rURL.GetMainURL(INetURLObject::NO_DECODE),
- uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
bRet = aCnt.isDocument();
}
catch( uno::Exception& )
diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
index 0701f95d5c25..f5fea74717c1 100644
--- a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
+++ b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
@@ -60,11 +60,11 @@ import com.sun.star.script.framework.container.ParsedScriptUri;
import com.sun.star.script.framework.container.UnoPkgContainer;
import com.sun.star.ucb.Command;
-import com.sun.star.ucb.XContentProvider;
+import com.sun.star.ucb.UniversalContentBroker;
import com.sun.star.ucb.XContent;
import com.sun.star.ucb.XCommandProcessor;
import com.sun.star.ucb.XContentIdentifier;
-import com.sun.star.ucb.XContentIdentifierFactory;
+import com.sun.star.ucb.XUniversalContentBroker;
import com.sun.star.sdbc.XRow;
@@ -694,23 +694,12 @@ public abstract class ScriptProvider
XModel xModel = null;
try
{
- Object[] args = new String[] {"Local", "Office" };
+ XUniversalContentBroker ucb = UniversalContentBroker.create( m_xContext );
- Object ucb = m_xMultiComponentFactory.createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", args, m_xContext );
+ XContentIdentifier xCntId = ucb.createContentIdentifier( docUrl );
- XContentIdentifierFactory xFac = UnoRuntime.queryInterface( XContentIdentifierFactory.class,
- ucb );
-
-
- XContentIdentifier xCntId = xFac.createContentIdentifier( docUrl );
-
-
- XContentProvider xCntAccess = UnoRuntime.queryInterface( XContentProvider.class,
- ucb );
-
-
- XContent xCnt = xCntAccess.queryContent( xCntId );
+ XContent xCnt = ucb.queryContent( xCntId );
XCommandProcessor xCmd = UnoRuntime.queryInterface( XCommandProcessor.class, xCnt );
diff --git a/scripting/source/inc/util/MiscUtils.hxx b/scripting/source/inc/util/MiscUtils.hxx
index 8edbde242c0b..8ad4f8f505de 100644
--- a/scripting/source/inc/util/MiscUtils.hxx
+++ b/scripting/source/inc/util/MiscUtils.hxx
@@ -36,7 +36,7 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-
+#include <comphelper/processfactory.hxx>
#include "util.hxx"
@@ -116,7 +116,7 @@ public:
try
{
- ::ucbhelper::Content root( url, NULL );
+ ::ucbhelper::Content root( url, NULL, comphelper::getProcessComponentContext() );
::rtl::OUString propName = OUSTR("DocumentModel");
result = getUCBProperty( root, propName );
}
diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk
index 4b324b0065fb..baba9fa72f95 100644
--- a/sd/CppunitTest_sd_uimpress.mk
+++ b/sd/CppunitTest_sd_uimpress.mk
@@ -95,6 +95,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_uimpress,\
configmgr/source/configmgr \
framework/util/fwk \
i18npool/util/i18npool \
+ ucb/source/core/ucb1 \
))
$(eval $(call gb_CppunitTest_use_configuration,sd_uimpress))
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 47013f7af97b..d4632c65a984 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -73,8 +73,6 @@
#include <tools/urlobj.hxx>
#include <comphelper/extract.hxx>
#include <cppuhelper/proptypehlp.hxx>
-#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <toolkit/unohlp.hxx>
#include <rtl/crc.h>
#include <sot/clsids.hxx>
diff --git a/sd/source/filter/eppt/pptexsoundcollection.cxx b/sd/source/filter/eppt/pptexsoundcollection.cxx
index d8c1fdd11e0f..4ce9f12c901e 100644
--- a/sd/source/filter/eppt/pptexsoundcollection.cxx
+++ b/sd/source/filter/eppt/pptexsoundcollection.cxx
@@ -30,7 +30,7 @@
#include "epptdef.hxx"
#include <tools/urlobj.hxx>
#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/proptypehlp.hxx>
#include <unotools/ucbstreamhelper.hxx>
@@ -44,7 +44,8 @@ ExSoundEntry::ExSoundEntry(const rtl::OUString& rString)
try
{
::ucbhelper::Content aCnt( aSoundURL,
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
sal_Int64 nVal = 0;
::cppu::convertPropertyValue( nVal, aCnt.getPropertyValue( ::rtl::OUString( "Size" ) ) );
nFileSize = (sal_uInt32)nVal;
@@ -99,7 +100,8 @@ void ExSoundEntry::Write( SvStream& rSt, sal_uInt32 nId ) const
try
{
::ucbhelper::Content aCnt( aSoundURL,
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
// create SoundContainer
rSt << (sal_uInt32)( ( EPP_Sound << 16 ) | 0xf ) << (sal_uInt32)( GetSize( nId ) - 8 );
diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx
index c9e93c17f995..0f01371aa0c7 100644
--- a/sd/source/ui/dlg/TemplateScanner.cxx
+++ b/sd/source/ui/dlg/TemplateScanner.cxx
@@ -276,7 +276,7 @@ TemplateScanner::State TemplateScanner::ScanEntry (void)
::rtl::OUString sContentType (xRow->getString (3));
::rtl::OUString aId = xContentAccess->queryContentIdentifierString();
- ::ucbhelper::Content aContent = ::ucbhelper::Content (aId, mxEntryEnvironment);
+ ::ucbhelper::Content aContent = ::ucbhelper::Content (aId, mxEntryEnvironment, comphelper::getProcessComponentContext());
if (aContent.isDocument ())
{
// Check whether the entry is an impress template. If so
@@ -332,7 +332,7 @@ TemplateScanner::State TemplateScanner::InitializeFolderScanning (void)
{
// Create content for template folders.
mxFolderEnvironment = Reference<com::sun::star::ucb::XCommandEnvironment>();
- ::ucbhelper::Content aTemplateDir (mxTemplateRoot, mxFolderEnvironment);
+ ::ucbhelper::Content aTemplateDir (mxTemplateRoot, mxFolderEnvironment, comphelper::getProcessComponentContext());
// Define the list of properties we are interested in.
Sequence<rtl::OUString> aProps (2);
@@ -405,7 +405,7 @@ TemplateScanner::State TemplateScanner::ScanFolder (void)
::rtl::OUString sTargetDir (aDescriptor.msTargetDir);
::rtl::OUString aId (aDescriptor.msContentIdentifier);
- maFolderContent = ::ucbhelper::Content (aId, aDescriptor.mxFolderEnvironment);
+ maFolderContent = ::ucbhelper::Content (aId, aDescriptor.mxFolderEnvironment, comphelper::getProcessComponentContext());
if (maFolderContent.isFolder())
{
// Scan the folder and insert it into the list of template
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 47e6bc67936d..d5f776b6e384 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -37,7 +37,6 @@
#include <unotools/configmgr.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/security.hxx>
-#include <ucbhelper/configurationkeys.hxx>
#include <unotools/pathoptions.hxx>
#include <unotools/historyoptions.hxx>
#include <unotools/moduleoptions.hxx>
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 69424dbe6516..f6da0cab9d22 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -634,7 +634,7 @@ void IndexTabPage_Impl::InitializeIndex()
AppendConfigToken( aTemp, sal_True );
aURL = aTemp;
- Content aCnt( aURL, Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ Content aCnt( aURL, Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = aCnt.getProperties();
if ( xInfo->hasPropertyByName( PROPERTY_ANCHORREF ) )
{
@@ -3340,7 +3340,7 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
{
try
{
- Content aCnt( aURL, Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ Content aCnt( aURL, Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = aCnt.getProperties();
if ( xInfo->hasPropertyByName( PROPERTY_TITLE ) )
{
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index f2d86c2520fa..ec88716e179d 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -177,7 +177,8 @@ sal_Bool GetHelpAnchor_Impl( const String& _rURL, String& _rAnchor )
try
{
::ucbhelper::Content aCnt( INetURLObject( _rURL ).GetMainURL( INetURLObject::NO_DECODE ),
- Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
if ( ( aCnt.getPropertyValue( ::rtl::OUString("AnchorName") ) >>= sAnchor ) )
{
diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx
index de3d37a002a1..302833dc9658 100644
--- a/sfx2/source/appl/xpackcreator.cxx
+++ b/sfx2/source/appl/xpackcreator.cxx
@@ -23,6 +23,7 @@
#include "xpackcreator.hxx"
+#include <comphelper/processfactory.hxx>
#include <sot/stg.hxx>
#include <sot/storage.hxx>
#include <tools/stream.hxx>
@@ -79,7 +80,7 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const ::rtl::OUString&
sal_Bool bSuccess = sal_False;
::ucbhelper::Content aContent;
- if( ::ucbhelper::Content::create( aFolderUrl, xComEnv, aContent ) )
+ if( ::ucbhelper::Content::create( aFolderUrl, xComEnv, comphelper::getProcessComponentContext(), aContent ) )
{
SvStream* pTempStream = NULL;
diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx
index 94b2e51be41c..2a01bf3f432b 100644
--- a/sfx2/source/bastyp/helper.cxx
+++ b/sfx2/source/bastyp/helper.cxx
@@ -82,7 +82,7 @@ uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL )
StringList_Impl* pList = NULL;
try
{
- ::ucbhelper::Content aCnt( rURL, uno::Reference< ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aCnt( rURL, uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
uno::Reference< sdbc::XResultSet > xResultSet;
uno::Reference< ucb::XDynamicResultSet > xDynResultSet;
uno::Sequence< OUString > aProps(3);
@@ -173,7 +173,7 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin
uno::Reference< task::XInteractionHandler > xInteractionHandler = uno::Reference< task::XInteractionHandler > (
xFactory->createInstance( "com.sun.star.task.InteractionHandler" ), uno::UNO_QUERY );
- ::ucbhelper::Content aCnt( rURL, new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() ) );
+ ::ucbhelper::Content aCnt( rURL, new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() ), comphelper::getProcessComponentContext() );
uno::Reference< sdbc::XResultSet > xResultSet;
uno::Sequence< OUString > aProps(2);
OUString* pProps = aProps.getArray();
@@ -256,7 +256,7 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL )
uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
uno::Reference< task::XInteractionHandler > xInteractionHandler = uno::Reference< task::XInteractionHandler > (
xFactory->createInstance( "com.sun.star.task.InteractionHandler" ), uno::UNO_QUERY );
- ::ucbhelper::Content aCnt( rURL, new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() ) );
+ ::ucbhelper::Content aCnt( rURL, new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() ), comphelper::getProcessComponentContext() );
// open the "active help" stream
uno::Reference< io::XInputStream > xStream = aCnt.openStream();
// and convert it to a String
@@ -288,7 +288,8 @@ sal_Bool SfxContentHelper::IsHelpErrorDocument( const String& rURL )
try
{
::ucbhelper::Content aCnt( INetURLObject( rURL ).GetMainURL( INetURLObject::NO_DECODE ),
- uno::Reference< ucb::XCommandEnvironment > () );
+ uno::Reference< ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
if ( !( aCnt.getPropertyValue( "IsErrorDocument" ) >>= bRet ) )
{
SAL_WARN( "sfx2.bastyp", "Property 'IsErrorDocument' is missing" );
@@ -311,7 +312,7 @@ sal_uIntPtr SfxContentHelper::GetSize( const String& rContent )
DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
try
{
- ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () );
+ ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
aCnt.getPropertyValue( "Size" ) >>= nTemp;
}
catch( const ucb::CommandAbortedException& )
diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx
index bef910237895..ad414affbb71 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -159,7 +159,7 @@ bool TemplateRemoteView::loadRepository (const sal_uInt16 nRepositoryId, bool bR
aProps[6] = "IsRemote";
aProps[7] = "IsRemoveable";
- ucbhelper::Content aContent(aURL,m_xCmdEnv);
+ ucbhelper::Content aContent(aURL, m_xCmdEnv, comphelper::getProcessComponentContext());
uno::Reference< XResultSet > xResultSet;
uno::Reference< XDynamicResultSet > xDynResultSet;
@@ -218,7 +218,7 @@ bool TemplateRemoteView::loadRepository (const sal_uInt16 nRepositoryId, bool bR
if ( bHasTargetURL &&
INetURLObject( aContentURL ).GetProtocol() == INET_PROT_VND_SUN_STAR_HIER )
{
- ucbhelper::Content aCnt( aTargetURL, m_xCmdEnv );
+ ucbhelper::Content aCnt( aTargetURL, m_xCmdEnv, comphelper::getProcessComponentContext() );
try
{
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 5ca226d1c8d6..b1ea8be470ae 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -2064,7 +2064,7 @@ namespace
sPathCheck += '.';
try
{
- ::ucbhelper::Content aContent( sPathCheck, uno::Reference< ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aContent( sPathCheck, uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
bValid = aContent.isFolder();
}
catch( const Exception& ) {}
@@ -2538,7 +2538,8 @@ static int impl_isFolder( const OUString& rPath )
try
{
::ucbhelper::Content aContent(
- rPath, uno::Reference< ucb::XCommandEnvironment > () );
+ rPath, uno::Reference< ucb::XCommandEnvironment > (),
+ comphelper::getProcessComponentContext() );
if ( aContent.isFolder() )
return 1;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 1a8c61976cc3..7620b8698a9b 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -101,7 +101,6 @@ using namespace ::com::sun::star::io;
#include <unotools/pathoptions.hxx>
#include <svtools/asynclink.hxx>
#include <svl/inettype.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <unotools/localfilehelper.hxx>
#include <unotools/ucbstreamhelper.hxx>
@@ -466,7 +465,7 @@ util::DateTime SfxMedium::GetInitFileDate( sal_Bool bIgnoreOldValue )
try
{
uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+ ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
aContent.getPropertyValue( ::rtl::OUString("DateModified" ) ) >>= pImp->m_aDateTime;
pImp->m_bGotDateTime = true;
@@ -495,7 +494,7 @@ Reference < XContent > SfxMedium::GetContent() const
{
try
{
- pImp->aContent = ::ucbhelper::Content( xContent, xEnv );
+ pImp->aContent = ::ucbhelper::Content( xContent, xEnv, comphelper::getProcessComponentContext() );
}
catch ( const Exception& )
{
@@ -510,7 +509,7 @@ Reference < XContent > SfxMedium::GetContent() const
else if ( !pImp->m_aLogicName.isEmpty() )
aURL = GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
if (!aURL.isEmpty() )
- ::ucbhelper::Content::create( aURL, xEnv, pImp->aContent );
+ ::ucbhelper::Content::create( aURL, xEnv, comphelper::getProcessComponentContext(), pImp->aContent );
}
}
@@ -790,7 +789,7 @@ void SfxMedium::StorageBackup_Impl()
&& ::utl::UCBContentHelper::IsDocument( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) );
if ( bBasedOnOriginalFile && pImp->m_aBackupURL.isEmpty()
- && ::ucbhelper::Content::create( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, aOriginalContent ) )
+ && ::ucbhelper::Content::create( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext(), aOriginalContent ) )
{
DoInternalBackup_Impl( aOriginalContent );
if( pImp->m_aBackupURL.isEmpty() )
@@ -1027,7 +1026,7 @@ bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
{
// MediaDescriptor does this check also, the duplication should be avoided in future
Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+ ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
aContent.getPropertyValue( ::rtl::OUString( "IsReadOnly" ) ) >>= bContentReadonly;
}
catch( const uno::Exception& ) {}
@@ -1496,7 +1495,7 @@ sal_Bool SfxMedium::UseBackupToRestore_Impl( ::ucbhelper::Content& aOriginalCont
{
try
{
- ::ucbhelper::Content aTransactCont( pImp->m_aBackupURL, xComEnv );
+ ::ucbhelper::Content aTransactCont( pImp->m_aBackupURL, xComEnv, comphelper::getProcessComponentContext() );
Reference< XInputStream > aOrigInput = aTransactCont.openStream();
aOriginalContent.writeStream( aOrigInput, true );
@@ -1542,7 +1541,7 @@ sal_Bool SfxMedium::StorageCommit_Impl()
OSL_ENSURE( !pImp->m_aBackupURL.isEmpty(), "No backup on storage commit!\n" );
if ( !pImp->m_aBackupURL.isEmpty()
&& ::ucbhelper::Content::create( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ),
- xDummyEnv,
+ xDummyEnv, comphelper::getProcessComponentContext(),
aOriginalContent ) )
{
// use backup to restore the file
@@ -1585,7 +1584,7 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
try
{
- aOriginalContent = ::ucbhelper::Content( aDest.GetMainURL( INetURLObject::NO_DECODE ), xComEnv );
+ aOriginalContent = ::ucbhelper::Content( aDest.GetMainURL( INetURLObject::NO_DECODE ), xComEnv, comphelper::getProcessComponentContext() );
}
catch ( const ::com::sun::star::ucb::CommandAbortedException& )
{
@@ -1619,7 +1618,7 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
CloseStreams_Impl();
::ucbhelper::Content aTempCont;
- if( ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, aTempCont ) )
+ if( ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext(), aTempCont ) )
{
bool bTransactStarted = false;
SFX_ITEMSET_ARG( GetItemSet(), pOverWrite, SfxBoolItem, SID_OVERWRITE, false );
@@ -1737,7 +1736,7 @@ sal_Bool SfxMedium::TryDirectTransfer( const ::rtl::OUString& aURL, SfxItemSet&
}
uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- ::ucbhelper::Content aTargetContent( aURL, xEnv );
+ ::ucbhelper::Content aTargetContent( aURL, xEnv, comphelper::getProcessComponentContext() );
InsertCommandArgument aInsertArg;
aInsertArg.Data = xInStream;
@@ -1804,7 +1803,7 @@ void SfxMedium::Transfer_Impl()
INetURLObject aSource( aNameURL );
::ucbhelper::Content aTempCont;
- if( ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xEnv, aTempCont ) )
+ if( ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext(), aTempCont ) )
{
try
{
@@ -1928,7 +1927,7 @@ void SfxMedium::Transfer_Impl()
// Get the parent URL from the XChild if possible: why would the URL necessarily have
// a hierarchical path? It's not the case for CMIS.
::ucbhelper::Content aDestContent;
- ::ucbhelper::Content::create( aDestURL, xComEnv, aDestContent );
+ ::ucbhelper::Content::create( aDestURL, xComEnv, comphelper::getProcessComponentContext(), aDestContent );
Reference< ::com::sun::star::container::XChild> xChild( aDestContent.get(), uno::UNO_QUERY );
rtl::OUString sParentUrl;
if ( xChild.is( ) )
@@ -1953,7 +1952,7 @@ void SfxMedium::Transfer_Impl()
try
{
- aTransferContent = ::ucbhelper::Content( aDest.GetMainURL( INetURLObject::NO_DECODE ), xComEnv );
+ aTransferContent = ::ucbhelper::Content( aDest.GetMainURL( INetURLObject::NO_DECODE ), xComEnv, comphelper::getProcessComponentContext() );
}
catch (const ::com::sun::star::ucb::ContentCreationException& ex)
{
@@ -1979,7 +1978,7 @@ void SfxMedium::Transfer_Impl()
CloseStreams_Impl();
- ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xEnv, aSourceContent );
+ ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext(), aSourceContent );
// check for external parameters that may customize the handling of NameClash situations
SFX_ITEMSET_ARG( GetItemSet(), pRename, SfxBoolItem, SID_RENAME, false );
@@ -2057,7 +2056,7 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont
Reference < ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv;
::ucbhelper::Content aBackupCont;
- if( ::ucbhelper::Content::create( aDestDir, xDummyEnv, aBackupCont ) )
+ if( ::ucbhelper::Content::create( aDestDir, xDummyEnv, comphelper::getProcessComponentContext(), aBackupCont ) )
{
try
{
@@ -2132,7 +2131,7 @@ void SfxMedium::DoBackup_Impl()
// create content for the parent folder ( = backup folder )
::ucbhelper::Content aContent;
Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- if( ::ucbhelper::Content::create( aBakDir, xEnv, aContent ) )
+ if( ::ucbhelper::Content::create( aBakDir, xEnv, comphelper::getProcessComponentContext(), aContent ) )
{
// save as ".bak" file
INetURLObject aDest( aBakDir );
@@ -2142,7 +2141,7 @@ void SfxMedium::DoBackup_Impl()
// create a content for the source file
::ucbhelper::Content aSourceContent;
- if ( ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xEnv, aSourceContent ) )
+ if ( ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext(), aSourceContent ) )
{
try
{
@@ -3280,7 +3279,7 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
INetURLObject::DECODE_WITH_CHARSET );
if ( !aFileName.isEmpty() && aTmpURLObj.removeSegment() )
{
- ::ucbhelper::Content aTargetContent( aTmpURLObj.GetMainURL( INetURLObject::NO_DECODE ), xComEnv );
+ ::ucbhelper::Content aTargetContent( aTmpURLObj.GetMainURL( INetURLObject::NO_DECODE ), xComEnv, comphelper::getProcessComponentContext() );
if ( aTargetContent.transferContent( pImp->aContent, ::ucbhelper::InsertOperation_COPY, aFileName, NameClash::OVERWRITE ) )
{
SetWritableForUserOnly( aTmpURL );
@@ -3515,8 +3514,8 @@ sal_Bool SfxMedium::IsOpen() const
try
{
uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > xComEnv;
- ::ucbhelper::Content aTargetContent( aDest.GetMainURL( INetURLObject::NO_DECODE ), xComEnv );
- ::ucbhelper::Content aSourceContent( aSource.GetMainURL( INetURLObject::NO_DECODE ), xComEnv );
+ ::ucbhelper::Content aTargetContent( aDest.GetMainURL( INetURLObject::NO_DECODE ), xComEnv, comphelper::getProcessComponentContext() );
+ ::ucbhelper::Content aSourceContent( aSource.GetMainURL( INetURLObject::NO_DECODE ), xComEnv, comphelper::getProcessComponentContext() );
if ( aTargetContent.transferContent( aSourceContent,
::ucbhelper::InsertOperation_COPY,
aFileName,
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index 2cf3f958b2d1..aa3c60327b8e 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -561,7 +561,7 @@ String SfxDocumentTemplates::GetPath
::rtl::OUString aResult;
Content aTemplate;
uno::Reference< XCommandEnvironment > aCmdEnv;
- if ( Content::create( aTemplateObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, aTemplate ) )
+ if ( Content::create( aTemplateObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext(), aTemplate ) )
{
OUString aPropName( TARGET_URL );
getTextProperty_Impl( aTemplate, aPropName, aResult );
@@ -817,7 +817,7 @@ sal_Bool SfxDocumentTemplates::CopyTo
try
{
- aTarget = Content( aParentURL, aCmdEnv );
+ aTarget = Content( aParentURL, aCmdEnv, comphelper::getProcessComponentContext() );
TransferInfo aTransferInfo;
aTransferInfo.MoveData = sal_False;
@@ -953,7 +953,7 @@ sal_Bool SfxDocumentTemplates::CopyFrom
uno::Reference< XCommandEnvironment > aCmdEnv;
Content aTemplCont;
- if( Content::create( aTemplURL, aCmdEnv, aTemplCont ) )
+ if( Content::create( aTemplURL, aCmdEnv, comphelper::getProcessComponentContext(), aTemplCont ) )
{
OUString aTemplName;
OUString aPropName( TARGET_URL );
@@ -1665,7 +1665,7 @@ const OUString& DocTempl_EntryData_Impl::GetTargetURL()
uno::Reference< XCommandEnvironment > aCmdEnv;
Content aRegion;
- if ( Content::create( GetHierarchyURL(), aCmdEnv, aRegion ) )
+ if ( Content::create( GetHierarchyURL(), aCmdEnv, comphelper::getProcessComponentContext(), aRegion ) )
{
OUString aPropName( TARGET_URL );
@@ -1826,7 +1826,7 @@ const OUString& RegionData_Impl::GetTargetURL()
uno::Reference< XCommandEnvironment > aCmdEnv;
Content aRegion;
- if ( Content::create( GetHierarchyURL(), aCmdEnv, aRegion ) )
+ if ( Content::create( GetHierarchyURL(), aCmdEnv, comphelper::getProcessComponentContext(), aRegion ) )
{
OUString aPropName( TARGET_DIR_URL );
@@ -2027,7 +2027,7 @@ void SfxDocTemplate_Impl::CreateFromHierarchy( Content &rTemplRoot )
OUString aTitle( xRow->getString( 1 ) );
OUString aId = xContentAccess->queryContentIdentifierString();
- Content aContent = Content( aId, aCmdEnv );
+ Content aContent = Content( aId, aCmdEnv, comphelper::getProcessComponentContext() );
AddRegion( aTitle, aContent );
}
@@ -2076,7 +2076,7 @@ sal_Bool SfxDocTemplate_Impl::Construct( )
if ( aLongNames.Count() )
maStandardGroup = aLongNames.GetString( 0 );
- Content aTemplRoot( aRootContent, aCmdEnv );
+ Content aTemplRoot( aRootContent, aCmdEnv, comphelper::getProcessComponentContext() );
CreateFromHierarchy( aTemplRoot );
return sal_True;
@@ -2090,7 +2090,7 @@ void SfxDocTemplate_Impl::ReInitFromComponent()
{
uno::Reference < XContent > aRootContent = xTemplates->getContent();
uno::Reference < XCommandEnvironment > aCmdEnv;
- Content aTemplRoot( aRootContent, aCmdEnv );
+ Content aTemplRoot( aRootContent, aCmdEnv, comphelper::getProcessComponentContext() );
Clear();
CreateFromHierarchy( aTemplRoot );
}
@@ -2138,7 +2138,7 @@ void SfxDocTemplate_Impl::Rescan()
uno::Reference < XContent > aRootContent = xTemplates->getContent();
uno::Reference < XCommandEnvironment > aCmdEnv;
- Content aTemplRoot( aRootContent, aCmdEnv );
+ Content aTemplRoot( aRootContent, aCmdEnv, comphelper::getProcessComponentContext() );
CreateFromHierarchy( aTemplRoot );
}
}
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 1218562121ec..07b5abbf5f69 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -417,7 +417,7 @@ void SfxDocTplService_Impl::init_Impl()
::rtl::OUString aTemplVersPropName( TEMPLATE_VERSION );
::rtl::OUString aTemplVers( TEMPLATE_VERSION_VALUE );
- if ( Content::create( maRootURL, maCmdEnv, maRootContent ) )
+ if ( Content::create( maRootURL, maCmdEnv, comphelper::getProcessComponentContext(), maRootContent ) )
{
uno::Any aValue;
::rtl::OUString aPropValue;
@@ -756,7 +756,7 @@ sal_Bool SfxDocTplService_Impl::addEntry( Content& rParentFolder,
Content aLink;
- if ( ! Content::create( aLinkURL, maCmdEnv, aLink ) )
+ if ( ! Content::create( aLinkURL, maCmdEnv, comphelper::getProcessComponentContext(), aLink ) )
{
Sequence< OUString > aNames(3);
aNames[0] = OUString( TITLE );
@@ -805,7 +805,7 @@ sal_Bool SfxDocTplService_Impl::createFolder( const OUString& rNewFolderURL,
// if the parent exists, we can continue with the creation of the
// new folder, we have to create the parent otherwise ( as long as
// bCreateParent is set to true )
- if ( Content::create( aParentURL.GetMainURL( INetURLObject::NO_DECODE ), maCmdEnv, aParent ) )
+ if ( Content::create( aParentURL.GetMainURL( INetURLObject::NO_DECODE ), maCmdEnv, comphelper::getProcessComponentContext(), aParent ) )
{
try
{
@@ -864,7 +864,7 @@ sal_Bool SfxDocTplService_Impl::CreateNewUniqueFolderWithPrefix( const ::rtl::OU
Content aParent;
uno::Reference< XCommandEnvironment > aQuietEnv;
- if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), aQuietEnv, aParent ) )
+ if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), aQuietEnv, comphelper::getProcessComponentContext(), aParent ) )
{
for ( sal_Int32 nInd = 0; nInd < 32000; nInd++ )
{
@@ -925,7 +925,7 @@ sal_Bool SfxDocTplService_Impl::CreateNewUniqueFolderWithPrefix( const ::rtl::OU
Content aParent;
uno::Reference< XCommandEnvironment > aQuietEnv;
- if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), aQuietEnv, aParent ) )
+ if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), aQuietEnv, comphelper::getProcessComponentContext(), aParent ) )
{
for ( sal_Int32 nInd = 0; nInd < 32000; nInd++ )
{
@@ -1002,7 +1002,7 @@ sal_Bool SfxDocTplService_Impl::removeContent( const OUString& rContentURL )
{
Content aContent;
- if ( Content::create( rContentURL, maCmdEnv, aContent ) )
+ if ( Content::create( rContentURL, maCmdEnv, comphelper::getProcessComponentContext(), aContent ) )
return removeContent( aContent );
else
return sal_False;
@@ -1249,7 +1249,7 @@ void SfxDocTplService_Impl::doUpdate()
while ( nCountDir )
{
nCountDir--;
- if ( Content::create( pDirs[ nCountDir ], aQuietEnv, aDirContent ) )
+ if ( Content::create( pDirs[ nCountDir ], aQuietEnv, comphelper::getProcessComponentContext(), aDirContent ) )
{
createFromContent( aGroupList, aDirContent, sal_False, bWriteableDirectory );
}
@@ -1266,7 +1266,7 @@ void SfxDocTplService_Impl::doUpdate()
if ( pGroup->getInHierarchy() )
{
Content aGroup;
- if ( Content::create( pGroup->getHierarchyURL(), maCmdEnv, aGroup ) )
+ if ( Content::create( pGroup->getHierarchyURL(), maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
setProperty( aGroup,
OUString( TARGET_DIR_URL ),
makeAny( pGroup->getTargetURL() ) );
@@ -1316,7 +1316,7 @@ uno::Sequence< beans::StringPair > SfxDocTplService_Impl::ReadUINamesForTemplate
// TODO/LATER: Use hashmap in future
uno::Sequence< beans::StringPair > aUINames;
- if ( Content::create( aLocObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference < ucb::XCommandEnvironment >(), aLocContent ) )
+ if ( Content::create( aLocObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference < ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext(), aLocContent ) )
{
try
{
@@ -1429,8 +1429,8 @@ sal_Bool SfxDocTplService_Impl::WriteUINamesForTemplateDir_Impl( const ::rtl::OU
} catch( uno::Exception& )
{}
- Content aTargetContent( aUserPath, maCmdEnv );
- Content aSourceContent( aTempURL, maCmdEnv );
+ Content aTargetContent( aUserPath, maCmdEnv, comphelper::getProcessComponentContext() );
+ Content aSourceContent( aTempURL, maCmdEnv, comphelper::getProcessComponentContext() );
aTargetContent.transferContent( aSourceContent,
InsertOperation_COPY,
::rtl::OUString( "groupuinames.xml" ),
@@ -1509,7 +1509,7 @@ sal_Bool SfxDocTplService_Impl::addGroup( const OUString& rGroupName )
aNewGroupURL = aNewGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( Content::create( aNewGroupURL, maCmdEnv, aNewGroup ) ||
+ if ( Content::create( aNewGroupURL, maCmdEnv, comphelper::getProcessComponentContext(), aNewGroup ) ||
! createFolder( aNewGroupURL, sal_False, sal_False, aNewGroup ) )
{
// if there already was a group with this name or the new group
@@ -1596,7 +1596,7 @@ sal_Bool SfxDocTplService_Impl::removeGroup( const OUString& rGroupName )
Content aGroup;
OUString aGroupURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( Content::create( aGroupURL, maCmdEnv, aGroup ) )
+ if ( Content::create( aGroupURL, maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
{
OUString aPropName( TARGET_DIR_URL );
Any aValue;
@@ -1698,7 +1698,7 @@ sal_Bool SfxDocTplService_Impl::renameGroup( const OUString& rOldName,
// Check, if there is a group with the new name, return false
// if there is one.
- if ( Content::create( aGroupURL, maCmdEnv, aGroup ) )
+ if ( Content::create( aGroupURL, maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
return sal_False;
aGroupObj.removeSegment();
@@ -1708,7 +1708,7 @@ sal_Bool SfxDocTplService_Impl::renameGroup( const OUString& rOldName,
aGroupURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
// When there is no group with the old name, we can't rename it
- if ( ! Content::create( aGroupURL, maCmdEnv, aGroup ) )
+ if ( ! Content::create( aGroupURL, maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
return sal_False;
OUString aGroupTargetURL;
@@ -1805,7 +1805,7 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName,
INetURLObject::ENCODE_ALL );
aGroupURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( ! Content::create( aGroupURL, maCmdEnv, aGroup ) )
+ if ( ! Content::create( aGroupURL, maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
return sal_False;
::rtl::OUString aGroupTargetURL;
@@ -1824,7 +1824,7 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName,
INetURLObject::ENCODE_ALL );
aTemplateURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( Content::create( aTemplateURL, maCmdEnv, aTemplateToRemove ) )
+ if ( Content::create( aTemplateURL, maCmdEnv, comphelper::getProcessComponentContext(), aTemplateToRemove ) )
{
OUString aTargetTemplPropName( TARGET_URL );
@@ -1993,7 +1993,7 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName,
INetURLObject::ENCODE_ALL );
aGroupURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( ! Content::create( aGroupURL, maCmdEnv, aGroup ) )
+ if ( ! Content::create( aGroupURL, maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
return sal_False;
// Check, if there's a template with the given name in this group
@@ -2003,7 +2003,7 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName,
INetURLObject::ENCODE_ALL );
aTemplateURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( Content::create( aTemplateURL, maCmdEnv, aTemplate ) )
+ if ( Content::create( aTemplateURL, maCmdEnv, comphelper::getProcessComponentContext(), aTemplate ) )
return sal_False;
// get the target url of the group
@@ -2067,10 +2067,10 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName,
Content aSourceContent;
uno::Reference < ucb::XCommandEnvironment > xEnv;
INetURLObject aSourceURL( rSourceURL );
- if( ! Content::create( aSourceURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv, aSourceContent ) )
+ if( ! Content::create( aSourceURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext(), aSourceContent ) )
return sal_False;
- if( ! Content::create( aTargetURL, xEnv, aTargetGroup ) )
+ if( ! Content::create( aTargetURL, xEnv, comphelper::getProcessComponentContext(), aTargetGroup ) )
return sal_False;
// transfer source file
@@ -2084,7 +2084,7 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName,
// allow to edit the added template
Content aResultContent;
- if ( Content::create( aNewTemplateTargetURL, xEnv, aResultContent ) )
+ if ( Content::create( aNewTemplateTargetURL, xEnv, comphelper::getProcessComponentContext(), aResultContent ) )
{
::rtl::OUString aPropertyName( "IsReadOnly" );
uno::Any aProperty;
@@ -2143,7 +2143,7 @@ sal_Bool SfxDocTplService_Impl::removeTemplate( const OUString& rGroupName,
INetURLObject::ENCODE_ALL );
aGroupURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( ! Content::create( aGroupURL, maCmdEnv, aGroup ) )
+ if ( ! Content::create( aGroupURL, maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
return sal_False;
// Check, if there's a template with the given name in this group
@@ -2153,7 +2153,7 @@ sal_Bool SfxDocTplService_Impl::removeTemplate( const OUString& rGroupName,
INetURLObject::ENCODE_ALL );
aTemplateURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( !Content::create( aTemplateURL, maCmdEnv, aTemplate ) )
+ if ( !Content::create( aTemplateURL, maCmdEnv, comphelper::getProcessComponentContext(), aTemplate ) )
return sal_False;
// get the target URL from the template
@@ -2196,7 +2196,7 @@ sal_Bool SfxDocTplService_Impl::renameTemplate( const OUString& rGroupName,
INetURLObject::ENCODE_ALL );
aGroupURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( ! Content::create( aGroupURL, maCmdEnv, aGroup ) )
+ if ( ! Content::create( aGroupURL, maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
return sal_False;
// Check, if there's a template with the new name in this group
@@ -2206,7 +2206,7 @@ sal_Bool SfxDocTplService_Impl::renameTemplate( const OUString& rGroupName,
INetURLObject::ENCODE_ALL );
aTemplateURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( Content::create( aTemplateURL, maCmdEnv, aTemplate ) )
+ if ( Content::create( aTemplateURL, maCmdEnv, comphelper::getProcessComponentContext(), aTemplate ) )
return sal_False;
// Check, if there's a template with the old name in this group
@@ -2217,7 +2217,7 @@ sal_Bool SfxDocTplService_Impl::renameTemplate( const OUString& rGroupName,
INetURLObject::ENCODE_ALL );
aTemplateURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( !Content::create( aTemplateURL, maCmdEnv, aTemplate ) )
+ if ( !Content::create( aTemplateURL, maCmdEnv, comphelper::getProcessComponentContext(), aTemplate ) )
return sal_False;
OUString aTemplateTargetURL;
@@ -2449,7 +2449,7 @@ void SfxDocTplService_Impl::addHierGroup( GroupList_Impl& rList,
try
{
- aContent = Content( rOwnURL, maCmdEnv );
+ aContent = Content( rOwnURL, maCmdEnv, comphelper::getProcessComponentContext() );
ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
xResultSet = aContent.createCursor( aProps, eInclude );
}
@@ -2561,7 +2561,7 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList,
// this method is only used during checking of the available template-folders
// that should happen quietly
uno::Reference< XCommandEnvironment > aQuietEnv;
- aContent = Content( rOwnURL, aQuietEnv );
+ aContent = Content( rOwnURL, aQuietEnv, comphelper::getProcessComponentContext() );
ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
xResultSet = aContent.createCursor( aProps, eInclude );
}
@@ -2668,7 +2668,7 @@ void SfxDocTplService_Impl::removeFromHierarchy( DocTemplates_EntryData_Impl *pD
{
Content aTemplate;
- if ( Content::create( pData->getHierarchyURL(), maCmdEnv, aTemplate ) )
+ if ( Content::create( pData->getHierarchyURL(), maCmdEnv, comphelper::getProcessComponentContext(), aTemplate ) )
{
removeContent( aTemplate );
}
@@ -2680,7 +2680,7 @@ void SfxDocTplService_Impl::addToHierarchy( GroupData_Impl *pGroup,
{
Content aGroup, aTemplate;
- if ( ! Content::create( pGroup->getHierarchyURL(), maCmdEnv, aGroup ) )
+ if ( ! Content::create( pGroup->getHierarchyURL(), maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
return;
// Check, if there's a template with the given name in this group
@@ -2693,7 +2693,7 @@ void SfxDocTplService_Impl::addToHierarchy( GroupData_Impl *pGroup,
OUString aTemplateURL = aGroupObj.GetMainURL( INetURLObject::NO_DECODE );
- if ( Content::create( aTemplateURL, maCmdEnv, aTemplate ) )
+ if ( Content::create( aTemplateURL, maCmdEnv, comphelper::getProcessComponentContext(), aTemplate ) )
return;
addEntry( aGroup, pData->getTitle(),
@@ -2706,7 +2706,7 @@ void SfxDocTplService_Impl::updateData( DocTemplates_EntryData_Impl *pData )
{
Content aTemplate;
- if ( ! Content::create( pData->getHierarchyURL(), maCmdEnv, aTemplate ) )
+ if ( ! Content::create( pData->getHierarchyURL(), maCmdEnv, comphelper::getProcessComponentContext(), aTemplate ) )
return;
OUString aPropName;
@@ -2756,7 +2756,7 @@ void SfxDocTplService_Impl::removeFromHierarchy( GroupData_Impl *pGroup )
{
Content aGroup;
- if ( Content::create( pGroup->getHierarchyURL(), maCmdEnv, aGroup ) )
+ if ( Content::create( pGroup->getHierarchyURL(), maCmdEnv, comphelper::getProcessComponentContext(), aGroup ) )
{
removeContent( aGroup );
}
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index bebe6b0bb823..cf8d0c264f51 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -742,7 +742,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
try
{
- ::ucbhelper::Content aContent( pMedium->GetName(), com::sun::star::uno::Reference < XCommandEnvironment >() );
+ ::ucbhelper::Content aContent( pMedium->GetName(), com::sun::star::uno::Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
com::sun::star::uno::Reference < XPropertySetInfo > xProps = aContent.getProperties();
if ( xProps.is() )
{
@@ -1674,7 +1674,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
{
try
{
- ::ucbhelper::Content aContent( rMedium.GetName(), com::sun::star::uno::Reference < XCommandEnvironment >() );
+ ::ucbhelper::Content aContent( rMedium.GetName(), com::sun::star::uno::Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
com::sun::star::uno::Reference < XPropertySetInfo > xProps = aContent.getProperties();
if ( xProps.is() )
{
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index cf7b5cff2d9f..fdc01f6fe892 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -30,7 +30,7 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/EventObject.hpp>
#include <com/sun/star/view/DuplexMode.hpp>
-
+#include <comphelper/processfactory.hxx>
#include <svl/lstner.hxx>
#include <svl/stritem.hxx>
#include <svl/intitem.hxx>
@@ -534,11 +534,13 @@ class ImplUCBPrintWatcher : public ::osl::Thread
{
::ucbhelper::Content aSource(
::rtl::OUString((*ppTempFile)->GetURL()),
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >());
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext());
::ucbhelper::Content aTarget(
::rtl::OUString(aSplitter.GetMainURL(INetURLObject::NO_DECODE)),
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >());
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext());
aTarget.transferContent(
aSource,
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index b2b6e20439e6..2ef4d8b5bede 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -3783,7 +3783,8 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl
{
try {
::ucbhelper::Content aContent( pMedium->GetName(),
- uno::Reference<ucb::XCommandEnvironment>() );
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext() );
const uno::Reference < beans::XPropertySetInfo > xProps
= aContent.getProperties();
if ( xProps.is() )
diff --git a/slideshow/test/demoshow.cxx b/slideshow/test/demoshow.cxx
index 1401f47ae7d9..46a026b3c960 100644
--- a/slideshow/test/demoshow.cxx
+++ b/slideshow/test/demoshow.cxx
@@ -40,9 +40,6 @@
#include "com/sun/star/animations/TransitionType.hpp"
#include "com/sun/star/animations/TransitionSubType.hpp"
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
-
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/tools/canvastools.hxx>
@@ -550,17 +547,8 @@ void DemoApp::Main()
exit( 1 );
}
- // Create UCB.
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= rtl::OUString(UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= rtl::OUString(UCB_CONFIGURATION_KEY2_OFFICE );
- ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
-
DemoWindow pWindow;
pWindow.Execute();
-
- // clean up UCB
- ::ucbhelper::ContentBroker::deinitialize();
}
}
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 56a367976adb..bc0ab823386b 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -483,7 +483,7 @@ void SotStorage::CreateStorage( sal_Bool bForceUCBStorage, StreamMode nMode, Sto
String aURL = UCBStorage::CreateLinkFile( m_aName );
if ( aURL.Len() )
{
- ::ucbhelper::Content aContent( aURL, ::com::sun::star::uno::Reference < ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aContent( aURL, ::com::sun::star::uno::Reference < ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
m_pOwnStg = new UCBStorage( aContent, aURL, nMode, sal_False );
}
else
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 46fb25ea1a20..d1ff3c13285b 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -663,7 +663,7 @@ UCBStorageStream_Impl::UCBStorageStream_Impl( const String& rName, StreamMode nM
aTemp += rtl::OUString("?repairpackage");
}
- m_pContent = new ::ucbhelper::Content( aTemp, xComEnv );
+ m_pContent = new ::ucbhelper::Content( aTemp, xComEnv, comphelper::getProcessComponentContext() );
if ( pKey )
{
@@ -1539,7 +1539,7 @@ UCBStorage::UCBStorage( SvStream& rStrm, sal_Bool bDirect )
if( rStrm.IsWritable() )
nMode = STREAM_READ | STREAM_WRITE;
- ::ucbhelper::Content aContent( aURL, Reference < XCommandEnvironment >() );
+ ::ucbhelper::Content aContent( aURL, Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
pImp = new UCBStorage_Impl( aContent, aURL, nMode, this, bDirect, sal_True );
}
else
@@ -1850,7 +1850,7 @@ void UCBStorage_Impl::CreateContent()
aTemp += rtl::OUString("?repairpackage");
}
- m_pContent = new ::ucbhelper::Content( aTemp, xComEnv );
+ m_pContent = new ::ucbhelper::Content( aTemp, xComEnv, comphelper::getProcessComponentContext() );
}
catch (const ContentCreationException&)
{
@@ -1935,7 +1935,7 @@ void UCBStorage_Impl::ReadContent()
aName += String( "?repairpackage" );
}
- ::ucbhelper::Content aContent( aName, xComEnv );
+ ::ucbhelper::Content aContent( aName, xComEnv, comphelper::getProcessComponentContext() );
::rtl::OUString aMediaType;
Any aAny = aContent.getPropertyValue( ::rtl::OUString("MediaType") );
@@ -2229,7 +2229,7 @@ sal_Int16 UCBStorage_Impl::Commit()
String aName( m_aURL );
aName += '/';
aName += pElement->m_aOriginalName;
- pContent = new ::ucbhelper::Content( aName, Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ pContent = new ::ucbhelper::Content( aName, Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
}
if ( pElement->m_bIsRemoved )
@@ -2377,7 +2377,7 @@ sal_Int16 UCBStorage_Impl::Commit()
xWriter->writeManifestSequence( xOutputStream, aProps );
// move the stream to its desired location
- Content aSource( pTempFile->GetURL(), Reference < XCommandEnvironment >() );
+ Content aSource( pTempFile->GetURL(), Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
xWriter = NULL;
xOutputStream = NULL;
DELETEZ( pTempFile );
@@ -2967,7 +2967,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM
String aName = aFolderObj.GetName();
aFolderObj.removeSegment();
- Content aFolder( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ), Reference < XCommandEnvironment >() );
+ Content aFolder( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ), Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
pImp->m_pContent = new Content;
sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, pImp->m_aName, *pImp->m_pContent );
if ( !bRet )
@@ -3283,7 +3283,7 @@ String UCBStorage::CreateLinkFile( const String& rName )
aTitle += aTmpName;
// create a folder and store its URL
- Content aFolder( aFolderURL, Reference < XCommandEnvironment >() );
+ Content aFolder( aFolderURL, Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
Content aNewFolder;
sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, aTitle, aNewFolder );
if ( !bRet )
@@ -3325,7 +3325,7 @@ String UCBStorage::CreateLinkFile( const String& rName )
pStream->Flush();
// move the stream to its desired location
- Content aSource( pTempFile->GetURL(), Reference < XCommandEnvironment >() );
+ Content aSource( pTempFile->GetURL(), Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
DELETEZ( pTempFile );
aFolder.transferContent( aSource, InsertOperation_MOVE, aName, NameClash::OVERWRITE );
return aURL;
diff --git a/svl/qa/unit/test_URIHelper.cxx b/svl/qa/unit/test_URIHelper.cxx
index 9cb810b38beb..98c25a6d6eb8 100644
--- a/svl/qa/unit/test_URIHelper.cxx
+++ b/svl/qa/unit/test_URIHelper.cxx
@@ -22,21 +22,19 @@
#include "com/sun/star/lang/Locale.hpp"
#include "com/sun/star/lang/XComponent.hpp"
-#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/ucb/Command.hpp"
#include "com/sun/star/ucb/CommandAbortedException.hpp"
#include "com/sun/star/ucb/IllegalIdentifierException.hpp"
+#include "com/sun/star/ucb/UniversalContentBroker.hpp"
#include "com/sun/star/ucb/XCommandProcessor.hpp"
#include "com/sun/star/ucb/XContent.hpp"
#include "com/sun/star/ucb/XContentIdentifier.hpp"
#include "com/sun/star/ucb/XContentProvider.hpp"
-#include "com/sun/star/ucb/XContentProviderManager.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
-#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uri/XUriReference.hpp"
#include "cppuhelper/bootstrap.hxx"
@@ -230,16 +228,8 @@ void Test::finish() {
}
void Test::testNormalizedMakeRelative() {
- css::uno::Sequence< css::uno::Any > args(2);
- args[0] <<= rtl::OUString("Local");
- args[1] <<= rtl::OUString("Office");
- css::uno::Reference< css::ucb::XContentProviderManager >(
- (css::uno::Reference< css::lang::XMultiComponentFactory >(
- m_context->getServiceManager(), css::uno::UNO_QUERY_THROW)->
- createInstanceWithArgumentsAndContext(
- rtl::OUString("com.sun.star.ucb.UniversalContentBroker"),
- args, m_context)),
- css::uno::UNO_QUERY_THROW)->registerContentProvider(
+ css::ucb::UniversalContentBroker::create(m_context)->
+ registerContentProvider(
new Provider, rtl::OUString("test"),
true);
struct Data {
diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx
index f11453c2f1a2..e76c7a645134 100644
--- a/svl/source/fsstor/fsfactory.cxx
+++ b/svl/source/fsstor/fsfactory.cxx
@@ -23,10 +23,9 @@
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-
+#include <comphelper/processfactory.hxx>
#include <ucbhelper/fileidentifierconverter.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/content.hxx>
#include <unotools/tempfile.hxx>
@@ -72,7 +71,8 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstance()
throw uno::RuntimeException(); // TODO: can not create tempfile
::ucbhelper::Content aResultContent(
- aTempURL, uno::Reference< ucb::XCommandEnvironment >() );
+ aTempURL, uno::Reference< ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
return uno::Reference< uno::XInterface >(
static_cast< OWeakObject* >(
@@ -148,7 +148,8 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA
throw io::IOException(); // there is no such folder
::ucbhelper::Content aResultContent(
- aURL, uno::Reference< ucb::XCommandEnvironment >() );
+ aURL, uno::Reference< ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
// create storage based on source
return uno::Reference< uno::XInterface >(
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index 03ad05bdfba8..00f93802562a 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/ucb/NameClash.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
@@ -55,7 +56,6 @@
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/streamwrap.hxx>
#include <ucbhelper/fileidentifierconverter.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/content.hxx>
#include "fsstorage.hxx"
@@ -70,15 +70,13 @@ using namespace ::com::sun::star;
sal_Bool isLocalFile_Impl( ::rtl::OUString aURL )
{
::rtl::OUString aSystemPath;
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- if ( !pBroker )
- throw uno::RuntimeException();
- uno::Reference< ucb::XContentProviderManager > xManager =
- pBroker->getContentProviderManagerInterface();
try
{
- aSystemPath = ::ucbhelper::getSystemPathFromFileURL( xManager, aURL );
+ aSystemPath = ::ucbhelper::getSystemPathFromFileURL(
+ ucb::UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() ),
+ aURL );
}
catch ( uno::Exception& )
{
@@ -182,6 +180,7 @@ sal_Bool FSStorage::MakeFolderNoUI( const ::rtl::OUString& rFolder )
if ( ::ucbhelper::Content::create( aURL.GetMainURL( INetURLObject::NO_DECODE ),
uno::Reference< ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext(),
aParent ) )
return ::utl::UCBContentHelper::MakeFolder( aParent, aTitle, aResultContent, sal_False );
@@ -198,7 +197,7 @@ sal_Bool FSStorage::MakeFolderNoUI( const ::rtl::OUString& rFolder )
try
{
- m_pImpl->m_pContent = new ::ucbhelper::Content( m_pImpl->m_aURL, xDummyEnv );
+ m_pImpl->m_pContent = new ::ucbhelper::Content( m_pImpl->m_aURL, xDummyEnv, comphelper::getProcessComponentContext() );
}
catch( uno::Exception& )
{
@@ -217,7 +216,7 @@ void FSStorage::CopyStreamToSubStream( const ::rtl::OUString& aSourceURL,
throw uno::RuntimeException();
uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv );
+ ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xSourceInput = aSourceContent.openStream();
if ( !xSourceInput.is() )
@@ -276,7 +275,7 @@ void FSStorage::CopyContentToStorage_Impl( ::ucbhelper::Content* pContent, const
throw uno::RuntimeException();
uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv );
+ ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv, comphelper::getProcessComponentContext() );
CopyContentToStorage_Impl( &aSourceContent, xSubStorage );
}
else
@@ -509,7 +508,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement(
|| !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
throw io::IOException(); // TODO: access denied
- ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+ ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) );
}
@@ -619,7 +618,7 @@ uno::Reference< embed::XStorage > SAL_CALL FSStorage::openStorageElement(
if ( !bFolderExists )
throw io::IOException(); // there is no such folder
- ::ucbhelper::Content aResultContent( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+ ::ucbhelper::Content aResultContent( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
xResult = uno::Reference< embed::XStorage >(
static_cast< OWeakObject* >( new FSStorage( aResultContent,
nStorageMode,
@@ -682,7 +681,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::cloneStreamElement( const ::rt
try
{
uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+ ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xTempResult = uno::Reference < io::XStream >(
@@ -883,7 +882,7 @@ void SAL_CALL FSStorage::renameElement( const ::rtl::OUString& aElementName, con
try
{
uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aSourceContent( aOldURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+ ::ucbhelper::Content aSourceContent( aOldURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
if ( !GetContent()->transferContent( aSourceContent,
::ucbhelper::InsertOperation_MOVE,
@@ -962,7 +961,7 @@ void SAL_CALL FSStorage::copyElementTo( const ::rtl::OUString& aElementName,
uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
if ( ::utl::UCBContentHelper::IsFolder( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
{
- ::ucbhelper::Content aSourceContent( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+ ::ucbhelper::Content aSourceContent( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< embed::XStorage > xDestSubStor(
xDest->openStorageElement( aNewName, embed::ElementModes::READWRITE ),
uno::UNO_QUERY_THROW );
@@ -1506,7 +1505,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
|| !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
throw io::IOException(); // TODO: access denied
- ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+ ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) );
}
diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx
index 17d9e7ca239e..119ebcdd6a1c 100644
--- a/svl/source/misc/documentlockfile.cxx
+++ b/svl/source/misc/documentlockfile.cxx
@@ -110,7 +110,7 @@ sal_Bool DocumentLockFile::CreateOwnLockFile()
xSeekable->seek( 0 );
uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- ::ucbhelper::Content aTargetContent( m_aURL, xEnv );
+ ::ucbhelper::Content aTargetContent( m_aURL, xEnv, comphelper::getProcessComponentContext() );
ucb::InsertCommandArgument aInsertArg;
aInsertArg.Data = xInput;
@@ -162,7 +162,7 @@ uno::Reference< io::XInputStream > DocumentLockFile::OpenStream()
::osl::MutexGuard aGuard( m_aMutex );
uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- ::ucbhelper::Content aSourceContent( m_aURL, xEnv );
+ ::ucbhelper::Content aSourceContent( m_aURL, xEnv, comphelper::getProcessComponentContext() );
// the file can be opened readonly, no locking will be done
return aSourceContent.openStream();
@@ -175,7 +175,7 @@ sal_Bool DocumentLockFile::OverwriteOwnLockFile()
try
{
uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- ::ucbhelper::Content aTargetContent( m_aURL, xEnv );
+ ::ucbhelper::Content aTargetContent( m_aURL, xEnv, comphelper::getProcessComponentContext() );
uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry();
@@ -213,7 +213,7 @@ void DocumentLockFile::RemoveFile()
throw io::IOException(); // not the owner, access denied
uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- ::ucbhelper::Content aCnt(m_aURL, xEnv);
+ ::ucbhelper::Content aCnt(m_aURL, xEnv, comphelper::getProcessComponentContext());
aCnt.executeCommand(rtl::OUString("delete"),
uno::makeAny(sal_Bool(sal_True)));
}
diff --git a/svl/source/misc/fstathelper.cxx b/svl/source/misc/fstathelper.cxx
index 94e13c81a5c5..3e0a08001ef8 100644
--- a/svl/source/misc/fstathelper.cxx
+++ b/svl/source/misc/fstathelper.cxx
@@ -22,6 +22,7 @@
#include <tools/string.hxx>
#include <ucbhelper/content.hxx>
#include <com/sun/star/util/DateTime.hpp>
+#include <comphelper/processfactory.hxx>
#include <svl/fstathelper.hxx>
using namespace ::com::sun::star;
@@ -36,7 +37,8 @@ sal_Bool FStatHelper::GetModifiedDateTimeOfFile( const rtl::OUString& rURL,
try
{
::ucbhelper::Content aTestContent( rURL,
- uno::Reference< XCommandEnvironment > ());
+ uno::Reference< XCommandEnvironment > (),
+ comphelper::getProcessComponentContext());
uno::Any aAny = aTestContent.getPropertyValue(
OUString("DateModified") );
if( aAny.hasValue() )
@@ -63,7 +65,8 @@ sal_Bool FStatHelper::IsDocument( const rtl::OUString& rURL )
try
{
::ucbhelper::Content aTestContent( rURL,
- uno::Reference< XCommandEnvironment > ());
+ uno::Reference< XCommandEnvironment > (),
+ comphelper::getProcessComponentContext());
bExist = aTestContent.isDocument();
}
catch(...)
@@ -78,7 +81,8 @@ sal_Bool FStatHelper::IsFolder( const rtl::OUString& rURL )
try
{
::ucbhelper::Content aTestContent( rURL,
- uno::Reference< XCommandEnvironment > ());
+ uno::Reference< XCommandEnvironment > (),
+ comphelper::getProcessComponentContext());
bExist = aTestContent.isFolder();
}
catch(...)
diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx
index 95abae227dc2..2d2a4d93b418 100644
--- a/svl/source/misc/sharecontrolfile.cxx
+++ b/svl/source/misc/sharecontrolfile.cxx
@@ -81,7 +81,7 @@ void ShareControlFile::OpenStream()
if ( !m_xStream.is() && !m_aURL.isEmpty() )
{
uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aContent = ::ucbhelper::Content( m_aURL, xDummyEnv );
+ ::ucbhelper::Content aContent = ::ucbhelper::Content( m_aURL, xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< ucb::XContentIdentifier > xContId( aContent.get().is() ? aContent.get()->getIdentifier() : 0 );
if ( !xContId.is() || xContId->getContentProviderScheme() != "file" )
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index 23340841999c..ed96a698f48c 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -19,30 +19,23 @@
#include <svl/urihelper.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
-#include "com/sun/star/ucb/UniversalContentBroker.hpp"
#include "com/sun/star/ucb/Command.hpp"
-#include <com/sun/star/ucb/FileSystemNotation.hpp>
#include "com/sun/star/ucb/IllegalIdentifierException.hpp"
+#include "com/sun/star/ucb/UniversalContentBroker.hpp"
#include "com/sun/star/ucb/UnsupportedCommandException.hpp"
#include "com/sun/star/ucb/XCommandEnvironment.hpp"
#include "com/sun/star/ucb/XCommandProcessor.hpp"
#include "com/sun/star/ucb/XContent.hpp"
-#include "com/sun/star/ucb/XContentIdentifierFactory.hpp"
-#include "com/sun/star/ucb/XContentProvider.hpp"
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include "com/sun/star/ucb/XUniversalContentBroker.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
-#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
-#include "com/sun/star/uno/XInterface.hpp"
#include "com/sun/star/uri/UriReferenceFactory.hpp"
#include "com/sun/star/uri/XUriReference.hpp"
#include "com/sun/star/uri/XUriReferenceFactory.hpp"
-#include "cppuhelper/exc_hlp.hxx"
#include "comphelper/processfactory.hxx"
#include "osl/diagnose.h"
#include "rtl/ustrbuf.hxx"
@@ -50,7 +43,6 @@
#include "rtl/ustring.hxx"
#include "sal/types.h"
#include <tools/inetmime.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <unotools/charclass.hxx>
#include "rtl/instance.hxx"
@@ -159,16 +151,13 @@ bool isAbsoluteHierarchicalUriReference(
enum Result { Success, GeneralFailure, SpecificFailure };
Result normalizePrefix(
- css::uno::Reference< css::ucb::XContentProvider > const & broker,
+ css::uno::Reference< css::ucb::XUniversalContentBroker > const & broker,
rtl::OUString const & uri, rtl::OUString * normalized)
{
OSL_ASSERT(broker.is() && normalized != 0);
css::uno::Reference< css::ucb::XContent > content;
try {
- content = broker->queryContent(
- css::uno::Reference< css::ucb::XContentIdentifierFactory >(
- broker, css::uno::UNO_QUERY_THROW)->createContentIdentifier(
- uri));
+ content = broker->queryContent(broker->createContentIdentifier(uri));
} catch (css::ucb::IllegalIdentifierException &) {}
if (!content.is()) {
return GeneralFailure;
@@ -196,7 +185,7 @@ Result normalizePrefix(
}
rtl::OUString normalize(
- css::uno::Reference< css::ucb::XContentProvider > const & broker,
+ css::uno::Reference< css::ucb::XUniversalContentBroker > const & broker,
css::uno::Reference< css::uri::XUriReferenceFactory > const & uriFactory,
rtl::OUString const & uriReference)
{
@@ -287,20 +276,8 @@ URIHelper::normalizedMakeRelative(
rtl::OUString const & baseUriReference, rtl::OUString const & uriReference)
{
OSL_ASSERT(context.is());
- css::uno::Reference< css::ucb::XContentProvider > broker;
- try {
- broker = css::uno::Reference< css::ucb::XContentProvider >(
- css::ucb::UniversalContentBroker::createWithKeys(context, "Local", "Office"),
- css::uno::UNO_QUERY_THROW);
- } catch (css::uno::RuntimeException &) {
- throw;
- } catch (css::uno::Exception &) {
- css::uno::Any exception(cppu::getCaughtException());
- throw css::lang::WrappedTargetRuntimeException(
- "creating com.sun.star.ucb.UniversalContentBroker failed",
- css::uno::Reference< css::uno::XInterface >(),
- exception);
- }
+ css::uno::Reference< css::ucb::XUniversalContentBroker > broker(
+ css::ucb::UniversalContentBroker::create(context));
css::uno::Reference< css::uri::XUriReferenceFactory > uriFactory(
css::uri::UriReferenceFactory::create(context));
return uriFactory->makeRelative(
diff --git a/svtools/CppunitTest_svtools_filters_test.mk b/svtools/CppunitTest_svtools_filters_test.mk
index f2669fbb1fbf..c6abe11a10ac 100644
--- a/svtools/CppunitTest_svtools_filters_test.mk
+++ b/svtools/CppunitTest_svtools_filters_test.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_CppunitTest_use_ure,svtools_filters_test))
$(eval $(call gb_CppunitTest_use_components,svtools_filters_test,\
configmgr/source/configmgr \
+ ucb/source/core/ucb1 \
))
$(eval $(call gb_CppunitTest_use_configuration,svtools_filters_test))
diff --git a/svtools/langsupport/langsupport.cxx b/svtools/langsupport/langsupport.cxx
index 1728fd10b647..12855da0a3ba 100644
--- a/svtools/langsupport/langsupport.cxx
+++ b/svtools/langsupport/langsupport.cxx
@@ -35,7 +35,6 @@
#include <sal/main.h>
#include <svtools/langtab.hxx>
#include <tools/extendapplicationenvironment.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <vcl/svapp.hxx>
#include <iostream>
diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx
index 924605628ca7..99bb35f75fe3 100644
--- a/svtools/source/contnr/contentenumeration.cxx
+++ b/svtools/source/contnr/contentenumeration.cxx
@@ -189,7 +189,7 @@ namespace svt
}
if ( !aFolder.aContent.get().is() )
{
- aFolder.aContent = ::ucbhelper::Content( aFolder.sURL, xEnvironment );
+ aFolder.aContent = ::ucbhelper::Content( aFolder.sURL, xEnvironment, comphelper::getProcessComponentContext() );
{
::osl::MutexGuard aGuard( m_aMutex );
m_aFolder.aContent = aFolder.aContent;
@@ -269,7 +269,7 @@ namespace svt
if ( bHasTargetURL &&
INetURLObject( aContentURL ).GetProtocol() == INET_PROT_VND_SUN_STAR_HIER )
{
- ::ucbhelper::Content aCnt( aTargetURL, xEnvironment );
+ ::ucbhelper::Content aCnt( aTargetURL, xEnvironment, comphelper::getProcessComponentContext() );
try
{
aCnt.getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" )) ) >>= pData->maSize;
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 2ada4c14be1a..a390c458fd40 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -365,7 +365,7 @@ void NameTranslationList::Init()
try
{
- ::ucbhelper::Content aTestContent( maTransFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
+ ::ucbhelper::Content aTestContent( maTransFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
if( aTestContent.isDocument() )
{
@@ -816,7 +816,7 @@ PopupMenu* ViewTabListBox_Impl::CreateContextMenu( void )
{
OUString aURL( static_cast< SvtContentEntry * >(
pEntry->GetUserData() )->maURL );
- aCnt = ::ucbhelper::Content( aURL, mxCmdEnv );
+ aCnt = ::ucbhelper::Content( aURL, mxCmdEnv, comphelper::getProcessComponentContext() );
}
catch( Exception const & )
{
@@ -929,7 +929,7 @@ void ViewTabListBox_Impl::DeleteEntries()
bool canDelete = true;
try
{
- ::ucbhelper::Content aCnt( aURL, mxCmdEnv );
+ ::ucbhelper::Content aCnt( aURL, mxCmdEnv, comphelper::getProcessComponentContext() );
Reference< XCommandInfo > aCommands = aCnt.getCommands();
if ( aCommands.is() )
canDelete
@@ -996,7 +996,7 @@ sal_Bool ViewTabListBox_Impl::EditedEntry( SvLBoxEntry* pEntry,
{
OUString aPropName( RTL_CONSTASCII_USTRINGPARAM( "Title" ));
bool canRename = true;
- ::ucbhelper::Content aContent( aURL, mxCmdEnv );
+ ::ucbhelper::Content aContent( aURL, mxCmdEnv, comphelper::getProcessComponentContext() );
try
{
@@ -1125,7 +1125,7 @@ sal_Bool ViewTabListBox_Impl::Kill( const OUString& rContent )
try
{
- ::ucbhelper::Content aCnt( rContent, mxCmdEnv );
+ ::ucbhelper::Content aCnt( rContent, mxCmdEnv, comphelper::getProcessComponentContext() );
aCnt.executeCommand( OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" )), makeAny( sal_Bool( sal_True ) ) );
}
catch( ::com::sun::star::ucb::CommandAbortedException const & )
@@ -1251,7 +1251,7 @@ sal_Bool SvtFileView::GetParentURL( String& rParentURL ) const
sal_Bool bRet = sal_False;
try
{
- ::ucbhelper::Content aCnt( mpImp->maViewURL, mpImp->mxCmdEnv );
+ ::ucbhelper::Content aCnt( mpImp->maViewURL, mpImp->mxCmdEnv, comphelper::getProcessComponentContext() );
Reference< XContent > xContent( aCnt.get() );
Reference< com::sun::star::container::XChild > xChild( xContent, UNO_QUERY );
if ( xChild.is() )
@@ -1308,7 +1308,7 @@ sal_Bool SvtFileView::Initialize( const ::com::sun::star::uno::Reference< ::com:
WaitObject aWaitCursor( this );
mpImp->Clear();
- ::ucbhelper::Content aContent(_xContent, mpImp->mxCmdEnv );
+ ::ucbhelper::Content aContent(_xContent, mpImp->mxCmdEnv, comphelper::getProcessComponentContext() );
FileViewResult eResult = mpImp->GetFolderContent_Impl( FolderDescriptor( aContent ), NULL );
OSL_ENSURE( eResult != eStillRunning, "SvtFileView::Initialize: this was expected to be synchronous!" );
if ( eResult != eSuccess )
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 238ead8f89de..b0d80e773245 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -358,7 +358,8 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL,
Content aCnt( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ),
new ::ucbhelper::CommandEnvironment( uno::Reference< XInteractionHandler >(),
- uno::Reference< XProgressHandler >() ) );
+ uno::Reference< XProgressHandler >() ),
+ comphelper::getProcessComponentContext() );
uno::Reference< XResultSet > xResultSet;
Sequence< OUString > aProps(2);
OUString* pProps = aProps.getArray();
diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx
index 567bb1e9fae1..e93be567293b 100644
--- a/svtools/source/dialogs/ServerDetailsControls.cxx
+++ b/svtools/source/dialogs/ServerDetailsControls.cxx
@@ -384,7 +384,7 @@ IMPL_LINK( CmisDetailsContainer, RefreshReposHdl, void *, EMPTYARG )
}
// Get the Content
- ::ucbhelper::Content aCnt( sUrl, m_xCmdEnv );
+ ::ucbhelper::Content aCnt( sUrl, m_xCmdEnv, comphelper::getProcessComponentContext() );
Sequence< rtl::OUString > aProps( 1 );
aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx
index 217f9a207c1e..5cd2f8d7fd20 100644
--- a/svtools/source/filter/filter.cxx
+++ b/svtools/source/filter/filter.cxx
@@ -124,7 +124,8 @@ sal_Bool ImplDirEntryHelper::Exists( const INetURLObject& rObj )
try
{
::ucbhelper::Content aCnt( rObj.GetMainURL( INetURLObject::NO_DECODE ),
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
bExists = aCnt.isDocument();
}
@@ -150,7 +151,8 @@ void ImplDirEntryHelper::Kill( const String& rMainUrl )
try
{
::ucbhelper::Content aCnt( rMainUrl,
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
aCnt.executeCommand( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" )),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx
index 3a0943f726a9..69d5671479b3 100644
--- a/svtools/source/misc/imagemgr.cxx
+++ b/svtools/source/misc/imagemgr.cxx
@@ -340,7 +340,7 @@ static sal_uInt16 GetFolderImageId_Impl( const String& rURL )
::svtools::VolumeInfo aVolumeInfo;
try
{
- ::ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ ::ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
if ( GetVolumeProperties_Impl( aCnt, aVolumeInfo ) )
{
if ( aVolumeInfo.m_bIsRemote )
@@ -472,7 +472,7 @@ static sal_uInt16 GetFolderDescriptionId_Impl( const String& rURL )
svtools::VolumeInfo aVolumeInfo;
try
{
- ::ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ ::ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
if ( GetVolumeProperties_Impl( aCnt, aVolumeInfo ) )
{
if ( aVolumeInfo.m_bIsRemote )
diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx
index da29646e7294..139d84ad7336 100644
--- a/svtools/source/misc/templatefoldercache.cxx
+++ b/svtools/source/misc/templatefoldercache.cxx
@@ -622,7 +622,7 @@ namespace svt
{
Reference< XDynamicResultSet > xDynResultSet;
- ::ucbhelper::Content aTemplateRoot( _rxRoot->getURL(), Reference< XCommandEnvironment >() );
+ ::ucbhelper::Content aTemplateRoot( _rxRoot->getURL(), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
xDynResultSet = aTemplateRoot.createDynamicCursor( aContentProperties, ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS );
if ( xDynResultSet.is() )
xResultSet = xDynResultSet->getStaticResultSet();
diff --git a/svx/Executable_gengal.bin.mk b/svx/Executable_gengal.bin.mk
index 21df00ef2741..7b06bad00624 100644
--- a/svx/Executable_gengal.bin.mk
+++ b/svx/Executable_gengal.bin.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Executable_use_libraries,$(svx_GENGALBIN),\
cppu \
cppuhelper \
vcl \
- ucbhelper \
svxcore \
$(gb_STDLIBS) \
))
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index df80ccf72bc9..4aa2875b3510 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -26,7 +26,9 @@
*
************************************************************************/
+#include "sal/config.h"
+#include <comphelper/processfactory.hxx>
#include <tools/datetime.hxx>
#include <unotools/datetime.hxx>
#include <vcl/msgbox.hxx>
@@ -231,7 +233,7 @@ void GalleryBrowser1::ImplFillExchangeData( const GalleryTheme* pThm, ExchangeDa
try
{
- ::ucbhelper::Content aCnt( pThm->GetThmURL().GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aCnt( pThm->GetThmURL().GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
util::DateTime aDateTimeModified;
DateTime aDateTime( DateTime::EMPTY );
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 7f4303522646..856a92993926 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -26,7 +26,9 @@
*
************************************************************************/
+#include "sal/config.h"
+#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <tools/vcompat.hxx>
#include <ucbhelper/content.hxx>
@@ -264,7 +266,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR
try
{
uno::Reference< ucb::XCommandEnvironment > xEnv;
- ::ucbhelper::Content aCnt( rBaseURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
+ ::ucbhelper::Content aCnt( rBaseURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext() );
uno::Sequence< OUString > aProps( 1 );
aProps.getArray()[ 0 ] = OUString("Url");
@@ -327,9 +329,9 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR
try
{
- ::ucbhelper::Content aThmCnt( aThmURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
- ::ucbhelper::Content aSdgCnt( aSdgURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
- ::ucbhelper::Content aSdvCnt( aSdvURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
+ ::ucbhelper::Content aThmCnt( aThmURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext() );
+ ::ucbhelper::Content aSdgCnt( aSdgURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext() );
+ ::ucbhelper::Content aSdvCnt( aSdvURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext() );
try
{
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index 00ee9b709f19..4fd476915e20 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -280,7 +280,7 @@ sal_Bool FileExists( const INetURLObject& rURL )
{
try
{
- ::ucbhelper::Content aCnt( rURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aCnt( rURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
OUString aTitle;
aCnt.getPropertyValue( OUString("Title") ) >>= aTitle;
@@ -313,14 +313,14 @@ sal_Bool CreateDir( const INetURLObject& rURL )
uno::Reference< ucb::XCommandEnvironment > aCmdEnv;
INetURLObject aNewFolderURL( rURL );
INetURLObject aParentURL( aNewFolderURL ); aParentURL.removeSegment();
- ::ucbhelper::Content aParent( aParentURL.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv );
+ ::ucbhelper::Content aParent( aParentURL.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext() );
uno::Sequence< OUString > aProps( 1 );
uno::Sequence< uno::Any > aValues( 1 );
aProps.getArray()[ 0 ] = OUString("Title");
aValues.getArray()[ 0 ] = uno::makeAny( OUString( aNewFolderURL.GetName() ) );
- ::ucbhelper::Content aContent( aNewFolderURL.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv );
+ ::ucbhelper::Content aContent( aNewFolderURL.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext() );
bRet = aParent.insertNewContent( OUString("application/vnd.sun.staroffice.fsys-folder"), aProps, aValues, aContent );
}
catch( const ucb::ContentCreationException& )
@@ -345,7 +345,7 @@ sal_Bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL )
try
{
- ::ucbhelper::Content aDestPath( rDstURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aDestPath( rDstURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
aDestPath.executeCommand( OUString("transfer"),
uno::makeAny( ucb::TransferInfo( sal_False, rSrcURL.GetMainURL( INetURLObject::NO_DECODE ),
@@ -375,7 +375,7 @@ sal_Bool KillFile( const INetURLObject& rURL )
{
try
{
- ::ucbhelper::Content aCnt( rURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aCnt( rURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
aCnt.executeCommand( OUString("delete"), uno::makeAny( sal_Bool( sal_True ) ) );
}
catch( const ucb::ContentCreationException& )
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index e82289d5f970..0d1ff7db010c 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -26,7 +26,9 @@
*
************************************************************************/
+#include "sal/config.h"
+#include <comphelper/processfactory.hxx>
#include <tools/urlobj.hxx>
#include <tools/vcompat.hxx>
#include <unotools/streamwrap.hxx>
@@ -1160,7 +1162,7 @@ sal_Bool GalleryTheme::InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, s
try
{
- ::ucbhelper::Content aCnt( rFileOrDirURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aCnt( rFileOrDirURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
sal_Bool bFolder = false;
aCnt.getPropertyValue( OUString("IsFolder") ) >>= bFolder;
diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx
index 1ec70287e9da..21b86b874c51 100644
--- a/svx/source/gengal/gengal.cxx
+++ b/svx/source/gengal/gengal.cxx
@@ -42,9 +42,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
-
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <tools/urlobj.hxx>
#include <tools/fsys.hxx>
@@ -80,7 +78,6 @@ public:
protected:
Reference<XMultiServiceFactory> xMSF;
void Init();
- void InitUCB();
};
Gallery* createGallery( const rtl::OUString& aGalleryURL )
@@ -217,19 +214,9 @@ void GalApp::Init()
fprintf( stderr, "Failed to bootstrap\n" );
::comphelper::setProcessServiceFactory( xMSF );
- InitUCB();
-}
-
-void GalApp::InitUCB()
-{
- Sequence< Any > aArgs(2);
- aArgs[0]
- <<= rtl::OUString(UCB_CONFIGURATION_KEY1_LOCAL);
- aArgs[1]
- <<= rtl::OUString(UCB_CONFIGURATION_KEY2_OFFICE);
-
- if (! ::ucbhelper::ContentBroker::initialize( xMSF, aArgs ) )
- fprintf( stderr, "Failed to init content broker\n" );
+ // For backwards compatibility, in case some code still uses plain
+ // createInstance w/o args directly to obtain an instance:
+ com::sun::star::ucb::UniversalContentBroker::create(xComponentContext);
}
int GalApp::Main()
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 624a2a71cc0d..dab7b9feaf62 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -30,7 +30,6 @@
#include "svx/unoapi.hxx"
#include <svx/unoshape.hxx>
#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <unotools/datetime.hxx>
#include <sfx2/lnkbase.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index d693d8b2035d..bf8552521be6 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -28,8 +28,6 @@
#include <sfx2/linkmgr.hxx>
-#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <unotools/datetime.hxx>
#include <svx/svdogrp.hxx>
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 875d263e033f..89ce42f4d540 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -36,7 +36,7 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <ucbhelper/content.hxx>
-
+#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <vcl/svapp.hxx>
@@ -290,7 +290,8 @@ uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream()
return 0;
}
ucbhelper::Content tempFile(m_pImpl->m_pTempFile->m_TempFileURL,
- uno::Reference<ucb::XCommandEnvironment>());
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext());
return tempFile.openStream();
}
@@ -338,7 +339,8 @@ bool lcl_HandlePackageURL(
try
{
::ucbhelper::Content tempContent(tempFileURL,
- uno::Reference<ucb::XCommandEnvironment>());
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext());
tempContent.writeStream(xInStream, true); // copy stream to file
}
catch (uno::Exception const& e)
diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx
index e8c8344bec84..ea7abe3ca95f 100644
--- a/svx/source/svdraw/svdotxln.cxx
+++ b/svx/source/svdraw/svdotxln.cxx
@@ -26,11 +26,12 @@
*
************************************************************************/
+#include "sal/config.h"
+#include <comphelper/processfactory.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/localfilehelper.hxx>
#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <unotools/datetime.hxx>
#include <svx/svdotext.hxx>
#include "svx/svditext.hxx"
@@ -175,30 +176,24 @@ bool SdrTextObj::ReloadLinkedText( bool bForceLoad)
if( pData )
{
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
DateTime aFileDT( DateTime::EMPTY );
- sal_Bool bExists = sal_False, bLoad = sal_False;
+ sal_Bool bExists = sal_True, bLoad = sal_False;
- if( pBroker )
+ try
{
- bExists = sal_True;
+ INetURLObject aURL( pData->aFileName );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
- try
- {
- INetURLObject aURL( pData->aFileName );
- DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
-
- ::ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
- ::com::sun::star::uno::Any aAny( aCnt.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" ) ) ) );
- ::com::sun::star::util::DateTime aDateTime;
+ ::ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
+ ::com::sun::star::uno::Any aAny( aCnt.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" ) ) ) );
+ ::com::sun::star::util::DateTime aDateTime;
- aAny >>= aDateTime;
- ::utl::typeConvert( aDateTime, aFileDT );
- }
- catch( ... )
- {
- bExists = sal_False;
- }
+ aAny >>= aDateTime;
+ ::utl::typeConvert( aDateTime, aFileDT );
+ }
+ catch( ... )
+ {
+ bExists = sal_False;
}
if( bExists )
diff --git a/svx/workben/msview/msview.cxx b/svx/workben/msview/msview.cxx
index 122dcc1fa5e1..03c0375f578d 100644
--- a/svx/workben/msview/msview.cxx
+++ b/svx/workben/msview/msview.cxx
@@ -60,9 +60,6 @@
#include <cppuhelper/servicefactory.hxx>
#include <cppuhelper/bootstrap.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
-
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/awt/XWindowPeer.hpp>
@@ -1113,18 +1110,6 @@ void MSViewerWorkWindow::Resize()
OSL_FAIL( "No service manager!" );
return -1;
}
-
- // Init UCB
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= rtl::OUString( UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= rtl::OUString( UCB_CONFIGURATION_KEY2_OFFICE );
- sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xMSF, aArgs );
- if ( !bSuccess )
- {
- OSL_FAIL( "Error creating UCB!" );
- return -1;
- }
-
}
catch ( uno::Exception const & )
{
diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
index 01fb1921efd0..6397eebc2830 100644
--- a/sw/source/core/unocore/swunohelper.cxx
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -28,8 +28,8 @@
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XContentIdentifier.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/ucb/NameClash.hpp>
@@ -42,7 +42,6 @@
#include <tools/datetime.hxx>
#include <tools/string.hxx>
#include <ucbhelper/contentidentifier.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/content.hxx>
#include <swunohelper.hxx>
@@ -71,7 +70,8 @@ sal_Bool UCB_DeleteFile( const String& rURL )
try
{
ucbhelper::Content aTempContent( rURL,
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >());
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
aTempContent.executeCommand(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
@@ -96,7 +96,8 @@ sal_Bool UCB_CopyFile( const String& rURL, const String& rNewURL, sal_Bool bCopy
String sMainURL( aURL.GetMainURL(INetURLObject::NO_DECODE) );
ucbhelper::Content aTempContent( sMainURL,
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >());
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
::com::sun::star::uno::Any aAny;
::com::sun::star::ucb::TransferInfo aInfo;
@@ -136,10 +137,10 @@ sal_Bool UCB_IsCaseSensitiveFileName( const String& rURL )
ucbhelper::ContentIdentifier( xMSF,
aTempObj.GetMainURL( INetURLObject::NO_DECODE ));
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider > xProv =
- ucbhelper::ContentBroker::get()->getContentProviderInterface();
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XUniversalContentBroker > xUcb =
+ com::sun::star::ucb::UniversalContentBroker::create(comphelper::getProcessComponentContext());
- sal_Int32 nCompare = xProv->compareContentIds( xRef1, xRef2 );
+ sal_Int32 nCompare = xUcb->compareContentIds( xRef1, xRef2 );
bCaseSensitive = 0 != nCompare;
}
catch( ::com::sun::star::uno::Exception& )
@@ -155,7 +156,7 @@ sal_Bool UCB_IsReadOnlyFileName( const String& rURL )
sal_Bool bIsReadOnly = sal_False;
try
{
- ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >());
+ ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
::com::sun::star::uno::Any aAny = aCnt.getPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsReadOnly")));
if(aAny.hasValue())
@@ -173,7 +174,7 @@ sal_Bool UCB_IsFile( const String& rURL )
sal_Bool bExists = sal_False;
try
{
- ::ucbhelper::Content aContent( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aContent( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
bExists = aContent.isDocument();
}
catch (::com::sun::star::uno::Exception &)
@@ -187,7 +188,7 @@ sal_Bool UCB_IsDirectory( const String& rURL )
sal_Bool bExists = sal_False;
try
{
- ::ucbhelper::Content aContent( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::ucbhelper::Content aContent( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
bExists = aContent.isFolder();
}
catch (::com::sun::star::uno::Exception &)
@@ -209,7 +210,7 @@ bool UCB_GetFileListOfFolder( const String& rURL,
sal_Bool bOk = sal_False;
try
{
- ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >());
+ ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet;
sal_uInt16 nSeqSize = pDateTimeList ? 2 : 1;
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 67345a93475c..992549c9df48 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -32,7 +32,7 @@
#include <sal/types.h>
#include <tools/solar.h>
-
+#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/string.hxx>
#include <sot/storinfo.hxx>
@@ -48,8 +48,6 @@
#include <sfx2/linkmgr.hxx>
#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/commandenvironment.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <hintids.hxx>
@@ -2320,8 +2318,8 @@ bool CanUseRemoteLink(const String &rGrfName)
try
{
::ucbhelper::Content aCnt(rGrfName,
- uno::Reference<
- ucb::XCommandEnvironment >() );
+ uno::Reference< ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
rtl::OUString aTitle;
aCnt.getPropertyValue("Title") >>= aTitle;
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index c123b95d16f8..7f011ecc194c 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -668,7 +668,8 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl)
try
{
Content aTestContent( sPath,
- uno::Reference< XCommandEnvironment >());
+ uno::Reference< XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
Any aAny = aTestContent.getPropertyValue( C2U("IsReadOnly") );
if(aAny.hasValue())
{
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index b829dd46d7c5..ead6af3adad1 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -42,7 +42,6 @@ $(eval $(call gb_Library_use_libraries,subsequenttest,\
test \
tl \
utl \
- ucbhelper \
unotest \
vcl \
$(gb_STDLIBS) \
diff --git a/test/Library_test.mk b/test/Library_test.mk
index 48ca6b01262b..cea736feffa1 100644
--- a/test/Library_test.mk
+++ b/test/Library_test.mk
@@ -48,7 +48,6 @@ $(eval $(call gb_Library_use_libraries,test,\
svt \
tl \
utl \
- ucbhelper \
unotest \
vcl \
$(gb_STDLIBS) \
diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx
index b560913699be..2b68451d1ae6 100644
--- a/test/source/bootstrapfixture.cxx
+++ b/test/source/bootstrapfixture.cxx
@@ -31,13 +31,14 @@
#include <rtl/strbuf.hxx>
#include <rtl/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <comphelper/processfactory.hxx>
#include <i18npool/mslangid.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
#include <vcl/svapp.hxx>
#include <tools/resmgr.hxx>
@@ -77,21 +78,6 @@ void test::BootstrapFixture::setUp()
lang::Locale aLocale(aLang, aCountry, OUString());
ResMgr::SetDefaultLocale( aLocale );
- if (m_bNeedUCB)
- {
- // initialise UCB-Broker
- uno::Sequence<uno::Any> aUcbInitSequence(2);
- aUcbInitSequence[0] <<= OUString("Local");
- aUcbInitSequence[1] <<= OUString("Office");
- bool bInitUcb = ucbhelper::ContentBroker::initialize(m_xSFactory, aUcbInitSequence);
- CPPUNIT_ASSERT_MESSAGE("Should be able to initialize UCB", bInitUcb);
-
- uno::Reference<ucb::XContentProviderManager> xUcb =
- ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
- uno::Reference<ucb::XContentProvider> xFileProvider(m_xSFactory->createInstance("com.sun.star.ucb.FileContentProvider"), uno::UNO_QUERY);
- xUcb->registerContentProvider(xFileProvider, "file", sal_True);
- }
-
SvtSysLocaleOptions aLocalOptions;
OUString aLangISO = MsLangId::convertLanguageToIsoString( LANGUAGE_ENGLISH_US );
aLocalOptions.SetLocaleConfigString( aLangISO );
@@ -106,11 +92,23 @@ void test::BootstrapFixture::setUp()
// Make GraphicConverter work, normally done in desktop::Desktop::Main()
Application::SetFilterHdl( LINK( this, test::BootstrapFixture, ImplInitFilterHdl ) );
+
+ if (m_bNeedUCB)
+ {
+ // initialise unconfigured UCB:
+ uno::Reference<ucb::XUniversalContentBroker> xUcb(m_xSFactory->createInstance("com.sun.star.ucb.UniversalContentBroker"), uno::UNO_QUERY_THROW);
+ uno::Reference<ucb::XContentProvider> xFileProvider(m_xSFactory->createInstance("com.sun.star.ucb.FileContentProvider"), uno::UNO_QUERY_THROW);
+ xUcb->registerContentProvider(xFileProvider, "file", sal_True);
+ uno::Reference<ucb::XContentProvider> xTdocProvider(m_xSFactory->createInstance("com.sun.star.ucb.TransientDocumentsContentProvider"), uno::UNO_QUERY);
+ if (xTdocProvider.is())
+ {
+ xUcb->registerContentProvider(xTdocProvider, "vnd.sun.star.tdoc", sal_True);
+ }
+ }
}
void test::BootstrapFixture::tearDown()
{
- ucbhelper::ContentBroker::deinitialize();
test::BootstrapFixtureBase::tearDown();
}
diff --git a/ucb/Library_ucpftp1.mk b/ucb/Library_ucpftp1.mk
index 69e938ce9d8d..e588649e2f30 100644
--- a/ucb/Library_ucpftp1.mk
+++ b/ucb/Library_ucpftp1.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_Library_set_componentfile,ucpftp1,ucb/source/ucp/ftp/ucpftp1))
$(eval $(call gb_Library_use_sdk_api,ucpftp1))
$(eval $(call gb_Library_use_libraries,ucpftp1,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/ucb/qa/complex/tdoc/CheckContentProvider.java b/ucb/qa/complex/tdoc/CheckContentProvider.java
index b41f04e656d3..7e82ba795a08 100644
--- a/ucb/qa/complex/tdoc/CheckContentProvider.java
+++ b/ucb/qa/complex/tdoc/CheckContentProvider.java
@@ -122,7 +122,7 @@ public class CheckContentProvider {
XContentProvider xContentProvider =
UnoRuntime.queryInterface(XContentProvider.class, o);
- // create the ucb
+ // create unconfigured ucb
XContentIdentifierFactory xContentIdentifierFactory =
UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker"));
// create a content identifier from the ucb for tdoc
@@ -185,7 +185,7 @@ public class CheckContentProvider {
Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider");
XContentProvider xContentProvider =
UnoRuntime.queryInterface(XContentProvider.class, o);
- // create the ucb
+ // create unconfigured ucb
XContentIdentifierFactory xContentIdentifierFactory =
UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker"));
// create a content identifier from the ucb for tdoc
@@ -220,7 +220,7 @@ public class CheckContentProvider {
Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider");
XContentProvider xContentProvider =
UnoRuntime.queryInterface(XContentProvider.class, o);
- // create the ucb
+ // create unconfigured ucb
XContentIdentifierFactory xContentIdentifierFactory =
UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker"));
// create a content identifier from the ucb for tdoc
@@ -255,7 +255,7 @@ public class CheckContentProvider {
XContentProvider xContentProvider =
UnoRuntime.queryInterface(XContentProvider.class, o);
- // create the ucb
+ // create unconfigured ucb
XContentIdentifierFactory xContentIdentifierFactory =
UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker"));
// create a content identifier from the ucb for tdoc
diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java
index 2898792eca18..7ad0dc07e59a 100644
--- a/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java
+++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java
@@ -74,7 +74,7 @@ public class CheckTransientDocumentsContent {
*/
@Test public void checkTransientDocumentsContent() {
try {
- // create the ucb
+ // create unconfigured ucb
XContentIdentifierFactory xContentIdentifierFactory =
UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker"));
XContentProvider xContentProvider =
diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java
index 29059e0ce3d1..6697709180c2 100644
--- a/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java
+++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java
@@ -85,7 +85,7 @@ public class CheckTransientDocumentsContentProvider {
XContentProvider xContentProvider =
UnoRuntime.queryInterface(XContentProvider.class, o);
- // create the ucb
+ // create unconfigured ucb
XContentIdentifierFactory xContentIdentifierFactory =
UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker"));
// create a content identifier from the ucb for tdoc
diff --git a/ucb/qa/complex/ucb/UCB.java b/ucb/qa/complex/ucb/UCB.java
index 95cc501b5270..2296b7530037 100644
--- a/ucb/qa/complex/ucb/UCB.java
+++ b/ucb/qa/complex/ucb/UCB.java
@@ -29,7 +29,6 @@ import java.util.List;
import java.util.ArrayList;
import com.sun.star.beans.Property;
-import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdbc.XResultSet;
import com.sun.star.sdbc.XRow;
// import com.sun.star.uno.XComponentContext;
@@ -54,20 +53,14 @@ import static org.junit.Assert.*;
* It should be always: dir,filename.
*/
public class UCB {
- private Object ucb;
+ private XUniversalContentBroker ucb;
// public String[] getTestMethodNames() {
// return new String[] {"checkWrongFtpConnection"};
// }
- public void init(XMultiServiceFactory xmsf) throws Exception {
- String[] keys = new String[2];
- keys[0] = "Local";
- keys[1] = "Office";
- ucb =
- xmsf.createInstanceWithArguments(
- "com.sun.star.ucb.UniversalContentBroker",
- keys);
+ public void init() throws Exception {
+ ucb = UniversalContentBroker.create(connection.getComponentContext());
}
public void delete(String filename) throws Exception {
@@ -193,8 +186,8 @@ public class UCB {
public Object getContent(String path) throws Exception
{
- XContentIdentifier id = (UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb)).createContentIdentifier(path);
- return (UnoRuntime.queryInterface(XContentProvider.class, ucb)).queryContent(id);
+ XContentIdentifier id = ucb.createContentIdentifier(path);
+ return ucb.queryContent(id);
}
public static interface Verifier {
@@ -204,10 +197,9 @@ public class UCB {
@Test public void checkWrongFtpConnection() {
//localhost ;Lo-1.Germany.sun.com; 10.16.65.155
try {
- XMultiServiceFactory xLocMSF = getMSF();
String acountUrl = "ftp://noname:nopasswd@nohost";
System.out.println(acountUrl);
- init(xLocMSF);
+ init();
Object content = getContent(acountUrl);
OpenCommandArgument2 aArg = new OpenCommandArgument2();
@@ -232,14 +224,6 @@ public class UCB {
// System.exit(0);
}
-
-
- private XMultiServiceFactory getMSF()
- {
- final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
- return xMSF1;
- }
-
// setup and close connections
@BeforeClass public static void setUpConnection() throws Exception {
System.out.println("setUpConnection()");
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index 4d454c2e4f30..c3ad4337460f 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -372,17 +372,34 @@ void SAL_CALL UniversalContentBroker::initialize(
throw( com::sun::star::uno::Exception,
com::sun::star::uno::RuntimeException )
{
- //@@@ At the moment, there's a problem when one (non-one-instance) factory
- // 'wraps' another (one-instance) factory, causing this method to be
- // called several times:
- m_aArguments = aArguments;
-
- oslInterlockedCount nCount = osl_incrementInterlockedCount(&m_nInitCount);
- if (nCount == 1)
- configureUcb();
- else
- osl_decrementInterlockedCount(&m_nInitCount);
- // make the possibility of overflow less likely...
+ {
+ osl::MutexGuard aGuard(m_aMutex);
+ if (m_aArguments.getLength() != 0)
+ {
+ if (aArguments.getLength() != 0
+ && !(m_aArguments.getLength() == 2
+ && aArguments.getLength() == 2
+ && m_aArguments[0] == aArguments[0]
+ && m_aArguments[1] == aArguments[1]))
+ {
+ throw IllegalArgumentException(
+ "UCB reinitialized with different arguments",
+ static_cast< cppu::OWeakObject * >(this), 0);
+ }
+ return;
+ }
+ if (aArguments.getLength() == 0)
+ {
+ m_aArguments.realloc(2);
+ m_aArguments[0] <<= OUString("Local");
+ m_aArguments[1] <<= OUString("Office");
+ }
+ else
+ {
+ m_aArguments = aArguments;
+ }
+ }
+ configureUcb();
}
//=========================================================================
diff --git a/ucb/source/core/ucb.hxx b/ucb/source/core/ucb.hxx
index f12386fe94ab..8cd61e413f0a 100644
--- a/ucb/source/core/ucb.hxx
+++ b/ucb/source/core/ucb.hxx
@@ -57,6 +57,7 @@ class UniversalContentBroker :
public com::sun::star::ucb::XUniversalContentBroker,
public com::sun::star::lang::XTypeProvider,
public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::lang::XInitialization,
public com::sun::star::util::XChangesListener
{
public:
diff --git a/ucb/source/ucp/expand/ucpexpand.cxx b/ucb/source/ucp/expand/ucpexpand.cxx
index 3f75376e1249..4e2aadef6843 100644
--- a/ucb/source/ucp/expand/ucpexpand.cxx
+++ b/ucb/source/ucp/expand/ucpexpand.cxx
@@ -63,6 +63,7 @@ typedef ::cppu::WeakComponentImplHelper2<
//==============================================================================
class ExpandContentProviderImpl : protected MutexHolder, public t_impl_helper
{
+ uno::Reference< uno::XComponentContext > m_xComponentContext;
uno::Reference< util::XMacroExpander > m_xMacroExpander;
OUString expandUri(
uno::Reference< ucb::XContentIdentifier > const & xIdentifier ) const;
@@ -75,6 +76,7 @@ public:
inline ExpandContentProviderImpl(
uno::Reference< uno::XComponentContext > const & xComponentContext )
: t_impl_helper( m_mutex ),
+ m_xComponentContext( xComponentContext ),
m_xMacroExpander(
xComponentContext->getValueByName(
OUSTR("/singletons/com.sun.star.util.theMacroExpander") ),
@@ -216,7 +218,8 @@ uno::Reference< ucb::XContent > ExpandContentProviderImpl::queryContent(
::ucbhelper::Content ucb_content;
if (::ucbhelper::Content::create(
- uri, uno::Reference< ucb::XCommandEnvironment >(), ucb_content ))
+ uri, uno::Reference< ucb::XCommandEnvironment >(),
+ m_xComponentContext, ucb_content ))
{
return ucb_content.get();
}
diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx
index 6e47cad61aa9..290a49570c6d 100644
--- a/ucb/source/ucp/ext/ucpext_content.cxx
+++ b/ucb/source/ucp/ext/ucpext_content.cxx
@@ -286,7 +286,7 @@ namespace ucb { namespace ucp { namespace ext
if ( aOpenCommand.Sink.is() )
{
const ::rtl::OUString sPhysicalContentURL( getPhysicalURL() );
- ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEvironment );
+ ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEvironment, comphelper::ComponentContext(m_xSMgr).getUNOContext() );
aRet = aRequestedContent.executeCommand( ::rtl::OUString( "open" ), makeAny( aOpenCommand ) );
}
}
@@ -502,7 +502,7 @@ namespace ucb { namespace ucp { namespace ext
case E_EXTENSION_CONTENT:
{
const ::rtl::OUString sPhysicalContentURL( getPhysicalURL() );
- ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEnv );
+ ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEnv, comphelper::ComponentContext(m_xSMgr).getUNOContext() );
// translate the property request
Sequence< ::rtl::OUString > aPropertyNames( i_rProperties.getLength() );
diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
index 29356a7e68e5..aec7058c1f24 100644
--- a/ucb/source/ucp/ext/ucpext_datasupplier.cxx
+++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
@@ -178,7 +178,7 @@ namespace ucb { namespace ucp { namespace ext
case E_EXTENSION_CONTENT:
{
const ::rtl::OUString sPackageLocation( m_pImpl->m_xContent->getPhysicalURL() );
- ::ucbhelper::Content aWrappedContent( sPackageLocation, getResultSet()->getEnvironment() );
+ ::ucbhelper::Content aWrappedContent( sPackageLocation, getResultSet()->getEnvironment(), comphelper::ComponentContext(m_pImpl->m_xSMgr).getUNOContext() );
// obtain the properties which our result set is set up for from the wrapped content
Sequence< ::rtl::OUString > aPropertyNames(1);
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index a7b281129e62..7d9db3d8b582 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -33,7 +33,8 @@
*************************************************************************/
-#include <ucbhelper/contentbroker.hxx>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
+#include <comphelper/componentcontext.hxx>
#include <osl/socket.hxx>
#include "ftpcontentprovider.hxx"
#include "ftpcontent.hxx"
@@ -258,23 +259,10 @@ FTPContentProvider::getHttpProvider()
throw(RuntimeException)
{
// used for access to ftp-proxy
- ucbhelper::ContentBroker *pBroker = ucbhelper::ContentBroker::get();
-
- if(pBroker) {
- Reference<XContentProviderManager > xManager(
- pBroker->getContentProviderManagerInterface());
-
- if(xManager.is())
- return
- xManager->queryContentProvider(
- rtl::OUString("http:"));
- else
- throw RuntimeException(
- rtl::OUString( "bad ucbhelper::ContentBroker"),
- *this);
- } else
- return 0;
-
+ return
+ UniversalContentBroker::create(
+ comphelper::ComponentContext(m_xSMgr).getUNOContext())->
+ queryContentProvider("http:");
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java b/ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java
index 7017bec2ed25..a84516e0f4a4 100644
--- a/ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java
+++ b/ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java
@@ -64,6 +64,7 @@ public final class GlobalTransfer_Test extends ComplexTestCase {
XMultiServiceFactory xMSF = (XMultiServiceFactory)param.getMSF();
oObj
= xMSF.createInstance( "com.sun.star.ucb.UniversalContentBroker" );
+ // unconfigured instance
}
catch(com.sun.star.uno.Exception e) {
e.printStackTrace((PrintWriter)log);
diff --git a/ucbhelper/Package_inc.mk b/ucbhelper/Package_inc.mk
index 7df94fef828e..2569a0487cbd 100644
--- a/ucbhelper/Package_inc.mk
+++ b/ucbhelper/Package_inc.mk
@@ -13,9 +13,7 @@ $(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/activedatasink.hxx
$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/activedatastreamer.hxx,ucbhelper/activedatastreamer.hxx))
$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/cancelcommandexecution.hxx,ucbhelper/cancelcommandexecution.hxx))
$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/commandenvironment.hxx,ucbhelper/commandenvironment.hxx))
-$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/configurationkeys.hxx,ucbhelper/configurationkeys.hxx))
$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/content.hxx,ucbhelper/content.hxx))
-$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/contentbroker.hxx,ucbhelper/contentbroker.hxx))
$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/contenthelper.hxx,ucbhelper/contenthelper.hxx))
$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/contentidentifier.hxx,ucbhelper/contentidentifier.hxx))
$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/contentinfo.hxx,ucbhelper/contentinfo.hxx))
diff --git a/ucbhelper/inc/ucbhelper/configurationkeys.hxx b/ucbhelper/inc/ucbhelper/configurationkeys.hxx
deleted file mode 100644
index 2f7992047993..000000000000
--- a/ucbhelper/inc/ucbhelper/configurationkeys.hxx
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _UCBHELPER_CONFIGURATIONKEYS_HXX_
-#define _UCBHELPER_CONFIGURATIONKEYS_HXX_
-
-//============================================================================
-/** Various primary and secondary keys under which UCB configurations can be
- accessed in the configuration database.
- */
-#define UCB_CONFIGURATION_KEY1_LOCAL "Local"
-#define UCB_CONFIGURATION_KEY2_OFFICE "Office"
-
-#endif // _UCBHELPER_CONFIGURATIONKEYS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucbhelper/inc/ucbhelper/content.hxx b/ucbhelper/inc/ucbhelper/content.hxx
index 9667190944ed..9c06bf5366e7 100644
--- a/ucbhelper/inc/ucbhelper/content.hxx
+++ b/ucbhelper/inc/ucbhelper/content.hxx
@@ -53,6 +53,10 @@ namespace com { namespace sun { namespace star { namespace ucb {
struct NumberedSortingInfo;
} } } }
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
+
namespace ucbhelper
{
@@ -118,7 +122,9 @@ public:
*/
Content( const rtl::OUString& rURL,
const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& rEnv )
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& rCtx )
throw ( ::com::sun::star::ucb::ContentCreationException,
::com::sun::star::uno::RuntimeException );
/**
@@ -133,7 +139,9 @@ public:
Content( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContent >& rContent,
const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& rEnv )
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& rCtx )
throw ( ::com::sun::star::ucb::ContentCreationException,
::com::sun::star::uno::RuntimeException );
/**
@@ -172,6 +180,8 @@ public:
create( const rtl::OUString& rURL,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& rEnv,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& rCtx,
Content& rContent );
//////////////////////////////////////////////////////////////////////
diff --git a/ucbhelper/inc/ucbhelper/contentbroker.hxx b/ucbhelper/inc/ucbhelper/contentbroker.hxx
deleted file mode 100644
index 564b11e18b71..000000000000
--- a/ucbhelper/inc/ucbhelper/contentbroker.hxx
+++ /dev/null
@@ -1,170 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _UCBHELPER_CONTENTBROKER_HXX
-#define _UCBHELPER_CONTENTBROKER_HXX
-
-#include <boost/noncopyable.hpp>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.h>
-
-namespace com { namespace sun { namespace star { namespace lang {
- class XMultiServiceFactory;
-} } } }
-
-namespace com { namespace sun { namespace star { namespace ucb {
- class XContentIdentifierFactory;
- class XContentProvider;
- class XContentProviderManager;
- class XCommandProcessor;
-} } } }
-#include <ucbhelper/registerucb.hxx>
-#include "ucbhelper/ucbhelperdllapi.h"
-
-namespace ucbhelper
-{
-
-class ContentBroker_Impl;
-
-//=========================================================================
-
-/**
- * This class simplifies access to the Universal Content Broker (UCB).
- * Currently there can only be one UCB instance per process. This class can
- * be used to initialize and deinitialize the Broker and to access its
- * interfaces directly.
- */
-class UCBHELPER_DLLPUBLIC ContentBroker : private boost::noncopyable
-{
- ContentBroker_Impl* m_pImpl;
- // The "one and only" Broker.
- static ContentBroker* m_pTheBroker;
-
-private:
- /** Constructor.
- *
- * @param rxSMgr is a Service Manager.
- * @param rArguments are the arguments to pass to the
- * com.sun.star.ucb.UniversalContentBroker service when creating it.
- * Currently, this must be a sequence containing exactly two
- * strings, a primary and a secondary configuration key.
- * Refer to http://ucb.openoffice.org/docs/ucb-configuration.html
- * for more information on UCB configuration.
- */
- UCBHELPER_DLLPRIVATE ContentBroker( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& rArguments );
-
-protected:
- /**
- * Destructor.
- */
- ~ContentBroker();
-
-public:
- /** Initialize "the one and only" Broker. This method must be called
- * exactly once, before the Broker is used in any way.
- *
- * @param rSMgr is a factory to create services needed in the Broker's
- * implementation.
- *
- * @param rArguments are the arguments to pass to the
- * com.sun.star.ucb.UniversalContentBroker service when creating
- * it. Currently, this must be a sequence containing exactly two
- * strings, a primary and a secondary configuration key.
- * Refer to http://ucb.openoffice.org/docs/ucb-configuration.html
- * for more information on UCB configuration.
- *
- * @return True if creation and possible configuration of the Broker
- * was successful.
- */
- static sal_Bool
- initialize( const::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& rArguments );
-
- /** Deinitialize "the one and only" Broker. Once this method has been
- * called, the Broker must not be used any longer.
- */
- static void
- deinitialize();
-
- /**
- * This method returns the Broker, if it was already initialized.
- *
- * @return the Broker or 0, if ContentBroker::initialize() was not yet
- * called or did fail.
- */
- static ContentBroker*
- get();
-
- /**
- * This method returns the Service Manager used to instanciate the Broker.
- *
- * @return a Service Manager.
- */
- ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >
- getServiceManager() const;
-
- /**
- * This method returns the XContentIdentifierFactory interface of the
- * Broker.
- *
- * @return a XContentIdentifierFactory interface.
- */
- ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentIdentifierFactory >
- getContentIdentifierFactoryInterface() const;
-
- /**
- * This method returns the XContentProvider interface of the Broker.
- *
- * @return a XContentProvider interface.
- */
- ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentProvider >
- getContentProviderInterface() const;
-
- /**
- * This method returns the XContentProviderManager interface of the Broker.
- *
- * @return a XContentProviderManager interface.
- */
- ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentProviderManager >
- getContentProviderManagerInterface() const;
-
- /**
- * This method returns the XCommandProcessor interface of the Broker.
- *
- * @return a XCommandProcessor interface.
- */
- ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandProcessor >
- getCommandProcessorInterface() const;
-};
-
-} /* namespace ucbhelper */
-
-#endif /* !_UCBHELPER_CONTENTBROKER_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucbhelper/inc/ucbhelper/fileidentifierconverter.hxx b/ucbhelper/inc/ucbhelper/fileidentifierconverter.hxx
index be7ce3b0c33e..b044c31db7c8 100644
--- a/ucbhelper/inc/ucbhelper/fileidentifierconverter.hxx
+++ b/ucbhelper/inc/ucbhelper/fileidentifierconverter.hxx
@@ -26,7 +26,7 @@
#include "ucbhelper/ucbhelperdllapi.h"
namespace com { namespace sun { namespace star { namespace ucb {
- class XContentProviderManager;
+ class XUniversalContentBroker;
} } } }
namespace rtl { class OUString; }
@@ -73,8 +73,8 @@ UCBHELPER_DLLPUBLIC rtl::OUString getLocalFileURL()
UCBHELPER_DLLPUBLIC rtl::OUString
getFileURLFromSystemPath(
com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
+ com::sun::star::ucb::XUniversalContentBroker > const &
+ rUcb,
rtl::OUString const & rBaseURL,
rtl::OUString const & rSystemPath)
SAL_THROW((com::sun::star::uno::RuntimeException));
@@ -103,8 +103,8 @@ getFileURLFromSystemPath(
UCBHELPER_DLLPUBLIC rtl::OUString
getSystemPathFromFileURL(
com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
+ com::sun::star::ucb::XUniversalContentBroker > const &
+ rUcb,
rtl::OUString const & rURL)
SAL_THROW((com::sun::star::uno::RuntimeException));
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
index 95106abb64c3..ec3b4544d62c 100644
--- a/ucbhelper/source/client/content.cxx
+++ b/ucbhelper/source/client/content.cxx
@@ -17,12 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "sal/config.h"
-/**************************************************************************
- TODO
- **************************************************************************
+#include <cassert>
- *************************************************************************/
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <salhelper/simplereferenceobject.hxx>
@@ -48,6 +46,8 @@
#include <com/sun/star/ucb/XContentProviderManager.hpp>
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
+#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -57,7 +57,6 @@
#include <com/sun/star/beans/UnknownPropertyException.hpp>
#include <ucbhelper/macros.hxx>
#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/activedatasink.hxx>
#include <ucbhelper/activedatastreamer.hxx>
#include <ucbhelper/interactionrequest.hxx>
@@ -167,7 +166,7 @@ class Content_Impl : public salhelper::SimpleReferenceObject
friend class ContentEventListener_Impl;
mutable rtl::OUString m_aURL;
- Reference< XMultiServiceFactory > m_xSMgr;
+ Reference< XComponentContext > m_xCtx;
Reference< XContent > m_xContent;
Reference< XCommandProcessor > m_xCommandProcessor;
Reference< XCommandEnvironment > m_xEnv;
@@ -181,7 +180,7 @@ private:
public:
Content_Impl() : m_nCommandId( 0 ) {};
- Content_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ Content_Impl( const Reference< XComponentContext >& rCtx,
const Reference< XContent >& rContent,
const Reference< XCommandEnvironment >& rEnv );
@@ -191,7 +190,8 @@ public:
Reference< XContent > getContent();
Reference< XCommandProcessor > getCommandProcessor();
sal_Int32 getCommandId();
- Reference< XMultiServiceFactory > getServiceManager() { return m_xSMgr; }
+ Reference< XComponentContext > getComponentContext()
+ { assert(m_xCtx.is()); return m_xCtx; }
Any executeCommand( const Command& rCommand );
@@ -206,109 +206,42 @@ public:
// Helpers.
//=========================================================================
-static void ensureContentProviderForURL( const ContentBroker & rBroker,
+static void ensureContentProviderForURL( const Reference< XUniversalContentBroker >& rBroker,
const rtl::OUString & rURL )
throw ( ContentCreationException, RuntimeException )
{
- Reference< XContentProviderManager > xMgr
- = rBroker.getContentProviderManagerInterface();
- if ( !xMgr.is() )
+ Reference< XContentProvider > xProv
+ = rBroker->queryContentProvider( rURL );
+ if ( !xProv.is() )
{
- throw RuntimeException(
- rtl::OUString(
- "UCB does not implement mandatory interface "
- "XContentProviderManager!" ),
- Reference< XInterface >() );
- }
- else
- {
- Reference< XContentProvider > xProv
- = xMgr->queryContentProvider( rURL );
- if ( !xProv.is() )
- {
- throw ContentCreationException(
- rtl::OUString(
- "No Content Provider available for URL: ") + rURL,
- Reference< XInterface >(),
- ContentCreationError_NO_CONTENT_PROVIDER );
- }
+ throw ContentCreationException(
+ "No Content Provider available for URL: " + rURL,
+ Reference< XInterface >(),
+ ContentCreationError_NO_CONTENT_PROVIDER );
}
}
//=========================================================================
-static ContentBroker* getContentBroker( bool bThrow )
- throw ( ContentCreationException, RuntimeException )
-{
- ContentBroker* pBroker = ContentBroker::get();
-
- if ( !pBroker )
- {
- if ( bThrow )
- throw RuntimeException(
- rtl::OUString("No Content Broker!"),
- Reference< XInterface >() );
- }
- else
- {
-#if OSL_DEBUG_LEVEL > 1
- Reference< XContentProviderManager > xMgr
- = pBroker->getContentProviderManagerInterface();
- if ( !xMgr.is() )
- {
- if ( bThrow )
- throw RuntimeException(
- rtl::OUString(
- "UCB does not implement mandatory interface "
- "XContentProviderManager!" ),
- Reference< XInterface >() );
- }
- else
- {
- OSL_ENSURE( xMgr->queryContentProviders().getLength(),
- "Content Broker not configured (no providers)!" );
- }
-#endif
- }
-
- return pBroker;
-}
-
-//=========================================================================
static Reference< XContentIdentifier > getContentIdentifier(
- const ContentBroker & rBroker,
+ const Reference< XUniversalContentBroker > & rBroker,
const rtl::OUString & rURL,
bool bThrow )
throw ( ContentCreationException, RuntimeException )
{
- Reference< XContentIdentifierFactory > xIdFac
- = rBroker.getContentIdentifierFactoryInterface();
- if ( xIdFac.is() )
- {
- Reference< XContentIdentifier > xId
- = xIdFac->createContentIdentifier( rURL );
-
- if ( xId.is() )
- return xId;
+ Reference< XContentIdentifier > xId
+ = rBroker->createContentIdentifier( rURL );
- if ( bThrow )
- {
- ensureContentProviderForURL( rBroker, rURL );
+ if ( xId.is() )
+ return xId;
- throw ContentCreationException(
- rtl::OUString(
- "Unable to create Content Identifier!" ),
- Reference< XInterface >(),
- ContentCreationError_IDENTIFIER_CREATION_FAILED );
- }
- }
- else
+ if ( bThrow )
{
- if ( bThrow )
- throw RuntimeException(
- rtl::OUString(
- "UCB does not implement mandatory interface "
- "XContentIdentifierFactory!" ),
- Reference< XInterface >() );
+ ensureContentProviderForURL( rBroker, rURL );
+
+ throw ContentCreationException(
+ "Unable to create Content Identifier!",
+ Reference< XInterface >(),
+ ContentCreationError_IDENTIFIER_CREATION_FAILED );
}
return Reference< XContentIdentifier >();
@@ -316,49 +249,34 @@ static Reference< XContentIdentifier > getContentIdentifier(
//=========================================================================
static Reference< XContent > getContent(
- const ContentBroker & rBroker,
+ const Reference< XUniversalContentBroker > & rBroker,
const Reference< XContentIdentifier > & xId,
bool bThrow )
throw ( ContentCreationException, RuntimeException )
{
- Reference< XContentProvider > xProvider
- = rBroker.getContentProviderInterface();
- if ( xProvider.is() )
+ Reference< XContent > xContent;
+ rtl::OUString msg;
+ try
{
- Reference< XContent > xContent;
- rtl::OUString msg;
- try
- {
- xContent = xProvider->queryContent( xId );
- }
- catch ( IllegalIdentifierException const & e )
- {
- msg = e.Message;
- // handled below.
- }
-
- if ( xContent.is() )
- return xContent;
+ xContent = rBroker->queryContent( xId );
+ }
+ catch ( IllegalIdentifierException const & e )
+ {
+ msg = e.Message;
+ // handled below.
+ }
- if ( bThrow )
- {
- ensureContentProviderForURL( rBroker, xId->getContentIdentifier() );
+ if ( xContent.is() )
+ return xContent;
- throw ContentCreationException(
- rtl::OUString(
- "Unable to create Content! " ) + msg,
- Reference< XInterface >(),
- ContentCreationError_CONTENT_CREATION_FAILED );
- }
- }
- else
+ if ( bThrow )
{
- if ( bThrow )
- throw RuntimeException(
- rtl::OUString(
- "UCB does not implement mandatory interface "
- "XContentProvider!" ),
- Reference< XInterface >() );
+ ensureContentProviderForURL( rBroker, xId->getContentIdentifier() );
+
+ throw ContentCreationException(
+ "Unable to create Content! " + msg,
+ Reference< XInterface >(),
+ ContentCreationError_CONTENT_CREATION_FAILED );
}
return Reference< XContent >();
@@ -379,27 +297,28 @@ Content::Content()
//=========================================================================
Content::Content( const rtl::OUString& rURL,
- const Reference< XCommandEnvironment >& rEnv )
+ const Reference< XCommandEnvironment >& rEnv,
+ const Reference< XComponentContext >& rCtx )
throw ( ContentCreationException, RuntimeException )
{
- ContentBroker* pBroker = getContentBroker( true );
+ Reference< XUniversalContentBroker > pBroker(
+ UniversalContentBroker::create( rCtx ) );
Reference< XContentIdentifier > xId
- = getContentIdentifier( *pBroker, rURL, true );
+ = getContentIdentifier( pBroker, rURL, true );
- Reference< XContent > xContent = getContent( *pBroker, xId, true );
+ Reference< XContent > xContent = getContent( pBroker, xId, true );
- m_xImpl = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+ m_xImpl = new Content_Impl( rCtx, xContent, rEnv );
}
//=========================================================================
Content::Content( const Reference< XContent >& rContent,
- const Reference< XCommandEnvironment >& rEnv )
+ const Reference< XCommandEnvironment >& rEnv,
+ const Reference< XComponentContext >& rCtx )
throw ( ContentCreationException, RuntimeException )
{
- ContentBroker* pBroker = getContentBroker( true );
-
- m_xImpl = new Content_Impl( pBroker->getServiceManager(), rContent, rEnv );
+ m_xImpl = new Content_Impl( rCtx, rContent, rEnv );
}
//=========================================================================
@@ -412,23 +331,23 @@ Content::Content( const Content& rOther )
// static
sal_Bool Content::create( const rtl::OUString& rURL,
const Reference< XCommandEnvironment >& rEnv,
+ const Reference< XComponentContext >& rCtx,
Content& rContent )
{
- ContentBroker* pBroker = getContentBroker( false );
- if ( !pBroker )
- return sal_False;
+ Reference< XUniversalContentBroker > pBroker(
+ UniversalContentBroker::create( rCtx ) );
Reference< XContentIdentifier > xId
- = getContentIdentifier( *pBroker, rURL, false );
+ = getContentIdentifier( pBroker, rURL, false );
if ( !xId.is() )
return sal_False;
- Reference< XContent > xContent = getContent( *pBroker, xId, false );
+ Reference< XContent > xContent = getContent( pBroker, xId, false );
if ( !xContent.is() )
return sal_False;
rContent.m_xImpl
- = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+ = new Content_Impl( rCtx, xContent, rEnv );
return sal_True;
}
@@ -738,12 +657,12 @@ Reference< XResultSet > Content::createSortedCursor(
if( aDynSet.is() )
{
Reference< XDynamicResultSet > aDynResult;
- Reference< XMultiServiceFactory > aServiceManager = m_xImpl->getServiceManager();
+ Reference< XMultiComponentFactory > aServiceManager = m_xImpl->getComponentContext()->getServiceManager();
if( aServiceManager.is() )
{
- Reference< XSortedDynamicResultSetFactory > aSortFactory( aServiceManager->createInstance(
- rtl::OUString("com.sun.star.ucb.SortedDynamicResultSetFactory")),
+ Reference< XSortedDynamicResultSetFactory > aSortFactory( aServiceManager->createInstanceWithContext(
+ "com.sun.star.ucb.SortedDynamicResultSetFactory", m_xImpl->getComponentContext()),
UNO_QUERY );
aDynResult = aSortFactory->createSortedDynamicResultSet( aDynSet,
@@ -1024,7 +943,8 @@ sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
return sal_False;
}
- Content aNewContent( xNew, m_xImpl->getEnvironment() );
+ Content aNewContent(
+ xNew, m_xImpl->getEnvironment(), m_xImpl->getComponentContext() );
aNewContent.setPropertyValues( rPropertyNames, rPropertyValues );
aNewContent.executeCommand( rtl::OUString("insert"),
makeAny(
@@ -1044,20 +964,8 @@ sal_Bool Content::transferContent( const Content& rSourceContent,
const sal_Int32 nNameClashAction )
throw( CommandAbortedException, RuntimeException, Exception )
{
- ContentBroker* pBroker = ContentBroker::get();
- if ( !pBroker )
- {
- OSL_FAIL( "Content::transferContent - No Content Broker!" );
- return sal_False;
- }
-
- Reference< XCommandProcessor > xCmdProc(
- pBroker->getCommandProcessorInterface() );
- if ( !xCmdProc.is() )
- {
- OSL_FAIL( "Content::transferContent - No XCommandProcessor!" );
- return sal_False;
- }
+ Reference< XUniversalContentBroker > pBroker(
+ UniversalContentBroker::create( m_xImpl->getComponentContext() ) );
// Execute command "globalTransfer" at UCB.
@@ -1098,7 +1006,7 @@ sal_Bool Content::transferContent( const Content& rSourceContent,
aCommand.Handle = -1; // n/a
aCommand.Argument <<= aTransferArg;
- xCmdProc->execute( aCommand, 0, m_xImpl->getEnvironment() );
+ pBroker->execute( aCommand, 0, m_xImpl->getEnvironment() );
return sal_True;
}
@@ -1152,14 +1060,15 @@ sal_Bool Content::isDocument()
//=========================================================================
//=========================================================================
-Content_Impl::Content_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+Content_Impl::Content_Impl( const Reference< XComponentContext >& rCtx,
const Reference< XContent >& rContent,
const Reference< XCommandEnvironment >& rEnv )
-: m_xSMgr( rSMgr ),
+: m_xCtx( rCtx ),
m_xContent( rContent ),
m_xEnv( rEnv ),
m_nCommandId( 0 )
{
+ assert(rCtx.is());
if ( m_xContent.is() )
{
m_xContentEventListener = new ContentEventListener_Impl( *this );
@@ -1288,51 +1197,30 @@ Reference< XContent > Content_Impl::getContent()
if ( !m_xContent.is() && !m_aURL.isEmpty() )
{
- ContentBroker* pBroker = ContentBroker::get();
+ Reference< XUniversalContentBroker > pBroker(
+ UniversalContentBroker::create( getComponentContext() ) );
- OSL_ENSURE( pBroker, "No Content Broker!" );
-
- if ( pBroker )
- {
- OSL_ENSURE( pBroker->getContentProviderManagerInterface()
- ->queryContentProviders().getLength(),
- "Content Broker not configured (no providers)!" );
+ OSL_ENSURE( pBroker->queryContentProviders().getLength(),
+ "Content Broker not configured (no providers)!" );
- Reference< XContentIdentifierFactory > xIdFac
- = pBroker->getContentIdentifierFactoryInterface();
+ Reference< XContentIdentifier > xId
+ = pBroker->createContentIdentifier( m_aURL );
- OSL_ENSURE( xIdFac.is(), "No Content Identifier factory!" );
+ OSL_ENSURE( xId.is(), "No Content Identifier!" );
- if ( xIdFac.is() )
+ if ( xId.is() )
+ {
+ try
+ {
+ m_xContent = pBroker->queryContent( xId );
+ }
+ catch ( IllegalIdentifierException const & )
{
- Reference< XContentIdentifier > xId
- = xIdFac->createContentIdentifier( m_aURL );
-
- OSL_ENSURE( xId.is(), "No Content Identifier!" );
-
- if ( xId.is() )
- {
- Reference< XContentProvider > xProvider
- = pBroker->getContentProviderInterface();
-
- OSL_ENSURE( xProvider.is(), "No Content Provider!" );
-
- if ( xProvider.is() )
- {
- try
- {
- m_xContent = xProvider->queryContent( xId );
- }
- catch ( IllegalIdentifierException const & )
- {
- }
-
- if ( m_xContent.is() )
- m_xContent->addContentEventListener(
- m_xContentEventListener );
- }
- }
}
+
+ if ( m_xContent.is() )
+ m_xContent->addContentEventListener(
+ m_xContentEventListener );
}
}
}
diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx
index 219a7a13d077..24cec09b7ea5 100644
--- a/ucbhelper/source/client/contentbroker.cxx
+++ b/ucbhelper/source/client/contentbroker.cxx
@@ -17,194 +17,25 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "sal/config.h"
-/**************************************************************************
- TODO
- **************************************************************************
+#ifdef ANDROID
- *************************************************************************/
-#include <osl/diagnose.h>
-#include <osl/mutex.hxx>
-#include <rtl/instance.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/ucb/UniversalContentBroker.hpp>
-#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
-#include <com/sun/star/ucb/XCommandProcessor.hpp>
-#include <ucbhelper/contentbroker.hxx>
-
-#ifdef ANDROID
-#include <cppuhelper/bootstrap.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <ucbhelper/configurationkeys.hxx>
-#endif
+#include <cppuhelper/bootstrap.hxx>
-using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::uno;
-using ::rtl::OUString;
-
-namespace
-{
- struct theContentBrokerMutex : public rtl::Static< osl::Mutex, theContentBrokerMutex > {};
-} // namespace
-
-namespace ucbhelper
-{
-
-//=========================================================================
-//=========================================================================
-//
-// class ContentBroker_Impl.
-//
-//=========================================================================
-//=========================================================================
-
-class ContentBroker_Impl
-{
- Reference< XMultiServiceFactory > m_xSMgr;
- Reference< XContentIdentifierFactory > m_xIdFac;
- Reference< XContentProvider > m_xProvider;
- Reference< XContentProviderManager > m_xProviderMgr;
- Reference< XCommandProcessor > m_xCommandProc;
- osl::Mutex m_aMutex;
- Sequence< Any > m_aArguments;
- ContentProviderDataList m_aProvData;
- bool m_bInitDone;
-
-public:
- ContentBroker_Impl( const Reference< XMultiServiceFactory >& rSMgr,
- const Sequence< Any >& rArguments )
- : m_xSMgr( rSMgr ), m_aArguments( rArguments ), m_bInitDone( sal_False )
- {}
-
- ContentBroker_Impl( const Reference< XMultiServiceFactory >& rSMgr,
- const ContentProviderDataList & rData )
- : m_xSMgr( rSMgr ), m_aProvData( rData ), m_bInitDone( sal_False )
- {}
-
- ~ContentBroker_Impl();
-
- bool initialize();
-
- const Reference< XMultiServiceFactory >& getServiceManager() const
- { return m_xSMgr; }
-
- const Reference< XContentIdentifierFactory >& getIdFactory() const
- { return m_xIdFac; }
-
- const Reference< XContentProvider >& getProvider() const
- { return m_xProvider; }
-
- const Reference< XContentProviderManager >& getProviderManager() const
- { return m_xProviderMgr; }
-
- const Reference< XCommandProcessor >& getCommandProcessor() const
- { return m_xCommandProc; }
-};
-
-//=========================================================================
-//=========================================================================
-//
-// ContentBroker Implementation.
-//
-//=========================================================================
-//=========================================================================
-
-// static member!
-ContentBroker* ContentBroker::m_pTheBroker = 0;
-
-//=========================================================================
-ContentBroker::ContentBroker( const Reference< XMultiServiceFactory >& rSMgr,
- const Sequence< Any >& rArguments )
-{
- m_pImpl = new ContentBroker_Impl( rSMgr, rArguments );
-}
-
-//=========================================================================
-ContentBroker::~ContentBroker()
-{
- delete m_pImpl;
-}
-
-//=========================================================================
-Reference< XMultiServiceFactory > ContentBroker::getServiceManager() const
-{
- return m_pImpl->getServiceManager();
-}
-
-//=========================================================================
-Reference< XContentIdentifierFactory >
- ContentBroker::getContentIdentifierFactoryInterface() const
-{
- return m_pImpl->getIdFactory();
-}
-
-//=========================================================================
-Reference< XContentProvider >
- ContentBroker::getContentProviderInterface() const
-{
- return m_pImpl->getProvider();
-}
-
-//=========================================================================
-Reference< XContentProviderManager >
- ContentBroker::getContentProviderManagerInterface() const
-{
- return m_pImpl->getProviderManager();
-}
-
-//=========================================================================
-Reference< XCommandProcessor >
- ContentBroker::getCommandProcessorInterface() const
-{
- return m_pImpl->getCommandProcessor();
-}
-
-//=========================================================================
-// static
-sal_Bool ContentBroker::initialize(
- const Reference< XMultiServiceFactory >& rSMgr,
- const Sequence< Any >& rArguments )
-{
- OSL_ENSURE( !m_pTheBroker,
- "ContentBroker::initialize - already initialized!" );
-
- if ( !m_pTheBroker )
- {
- osl::Guard< osl::Mutex > aGuard( theContentBrokerMutex::get() );
-
- if ( !m_pTheBroker )
- {
- ContentBroker * pBroker = new ContentBroker( rSMgr, rArguments );
-
- // Force init to be able to detect UCB init trouble immediately.
- if ( pBroker->m_pImpl->initialize() )
- m_pTheBroker = pBroker;
- else
- delete pBroker;
- }
- }
-
- return m_pTheBroker != 0;
-}
-
-#ifdef ANDROID
-
+//TODO: Is this relevant still?
extern "C" __attribute__ ((visibility("default"))) void
InitUCBHelper()
{
- Reference< XMultiServiceFactory > xFactory;
+ Reference< XComponentContext > xCtx;
try
{
Reference< XComponentContext > xCtx = ::cppu::defaultBootstrap_InitialComponentContext();
- xFactory = Reference< XMultiServiceFactory >( xCtx->getServiceManager(),
- UNO_QUERY );
}
catch( Exception& )
{
@@ -217,169 +48,11 @@ InitUCBHelper()
exit( 1 );
}
- // Create UCB.
- Sequence< Any > aArgs( 2 );
- aArgs[ 0 ] <<= rtl::OUString( UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= rtl::OUString( UCB_CONFIGURATION_KEY2_OFFICE );
- ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
+ // Create UCB (for backwards compatibility, in case some code still uses
+ // plain createInstance w/o args directly to obtain an instance):
+ UniversalContentBroker::create( xCtx );
}
#endif
-//=========================================================================
-// static
-void ContentBroker::deinitialize()
-{
- osl::MutexGuard aGuard( theContentBrokerMutex::get() );
-
- delete m_pTheBroker;
- m_pTheBroker = 0;
-}
-
-//=========================================================================
-// static
-ContentBroker* ContentBroker::get()
-{
- return m_pTheBroker;
-}
-
-//=========================================================================
-//=========================================================================
-//
-// ContentBroker_Impl Implementation.
-//
-//=========================================================================
-//=========================================================================
-
-ContentBroker_Impl::~ContentBroker_Impl()
-{
- Reference< XComponent > xComponent( m_xProvider, UNO_QUERY );
- if ( xComponent.is() )
- {
- m_xIdFac = 0;
- m_xProvider = 0;
- m_xProviderMgr = 0;
-
- xComponent->dispose();
- }
-}
-
-//=========================================================================
-bool ContentBroker_Impl::initialize()
-{
- if ( !m_bInitDone )
- {
- osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_bInitDone )
- {
- Reference< XInterface > xIfc;
-
- if ( m_aProvData.size() > 0 )
- {
- try
- {
- xIfc = m_xSMgr->createInstance(
- OUString(
- "com.sun.star.ucb.UniversalContentBroker" ) );
- }
- catch ( Exception const & )
- {
- }
-
- if ( xIfc.is() )
- {
- m_xProviderMgr
- = Reference< XContentProviderManager >( xIfc, UNO_QUERY );
-
- if ( m_xProviderMgr.is() )
- {
- ContentProviderDataList::const_iterator aEnd(m_aProvData.end());
- for (ContentProviderDataList::const_iterator aIt(m_aProvData.begin());
- aIt != aEnd; ++aIt)
- {
- registerAtUcb(m_xProviderMgr,
- m_xSMgr,
- aIt->ServiceName,
- aIt->Arguments,
- aIt->URLTemplate,
- 0);
- }
-
- }
- }
- }
- else
- {
- try
- {
- Reference< XPropertySet > xFactoryProperties( m_xSMgr, UNO_QUERY_THROW );
- Reference< XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY_THROW );
- if( m_aArguments.getLength() == 0 )
- xIfc = UniversalContentBroker::createDefault(xContext);
- else
- {
- rtl::OUString aPrimaryConfigKey, aSecondaryConfigKey;
- m_aArguments[0] >>= aPrimaryConfigKey;
- m_aArguments[1] >>= aSecondaryConfigKey;
- xIfc = UniversalContentBroker::createWithKeys(xContext, aPrimaryConfigKey, aSecondaryConfigKey);
- }
- }
- catch ( const Exception & e)
- {
- SAL_WARN("ucbhelper", "exception while initialising UniversalContentBroker " << e.Message);
- }
- }
-
- OSL_ENSURE( xIfc.is(), "Error creating UCB service 'com.sun.star.ucb.UniversalContentBroker'" );
-
- if ( !xIfc.is() )
- return false;
-
-
- m_xIdFac
- = Reference< XContentIdentifierFactory >( xIfc, UNO_QUERY );
-
- OSL_ENSURE( m_xIdFac.is(),
- "UCB without required interface XContentIdentifierFactory!" );
-
- if ( !m_xIdFac.is() )
- return false;
-
- m_xProvider = Reference< XContentProvider >( xIfc, UNO_QUERY );
-
- OSL_ENSURE( m_xProvider.is(),
- "UCB without required interface XContentProvider!" );
-
- if ( !m_xProvider.is() )
- return false;
-
- if ( !m_xProviderMgr.is() )
- m_xProviderMgr
- = Reference< XContentProviderManager >( xIfc, UNO_QUERY );
-
- OSL_ENSURE( m_xProviderMgr.is(),
- "UCB without required interface XContentProviderManager!" );
-
- if ( !m_xProviderMgr.is() )
- return false;
-
- m_xCommandProc = Reference< XCommandProcessor >( xIfc, UNO_QUERY );
-
- OSL_ENSURE( m_xCommandProc.is(),
- "UCB without required interface XCommandProcessor!" );
-
- if ( !m_xCommandProc.is() )
- return false;
-
- // Everything okay.
- m_bInitDone = sal_True;
- }
- }
-
- return true;
-}
-
-} /* namespace ucbhelper */
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucbhelper/source/client/fileidentifierconverter.cxx b/ucbhelper/source/client/fileidentifierconverter.cxx
index 3771d0d3c20e..4e0e28850b03 100644
--- a/ucbhelper/source/client/fileidentifierconverter.cxx
+++ b/ucbhelper/source/client/fileidentifierconverter.cxx
@@ -19,8 +19,8 @@
#include <ucbhelper/fileidentifierconverter.hxx>
#include <com/sun/star/ucb/ContentProviderInfo.hpp>
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
#include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
+#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <osl/diagnose.h>
@@ -55,15 +55,15 @@ getLocalFileURL() SAL_THROW((uno::RuntimeException))
rtl::OUString
getFileURLFromSystemPath(
- uno::Reference< ucb::XContentProviderManager > const & rManager,
+ uno::Reference< ucb::XUniversalContentBroker > const & rUcb,
rtl::OUString const & rBaseURL,
rtl::OUString const & rSystemPath)
SAL_THROW((uno::RuntimeException))
{
- OSL_ASSERT(rManager.is());
+ OSL_ASSERT(rUcb.is());
uno::Reference< ucb::XFileIdentifierConverter >
- xConverter(rManager->queryContentProvider(rBaseURL), uno::UNO_QUERY);
+ xConverter(rUcb->queryContentProvider(rBaseURL), uno::UNO_QUERY);
if (xConverter.is())
return xConverter->getFileURLFromSystemPath(rBaseURL, rSystemPath);
else
@@ -78,14 +78,14 @@ getFileURLFromSystemPath(
rtl::OUString
getSystemPathFromFileURL(
- uno::Reference< ucb::XContentProviderManager > const & rManager,
+ uno::Reference< ucb::XUniversalContentBroker > const & rUcb,
rtl::OUString const & rURL)
SAL_THROW((uno::RuntimeException))
{
- OSL_ASSERT(rManager.is());
+ OSL_ASSERT(rUcb.is());
uno::Reference< ucb::XFileIdentifierConverter >
- xConverter(rManager->queryContentProvider(rURL), uno::UNO_QUERY);
+ xConverter(rUcb->queryContentProvider(rURL), uno::UNO_QUERY);
if (xConverter.is())
return xConverter->getSystemPathFromFileURL(rURL);
else
diff --git a/unotest/source/cpp/bootstrapfixturebase.cxx b/unotest/source/cpp/bootstrapfixturebase.cxx
index 5ce1a0611604..9c7863280092 100644
--- a/unotest/source/cpp/bootstrapfixturebase.cxx
+++ b/unotest/source/cpp/bootstrapfixturebase.cxx
@@ -30,7 +30,6 @@
#include <rtl/strbuf.hxx>
#include <rtl/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/Locale.hpp>
diff --git a/unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx b/unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx
index f9163874badf..6cfd005eaf1c 100644
--- a/unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx
+++ b/unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx
@@ -26,7 +26,6 @@
#include "com/sun/star/uno/Exception.hpp"
#include <cppuhelper/bootstrap.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/Locale.hpp>
diff --git a/unotools/source/ucbhelper/localfilehelper.cxx b/unotools/source/ucbhelper/localfilehelper.cxx
index d14d79c17e6f..ef0acbecde90 100644
--- a/unotools/source/ucbhelper/localfilehelper.cxx
+++ b/unotools/source/ucbhelper/localfilehelper.cxx
@@ -20,10 +20,10 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
-
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
+#include <comphelper/processfactory.hxx>
#include <unotools/localfilehelper.hxx>
#include <ucbhelper/fileidentifierconverter.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <rtl/ustring.hxx>
#include <osl/file.hxx>
#include <tools/urlobj.hxx>
@@ -41,25 +41,16 @@ sal_Bool LocalFileHelper::ConvertSystemPathToURL( const String& rName, const Str
{
rReturn = ::rtl::OUString();
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- if ( !pBroker )
+ Reference< XUniversalContentBroker > pBroker(
+ UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() ) );
+ try
{
- rtl::OUString aRet;
- if ( FileBase::getFileURLFromSystemPath( rName, aRet ) == FileBase::E_None )
- rReturn = aRet;
+ rReturn = ::ucbhelper::getFileURLFromSystemPath( pBroker, rBaseURL, rName );
}
- else
+ catch ( ::com::sun::star::uno::RuntimeException& )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProviderManager > xManager =
- pBroker->getContentProviderManagerInterface();
- try
- {
- rReturn = ::ucbhelper::getFileURLFromSystemPath( xManager, rBaseURL, rName );
- }
- catch ( ::com::sun::star::uno::RuntimeException& )
- {
- return sal_False;
- }
+ return sal_False;
}
return ( rReturn.Len() != 0 );
@@ -68,24 +59,15 @@ sal_Bool LocalFileHelper::ConvertSystemPathToURL( const String& rName, const Str
sal_Bool LocalFileHelper::ConvertURLToSystemPath( const String& rName, String& rReturn )
{
rReturn = ::rtl::OUString();
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- if ( !pBroker )
+ Reference< XUniversalContentBroker > pBroker(
+ UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() ) );
+ try
{
- rtl::OUString aRet;
- if( FileBase::getSystemPathFromFileURL( rName, aRet ) == FileBase::E_None )
- rReturn = aRet;
+ rReturn = ::ucbhelper::getSystemPathFromFileURL( pBroker, rName );
}
- else
+ catch ( ::com::sun::star::uno::RuntimeException& )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProviderManager > xManager =
- pBroker->getContentProviderManagerInterface();
- try
- {
- rReturn = ::ucbhelper::getSystemPathFromFileURL( xManager, rName );
- }
- catch ( ::com::sun::star::uno::RuntimeException& )
- {
- }
}
return ( rReturn.Len() != 0 );
@@ -94,26 +76,16 @@ sal_Bool LocalFileHelper::ConvertURLToSystemPath( const String& rName, String& r
bool LocalFileHelper::ConvertPhysicalNameToURL(const rtl::OUString& rName, rtl::OUString& rReturn)
{
rReturn = ::rtl::OUString();
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- if ( !pBroker )
+ Reference< XUniversalContentBroker > pBroker(
+ UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() ) );
+ try
{
- rtl::OUString aRet;
- if ( FileBase::getFileURLFromSystemPath( rName, aRet ) == FileBase::E_None )
- rReturn = aRet;
+ rtl::OUString aBase( ::ucbhelper::getLocalFileURL() );
+ rReturn = ::ucbhelper::getFileURLFromSystemPath( pBroker, aBase, rName );
}
- else
+ catch (const ::com::sun::star::uno::RuntimeException&)
{
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProviderManager > xManager =
- pBroker->getContentProviderManagerInterface();
-
- try
- {
- rtl::OUString aBase( ::ucbhelper::getLocalFileURL() );
- rReturn = ::ucbhelper::getFileURLFromSystemPath( xManager, aBase, rName );
- }
- catch (const ::com::sun::star::uno::RuntimeException&)
- {
- }
}
return !rReturn.isEmpty();
@@ -122,27 +94,18 @@ bool LocalFileHelper::ConvertPhysicalNameToURL(const rtl::OUString& rName, rtl::
bool LocalFileHelper::ConvertURLToPhysicalName(const rtl::OUString& rName, rtl::OUString& rReturn)
{
rReturn = ::rtl::OUString();
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- if ( !pBroker )
+ Reference< XUniversalContentBroker > pBroker(
+ UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() ) );
+ try
{
- ::rtl::OUString aRet;
- if ( FileBase::getSystemPathFromFileURL( rName, aRet ) == FileBase::E_None )
- rReturn = aRet;
+ INetURLObject aObj( rName );
+ INetURLObject aLocal( ::ucbhelper::getLocalFileURL() );
+ if ( aObj.GetProtocol() == aLocal.GetProtocol() )
+ rReturn = ::ucbhelper::getSystemPathFromFileURL( pBroker, rName );
}
- else
+ catch (const ::com::sun::star::uno::RuntimeException&)
{
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProviderManager > xManager =
- pBroker->getContentProviderManagerInterface();
- try
- {
- INetURLObject aObj( rName );
- INetURLObject aLocal( ::ucbhelper::getLocalFileURL() );
- if ( aObj.GetProtocol() == aLocal.GetProtocol() )
- rReturn = ::ucbhelper::getSystemPathFromFileURL( xManager, rName );
- }
- catch (const ::com::sun::star::uno::RuntimeException&)
- {
- }
}
return !rReturn.isEmpty();
@@ -167,7 +130,9 @@ typedef ::std::vector< ::rtl::OUString* > StringList_Impl;
StringList_Impl* pFiles = NULL;
try
{
- ::ucbhelper::Content aCnt( rFolder, Reference< XCommandEnvironment > () );
+ ::ucbhelper::Content aCnt(
+ rFolder, Reference< XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
Reference< ::com::sun::star::sdbc::XResultSet > xResultSet;
::com::sun::star::uno::Sequence< ::rtl::OUString > aProps(1);
::rtl::OUString* pProps = aProps.getArray();
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 60a82dc96f31..1782dcf6a011 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -17,13 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "sal/config.h"
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
+#include <comphelper/processfactory.hxx>
#include <unotools/tempfile.hxx>
#include <tools/tempfile.hxx>
#include <unotools/localfilehelper.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <ucbhelper/fileidentifierconverter.hxx>
-#include <ucbhelper/contentbroker.hxx>
#include <rtl/ustring.hxx>
#include <rtl/instance.hxx>
#include <osl/file.hxx>
@@ -128,34 +130,28 @@ String ConstructTempDir_Impl( const String* pParent )
String aName;
if ( pParent && pParent->Len() )
{
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- if ( pBroker )
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XUniversalContentBroker > pBroker(
+ com::sun::star::ucb::UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() ) );
+
+ // if parent given try to use it
+ rtl::OUString aTmp( *pParent );
+
+ // test for valid filename
+ rtl::OUString aRet;
+ ::osl::FileBase::getFileURLFromSystemPath(
+ ::ucbhelper::getSystemPathFromFileURL( pBroker, aTmp ),
+ aRet );
+ if ( !aRet.isEmpty() )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProviderManager > xManager =
- pBroker->getContentProviderManagerInterface();
-
- // if parent given try to use it
- rtl::OUString aTmp( *pParent );
-
- // test for valid filename
- rtl::OUString aRet;
- ::osl::FileBase::getFileURLFromSystemPath(
- ::ucbhelper::getSystemPathFromFileURL( xManager, aTmp ),
- aRet );
- if ( !aRet.isEmpty() )
- {
- ::osl::DirectoryItem aItem;
- sal_Int32 i = aRet.getLength();
- if ( aRet[i-1] == '/' )
- i--;
+ ::osl::DirectoryItem aItem;
+ sal_Int32 i = aRet.getLength();
+ if ( aRet[i-1] == '/' )
+ i--;
- if ( DirectoryItem::get( aRet.copy(0, i), aItem ) == FileBase::E_None )
- aName = aRet;
- }
- }
- else
- {
- DBG_WARNING( "::unotools::TempFile : UCB not present or not initialized!" );
+ if ( DirectoryItem::get( aRet.copy(0, i), aItem ) == FileBase::E_None )
+ aName = aRet;
}
}
diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx
index 0709caa115e6..39e0835f6a19 100644
--- a/unotools/source/ucbhelper/ucbhelper.cxx
+++ b/unotools/source/ucbhelper/ucbhelper.cxx
@@ -31,11 +31,12 @@
#include "com/sun/star/ucb/IOErrorCode.hpp"
#include "com/sun/star/ucb/InteractiveIOException.hpp"
#include "com/sun/star/ucb/NameClashException.hpp"
+#include "com/sun/star/ucb/UniversalContentBroker.hpp"
#include "com/sun/star/ucb/XCommandEnvironment.hpp"
#include "com/sun/star/ucb/XContentAccess.hpp"
#include "com/sun/star/ucb/XContentIdentifier.hpp"
-#include "com/sun/star/ucb/XContentIdentifierFactory.hpp"
#include "com/sun/star/ucb/XProgressHandler.hpp"
+#include "com/sun/star/ucb/XUniversalContentBroker.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
@@ -55,7 +56,6 @@
#include "tools/urlobj.hxx"
#include "ucbhelper/commandenvironment.hxx"
#include "ucbhelper/content.hxx"
-#include "ucbhelper/contentbroker.hxx"
#include "unotools/localfilehelper.hxx"
#include "unotools/ucbhelper.hxx"
@@ -72,13 +72,15 @@ rtl::OUString canonic(rtl::OUString const & url) {
ucbhelper::Content content(rtl::OUString const & url) {
return ucbhelper::Content(
canonic(url),
- css::uno::Reference<css::ucb::XCommandEnvironment>());
+ css::uno::Reference<css::ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext());
}
ucbhelper::Content content(INetURLObject const & url) {
return ucbhelper::Content(
url.GetMainURL(INetURLObject::NO_DECODE),
- css::uno::Reference<css::ucb::XCommandEnvironment>());
+ css::uno::Reference<css::ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext());
}
std::vector<rtl::OUString> getContents(rtl::OUString const & url) {
@@ -444,18 +446,13 @@ bool utl::UCBContentHelper::EqualURLs(
if (url1.isEmpty() || url2.isEmpty()) {
return false;
}
- ucbhelper::ContentBroker * broker = ucbhelper::ContentBroker::get();
- if (broker == 0) {
- throw css::uno::RuntimeException(
- rtl::OUString( "no ucbhelper::ContentBroker"),
- css::uno::Reference<css::uno::XInterface>());
- }
+ css::uno::Reference< css::ucb::XUniversalContentBroker > ucb(
+ css::ucb::UniversalContentBroker::create(
+ comphelper::getProcessComponentContext()));
return
- broker->getContentProviderInterface()->compareContentIds(
- (broker->getContentIdentifierFactoryInterface()->
- createContentIdentifier(canonic(url1))),
- (broker->getContentIdentifierFactoryInterface()->
- createContentIdentifier(canonic(url2))))
+ ucb->compareContentIds(
+ ucb->createContentIdentifier(canonic(url1)),
+ ucb->createContentIdentifier(canonic(url2)))
== 0;
}
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index e74c83d5df68..2b709a98c157 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -54,8 +54,6 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <comphelper/storagehelper.hxx>
-
-#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/content.hxx>
using namespace ::com::sun::star::uno;
@@ -628,8 +626,8 @@ Moderator::Moderator(
xContent,
new UcbTaskEnvironment(
xInteract.is() ? new ModeratorsInteractionHandler(*this) : 0,
- xProgress.is() ? new ModeratorsProgressHandler(*this) : 0
- ))
+ xProgress.is() ? new ModeratorsProgressHandler(*this) : 0),
+ comphelper::getProcessComponentContext())
{
// now exchange the whole data sink stuff
// with a thread safe version
@@ -1149,7 +1147,9 @@ static sal_Bool _UCBOpenContentSync(
Reference < XProgressHandler > xProgress,
UcbLockBytesHandlerRef xHandler )
{
- ::ucbhelper::Content aContent( xContent, new UcbTaskEnvironment( xInteract, xProgress ) );
+ ::ucbhelper::Content aContent(
+ xContent, new UcbTaskEnvironment( xInteract, xProgress ),
+ comphelper::getProcessComponentContext() );
Reference < XContentIdentifier > xIdent = xContent->getIdentifier();
::rtl::OUString aScheme = xIdent->getContentProviderScheme();
diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx
index 330b3d0bba73..67483f1904b0 100644
--- a/unotools/source/ucbhelper/ucbstreamhelper.cxx
+++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx
@@ -22,12 +22,11 @@
#include <unotools/ucbstreamhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
-
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
-#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/content.hxx>
#include <unotools/streamwrap.hxx>
@@ -47,93 +46,95 @@ static SvStream* lcl_CreateStream( const String& rFileName, StreamMode eOpenMode
UcbLockBytesHandler* pHandler, sal_Bool bEnsureFileExists )
{
SvStream* pStream = NULL;
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- if ( pBroker )
+ Reference< XUniversalContentBroker > ucb(
+ UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() ) );
+ UcbLockBytesRef xLockBytes;
+ if ( eOpenMode & STREAM_WRITE )
{
- UcbLockBytesRef xLockBytes;
- if ( eOpenMode & STREAM_WRITE )
+ sal_Bool bTruncate = ( eOpenMode & STREAM_TRUNC ) != 0;
+ if ( bTruncate )
{
- sal_Bool bTruncate = ( eOpenMode & STREAM_TRUNC ) != 0;
- if ( bTruncate )
+ try
{
- try
- {
- // truncate is implemented with deleting the original file
- ::ucbhelper::Content aCnt( rFileName, Reference < XCommandEnvironment >() );
- aCnt.executeCommand( ::rtl::OUString("delete"), makeAny( sal_Bool( sal_True ) ) );
- }
-
- catch ( const CommandAbortedException& )
- {
- // couldn't truncate/delete
- }
- catch ( const ContentCreationException& )
- {
- }
- catch ( const Exception& )
- {
- }
+ // truncate is implemented with deleting the original file
+ ::ucbhelper::Content aCnt(
+ rFileName, Reference < XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
+ aCnt.executeCommand( ::rtl::OUString("delete"), makeAny( sal_Bool( sal_True ) ) );
}
- if ( bEnsureFileExists || bTruncate )
+ catch ( const CommandAbortedException& )
+ {
+ // couldn't truncate/delete
+ }
+ catch ( const ContentCreationException& )
+ {
+ }
+ catch ( const Exception& )
{
- try
- {
- // make sure that the desired file exists before trying to open
- SvMemoryStream aStream(0,0);
- ::utl::OInputStreamWrapper* pInput = new ::utl::OInputStreamWrapper( aStream );
- Reference< XInputStream > xInput( pInput );
-
- ::ucbhelper::Content aContent( rFileName, Reference < XCommandEnvironment >() );
- InsertCommandArgument aInsertArg;
- aInsertArg.Data = xInput;
-
- aInsertArg.ReplaceExisting = sal_False;
- Any aCmdArg;
- aCmdArg <<= aInsertArg;
- aContent.executeCommand( ::rtl::OUString("insert"), aCmdArg );
- }
-
- // it is NOT an error when the stream already exists and no truncation was desired
- catch ( const CommandAbortedException& )
- {
- // currently never an error is detected !
- }
- catch ( const ContentCreationException& )
- {
- }
- catch ( const Exception& )
- {
- }
}
}
- try
+ if ( bEnsureFileExists || bTruncate )
{
- // create LockBytes using UCB
- ::ucbhelper::Content aContent( rFileName, Reference < XCommandEnvironment >() );
- xLockBytes = UcbLockBytes::CreateLockBytes( aContent.get(), Sequence < PropertyValue >(),
- eOpenMode, xInteractionHandler, pHandler );
- if ( xLockBytes.Is() )
+ try
+ {
+ // make sure that the desired file exists before trying to open
+ SvMemoryStream aStream(0,0);
+ ::utl::OInputStreamWrapper* pInput = new ::utl::OInputStreamWrapper( aStream );
+ Reference< XInputStream > xInput( pInput );
+
+ ::ucbhelper::Content aContent(
+ rFileName, Reference < XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
+ InsertCommandArgument aInsertArg;
+ aInsertArg.Data = xInput;
+
+ aInsertArg.ReplaceExisting = sal_False;
+ Any aCmdArg;
+ aCmdArg <<= aInsertArg;
+ aContent.executeCommand( ::rtl::OUString("insert"), aCmdArg );
+ }
+
+ // it is NOT an error when the stream already exists and no truncation was desired
+ catch ( const CommandAbortedException& )
+ {
+ // currently never an error is detected !
+ }
+ catch ( const ContentCreationException& )
+ {
+ }
+ catch ( const Exception& )
{
- pStream = new SvStream( xLockBytes );
- pStream->SetBufferSize( 4096 );
- pStream->SetError( xLockBytes->GetError() );
}
}
- catch ( const CommandAbortedException& )
- {
- }
- catch ( const ContentCreationException& )
- {
- }
- catch ( const Exception& )
+ }
+
+ try
+ {
+ // create LockBytes using UCB
+ ::ucbhelper::Content aContent(
+ rFileName, Reference < XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
+ xLockBytes = UcbLockBytes::CreateLockBytes( aContent.get(), Sequence < PropertyValue >(),
+ eOpenMode, xInteractionHandler, pHandler );
+ if ( xLockBytes.Is() )
{
+ pStream = new SvStream( xLockBytes );
+ pStream->SetBufferSize( 4096 );
+ pStream->SetError( xLockBytes->GetError() );
}
}
- else
- // if no UCB is present at least conventional file io is supported
- pStream = new SvFileStream( rFileName, eOpenMode );
+ catch ( const CommandAbortedException& )
+ {
+ }
+ catch ( const ContentCreationException& )
+ {
+ }
+ catch ( const Exception& )
+ {
+ }
return pStream;
}
diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx
index c8417a0a28b3..37f9b3f7a5d1 100644
--- a/unoxml/source/dom/documentbuilder.cxx
+++ b/unoxml/source/dom/documentbuilder.cxx
@@ -32,6 +32,7 @@
#include <rtl/memory.h>
#include <rtl/ustrbuf.hxx>
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
@@ -71,7 +72,7 @@ namespace DOM
Reference< XCommandEnvironment > aEnvironment(
new CommandEnvironment(Reference< XInteractionHandler >(),
Reference< XProgressHandler >() ));
- Content aContent(sSystemId, aEnvironment);
+ Content aContent(sSystemId, aEnvironment, comphelper::getProcessComponentContext());
is.aInputStream = aContent.openStream();
} catch (const com::sun::star::uno::Exception&) {
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 5d28efa9fce9..333fb3f0ef32 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -26,7 +26,9 @@
*
************************************************************************/
+#include "sal/config.h"
+#include <comphelper/processfactory.hxx>
#include <tools/vcompat.hxx>
#include <tools/urlobj.hxx>
#include <tools/debug.hxx>
@@ -375,7 +377,8 @@ void ImpGraphic::ImplClear()
try
{
::ucbhelper::Content aCnt( mpSwapFile->aSwapURL.GetMainURL( INetURLObject::NO_DECODE ),
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
aCnt.executeCommand( ::rtl::OUString("delete"),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
@@ -1093,7 +1096,8 @@ sal_Bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, sal_Bool bSwap )
try
{
::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ),
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
aCnt.executeCommand( ::rtl::OUString("delete"),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
@@ -1285,7 +1289,8 @@ sal_Bool ImpGraphic::ImplSwapOut()
try
{
::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ),
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
aCnt.executeCommand( ::rtl::OUString("delete"),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
@@ -1394,7 +1399,8 @@ sal_Bool ImpGraphic::ImplSwapIn()
try
{
::ucbhelper::Content aCnt( aSwapURL,
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
+ comphelper::getProcessComponentContext() );
aCnt.executeCommand( ::rtl::OUString("delete"),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
diff --git a/vcl/test/canvasbitmaptest.cxx b/vcl/test/canvasbitmaptest.cxx
index 576810afc96e..98a7d2471221 100644
--- a/vcl/test/canvasbitmaptest.cxx
+++ b/vcl/test/canvasbitmaptest.cxx
@@ -45,8 +45,6 @@
#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
#include <com/sun/star/rendering/XBitmapPalette.hpp>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
#include <cppuhelper/compbase3.hxx>
#include <tools/diagnose_ex.h>
diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx
index 323feee5d94f..9422afcf38f1 100644
--- a/vcl/workben/outdevgrind.cxx
+++ b/vcl/workben/outdevgrind.cxx
@@ -36,9 +36,6 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
-
#include <vcl/svapp.hxx>
#include <vcl/dialog.hxx>
#include <vcl/outdev.hxx>
@@ -952,17 +949,9 @@ int GrindApp::Main()
exit( 1 );
}
- // Create UCB.
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= rtl::OUString(UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= rtl::OUString(UCB_CONFIGURATION_KEY2_OFFICE );
- ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
-
TestWindow pWindow;
pWindow.Execute();
- // clean up UCB
- ::ucbhelper::ContentBroker::deinitialize();
return EXIT_SUCCESS;
}
diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx
index 4b07940eccf4..2f8c8561a948 100644
--- a/vcl/workben/svpclient.cxx
+++ b/vcl/workben/svpclient.cxx
@@ -48,8 +48,6 @@
#include <comphelper/processfactory.hxx>
#include <cppuhelper/servicefactory.hxx>
#include <cppuhelper/bootstrap.hxx>
-#include "ucbhelper/contentbroker.hxx"
-#include "ucbhelper/configurationkeys.hxx"
#include <errno.h>
#include <unistd.h>
@@ -102,25 +100,6 @@ SAL_IMPLEMENT_MAIN()
exit( 1 );
}
- /*
- * Create UCB.
- */
- Sequence< Any > aArgs( 2 );
- aArgs[ 0 ] <<= OUString(UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= OUString(UCB_CONFIGURATION_KEY2_OFFICE );
-#if OSL_DEBUG_LEVEL > 1
- sal_Bool bSuccess =
-#endif
- ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
-
-#if OSL_DEBUG_LEVEL > 1
- if ( !bSuccess )
- {
- fprintf( stderr, "Error creating UCB, installation must be in disorder. Exiting.\n" );
- exit( 1 );
- }
-#endif
-
InitVCL( xFactory );
::Main();
DeInitVCL();
diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java
index 6a3dc53cd38f..2c9399b74d4a 100644
--- a/wizards/com/sun/star/wizards/common/UCB.java
+++ b/wizards/com/sun/star/wizards/common/UCB.java
@@ -54,11 +54,8 @@ public class UCB
public UCB(XMultiServiceFactory xmsf) throws Exception
{
- String[] keys = new String[2];
- keys[ 0 ] = "Local";
- keys[ 1 ] = "Office";
ucb = xmsf.createInstanceWithArguments(
- "com.sun.star.ucb.UniversalContentBroker", keys );
+ "com.sun.star.ucb.UniversalContentBroker", new Object[0] );
fa = new FileAccess(xmsf);
}
diff --git a/writerfilter/CppunitTest_writerfilter_doctok.mk b/writerfilter/CppunitTest_writerfilter_doctok.mk
index 23110eeea852..ae2fb2c16144 100644
--- a/writerfilter/CppunitTest_writerfilter_doctok.mk
+++ b/writerfilter/CppunitTest_writerfilter_doctok.mk
@@ -36,7 +36,6 @@ $(eval $(call gb_CppunitTest_use_libraries,writerfilter_doctok, \
cppu \
cppuhelper \
sal \
- ucbhelper \
writerfilter \
$(gb_STDLIBS) \
))
diff --git a/writerfilter/CppunitTest_writerfilter_rtftok.mk b/writerfilter/CppunitTest_writerfilter_rtftok.mk
index 9b660d30abac..6e583e9227f5 100644
--- a/writerfilter/CppunitTest_writerfilter_rtftok.mk
+++ b/writerfilter/CppunitTest_writerfilter_rtftok.mk
@@ -40,7 +40,6 @@ $(eval $(call gb_CppunitTest_use_libraries,writerfilter_rtftok, \
cppuhelper \
sal \
test \
- ucbhelper \
unotest \
vcl \
writerfilter \
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk
index 202990d6472d..c0088eac61f3 100644
--- a/writerfilter/Library_writerfilter.mk
+++ b/writerfilter/Library_writerfilter.mk
@@ -78,7 +78,6 @@ $(eval $(call gb_Library_use_libraries,writerfilter,\
sot \
svt \
tl \
- ucbhelper \
utl \
vcl \
$(gb_STDLIBS) \
diff --git a/writerfilter/Library_writerfilter_uno.mk b/writerfilter/Library_writerfilter_uno.mk
index ddf51243f4d9..1eeccd538349 100644
--- a/writerfilter/Library_writerfilter_uno.mk
+++ b/writerfilter/Library_writerfilter_uno.mk
@@ -43,7 +43,6 @@ $(eval $(call gb_Library_use_libraries,writerfilter_uno,\
cppu \
cppuhelper \
sal \
- ucbhelper \
writerfilter \
$(gb_STDLIBS) \
))
diff --git a/writerfilter/prj/build.lst b/writerfilter/prj/build.lst
index b31510ab2b28..dc8a005a2391 100644
--- a/writerfilter/prj/build.lst
+++ b/writerfilter/prj/build.lst
@@ -1,3 +1,3 @@
-wf writerfilter : soltools sal BOOST:boost configmgr cppu cppuhelper ucbhelper tools svx LIBXSLT:libxslt oox test NULL
+wf writerfilter : soltools sal BOOST:boost configmgr cppu cppuhelper tools svx LIBXSLT:libxslt oox test NULL
wf writerfilter usr1 - all wf_mkout NULL
wf writerfilter\prj nmake - all wf_prj NULL
diff --git a/writerfilter/qa/cppunittests/doctok/testdoctok.cxx b/writerfilter/qa/cppunittests/doctok/testdoctok.cxx
index 32017595bc92..b86fb925f67b 100644
--- a/writerfilter/qa/cppunittests/doctok/testdoctok.cxx
+++ b/writerfilter/qa/cppunittests/doctok/testdoctok.cxx
@@ -23,7 +23,6 @@
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
-#include <ucbhelper/contentbroker.hxx>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -59,7 +58,6 @@ public:
{
bool bResult = false;
- // initialise UCB-Broker
uno::Reference<uno::XComponentContext>
xComponentContext
(::cppu::defaultBootstrap_InitialComponentContext());
@@ -71,36 +69,22 @@ public:
xFactory(xComponentContext->getServiceManager() );
OSL_ASSERT(xFactory.is());
- uno::Sequence<uno::Any> aUcbInitSequence(2);
- aUcbInitSequence[0] <<=
- OUString("Local");
- aUcbInitSequence[1] <<=
- OUString("Office");
-
uno::Reference<lang::XMultiServiceFactory>
xServiceFactory(xFactory, uno::UNO_QUERY);
OSL_ASSERT( xServiceFactory.is() );
if (xServiceFactory.is())
{
- sal_Bool bRet =
- ::ucbhelper::ContentBroker::initialize(xServiceFactory,
- aUcbInitSequence);
+ uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >
+ xNameContainer(xFactory->createInstanceWithContext
+ ("com.sun.star.ucb.SimpleFileAccess",
+ xComponentContext), uno::UNO_QUERY );
- OSL_ASSERT(bRet);
- if (bRet)
+ if (xNameContainer.is())
{
- uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >
- xNameContainer(xFactory->createInstanceWithContext
- ("com.sun.star.ucb.SimpleFileAccess",
- xComponentContext), uno::UNO_QUERY );
-
- if (xNameContainer.is())
- {
- xSimpleFileAccess = xNameContainer;
+ xSimpleFileAccess = xNameContainer;
- bResult = true;
- }
+ bResult = true;
}
}
@@ -150,11 +134,6 @@ public:
pDocument->resolve(*pStream);
}
- void testEnd()
- {
- ::ucbhelper::ContentBroker::deinitialize();
- }
-
// Change the following lines only, if you add, remove or rename
// member functions of the current class,
// because these macros are need by auto register mechanism.
@@ -163,7 +142,6 @@ public:
CPPUNIT_TEST(testInitUno);
CPPUNIT_TEST(testOpenFile);
CPPUNIT_TEST(testEvents);
- CPPUNIT_TEST(testEnd);
CPPUNIT_TEST_SUITE_END();
}; // class test
diff --git a/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx b/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx
index d35f3b6014d8..352bdc7b3f54 100644
--- a/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx
+++ b/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx
@@ -26,7 +26,6 @@
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <ucbhelper/contentbroker.hxx>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <osl/process.h>
@@ -41,9 +40,6 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/seqstream.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/uno/Any.hxx>
#include <resourcemodel/WW8ResourceModel.hxx>
#include <resourcemodel/exceptions.hxx>
#include <doctok/WW8Document.hxx>
@@ -140,111 +136,93 @@ sal_Int32 SAL_CALL AnalyzeService::run
( const uno::Sequence< OUString >& aArguments )
throw (uno::RuntimeException)
{
- uno::Sequence<uno::Any> aUcbInitSequence(2);
- aUcbInitSequence[0] <<= OUString("Local");
- aUcbInitSequence[1] <<=
- OUString("Office");
- uno::Reference<lang::XMultiServiceFactory>
- xServiceFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW);
- uno::Reference<lang::XMultiComponentFactory>
- xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-
- if (::ucbhelper::ContentBroker::initialize(xServiceFactory, aUcbInitSequence))
- {
- OUString arg=aArguments[0];
+ OUString arg=aArguments[0];
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
+ rtl_uString *dir=NULL;
+ osl_getProcessWorkingDir(&dir);
- OUString absFileUrlUrls;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrlUrls.pData);
+ OUString absFileUrlUrls;
+ osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrlUrls.pData);
- URLLister aLister(xContext, absFileUrlUrls);
+ URLLister aLister(xContext, absFileUrlUrls);
- fprintf(stdout, "<analyze>\n");
+ fprintf(stdout, "<analyze>\n");
- OUString aURL = aLister.getURL();
+ OUString aURL = aLister.getURL();
- while (!aURL.isEmpty())
- {
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
+ while (!aURL.isEmpty())
+ {
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
- OString aStr;
- aURL.convertToString(&aStr, RTL_TEXTENCODING_ASCII_US,
- OUSTRING_TO_OSTRING_CVTFLAGS);
+ OString aStr;
+ aURL.convertToString(&aStr, RTL_TEXTENCODING_ASCII_US,
+ OUSTRING_TO_OSTRING_CVTFLAGS);
- fprintf(stdout, "<file><name>%s</name>\n", aStr.getStr());
- fprintf(stderr, "%s\n", aStr.getStr());
- fflush(stderr);
+ fprintf(stdout, "<file><name>%s</name>\n", aStr.getStr());
+ fprintf(stderr, "%s\n", aStr.getStr());
+ fflush(stderr);
- bool bStatus = true;
+ bool bStatus = true;
+ try
+ {
try
{
- try
+ uno::Reference<io::XInputStream> xInputStream =
+ xFileAccess->openFileRead(aURL);
{
- uno::Reference<io::XInputStream> xInputStream =
- xFileAccess->openFileRead(aURL);
+ doctok::WW8Stream::Pointer_t pDocStream =
+ doctok::WW8DocumentFactory::createStream
+ (xContext, xInputStream);
+
+ if (pDocStream.get() != NULL)
{
- doctok::WW8Stream::Pointer_t pDocStream =
- doctok::WW8DocumentFactory::createStream
- (xContext, xInputStream);
-
- if (pDocStream.get() != NULL)
- {
- doctok::WW8Document::Pointer_t pDocument
- (doctok::WW8DocumentFactory::createDocument
- (pDocStream));
-
- Stream::Pointer_t pAnalyzer =
- writerfilter::createAnalyzer();
- pDocument->resolve(*pAnalyzer);
- }
- else
- {
- fprintf(stdout,
- "<exception>file open failed</exception>\n");
- bStatus = false;
- }
- fprintf(stderr, "done\n");
- }
+ doctok::WW8Document::Pointer_t pDocument
+ (doctok::WW8DocumentFactory::createDocument
+ (pDocStream));
- xInputStream->closeInput();
- }
- catch (const Exception &e)
- {
- fprintf(stdout, "<exception>%s</exception>\n",
- e.getText().c_str());
- bStatus = false;
+ Stream::Pointer_t pAnalyzer =
+ writerfilter::createAnalyzer();
+ pDocument->resolve(*pAnalyzer);
+ }
+ else
+ {
+ fprintf(stdout,
+ "<exception>file open failed</exception>\n");
+ bStatus = false;
+ }
+ fprintf(stderr, "done\n");
}
+
+ xInputStream->closeInput();
}
- catch (...)
+ catch (const Exception &e)
{
- fprintf(stdout, "<exception>unknown</exception>\n");
+ fprintf(stdout, "<exception>%s</exception>\n",
+ e.getText().c_str());
bStatus = false;
}
+ }
+ catch (...)
+ {
+ fprintf(stdout, "<exception>unknown</exception>\n");
+ bStatus = false;
+ }
- if (bStatus)
- fprintf(stdout, "<status>ok</status>\n");
- else
- fprintf(stdout, "<status>failed</status>\n");
+ if (bStatus)
+ fprintf(stdout, "<status>ok</status>\n");
+ else
+ fprintf(stdout, "<status>failed</status>\n");
- aURL = aLister.getURL();
+ aURL = aLister.getURL();
- fprintf(stdout, "</file>\n");
- fflush(stdout);
- }
-
- fprintf(stdout, "</analyze>\n");
+ fprintf(stdout, "</file>\n");
+ fflush(stdout);
+ }
- rtl_uString_release(dir);
- ::ucbhelper::ContentBroker::deinitialize();
+ fprintf(stdout, "</analyze>\n");
+ rtl_uString_release(dir);
- }
- else
- {
- fprintf(stdout, "can't initialize UCB");
- }
return 0;
}
diff --git a/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx b/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx
index a2ae1b72b386..56d2c003f26e 100644
--- a/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx
+++ b/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx
@@ -26,7 +26,6 @@
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <ucbhelper/contentbroker.hxx>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <osl/process.h>
@@ -41,9 +40,6 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/seqstream.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/uno/Any.hxx>
#include <resourcemodel/WW8ResourceModel.hxx>
#include <resourcemodel/exceptions.hxx>
#include <doctok/WW8Document.hxx>
@@ -67,37 +63,24 @@ xContext( xContext_ )
sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< OUString >& aArguments ) throw (uno::RuntimeException)
{
- uno::Sequence<uno::Any> aUcbInitSequence(2);
- aUcbInitSequence[0] <<= OUString("Local");
- aUcbInitSequence[1] <<= OUString("Office");
- uno::Reference<lang::XMultiServiceFactory> xServiceFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW);
- uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- if (::ucbhelper::ContentBroker::initialize(xServiceFactory, aUcbInitSequence))
- {
- OUString arg=aArguments[0];
-
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
-
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
- OUString absFileUrl;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData);
- rtl_uString_release(dir);
-
- uno::Reference<io::XInputStream> xInputStream = xFileAccess->openFileRead(absFileUrl);
- doctok::WW8Stream::Pointer_t pDocStream = doctok::WW8DocumentFactory::createStream(xContext, xInputStream);
-
- doctok::WW8Document::Pointer_t pDocument(doctok::WW8DocumentFactory::createDocument(pDocStream));
-
- Stream::Pointer_t pStream = createStreamHandler();
- pDocument->resolve(*pStream);
-
- ::ucbhelper::ContentBroker::deinitialize();
- }
- else
- {
- fprintf(stderr, "can't initialize UCB");
- }
+ OUString arg=aArguments[0];
+
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
+
+ rtl_uString *dir=NULL;
+ osl_getProcessWorkingDir(&dir);
+ OUString absFileUrl;
+ osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData);
+ rtl_uString_release(dir);
+
+ uno::Reference<io::XInputStream> xInputStream = xFileAccess->openFileRead(absFileUrl);
+ doctok::WW8Stream::Pointer_t pDocStream = doctok::WW8DocumentFactory::createStream(xContext, xInputStream);
+
+ doctok::WW8Document::Pointer_t pDocument(doctok::WW8DocumentFactory::createDocument(pDocStream));
+
+ Stream::Pointer_t pStream = createStreamHandler();
+ pDocument->resolve(*pStream);
+
return 0;
}
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx
index 8e6535876f81..7abb841a3707 100644
--- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx
+++ b/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <comphelper/processfactory.hxx>
-
#include "OOXMLAnalyzeService.hxx"
#include <stdio.h>
#include <wchar.h>
@@ -28,7 +26,6 @@
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <ucbhelper/contentbroker.hxx>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <osl/process.h>
@@ -43,9 +40,6 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/seqstream.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/uno/Any.hxx>
#include <resourcemodel/WW8ResourceModel.hxx>
#include <ooxml/OOXMLDocument.hxx>
@@ -141,107 +135,88 @@ sal_Int32 SAL_CALL AnalyzeService::run
( const uno::Sequence< OUString >& aArguments )
throw (uno::RuntimeException)
{
- uno::Sequence<uno::Any> aUcbInitSequence(2);
- aUcbInitSequence[0] <<= OUString("Local");
- aUcbInitSequence[1] <<= OUString("Office");
- uno::Reference<lang::XMultiServiceFactory>
- xServiceFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW);
- uno::Reference<lang::XMultiComponentFactory>
- xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-
- if (::ucbhelper::ContentBroker::initialize(xServiceFactory, aUcbInitSequence))
- {
- ::comphelper::setProcessServiceFactory(xServiceFactory);
+ OUString arg=aArguments[0];
- OUString arg=aArguments[0];
+ rtl_uString *dir=NULL;
+ osl_getProcessWorkingDir(&dir);
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
+ OUString absFileUrlUrls;
+ osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrlUrls.pData);
- OUString absFileUrlUrls;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrlUrls.pData);
+ URLLister aLister(xContext, absFileUrlUrls);
- URLLister aLister(xContext, absFileUrlUrls);
+ fprintf(stdout, "<analyze>\n");
- fprintf(stdout, "<analyze>\n");
+ writerfilter::analyzerIds();
- writerfilter::analyzerIds();
+ OUString aURL = aLister.getURL();
- OUString aURL = aLister.getURL();
+ while (!aURL.isEmpty())
+ {
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
- while (!aURL.isEmpty())
- {
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
+ OString aStr;
+ aURL.convertToString(&aStr, RTL_TEXTENCODING_ASCII_US,
+ OUSTRING_TO_OSTRING_CVTFLAGS);
- OString aStr;
- aURL.convertToString(&aStr, RTL_TEXTENCODING_ASCII_US,
- OUSTRING_TO_OSTRING_CVTFLAGS);
+ fprintf(stdout, "<file><name>%s</name>\n", aStr.getStr());
+ fprintf(stderr, "%s\n", aStr.getStr());
+ fflush(stderr);
- fprintf(stdout, "<file><name>%s</name>\n", aStr.getStr());
- fprintf(stderr, "%s\n", aStr.getStr());
- fflush(stderr);
+ bool bStatus = true;
+ try
+ {
+ uno::Reference<io::XInputStream> xInputStream =
+ xFileAccess->openFileRead(aURL);
- bool bStatus = true;
- try
+ if (xInputStream.is())
{
- uno::Reference<io::XInputStream> xInputStream =
- xFileAccess->openFileRead(aURL);
+ ooxml::OOXMLStream::Pointer_t pDocStream =
+ ooxml::OOXMLDocumentFactory::createStream
+ (xContext, xInputStream);
- if (xInputStream.is())
+ if (pDocStream.get() != NULL)
{
- ooxml::OOXMLStream::Pointer_t pDocStream =
- ooxml::OOXMLDocumentFactory::createStream
- (xContext, xInputStream);
-
- if (pDocStream.get() != NULL)
- {
- ooxml::OOXMLDocument::Pointer_t pDocument
- (ooxml::OOXMLDocumentFactory::createDocument
- (pDocStream));
-
- Stream::Pointer_t pAnalyzer =
- writerfilter::createAnalyzer();
- pDocument->resolve(*pAnalyzer);
- }
- else
- {
- fprintf(stdout,
- "<exception>file open failed</exception>\n");
- bStatus = false;
- }
- fprintf(stderr, "done\n");
- }
+ ooxml::OOXMLDocument::Pointer_t pDocument
+ (ooxml::OOXMLDocumentFactory::createDocument
+ (pDocStream));
- xInputStream->closeInput();
- }
- catch (...)
- {
- fprintf(stdout, "<exception>unknown</exception>\n");
- bStatus = false;
+ Stream::Pointer_t pAnalyzer =
+ writerfilter::createAnalyzer();
+ pDocument->resolve(*pAnalyzer);
+ }
+ else
+ {
+ fprintf(stdout,
+ "<exception>file open failed</exception>\n");
+ bStatus = false;
+ }
+ fprintf(stderr, "done\n");
}
- if (bStatus)
- fprintf(stdout, "<status>ok</status>\n");
- else
- fprintf(stdout, "<status>failed</status>\n");
+ xInputStream->closeInput();
+ }
+ catch (...)
+ {
+ fprintf(stdout, "<exception>unknown</exception>\n");
+ bStatus = false;
+ }
- aURL = aLister.getURL();
+ if (bStatus)
+ fprintf(stdout, "<status>ok</status>\n");
+ else
+ fprintf(stdout, "<status>failed</status>\n");
- fprintf(stdout, "</file>\n");
- fflush(stdout);
- }
+ aURL = aLister.getURL();
- fprintf(stdout, "</analyze>\n");
+ fprintf(stdout, "</file>\n");
+ fflush(stdout);
+ }
- rtl_uString_release(dir);
- ::ucbhelper::ContentBroker::deinitialize();
+ fprintf(stdout, "</analyze>\n");
+ rtl_uString_release(dir);
- }
- else
- {
- fprintf(stdout, "can't initialize UCB");
- }
return 0;
}
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
index 92d0144aa518..b6423f0cc4b7 100644
--- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
+++ b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
@@ -20,7 +20,6 @@
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/lang/XMain.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <comphelper/processfactory.hxx>
#include "OOXMLTestService.hxx"
#include <stdio.h>
@@ -31,7 +30,6 @@
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <ucbhelper/contentbroker.hxx>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <osl/process.h>
@@ -47,9 +45,6 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/seqstream.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <ooxml/OOXMLDocument.hxx>
@@ -74,52 +69,37 @@ xContext( xContext_ )
sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< OUString >& aArguments ) throw (uno::RuntimeException)
{
- uno::Sequence<uno::Any> aUcbInitSequence(2);
- aUcbInitSequence[0] <<= OUString("Local");
- aUcbInitSequence[1] <<= OUString("Office");
- uno::Reference<lang::XMultiServiceFactory> xServiceFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW);
- uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- if (::ucbhelper::ContentBroker::initialize(xServiceFactory, aUcbInitSequence))
- {
#ifdef DEBUG_ELEMENT
- writerfilter::TagLogger::Pointer_t debugLogger
+ writerfilter::TagLogger::Pointer_t debugLogger
(writerfilter::TagLogger::getInstance("DEBUG"));
- debugLogger->startDocument();
+ debugLogger->startDocument();
#endif
- OUString arg=aArguments[0];
+ OUString arg=aArguments[0];
- ::comphelper::setProcessServiceFactory(xServiceFactory);
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
+ rtl_uString *dir=NULL;
+ osl_getProcessWorkingDir(&dir);
+ OUString absFileUrl;
+ osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData);
+ rtl_uString_release(dir);
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
- OUString absFileUrl;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData);
- rtl_uString_release(dir);
+ uno::Reference<io::XInputStream> xInputStream =
+ xFileAccess->openFileRead(absFileUrl);
+ ooxml::OOXMLStream::Pointer_t pDocStream =
+ ooxml::OOXMLDocumentFactory::createStream(xContext, xInputStream);
- uno::Reference<io::XInputStream> xInputStream =
- xFileAccess->openFileRead(absFileUrl);
- ooxml::OOXMLStream::Pointer_t pDocStream =
- ooxml::OOXMLDocumentFactory::createStream(xContext, xInputStream);
+ ooxml::OOXMLDocument::Pointer_t pDocument
+ (ooxml::OOXMLDocumentFactory::createDocument(pDocStream));
- ooxml::OOXMLDocument::Pointer_t pDocument
- (ooxml::OOXMLDocumentFactory::createDocument(pDocStream));
-
- Stream::Pointer_t pStream = createStreamHandler();
- pDocument->resolve(*pStream);
+ Stream::Pointer_t pStream = createStreamHandler();
+ pDocument->resolve(*pStream);
#ifdef DEBUG_ELEMENT
- debugLogger->endDocument();
+ debugLogger->endDocument();
#endif
- ::ucbhelper::ContentBroker::deinitialize();
- }
- else
- {
- fprintf(stderr, "can't initialize UCB");
- }
return 0;
}
diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx
index c5155ea345f9..0c15e302c7a1 100644
--- a/writerperfect/source/writer/MSWorksImportFilter.cxx
+++ b/writerperfect/source/writer/MSWorksImportFilter.cxx
@@ -151,7 +151,7 @@ throw( com::sun::star::uno::RuntimeException )
{
try
{
- ::ucbhelper::Content aContent(sURL, xEnv);
+ ::ucbhelper::Content aContent(sURL, xEnv, mxContext);
xInputStream = aContent.openStream();
}
catch ( ... )
diff --git a/writerperfect/source/writer/WordPerfectImportFilter.cxx b/writerperfect/source/writer/WordPerfectImportFilter.cxx
index a7d1534d6df2..45372e399095 100644
--- a/writerperfect/source/writer/WordPerfectImportFilter.cxx
+++ b/writerperfect/source/writer/WordPerfectImportFilter.cxx
@@ -206,7 +206,7 @@ throw( RuntimeException )
{
try
{
- Content aContent(sURL, xEnv);
+ Content aContent(sURL, xEnv, mxContext);
xInputStream = aContent.openStream();
}
catch ( ... )
diff --git a/xmlsecurity/tools/standalone/csfit/helper.cxx b/xmlsecurity/tools/standalone/csfit/helper.cxx
index 6062c1d79e12..a4dd05aeef74 100644
--- a/xmlsecurity/tools/standalone/csfit/helper.cxx
+++ b/xmlsecurity/tools/standalone/csfit/helper.cxx
@@ -111,27 +111,6 @@ Reference< XMultiComponentFactory > serviceManager( Reference< XComponentContext
"serviceManager - "
"Cannot create intial service manager" ) ;
- /*-
- * Because of the exception rasied from
- * ucbhelper/source/provider/provconf.cxx, lin 323
- * I do not use the content broker at present
- ********************************************************************
- //init ucb
- if( ::ucb::ContentBroker::get() == NULL ) {
- Reference< lang::XMultiServiceFactory > xSvmg( xLocalServiceManager , UNO_QUERY ) ;
- OSL_ENSURE( xLocalServiceManager.is() ,
- "serviceManager - "
- "Cannot get multi-service factory" ) ;
-
- Sequence< Any > args( 2 ) ;
- args[ 0 ] <<= OUString( UCB_CONFIGURATION_KEY1_LOCAL ) ;
- args[ 1 ] <<= OUString( UCB_CONFIGURATION_KEY2_OFFICE ) ;
- if( ! ::ucb::ContentBroker::initialize( xSvmg , args ) ) {
- throw RuntimeException( OUString("Cannot inlitialize ContentBroker") , Reference< XInterface >() , Any() ) ;
- }
- }
- ********************************************************************/
-
xUsedComponentContext = xLocalComponentContext ;
xUsedServiceManager = xLocalServiceManager ;
} else {
diff --git a/xmlsecurity/tools/standalone/csfit/helper.hxx b/xmlsecurity/tools/standalone/csfit/helper.hxx
index 9ff67e54aab5..be52ab950698 100644
--- a/xmlsecurity/tools/standalone/csfit/helper.hxx
+++ b/xmlsecurity/tools/standalone/csfit/helper.hxx
@@ -24,8 +24,6 @@
#include <cppuhelper/bootstrap.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/servicefactory.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
diff --git a/xmlsecurity/tools/standalone/mscsfit/helper.cxx b/xmlsecurity/tools/standalone/mscsfit/helper.cxx
index 61886c6afc0d..6cd492a7be5c 100644
--- a/xmlsecurity/tools/standalone/mscsfit/helper.cxx
+++ b/xmlsecurity/tools/standalone/mscsfit/helper.cxx
@@ -110,28 +110,6 @@ Reference< XMultiComponentFactory > serviceManager( Reference< XComponentContext
"serviceManager - "
"Cannot create intial service manager" ) ;
- /*-
- * Because of the exception rasied from
- * ucbhelper/source/provider/provconf.cxx, lin 323
- * I do not use the content broker at present
- ********************************************************************
- //init ucb
- if( ::ucb::ContentBroker::get() == NULL ) {
- Reference< lang::XMultiServiceFactory > xSvmg( xLocalServiceManager , UNO_QUERY ) ;
- OSL_ENSURE( xLocalServiceManager.is() ,
- "serviceManager - "
- "Cannot get multi-service factory" ) ;
-
- Sequence< Any > args( 2 ) ;
- args[ 0 ] <<= OUString( UCB_CONFIGURATION_KEY1_LOCAL ) ;
- args[ 1 ] <<= OUString( UCB_CONFIGURATION_KEY2_OFFICE ) ;
- if( ! ::ucb::ContentBroker::initialize( xSvmg , args ) ) {
- throw RuntimeException( OUString("Cannot inlitialize ContentBroker") , Reference< XInterface >() , Any() ) ;
- }
- }
- ********************************************************************/
-
-
xUsedComponentContext = xLocalComponentContext ;
xUsedServiceManager = xLocalServiceManager ;
} else {
diff --git a/xmlsecurity/tools/standalone/mscsfit/helper.hxx b/xmlsecurity/tools/standalone/mscsfit/helper.hxx
index fa185219307e..e345c92ea887 100644
--- a/xmlsecurity/tools/standalone/mscsfit/helper.hxx
+++ b/xmlsecurity/tools/standalone/mscsfit/helper.hxx
@@ -23,8 +23,6 @@
#include <cppuhelper/bootstrap.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/servicefactory.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
diff --git a/xmlsecurity/workben/signaturetest.cxx b/xmlsecurity/workben/signaturetest.cxx
index f0c45fd95b1d..4adb6cb11b08 100644
--- a/xmlsecurity/workben/signaturetest.cxx
+++ b/xmlsecurity/workben/signaturetest.cxx
@@ -38,9 +38,6 @@
#include <cppuhelper/bootstrap.hxx>
#include <unotools/streamhelper.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
-
// Will be in comphelper if CWS MAV09 is integrated
#include <comphelper/storagehelper.hxx>
@@ -91,18 +88,6 @@ void Main();
OSL_FAIL( "No service manager!" );
return -1;
}
-
- // Init USB
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= rtl::OUString( UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= rtl::OUString( UCB_CONFIGURATION_KEY2_OFFICE );
- sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xMSF, aArgs );
- if ( !bSuccess )
- {
- OSL_FAIL( "Error creating UCB!" );
- return -1;
- }
-
}
catch ( uno::Exception const & )
{