summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-14 18:08:57 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-14 18:24:49 +0200
commit9ac86f484b0c278aafbce685ed19d3ea005ee8f8 (patch)
treecf2fe16d76992bcbd1bd89a8693c5f4996cd55f2 /svx
parent2e284203da7f9882842111265f5f68ea0a145065 (diff)
Improvement on previous commit, UCB clean up
* As UCB is only ever initialized with "Local"/"Office", remove this configuration vector completely. The "create" ctor creates an instance internally initialized with those "Local"/"Office" keys. Special (test) code can still instantiate an uninitialized one via plain createInstance. And for backwards compatilibity process startup still ensures to create an initialized instance early, in case there is still code out there (in extensions) that later calls plain createInstance and expects to get the already-initialized (single) instance. * XInitialization is an "implementation detail" of the UniversalContentBroker service, do not expose in XUniversalContentBroker. * ucbhelper/configurationkeys.hxx is no longer needed and is removed. * ucbhelper/contentbroker.hxx is an empty wrapper and is removed; however, that requires ucbhelper::Content constructors to take explicit XComponentContext arguments now. * The only remaining code in ucbhelper/source/client/contentbroker.cxx is Android-only InitUCBHelper. Is that relevant still? Change-Id: I3f7bddd0456bffbcd13590c66d9011915c760f28
Diffstat (limited to 'svx')
-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
11 files changed, 41 insertions, 70 deletions
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 & )
{