[Libreoffice-commits] .: 7 commits - basic/source chart2/source comphelper/source connectivity/source dbaccess/source editeng/source embeddedobj/source embedserv/source eventattacher/Library_evtatt.mk eventattacher/prj eventattacher/source extensions/source filter/source forms/source framework/source offapi/UnoApi_offapi.mk oox/source package/source pyuno/source remotebridges/examples reportdesign/source scripting/source sc/source sdext/source sfx2/source sot/source svl/source svtools/source svx/inc svx/source sw/source ucbhelper/source ucb/Library_cached1.mk ucb/Library_ucpfile1.mk ucb/Library_ucpgvfs1.mk ucb/source unotools/source vbahelper/source vcl/source xmlsecurity/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Aug 27 06:55:59 PDT 2012
basic/source/classes/sbunoobj.cxx | 8
chart2/source/controller/main/ChartController_Window.cxx | 25 --
chart2/source/model/main/ChartModel.cxx | 6
chart2/source/model/main/ChartModel_Persistence.cxx | 3
comphelper/source/eventattachermgr/eventattachermgr.cxx | 9
comphelper/source/streaming/seekableinput.cxx | 27 +-
connectivity/source/drivers/postgresql/pq_connection.cxx | 6
dbaccess/source/core/api/SingleSelectQueryComposer.cxx | 3
dbaccess/source/ui/misc/TokenWriter.cxx | 6
editeng/source/items/frmitems.cxx | 9
embeddedobj/source/commonembedding/persistence.cxx | 92 ++++-----
embeddedobj/source/msole/olecomponent.cxx | 8
embeddedobj/source/msole/oleembed.cxx | 5
embeddedobj/source/msole/olepersist.cxx | 16 -
embeddedobj/source/msole/ownview.cxx | 3
embedserv/source/embed/ed_ipersiststr.cxx | 143 ++++++--------
eventattacher/Library_evtatt.mk | 1
eventattacher/prj/build.lst | 2
eventattacher/source/eventattacher.cxx | 6
extensions/source/nsplugin/source/so_instance.cxx | 10
extensions/source/propctrlr/genericpropertyhandler.cxx | 6
extensions/source/propctrlr/propertyhandler.cxx | 6
filter/source/xsltfilter/OleHandler.cxx | 9
forms/source/xforms/model.cxx | 11 -
framework/source/lomenubar/FrameHelper.cxx | 5
framework/source/recording/dispatchrecorder.cxx | 4
offapi/UnoApi_offapi.mk | 4
oox/source/core/filterdetect.cxx | 4
oox/source/drawingml/graphicshapecontext.cxx | 6
oox/source/ole/olestorage.cxx | 10
package/source/xstor/owriteablestream.cxx | 10
package/source/xstor/switchpersistencestream.cxx | 4
package/source/xstor/xfactory.cxx | 8
package/source/xstor/xstorage.cxx | 9
package/source/zippackage/ZipPackage.cxx | 3
package/source/zippackage/ZipPackageStream.cxx | 28 +-
pyuno/source/module/pyuno_runtime.cxx | 8
remotebridges/examples/officeclient.cxx | 7
reportdesign/source/core/api/ReportDefinition.cxx | 7
reportdesign/source/ui/inspection/DataProviderHandler.cxx | 3
reportdesign/source/ui/inspection/GeometryHandler.cxx | 3
sc/source/ui/vba/vbahelper.cxx | 3
scripting/source/basprov/basmethnode.cxx | 34 +--
scripting/source/stringresource/stringresource.cxx | 25 --
sdext/source/minimizer/impoptimizer.cxx | 5
sdext/source/minimizer/informationdialog.cxx | 9
sdext/source/pdfimport/filterdet.cxx | 5
sfx2/source/appl/appserv.cxx | 56 ++---
sfx2/source/bastyp/frmhtmlw.cxx | 8
sfx2/source/dialog/templateinfodlg.cxx | 4
sfx2/source/doc/doctemplates.cxx | 3
sfx2/source/doc/objuno.cxx | 10
sfx2/source/doc/sfxbasemodel.cxx | 6
sot/source/unoolestorage/xolesimplestorage.cxx | 6
svl/source/fsstor/fsstorage.cxx | 3
svl/source/items/globalnameitem.cxx | 5
svl/source/items/ilstitem.cxx | 5
svl/source/misc/documentlockfile.cxx | 4
svtools/source/contnr/templwin.cxx | 6
svx/inc/svx/SmartTagMgr.hxx | 2
svx/source/smarttags/SmartTagMgr.cxx | 30 +-
sw/source/core/fields/docufld.cxx | 8
sw/source/ui/app/docsh2.cxx | 85 +++-----
ucb/Library_cached1.mk | 1
ucb/Library_ucpfile1.mk | 1
ucb/Library_ucpgvfs1.mk | 1
ucb/source/cacher/cachedcontentresultset.cxx | 8
ucb/source/ucp/file/filrow.cxx | 5
ucb/source/ucp/gvfs/gvfs_content.cxx | 7
ucbhelper/source/provider/propertyvalueset.cxx | 10
unotools/source/ucbhelper/ucblockbytes.cxx | 16 -
vbahelper/source/vbahelper/vbahelper.cxx | 3
vcl/source/app/unohelp.cxx | 5
xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 6
74 files changed, 421 insertions(+), 507 deletions(-)
New commits:
commit 206c70eef30f7b6f538b88f7fb9505f397bef073
Author: Noel Grandin <noel at peralex.com>
Date: Thu Aug 23 17:23:26 2012 +0200
fdo#46808, Adapt TempFile UNO service to new style
Change-Id: Ia448d6d74201e2be487c6d8317f94be3745808aa
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index dec47f1..cd6aff7 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <ucbhelper/content.hxx>
@@ -311,7 +312,7 @@ void SAL_CALL ChartModel::storeToURL(
{
Reference< lang::XMultiServiceFactory > xFact( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
Reference< io::XStream > xStream(
- xFact->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile"))), uno::UNO_QUERY_THROW );
+ io::TempFile::create(m_xContext), uno::UNO_QUERY_THROW );
Reference< io::XInputStream > xInputStream( xStream->getInputStream());
Reference< embed::XStorage > xStorage(
diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx
index c18d66a..41ee54e 100644
--- a/comphelper/source/streaming/seekableinput.cxx
+++ b/comphelper/source/streaming/seekableinput.cxx
@@ -17,9 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/seekableinput.hxx>
using namespace ::com::sun::star;
@@ -91,22 +93,19 @@ void OSeekableInputWrapper::PrepareCopy_Impl()
throw uno::RuntimeException();
uno::Reference< io::XOutputStream > xTempOut(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile")) ),
- uno::UNO_QUERY );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
- if ( xTempOut.is() )
+ copyInputToOutput_Impl( m_xOriginalStream, xTempOut );
+ xTempOut->closeOutput();
+
+ uno::Reference< io::XSeekable > xTempSeek( xTempOut, uno::UNO_QUERY );
+ if ( xTempSeek.is() )
{
- copyInputToOutput_Impl( m_xOriginalStream, xTempOut );
- xTempOut->closeOutput();
-
- uno::Reference< io::XSeekable > xTempSeek( xTempOut, uno::UNO_QUERY );
- if ( xTempSeek.is() )
- {
- xTempSeek->seek( 0 );
- m_xCopyInput = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY );
- if ( m_xCopyInput.is() )
- m_xCopySeek = xTempSeek;
- }
+ xTempSeek->seek( 0 );
+ m_xCopyInput = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY );
+ if ( m_xCopyInput.is() )
+ m_xCopySeek = xTempSeek;
}
}
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index a7780dd..4cd67ef 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/embed/XOptimizedStorage.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/EmbedUpdateModes.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
@@ -53,6 +54,7 @@
#include <com/sun/star/beans/IllegalTypeException.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/fileformat.h>
#include <comphelper/storagehelper.hxx>
#include <comphelper/mimeconfighelper.hxx>
@@ -132,57 +134,53 @@ uno::Reference< io::XInputStream > createTempInpStreamFromStor(
uno::Reference< io::XInputStream > xResult;
- const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
- uno::Reference < io::XStream > xTempStream = uno::Reference < io::XStream > (
- xFactory->createInstance ( aServiceName ),
- uno::UNO_QUERY );
- if ( xTempStream.is() )
- {
- uno::Reference < lang::XSingleServiceFactory > xStorageFactory(
- xFactory->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" )) ),
- uno::UNO_QUERY );
+ uno::Reference < io::XStream > xTempStream( io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= xTempStream;
- aArgs[1] <<= embed::ElementModes::READWRITE;
- uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ),
- uno::UNO_QUERY );
- if ( !xTempStorage.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::Reference < lang::XSingleServiceFactory > xStorageFactory(
+ xFactory->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" )) ),
+ uno::UNO_QUERY );
- try
- {
- xStorage->copyToStorage( xTempStorage );
- } catch( const uno::Exception& e )
- {
- throw embed::StorageWrappedTargetException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't copy storage!" )),
- uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
- }
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[0] <<= xTempStream;
+ aArgs[1] <<= embed::ElementModes::READWRITE;
+ uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ),
+ uno::UNO_QUERY );
+ if ( !xTempStorage.is() )
+ throw uno::RuntimeException(); // TODO:
- try {
- uno::Reference< lang::XComponent > xComponent( xTempStorage, uno::UNO_QUERY );
- OSL_ENSURE( xComponent.is(), "Wrong storage implementation!" );
- if ( xComponent.is() )
- xComponent->dispose();
- }
- catch ( const uno::Exception& )
- {
- }
+ try
+ {
+ xStorage->copyToStorage( xTempStorage );
+ } catch( const uno::Exception& e )
+ {
+ throw embed::StorageWrappedTargetException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't copy storage!" )),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
+ }
- try {
- uno::Reference< io::XOutputStream > xTempOut = xTempStream->getOutputStream();
- if ( xTempOut.is() )
- xTempOut->closeOutput();
- }
- catch ( const uno::Exception& )
- {
- }
+ try {
+ uno::Reference< lang::XComponent > xComponent( xTempStorage, uno::UNO_QUERY );
+ OSL_ENSURE( xComponent.is(), "Wrong storage implementation!" );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ catch ( const uno::Exception& )
+ {
+ }
- xResult = xTempStream->getInputStream();
+ try {
+ uno::Reference< io::XOutputStream > xTempOut = xTempStream->getOutputStream();
+ if ( xTempOut.is() )
+ xTempOut->closeOutput();
+ }
+ catch ( const uno::Exception& )
+ {
}
+ xResult = xTempStream->getInputStream();
+
return xResult;
}
@@ -587,11 +585,11 @@ uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStr
const ::rtl::OUString& aHierarchName )
{
uno::Reference < io::XOutputStream > xTempOut(
- m_xFactory->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" )) ),
- uno::UNO_QUERY );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
uno::Reference< io::XInputStream > aResult( xTempOut, uno::UNO_QUERY );
- if ( !xTempOut.is() || !aResult.is() )
+ if ( !aResult.is() )
throw uno::RuntimeException(); // TODO:
uno::Reference< frame::XStorable > xStorable;
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
index 8893091..e785aaa 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/embed/UnreachableStateException.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/awt/XRequestCallback.hpp>
@@ -1596,11 +1597,8 @@ uno::Any SAL_CALL OleComponent::getTransferData( const datatransfer::DataFlavor&
// allow to retrieve stream-representation of the object persistence
bSupportedFlavor = sal_True;
uno::Reference < io::XStream > xTempFileStream(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempFileStream.is() )
- throw uno::RuntimeException(); // TODO
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xTempOutStream = xTempFileStream->getOutputStream();
uno::Reference< io::XInputStream > xTempInStream = xTempFileStream->getInputStream();
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 087fb2a..1a65e1a 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/embed/StateChangeInProgressException.hpp>
#include <com/sun/star/embed/EmbedMisc.hpp>
#include <com/sun/star/embed/XEmbedObjectCreator.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -705,8 +706,8 @@ namespace
// the solution is only active for Unix systems
#ifndef WNT
uno::Reference <beans::XPropertySet> xNativeTempFile(
- xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile"))), uno::UNO_QUERY_THROW);
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW);
uno::Reference < io::XStream > xStream(xNativeTempFile, uno::UNO_QUERY_THROW);
uno::Sequence< uno::Any > aArgs( 2 );
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index 2d74cb8..7939ad5 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -91,11 +92,8 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
::rtl::OUString aResult;
uno::Reference < beans::XPropertySet > xTempFile(
- xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempFile.is() )
- throw uno::RuntimeException(); // TODO
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
try {
xTempFile->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RemoveFile" )), uno::makeAny( sal_False ) );
@@ -172,7 +170,7 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
try
{
uno::Reference < beans::XPropertySet > xTempFile(
- xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
uno::UNO_QUERY );
uno::Reference < io::XStream > xTempStream( xTempFile, uno::UNO_QUERY_THROW );
@@ -278,7 +276,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::GetNewFilledTempStream_Impl( co
OSL_ENSURE( xInStream.is(), "Wrong parameter is provided!\n" );
uno::Reference < io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xTempOutStream = xTempFile->getOutputStream();
@@ -355,7 +353,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::TryToGetAcceptableFormat_Impl(
{
// this is either a bitmap or a metafile clipboard format, retrieve the pure stream
uno::Reference < io::XStream > xResult(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference < io::XSeekable > xResultSeek( xResult, uno::UNO_QUERY_THROW );
uno::Reference < io::XOutputStream > xResultOut = xResult->getOutputStream();
@@ -403,7 +401,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
xCachedSeek->seek( 0 );
uno::Reference < io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference< io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW );
diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx
index 354ff11..c5bb43a 100644
--- a/embeddedobj/source/msole/ownview.cxx
+++ b/embeddedobj/source/msole/ownview.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/embed/XClassifiedObject.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
@@ -276,7 +277,7 @@ sal_Bool OwnView_Impl::ReadContentsAndGenerateTempFile( const uno::Reference< io
// create m_aNativeTempURL
::rtl::OUString aNativeTempURL;
uno::Reference < beans::XPropertySet > xNativeTempFile(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference < io::XStream > xNativeTempStream( xNativeTempFile, uno::UNO_QUERY_THROW );
uno::Reference < io::XOutputStream > xNativeOutTemp = xNativeTempStream->getOutputStream();
diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx
index 45e863a..9e9ef8c 100644
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
@@ -64,51 +65,46 @@ uno::Reference< io::XInputStream > createTempXInStreamFromIStream(
if ( !pStream )
return xResult;
- const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
- uno::Reference < io::XOutputStream > xTempOut = uno::Reference < io::XOutputStream > (
- xFactory->createInstance ( aServiceName ),
- uno::UNO_QUERY );
- if ( xTempOut.is() )
- {
- ULARGE_INTEGER nNewPos;
- LARGE_INTEGER aZero = { 0L, 0L };
- HRESULT hr = pStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
- if ( FAILED( hr ) ) return xResult;
+ uno::Reference < io::XOutputStream > xTempOut( io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
+ ULARGE_INTEGER nNewPos;
+ LARGE_INTEGER aZero = { 0L, 0L };
+ HRESULT hr = pStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
+ if ( FAILED( hr ) ) return xResult;
- STATSTG aStat;
- hr = pStream->Stat( &aStat, STATFLAG_NONAME );
- if ( FAILED( hr ) ) return xResult;
+ STATSTG aStat;
+ hr = pStream->Stat( &aStat, STATFLAG_NONAME );
+ if ( FAILED( hr ) ) return xResult;
- sal_uInt32 nSize = (sal_uInt32)aStat.cbSize.QuadPart;
- sal_uInt32 nCopied = 0;
- uno::Sequence< sal_Int8 > aBuffer( nConstBufferSize );
- try
+ sal_uInt32 nSize = (sal_uInt32)aStat.cbSize.QuadPart;
+ sal_uInt32 nCopied = 0;
+ uno::Sequence< sal_Int8 > aBuffer( nConstBufferSize );
+ try
+ {
+ sal_uInt32 nRead = 0;
+ do
{
- sal_uInt32 nRead = 0;
- do
- {
- pStream->Read( (void*)aBuffer.getArray(), nConstBufferSize, &nRead );
+ pStream->Read( (void*)aBuffer.getArray(), nConstBufferSize, &nRead );
- if ( nRead < nConstBufferSize )
- aBuffer.realloc( nRead );
+ if ( nRead < nConstBufferSize )
+ aBuffer.realloc( nRead );
- xTempOut->writeBytes( aBuffer );
- nCopied += nRead;
- } while( nRead == nConstBufferSize );
+ xTempOut->writeBytes( aBuffer );
+ nCopied += nRead;
+ } while( nRead == nConstBufferSize );
- if ( nCopied == nSize )
+ if ( nCopied == nSize )
+ {
+ uno::Reference < io::XSeekable > xTempSeek ( xTempOut, uno::UNO_QUERY );
+ if ( xTempSeek.is() )
{
- uno::Reference < io::XSeekable > xTempSeek ( xTempOut, uno::UNO_QUERY );
- if ( xTempSeek.is() )
- {
- xTempSeek->seek ( 0 );
- xResult = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY );
- }
+ xTempSeek->seek ( 0 );
+ xResult = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY );
}
}
- catch( const uno::Exception& )
- {
- }
+ }
+ catch( const uno::Exception& )
+ {
}
return xResult;
@@ -620,63 +616,58 @@ STDMETHODIMP EmbedDocument_Impl::Save( IStorage *pStgSave, BOOL fSameAsLoad )
HRESULT hr = E_FAIL;
- const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
- uno::Reference < io::XOutputStream > xTempOut = uno::Reference < io::XOutputStream > (
- m_xFactory->createInstance ( aServiceName ),
- uno::UNO_QUERY );
+ uno::Reference < io::XOutputStream > xTempOut( io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
- if ( xTempOut.is() )
+ uno::Reference< frame::XStorable > xStorable( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
+ if( xStorable.is() )
{
- uno::Reference< frame::XStorable > xStorable( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
- if( xStorable.is() )
+ try
{
- try
+ xStorable->storeToURL( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "private:stream" ) ),
+ fillArgsForStoring_Impl( xTempOut ) );
+ hr = copyXTempOutToIStream( xTempOut, pTargetStream );
+ if ( SUCCEEDED( hr ) )
{
- xStorable->storeToURL( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "private:stream" ) ),
- fillArgsForStoring_Impl( xTempOut ) );
- hr = copyXTempOutToIStream( xTempOut, pTargetStream );
+ // no need to truncate the stream, the size of the stream is always the same
+ ULARGE_INTEGER nNewPos;
+ LARGE_INTEGER aZero = { 0L, 0L };
+ hr = pNewExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
if ( SUCCEEDED( hr ) )
{
- // no need to truncate the stream, the size of the stream is always the same
- ULARGE_INTEGER nNewPos;
- LARGE_INTEGER aZero = { 0L, 0L };
- hr = pNewExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
+ SIZEL aSize;
+ hr = m_pDocHolder->GetExtent( &aSize );
+
if ( SUCCEEDED( hr ) )
{
- SIZEL aSize;
- hr = m_pDocHolder->GetExtent( &aSize );
+ sal_uInt32 nWritten;
+ sal_Int8 aInf[EXT_STREAM_LENGTH];
+ *((sal_Int32*)aInf) = 0;
+ *((sal_Int32*)&aInf[4]) = 0;
+ *((sal_Int32*)&aInf[8]) = aSize.cx;
+ *((sal_Int32*)&aInf[12]) = aSize.cy;
+
+ hr = pNewExtStream->Write( (void*)aInf, EXT_STREAM_LENGTH, &nWritten );
+ if ( nWritten != EXT_STREAM_LENGTH ) hr = E_FAIL;
if ( SUCCEEDED( hr ) )
{
- sal_uInt32 nWritten;
- sal_Int8 aInf[EXT_STREAM_LENGTH];
- *((sal_Int32*)aInf) = 0;
- *((sal_Int32*)&aInf[4]) = 0;
- *((sal_Int32*)&aInf[8]) = aSize.cx;
- *((sal_Int32*)&aInf[12]) = aSize.cy;
-
- hr = pNewExtStream->Write( (void*)aInf, EXT_STREAM_LENGTH, &nWritten );
- if ( nWritten != EXT_STREAM_LENGTH ) hr = E_FAIL;
-
- if ( SUCCEEDED( hr ) )
+ m_pOwnStream = CComPtr< IStream >();
+ m_pExtStream = CComPtr< IStream >();
+ if ( fSameAsLoad || pStgSave == m_pMasterStorage )
{
- m_pOwnStream = CComPtr< IStream >();
- m_pExtStream = CComPtr< IStream >();
- if ( fSameAsLoad || pStgSave == m_pMasterStorage )
- {
- uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
- if ( xMod.is() )
- xMod->setModified( sal_False );
- m_bIsDirty = sal_False;
- }
+ uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
+ if ( xMod.is() )
+ xMod->setModified( sal_False );
+ m_bIsDirty = sal_False;
}
}
}
}
}
- catch( const uno::Exception& )
- {
- }
+ }
+ catch( const uno::Exception& )
+ {
}
}
diff --git a/filter/source/xsltfilter/OleHandler.cxx b/filter/source/xsltfilter/OleHandler.cxx
index e2226c0..715058c 100644
--- a/filter/source/xsltfilter/OleHandler.cxx
+++ b/filter/source/xsltfilter/OleHandler.cxx
@@ -48,11 +48,13 @@
#include <package/Inflater.hxx>
#include <package/Deflater.hxx>
+#include <comphelper/componentcontext.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/servicefactory.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
@@ -70,11 +72,8 @@ using namespace ::rtl;
namespace XSLT
{
Reference<XStream> SAL_CALL OleHandler::createTempFile() {
- Reference<XStream>
- tempFile(
- m_msf->createInstance(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ))),
+ Reference<XStream> tempFile(
+ TempFile::create(comphelper::ComponentContext(m_msf).getUNOContext()),
UNO_QUERY);
OSL_ASSERT(tempFile.is());
return tempFile;
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 464bf51..0e2a1cb 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -19,6 +19,7 @@
#include "oox/core/filterdetect.hxx"
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <comphelper/docpasswordhelper.hxx>
#include <comphelper/mediadescriptor.hxx>
@@ -574,8 +575,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
else
{
// create temporary file for unencrypted package
- Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW );
- Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( TempFile::create(mxContext), UNO_QUERY_THROW );
Reference< XOutputStream > xDecryptedPackage( xTempFile->getOutputStream(), UNO_SET_THROW );
BinaryXOutputStream aDecryptedPackage( xDecryptedPackage, true );
BinaryXInputStream aEncryptedPackage( xEncryptedPackage, true );
diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index 8c340b1..1b13420 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/io/XTempFile.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include "oox/drawingml/graphicshapecontext.hxx"
#include <osl/diagnose.h>
@@ -76,9 +76,9 @@ Reference< XFastContextHandler > GraphicShapeContext::createFastChildContext( sa
getEmbeddedWAVAudioFile( getRelations(), xAttribs, mpShapePtr->getGraphicProperties().maAudio );
if( !mpShapePtr->getGraphicProperties().maAudio.msEmbed.isEmpty() )
{
- Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+ Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
Reference< XInputStream > xInStrm( getFilter().openInputStream( mpShapePtr->getGraphicProperties().maAudio.msEmbed ), UNO_SET_THROW );
- Reference< XTempFile > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
+ Reference< XTempFile > xTempFile( TempFile::create(xContext) );
Reference< XOutputStream > xOutStrm( xTempFile->getOutputStream(), UNO_SET_THROW );
BinaryXOutputStream aOutStrm( xOutStrm, false );
BinaryXInputStream aInStrm( xInStrm, false );
diff --git a/oox/source/ole/olestorage.cxx b/oox/source/ole/olestorage.cxx
index fdd6c8d..3b71dda 100644
--- a/oox/source/ole/olestorage.cxx
+++ b/oox/source/ole/olestorage.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
@@ -95,8 +96,7 @@ OleOutputStream::OleOutputStream( const Reference< XComponentContext >& rxContex
{
try
{
- Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW );
- mxTempFile.set( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
+ mxTempFile.set( TempFile::create(rxContext), UNO_QUERY_THROW );
mxOutStrm = mxTempFile->getOutputStream();
mxSeekable.set( mxOutStrm, UNO_QUERY );
}
@@ -224,8 +224,7 @@ void OleStorage::initStorage( const Reference< XInputStream >& rxInStream )
Reference< XInputStream > xInStrm = rxInStream;
if( !Reference< XSeekable >( xInStrm, UNO_QUERY ).is() ) try
{
- Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW );
- Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( TempFile::create(mxContext), UNO_QUERY_THROW );
{
Reference< XOutputStream > xOutStrm( xTempFile->getOutputStream(), UNO_SET_THROW );
/* Pass false to both binary stream objects to keep the UNO
@@ -335,8 +334,7 @@ StorageRef OleStorage::implOpenSubStorage( const OUString& rElementName, bool bC
if( !isReadOnly() && (bCreateMissing || xSubStorage.get()) ) try
{
// create new storage based on a temp file
- Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW );
- Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( TempFile::create(mxContext), UNO_QUERY_THROW );
StorageRef xTempStorage( new OleStorage( *this, xTempFile, rElementName ) );
// copy existing substorage into temp storage
if( xSubStorage.get() )
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 25e6639..ce8b36e 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -236,11 +237,8 @@ const sal_Int32 n_ConstBufferSize = 32000;
::rtl::OUString aTempURL;
uno::Reference < beans::XPropertySet > xTempFile(
- xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile") ) ),
- uno::UNO_QUERY );
-
- if ( !xTempFile.is() )
- throw uno::RuntimeException(); // TODO
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
try {
xTempFile->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveFile") ), uno::makeAny( sal_False ) );
@@ -1513,7 +1511,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io:
uno::Reference < io::XStream > xTempFile;
if ( !xTargetStream.is() )
xTempFile = uno::Reference < io::XStream >(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile") ) ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY );
else
xTempFile = xTargetStream;
diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx
index 41f43f5..359a65a 100644
--- a/package/source/xstor/switchpersistencestream.cxx
+++ b/package/source/xstor/switchpersistencestream.cxx
@@ -19,6 +19,8 @@
#include <osl/diagnose.h>
+#include <com/sun/star/io/TempFile.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/storagehelper.hxx>
#include <switchpersistencestream.hxx>
@@ -174,7 +176,7 @@ void SwitchablePersistenceStream::CopyAndSwitchPersistenceTo( const uno::Referen
if ( !xTargetStream.is() )
{
xTargetStream = uno::Reference < io::XStream >(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile") ) ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
xTargetSeek = uno::Reference< io::XSeekable >( xTargetStream, uno::UNO_QUERY_THROW );
diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx
index 8012c82..3023346 100644
--- a/package/source/xstor/xfactory.cxx
+++ b/package/source/xstor/xfactory.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <comphelper/componentcontext.hxx>
@@ -84,11 +85,8 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstance()
{
// TODO: reimplement TempStream service to support XStream interface
uno::Reference < io::XStream > xTempStream(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile") ) ),
- uno::UNO_QUERY );
-
- if ( !xTempStream.is() )
- throw uno::RuntimeException(); // TODO:
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
return uno::Reference< uno::XInterface >(
static_cast< OWeakObject* >( new OStorage( xTempStream,
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index d8fade3..9900cbc 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/embed/UseBackupException.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/ucb/XProgressHandler.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
@@ -144,7 +145,7 @@ uno::Reference< io::XInputStream > GetSeekableTempCopy( uno::Reference< io::XInp
uno::Reference< lang::XMultiServiceFactory > xFactory )
{
uno::Reference < io::XOutputStream > xTempOut(
- xFactory->createInstance ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ),
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
uno::UNO_QUERY );
uno::Reference < io::XInputStream > xTempIn( xTempOut, uno::UNO_QUERY );
@@ -3800,8 +3801,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement(
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
uno::Reference < io::XOutputStream > xTempOut(
- m_pImpl->GetServiceFactory()->createInstance (
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ),
+ io::TempFile::create(comphelper::ComponentContext(m_pImpl->GetServiceFactory()).getUNOContext()),
uno::UNO_QUERY );
xTempIn = uno::Reference < io::XInputStream >( xTempOut, uno::UNO_QUERY );
uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY );
@@ -3913,8 +3913,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement(
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
uno::Reference < io::XOutputStream > xTempOut(
- m_pImpl->GetServiceFactory()->createInstance (
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ),
+ io::TempFile::create(comphelper::ComponentContext(m_pImpl->GetServiceFactory()).getUNOContext()),
uno::UNO_QUERY );
xTempIn = uno::Reference < io::XInputStream >( xTempOut, uno::UNO_QUERY );
uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY );
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index e6abbea..bc941a6 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/packages/zip/ZipConstants.hpp>
#include <com/sun/star/packages/manifest/XManifestReader.hpp>
#include <com/sun/star/packages/manifest/XManifestWriter.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
@@ -1177,7 +1178,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
if( bUseTemp )
{
// create temporary file
- uno::Reference < io::XStream > xTempFile( m_xFactory->createInstance ("com.sun.star.io.TempFile"), UNO_QUERY_THROW );
+ uno::Reference < io::XStream > xTempFile( io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()), UNO_QUERY_THROW );
xTempOut.set( xTempFile->getOutputStream(), UNO_SET_THROW );
xTempIn.set( xTempFile->getInputStream(), UNO_SET_THROW );
}
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index a8029ff..5c7feb7 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/packages/zip/ZipConstants.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
@@ -37,6 +38,7 @@
#include <osl/diagnose.h>
#include "wrapstreamforshare.hxx"
+#include <comphelper/componentcontext.hxx>
#include <comphelper/seekableinput.hxx>
#include <comphelper/storagehelper.hxx>
@@ -175,12 +177,10 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop
// create temporary stream
uno::Reference < io::XOutputStream > xTempOut(
- m_xFactory->createInstance("com.sun.star.io.TempFile"),
- uno::UNO_QUERY );
- uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY );
- uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY );
- if ( !xTempOut.is() || !xTempIn.is() || !xTempSeek.is() )
- throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
+ uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY_THROW );
+ uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY_THROW );
// copy the raw stream to the temporary file starting from the current position
::comphelper::OStorageHelper::CopyInputToOutput( GetOwnSeekStream(), xTempOut );
@@ -282,10 +282,8 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream(
{
// create temporary file
uno::Reference < io::XStream > xTempStream(
- m_xFactory->createInstance ("com.sun.star.io.TempFile"),
- uno::UNO_QUERY );
- if ( !xTempStream.is() )
- throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
// create a package based on it
ZipPackage* pPackage = new ZipPackage( m_xFactory );
@@ -341,12 +339,10 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream(
// create another temporary file
uno::Reference < io::XOutputStream > xTempOut(
- m_xFactory->createInstance ("com.sun.star.io.TempFile"),
- uno::UNO_QUERY );
- uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY );
- uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY );
- if ( !xTempOut.is() || !xTempIn.is() || !xTempSeek.is() )
- throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
+ uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY_THROW );
+ uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY_THROW );
// copy the raw stream to the temporary file
::comphelper::OStorageHelper::CopyInputToOutput( xInRaw, xTempOut );
diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index b0d4eb6..7af39bd 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -18,6 +18,7 @@
*/
#include "stringresource.hxx"
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XTextInputStream.hpp>
#include <com/sun/star/io/XTextOutputStream.hpp>
#include <com/sun/star/io/XActiveDataSink.hpp>
@@ -1301,10 +1302,8 @@ BinaryOutput::BinaryOutput( Reference< XMultiComponentFactory > xMCF,
: m_xMCF( xMCF )
, m_xContext( xContext )
{
- m_xTempFile = m_xMCF->createInstanceWithContext
- ( ::rtl::OUString("com.sun.star.io.TempFile"), m_xContext );
- if( m_xTempFile.is() )
- m_xOutputStream = Reference< io::XOutputStream >( m_xTempFile, UNO_QUERY );
+ m_xTempFile = io::TempFile::create( m_xContext );
+ m_xOutputStream = Reference< io::XOutputStream >( m_xTempFile, UNO_QUERY_THROW );
}
template< class T >
@@ -1529,19 +1528,15 @@ Reference< io::XInputStream > BinaryInput::getInputStreamForSection( sal_Int32 n
Reference< io::XInputStream > xIn;
if( m_nCurPos + nSize <= m_nSize )
{
- Reference< io::XOutputStream > xTempOut( m_xMCF->createInstanceWithContext
- ( ::rtl::OUString("com.sun.star.io.TempFile"), m_xContext ), UNO_QUERY );
- if( xTempOut.is() )
- {
- Sequence< sal_Int8 > aSection( m_pData + m_nCurPos, nSize );
- xTempOut->writeBytes( aSection );
+ Reference< io::XOutputStream > xTempOut( io::TempFile::create(m_xContext), UNO_QUERY_THROW );
+ Sequence< sal_Int8 > aSection( m_pData + m_nCurPos, nSize );
+ xTempOut->writeBytes( aSection );
- Reference< io::XSeekable> xSeekable( xTempOut, UNO_QUERY );
- if( xSeekable.is() )
- xSeekable->seek( 0 );
+ Reference< io::XSeekable> xSeekable( xTempOut, UNO_QUERY );
+ if( xSeekable.is() )
+ xSeekable->seek( 0 );
- xIn = Reference< io::XInputStream>( xTempOut, UNO_QUERY );
- }
+ xIn = Reference< io::XInputStream>( xTempOut, UNO_QUERY );
}
else
OSL_FAIL( "BinaryInput::getInputStreamForSection(): Read past end" );
diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx
index 95b35ff..bc40456 100644
--- a/sdext/source/minimizer/impoptimizer.cxx
+++ b/sdext/source/minimizer/impoptimizer.cxx
@@ -67,6 +67,7 @@
#include <com/sun/star/graphic/GraphicType.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
@@ -350,7 +351,7 @@ Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >&
}
if ( bNeedsOptimizing && aDestSizePixel.Width && aDestSizePixel.Height )
{
- Reference< XStream > xTempFile( rxMSF->getServiceManager()->createInstanceWithContext( OUString("com.sun.star.io.TempFile"), rxMSF ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( io::TempFile::create(rxMSF), UNO_QUERY_THROW );
Reference< XOutputStream > xOutputStream( xTempFile->getOutputStream() );
Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create( rxMSF ) );
@@ -370,7 +371,7 @@ Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >&
else // this is a metafile
{
rtl::OUString aDestMimeType( aSourceMimeType );
- Reference< XStream > xTempFile( rxMSF->getServiceManager()->createInstanceWithContext( OUString("com.sun.star.io.TempFile"), rxMSF ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( io::TempFile::create(rxMSF), UNO_QUERY_THROW );
Reference< XOutputStream > xOutputStream( xTempFile->getOutputStream() );
Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create( rxMSF ) );
ImpCompressGraphic( xGraphicProvider, xGraphic, xOutputStream, aDestMimeType, aLogicalSize, rGraphicSettings.mnJPEGQuality, rGraphicSettings.mnImageResolution, sal_False, aGraphicCropLogic );
diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx
index b09f1ab..c56b254 100644
--- a/sdext/source/minimizer/informationdialog.cxx
+++ b/sdext/source/minimizer/informationdialog.cxx
@@ -29,15 +29,16 @@
#include "informationdialog.hxx"
#include "optimizationstats.hxx"
-#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/graphic/GraphicProvider.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
-#include <rtl/ustrbuf.hxx>
-#include <sal/macros.h>
+#include <com/sun/star/io/TempFile.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include "com/sun/star/util/URL.hpp"
#include "com/sun/star/util/URLTransformer.hpp"
#include "com/sun/star/util/XURLTransformer.hpp"
+#include <rtl/ustrbuf.hxx>
+#include <sal/macros.h>
#define DIALOG_WIDTH 240
#define DIALOG_HEIGHT 80
@@ -215,7 +216,7 @@ OUString InformationDialog::ImpGetStandardImage( const OUString& sPrivateURL )
rtl::OUString sURL;
try
{
- mxTempFile = Reference< XStream >( mxMSF->getServiceManager()->createInstanceWithContext( OUString("com.sun.star.io.TempFile"), mxMSF ), UNO_QUERY_THROW );
+ mxTempFile = Reference< XStream >( io::TempFile::create(mxMSF), UNO_QUERY_THROW );
Reference< XPropertySet > xPropSet( mxTempFile, UNO_QUERY );
Reference< XOutputStream > xOutputStream( mxTempFile->getOutputStream() );
if ( xOutputStream.is() && xPropSet.is() )
diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx
index 8bfee3b..8cbcd36 100644
--- a/sdext/source/pdfimport/filterdet.cxx
+++ b/sdext/source/pdfimport/filterdet.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <boost/scoped_ptr.hpp>
@@ -214,9 +215,7 @@ FileEmitContext::FileEmitContext( const rtl::OUString&
m_xOut()
{
m_xContextStream = uno::Reference< io::XStream >(
- xContext->getServiceManager()->createInstanceWithContext(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ),
- xContext ), uno::UNO_QUERY_THROW );
+ io::TempFile::create(xContext), uno::UNO_QUERY_THROW );
m_xOut = m_xContextStream->getOutputStream();
m_xSeek = uno::Reference<io::XSeekable>(m_xOut, uno::UNO_QUERY_THROW );
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index d3680eb..0e8ca95 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
#include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/NameClash.hpp>
@@ -1409,7 +1410,7 @@ sal_Bool SfxDocTplService_Impl::WriteUINamesForTemplateDir_Impl( const ::rtl::OU
sal_Bool bResult = sal_False;
try {
uno::Reference< beans::XPropertySet > xTempFile(
- mxFactory->createInstance( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(mxFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
::rtl::OUString aTempURL;
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index bd845c4..a1a93ae 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -22,8 +22,10 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <comphelper/storagehelper.hxx>
+#include <comphelper/componentcontext.hxx>
#include <unotools/ucbstreamhelper.hxx>
@@ -256,7 +258,7 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
else
{
uno::Reference < io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference < io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xTempOut = xTempFile->getOutputStream();
@@ -441,7 +443,7 @@ uno::Any SAL_CALL OLESimpleStorage::getByName( const ::rtl::OUString& aName )
uno::Any aResult;
uno::Reference< io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY );
uno::Reference< io::XSeekable > xSeekable( xTempFile, uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xOutputStream = xTempFile->getOutputStream();
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index 2272e72..03ad05b 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -685,7 +686,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::cloneStreamElement( const ::rt
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xTempResult = uno::Reference < io::XStream >(
- m_pImpl->m_xFactory->createInstance ( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(m_pImpl->m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference < io::XOutputStream > xTempOut = xTempResult->getOutputStream();
uno::Reference < io::XInputStream > xTempIn = xTempResult->getInputStream();
diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx
index 3c77b26..17d9e7c 100644
--- a/svl/source/misc/documentlockfile.cxx
+++ b/svl/source/misc/documentlockfile.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
#include <com/sun/star/io/WrongFormatException.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <osl/time.h>
#include <osl/security.hxx>
@@ -36,6 +37,7 @@
#include <rtl/ustrbuf.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <unotools/bootstrap.hxx>
@@ -91,7 +93,7 @@ sal_Bool DocumentLockFile::CreateOwnLockFile()
try
{
uno::Reference< io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference< io::XSeekable > xSeekable( xTempFile, uno::UNO_QUERY_THROW );
diff --git a/ucb/Library_ucpgvfs1.mk b/ucb/Library_ucpgvfs1.mk
index 213c7fc..577b65d 100644
--- a/ucb/Library_ucpgvfs1.mk
+++ b/ucb/Library_ucpgvfs1.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_add_libs,ucpgvfs1,\
))
$(eval $(call gb_Library_use_libraries,ucpgvfs1,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/ucb/source/ucp/gvfs/gvfs_content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx
index fd51030..037a837 100644
--- a/ucb/source/ucp/gvfs/gvfs_content.cxx
+++ b/ucb/source/ucp/gvfs/gvfs_content.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/beans/PropertySetInfoChangeEvent.hpp>
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/lang/IllegalAccessException.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
@@ -68,6 +69,7 @@
#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
+#include <comphelper/componentcontext.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/propertyvalueset.hxx>
#include <ucbhelper/interactionrequest.hxx>
@@ -1444,12 +1446,11 @@ Content::createTempStream(
GnomeVFSHandle *handle = NULL;
::rtl::OString aURI = getOURI();
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
// Something badly wrong happened - can't seek => stream to a temporary file
- const rtl::OUString sServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
uno::Reference < io::XOutputStream > xTempOut =
uno::Reference < io::XOutputStream >
- ( m_xSMgr->createInstance( sServiceName ), uno::UNO_QUERY );
+ ( io::TempFile::create(comphelper::ComponentContext(m_xSMgr).getUNOContext()), uno::UNO_QUERY );
if ( !xTempOut.is() )
cancelCommandExecution( GNOME_VFS_ERROR_IO, xEnv );
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 103adee..037d16b 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
#include <com/sun/star/ucb/InteractiveIOException.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/ucb/DocumentHeaderField.hpp>
#include <com/sun/star/ucb/XCommandInfo.hpp>
#include <com/sun/star/ucb/XCommandProcessor.hpp>
@@ -1322,17 +1323,12 @@ sal_Bool UcbLockBytes::setInputStream_Impl( const Reference<XInputStream> &rxInp
m_xSeekable = Reference < XSeekable > ( rxInputStream, UNO_QUERY );
if( !m_xSeekable.is() && rxInputStream.is() )
{
- Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- Reference< XOutputStream > rxTempOut = Reference < XOutputStream > (
- xFactory->createInstance ( ::rtl::OUString("com.sun.star.io.TempFile") ),
- UNO_QUERY );
+ Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ Reference< XOutputStream > rxTempOut = Reference < XOutputStream > ( TempFile::create(xContext), UNO_QUERY_THROW );
- if( rxTempOut.is() )
- {
- ::comphelper::OStorageHelper::CopyInputToOutput( rxInputStream, rxTempOut );
- m_xInputStream = Reference< XInputStream >( rxTempOut, UNO_QUERY );
- m_xSeekable = Reference < XSeekable > ( rxTempOut, UNO_QUERY );
- }
+ ::comphelper::OStorageHelper::CopyInputToOutput( rxInputStream, rxTempOut );
+ m_xInputStream = Reference< XInputStream >( rxTempOut, UNO_QUERY );
+ m_xSeekable = Reference < XSeekable > ( rxTempOut, UNO_QUERY );
}
}
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index e7e4cb2..b98a590 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -773,10 +774,7 @@ SignatureStreamHelper DigitalSignaturesDialog::ImplOpenSignatureStream(
if (nStreamOpenMode & css::embed::ElementModes::TRUNCATE)
{
//We write always into a new temporary stream.
- mxTempSignatureStream = Reference < css::io::XStream >(
- mxCtx->getServiceManager()->createInstanceWithContext(
- OUSTR( "com.sun.star.io.TempFile" ), mxCtx) ,
- UNO_QUERY_THROW);
+ mxTempSignatureStream = Reference < css::io::XStream >(css::io::TempFile::create(mxCtx), UNO_QUERY_THROW);
aHelper.xSignatureStream = mxTempSignatureStream;
}
else
commit 7634d064adc2c773288cec751674ff691de20b2b
Author: Noel Grandin <noel at peralex.com>
Date: Tue Aug 21 10:30:08 2012 +0200
fdo#46808, Adapt UNO service registry::ImplementationRegistration
Change-Id: I77d28e7575e18e682f8360f6e416954dfb7a4e30
diff --git a/remotebridges/examples/officeclient.cxx b/remotebridges/examples/officeclient.cxx
index d99b783..c672dd8 100644
--- a/remotebridges/examples/officeclient.cxx
+++ b/remotebridges/examples/officeclient.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/uno/XNamingService.hpp>
-#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/registry/ImplementationRegistration.hpp>
#include <com/sun/star/connection/XConnector.hpp>
@@ -94,10 +94,7 @@ void OfficeClientMain::registerServices( )
// register services.
// Note : this needs to be done only once and is in general done by the setup
Reference < XImplementationRegistration > rImplementationRegistration(
-
- m_xSMgr->createInstance(
- OUString("com.sun.star.registry.ImplementationRegistration")),
- UNO_QUERY );
+ ImplementationRegistration::create(m_xSMgr) );
if( ! rImplementationRegistration.is() )
{
diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx
index 52f4417..3b144f5 100644
--- a/vcl/source/app/unohelp.cxx
+++ b/vcl/source/app/unohelp.cxx
@@ -41,13 +41,14 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/i18n/XCharacterClassification.hpp>
#include <com/sun/star/awt/XExtendedToolkit.hpp>
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/registry/ImplementationRegistration.hpp>
using namespace ::com::sun::star;
@@ -101,7 +102,7 @@ uno::Reference< lang::XMultiServiceFactory > vcl::unohelper::GetMultiServiceFact
{
pSVData->maAppData.mxMSF = ::cppu::createRegistryServiceFactory( aTempFileName, rtl::OUString(), sal_False );
uno::Reference < registry::XImplementationRegistration > xReg(
- pSVData->maAppData.mxMSF->createInstance( OUString("com.sun.star.registry.ImplementationRegistration")), uno::UNO_QUERY );
+ registry::ImplementationRegistration::create( comphelper::ComponentContext(pSVData->maAppData.mxMSF).getUNOContext() ) );
if( xReg.is() )
{
commit 8638f1e72a3fe830c0e8dcc1bd847d4fb9e599ee
Author: Noel Grandin <noel at peralex.com>
Date: Tue Aug 21 08:07:58 2012 +0200
fdo#46808, Adapt script::Converter service code to new style
Change-Id: I19b3ba7c978e02ce865360f0411007525012149c
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 6005c7a..5f44542 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -50,7 +50,7 @@
#include <com/sun/star/script/BasicErrorException.hpp>
#include <com/sun/star/script/XAllListener.hpp>
#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/script/XDefaultProperty.hpp>
#include <com/sun/star/script/XDefaultMethod.hpp>
#include <com/sun/star/script/XDirectInvocation.hpp>
@@ -263,11 +263,7 @@ Reference< XTypeConverter > getTypeConverter_Impl( void )
Reference< XComponentContext > xContext = getComponentContext_Impl();
if( xContext.is() )
{
- Reference<XMultiComponentFactory> xSMgr = xContext->getServiceManager();
- xTypeConverter = Reference<XTypeConverter>(
- xSMgr->createInstanceWithContext(
- ::rtl::OUString( "com.sun.star.script.Converter"),
- xContext ), UNO_QUERY );
+ xTypeConverter = Converter::create(xContext);
}
if( !xTypeConverter.is() )
{
diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 3ade1e7..644d2d9 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -34,7 +34,7 @@
#include <com/sun/star/reflection/XIdlClass.hpp>
#include <com/sun/star/reflection/XIdlReflection.hpp>
#include <com/sun/star/reflection/XIdlMethod.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/script/XEngineListener.hpp>
#include <com/sun/star/script/XEventAttacher2.hpp>
#include <com/sun/star/script/XEventAttacherManager.hpp>
@@ -43,6 +43,7 @@
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
+#include <comphelper/componentcontext.hxx>
#include <deque>
#include <algorithm>
@@ -381,11 +382,7 @@ ImplEventAttacherManager::ImplEventAttacherManager( const Reference< XIntrospect
{
xAttacher = Reference< XEventAttacher2 >::query( xIFace );
}
- xIFace = rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" )) );
- if ( xIFace.is() )
- {
- xConverter = Reference< XTypeConverter >::query( xIFace );
- }
+ xConverter = Converter::create(comphelper::ComponentContext(rSMgr).getUNOContext());
}
Reference< XInitialization > xInit( xAttacher, UNO_QUERY );
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 209ca09..1b63c7d 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -82,6 +82,7 @@
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
using rtl::OUStringBuffer;
@@ -97,6 +98,7 @@ using com::sun::star::lang::XComponent;
using com::sun::star::lang::XInitialization;
using com::sun::star::lang::IllegalArgumentException;
+using com::sun::star::script::Converter;
using com::sun::star::script::XTypeConverter;
using com::sun::star::uno::RuntimeException;
@@ -543,9 +545,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
OUString url;
Sequence< PropertyValue > args;
- Reference< XTypeConverter > tc( m_ctx->getServiceManager()->createInstanceWithContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" ) ), m_ctx ),
- UNO_QUERY);
+ Reference< XTypeConverter > tc( Converter::create(m_ctx) );
if( ! tc.is() )
{
throw RuntimeException(
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 5c09efc..854c7f1 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/i18n/XLocaleData.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/sdb/BooleanComparisonMode.hpp>
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
#include <com/sun/star/sdb/XQueriesSupplier.hpp>
@@ -1594,7 +1595,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
if ( aValue.hasValue() )
{
if( !m_xTypeConverter.is() )
- m_aContext.createComponent( "com.sun.star.script.Converter", m_xTypeConverter );
+ m_xTypeConverter.set( Converter::create(m_aContext.getUNOContext()) );
OSL_ENSURE(m_xTypeConverter.is(),"NO typeconverter!");
if ( nType != DataType::BOOLEAN && DataType::BIT != nType )
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index dbf3943..0cd31ad 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/table/ShadowLocation.hpp>
#include <com/sun/star/table/TableBorder.hpp>
@@ -2013,8 +2013,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
// serialization for basic macro recording
uno::Reference < script::XTypeConverter > xConverter
- ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.script.Converter")),
- uno::UNO_QUERY );
+ ( script::Converter::create(::comphelper::getProcessComponentContext()) );
uno::Sequence < uno::Any > aSeq;
uno::Any aNew;
try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); }
@@ -2817,9 +2816,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE )
{
// serialization for basic macro recording
- uno::Reference < script::XTypeConverter > xConverter
- ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.script.Converter")),
- uno::UNO_QUERY );
+ uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(::comphelper::getProcessComponentContext()) );
uno::Any aNew;
uno::Sequence < uno::Any > aSeq;
try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); }
diff --git a/eventattacher/Library_evtatt.mk b/eventattacher/Library_evtatt.mk
index bab9243..02363a0 100644
--- a/eventattacher/Library_evtatt.mk
+++ b/eventattacher/Library_evtatt.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_Library_Library,evtatt))
$(eval $(call gb_Library_set_componentfile,evtatt,eventattacher/source/evtatt))
$(eval $(call gb_Library_use_libraries,evtatt,\
+ comphelper \
cppuhelper \
cppu \
sal \
diff --git a/eventattacher/prj/build.lst b/eventattacher/prj/build.lst
index 6e5faf8..1f634bf 100644
--- a/eventattacher/prj/build.lst
+++ b/eventattacher/prj/build.lst
@@ -1,2 +1,2 @@
-ea eventattacher : offapi cppuhelper LIBXSLT:libxslt NULL
+ea eventattacher : offapi comphelper cppuhelper LIBXSLT:libxslt NULL
ea eventattacher\prj nmake - all ea_prj NULL
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 2224d33..522940e 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -25,13 +25,14 @@
#include <com/sun/star/beans/XIntrospection.hpp>
#include <com/sun/star/beans/MethodConcept.hpp>
#include <com/sun/star/script/XEventAttacher2.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/script/XAllListener.hpp>
#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
#include <com/sun/star/reflection/XIdlReflection.hpp>
// InvocationToAllListenerMapper
#include <com/sun/star/script/XInvocation.hpp>
+#include <comphelper/componentcontext.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -433,8 +434,7 @@ Reference< XTypeConverter > EventAttacherImpl::getConverter() throw( Exception )
Guard< Mutex > aGuard( m_aMutex );
if( !m_xConverter.is() )
{
- Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString("com.sun.star.script.Converter") ) );
- m_xConverter = Reference< XTypeConverter >( xIFace, UNO_QUERY );
+ m_xConverter = Converter::create(comphelper::ComponentContext(m_xSMgr).getUNOContext());
}
return m_xConverter;
}
diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx
index 6d630de..4d19034 100644
--- a/extensions/source/propctrlr/genericpropertyhandler.cxx
+++ b/extensions/source/propctrlr/genericpropertyhandler.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/inspection/PropertyControlType.hpp>
#include <com/sun/star/inspection/XHyperlinkControl.hpp>
#include <com/sun/star/awt/XActionListener.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
@@ -316,10 +317,7 @@ namespace pcr
{
DBG_CTOR( GenericPropertyHandler, NULL );
- m_xTypeConverter = Reference< XTypeConverter >(
- m_aContext.createComponent( "com.sun.star.script.Converter" ),
- UNO_QUERY_THROW
- );
+ m_xTypeConverter = Converter::create(_rxContext);
}
//--------------------------------------------------------------------
diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx
index b41c0fc..d19ebf3 100644
--- a/extensions/source/propctrlr/propertyhandler.cxx
+++ b/extensions/source/propctrlr/propertyhandler.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/NullPointerException.hpp>
#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <tools/debug.hxx>
#include <unotools/confignode.hxx>
@@ -73,10 +74,7 @@ namespace pcr
{
DBG_CTOR( PropertyHandler, NULL );
- m_xTypeConverter = Reference< XTypeConverter >(
- m_aContext.createComponent( "com.sun.star.script.Converter" ),
- UNO_QUERY_THROW
- );
+ m_xTypeConverter = Converter::create(_rxContext);
}
//--------------------------------------------------------------------
diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx
index b061da5..525db61 100644
--- a/framework/source/recording/dispatchrecorder.cxx
+++ b/framework/source/recording/dispatchrecorder.cxx
@@ -29,10 +29,12 @@
#include <recording/dispatchrecorder.hxx>
#include <com/sun/star/frame/DispatchStatement.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <threadhelp/writeguard.hxx>
#include <threadhelp/readguard.hxx>
#include <services.h>
#include <vcl/svapp.hxx>
+#include <comphelper/componentcontext.hxx>
using namespace ::com::sun::star::uno;
@@ -130,7 +132,7 @@ DispatchRecorder::DispatchRecorder( const css::uno::Reference< css::lang::XMulti
: ThreadHelpBase ( &Application::GetSolarMutex() )
, ::cppu::OWeakObject( )
, m_xSMGR ( xSMGR )
- , m_xConverter( m_xSMGR->createInstance(::rtl::OUString("com.sun.star.script.Converter")), css::uno::UNO_QUERY )
+ , m_xConverter( css::script::Converter::create(comphelper::ComponentContext(m_xSMGR).getUNOContext()) )
{
}
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index b021fdd..3196be6 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -30,6 +30,7 @@
#include <typelib/typedescription.hxx>
#include <com/sun/star/beans/XMaterialHolder.hpp>
+#include <com/sun/star/script/Converter.hpp>
using rtl::OUString;
using rtl::OUStringToOString;
@@ -50,6 +51,7 @@ using com::sun::star::uno::XComponentContext;
using com::sun::star::lang::XSingleServiceFactory;
using com::sun::star::lang::XUnoTunnel;
using com::sun::star::reflection::XIdlReflection;
+using com::sun::star::script::Converter;
using com::sun::star::script::XTypeConverter;
using com::sun::star::script::XInvocationAdapterFactory2;
using com::sun::star::script::XInvocation;
@@ -256,11 +258,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
OUString( "pyuno: couldn't instantiate invocation service" ),
Reference< XInterface > () );
- c->xTypeConverter = Reference< XTypeConverter > (
- ctx->getServiceManager()->createInstanceWithContext(
- OUString( "com.sun.star.script.Converter" ),
- ctx ),
- UNO_QUERY );
+ c->xTypeConverter = Converter::create(ctx);
if( ! c->xTypeConverter.is() )
throw RuntimeException(
OUString( "pyuno: couldn't instantiate typeconverter service" ),
diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
index 8866591..f044ace 100644
--- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx
+++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
@@ -48,6 +48,7 @@
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/report/XReportDefinition.hpp>
#include <com/sun/star/report/XSection.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/inspection/XNumericControl.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/util/MeasureUnit.hpp>
@@ -73,7 +74,7 @@ DataProviderHandler::DataProviderHandler(uno::Reference< uno::XComponentContext
try
{
m_xFormComponentHandler.set(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.FormComponentPropertyHandler")),m_xContext),uno::UNO_QUERY_THROW);
- m_xTypeConverter.set(m_xContext->getServiceManager()->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter" )),m_xContext),uno::UNO_QUERY_THROW);
+ m_xTypeConverter.set(script::Converter::create(m_xContext));
}catch(const uno::Exception &)
{
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 2f8dc63..796ebd8 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -53,6 +53,7 @@
#include <com/sun/star/report/XSection.hpp>
#include <com/sun/star/report/XFormattedField.hpp>
#include <com/sun/star/report/XFixedLine.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
@@ -256,7 +257,7 @@ GeometryHandler::GeometryHandler(uno::Reference< uno::XComponentContext > const
{
const uno::Reference< lang::XMultiComponentFactory > xFac = m_xContext->getServiceManager();
m_xFormComponentHandler.set(xFac->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.FormComponentPropertyHandler")),m_xContext),uno::UNO_QUERY_THROW);
- m_xTypeConverter.set(xFac->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter" )),m_xContext),uno::UNO_QUERY_THROW);
+ m_xTypeConverter.set(script::Converter::create(context));
loadDefaultFunctions();
}
catch(const uno::Exception&)
diff --git a/sc/source/ui/vba/vbahelper.cxx b/sc/source/ui/vba/vbahelper.cxx
index b5fda85..a2a2217 100644
--- a/sc/source/ui/vba/vbahelper.cxx
+++ b/sc/source/ui/vba/vbahelper.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -90,7 +91,7 @@ getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
uno::Reference< script::XTypeConverter >
getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
{
- static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( "com.sun.star.script.Converter" ), xContext ), uno::UNO_QUERY_THROW );
+ static uno::Reference< script::XTypeConverter > xTypeConv( script::Converter::create(xContext) );
return xTypeConv;
}
// helper method to determine if the view ( calc ) is in print-preview mode
diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx
index 44b1a33..46131aa 100644
--- a/sfx2/source/bastyp/frmhtmlw.cxx
+++ b/sfx2/source/bastyp/frmhtmlw.cxx
@@ -39,7 +39,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <rtl/bootstrap.hxx>
@@ -214,10 +214,8 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_keywords, Keywords, sal_False,
eDestEnc, pNonConvertableChars);
- uno::Reference < script::XTypeConverter > xConverter(
- ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString("com.sun.star.script.Converter")),
- uno::UNO_QUERY_THROW );
+ uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(
+ ::comphelper::getProcessComponentContext() ) );
uno::Reference<beans::XPropertySet> xUserDefinedProps(
i_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
DBG_ASSERT(xUserDefinedProps.is(), "UserDefinedProperties is null");
diff --git a/svl/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx
index 2e89bca..333a97c 100644
--- a/svl/source/items/globalnameitem.cxx
+++ b/svl/source/items/globalnameitem.cxx
@@ -19,7 +19,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -73,8 +73,7 @@ SfxPoolItem* SfxGlobalNameItem::Clone(SfxItemPool *) const
bool SfxGlobalNameItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
{
com::sun::star::uno::Reference < com::sun::star::script::XTypeConverter > xConverter
- ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.script.Converter")),
- com::sun::star::uno::UNO_QUERY );
+ ( com::sun::star::script::Converter::create( ::comphelper::getProcessComponentContext() ));
com::sun::star::uno::Sequence< sal_Int8 > aSeq;
com::sun::star::uno::Any aNew;
diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx
index 1539847..e9b94fd 100644
--- a/svl/source/items/ilstitem.cxx
+++ b/svl/source/items/ilstitem.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
@@ -73,8 +73,7 @@ SfxPoolItem* SfxIntegerListItem::Clone( SfxItemPool * ) const
bool SfxIntegerListItem::PutValue ( const com::sun::star::uno::Any& rVal, sal_uInt8 )
{
::com::sun::star::uno::Reference < ::com::sun::star::script::XTypeConverter > xConverter
- ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.script.Converter")),
- ::com::sun::star::uno::UNO_QUERY );
+ ( ::com::sun::star::script::Converter::create(::comphelper::getProcessComponentContext()) );
::com::sun::star::uno::Any aNew;
try { aNew = xConverter->convertTo( rVal, ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int32 >*)0) ); }
catch (::com::sun::star::uno::Exception&)
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index b634a72..de0ca82 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -31,7 +31,7 @@
#include <hintids.hxx>
#include <com/sun/star/text/XText.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/text/SetVariableType.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/text/UserDataPart.hpp>
@@ -954,8 +954,7 @@ String SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat,
uno::UNO_QUERY_THROW);
aAny = xSet->getPropertyValue( rName );
- uno::Reference < script::XTypeConverter > xConverter( comphelper::getProcessServiceFactory()
- ->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY );
+ uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(comphelper::getProcessComponentContext()) );
uno::Any aNew;
aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
aNew >>= sVal;
@@ -1105,8 +1104,7 @@ String SwDocInfoField::Expand() const
{
// if the field is "fixed" we don't update it from the property
::rtl::OUString sVal;
- uno::Reference < script::XTypeConverter > xConverter( comphelper::getProcessServiceFactory()
- ->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY );
+ uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(comphelper::getProcessComponentContext()) );
util::Date aDate;
util::DateTime aDateTime;
util::Duration aDuration;
diff --git a/ucb/Library_cached1.mk b/ucb/Library_cached1.mk
index e548fa7..85b1fc2 100644
--- a/ucb/Library_cached1.mk
+++ b/ucb/Library_cached1.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_Library_set_componentfile,cached1,ucb/source/cacher/cached1))
$(eval $(call gb_Library_use_sdk_api,cached1))
$(eval $(call gb_Library_use_libraries,cached1,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/ucb/Library_ucpfile1.mk b/ucb/Library_ucpfile1.mk
index d0b301e..ed68c89 100644
--- a/ucb/Library_ucpfile1.mk
+++ b/ucb/Library_ucpfile1.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_Library_set_componentfile,ucpfile1,ucb/source/ucp/file/ucpfile1
$(eval $(call gb_Library_use_sdk_api,ucpfile1))
$(eval $(call gb_Library_use_libraries,ucpfile1,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx
index e08b657..d1cc704 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -32,10 +32,11 @@
#include <com/sun/star/ucb/FetchError.hpp>
#include <com/sun/star/ucb/ResultSetException.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <rtl/ustring.hxx>
#include <osl/diagnose.h>
+#include <comphelper/componentcontext.hxx>
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
@@ -2148,10 +2149,7 @@ const Reference< XTypeConverter >& CachedContentResultSet::getTypeConverter()
if ( !m_bTriedToGetTypeConverter && !m_xTypeConverter.is() )
{
m_bTriedToGetTypeConverter = sal_True;
- m_xTypeConverter = Reference< XTypeConverter >(
- m_xSMgr->createInstance(
- OUString( "com.sun.star.script.Converter" ) ),
- UNO_QUERY );
+ m_xTypeConverter = Reference< XTypeConverter >( Converter::create(comphelper::ComponentContext(m_xSMgr).getUNOContext()) );
OSL_ENSURE( m_xTypeConverter.is(),
"PropertyValueSet::getTypeConverter() - "
diff --git a/ucb/source/ucp/file/filrow.cxx b/ucb/source/ucp/file/filrow.cxx
index 0c78507..90fe7c9 100644
--- a/ucb/source/ucp/file/filrow.cxx
+++ b/ucb/source/ucp/file/filrow.cxx
@@ -29,6 +29,8 @@
#include "filrow.hxx"
#include "shell.hxx"
#include "prov.hxx"
+#include <com/sun/star/script/Converter.hpp>
+#include <comphelper/componentcontext.hxx>
using namespace fileaccess;
using namespace com::sun::star;
@@ -51,8 +53,7 @@ sal_Bool convert( shell* pShell,
if( ! xConverter.is() )
{
xConverter = uno::Reference< script::XTypeConverter >(
- pShell->m_xMultiServiceFactory->createInstance(
- rtl::OUString("com.sun.star.script.Converter") ), uno::UNO_QUERY );
+ script::Converter::create(comphelper::ComponentContext(pShell->m_xMultiServiceFactory).getUNOContext()) );
}
try
diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx
index e08122b..11308d3 100644
--- a/ucbhelper/source/provider/propertyvalueset.cxx
+++ b/ucbhelper/source/provider/propertyvalueset.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include "osl/diagnose.h"
#include "osl/mutex.hxx"
@@ -628,11 +628,9 @@ const Reference< XTypeConverter >& PropertyValueSet::getTypeConverter()
if ( !m_bTriedToGetTypeConverter && !m_xTypeConverter.is() )
{
m_bTriedToGetTypeConverter = sal_True;
- m_xTypeConverter = Reference< XTypeConverter >(
- m_xSMgr->createInstance(
- OUString(
- "com.sun.star.script.Converter" ) ),
- UNO_QUERY );
+ Reference< XPropertySet > xFactoryProperties( m_xSMgr, UNO_QUERY_THROW );
+ Reference< XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY_THROW );
+ m_xTypeConverter = Converter::create(xContext);
OSL_ENSURE( m_xTypeConverter.is(),
"PropertyValueSet::getTypeConverter() - "
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index ff9681d..748a4c0 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <com/sun/star/script/XDefaultProperty.hpp>
+#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -118,7 +119,7 @@ getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
uno::Reference< script::XTypeConverter >
getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
{
- static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( "com.sun.star.script.Converter" ), xContext ), uno::UNO_QUERY_THROW );
+ static uno::Reference< script::XTypeConverter > xTypeConv( script::Converter::create(xContext) );
return xTypeConv;
}
const uno::Any&
commit 4381f3dd5ae9e042840a16f69d07267208160420
Author: Noel Grandin <noel at peralex.com>
Date: Tue Aug 21 07:55:03 2012 +0200
fdo#46808, Use BreakIterator ::create method
Change-Id: Iff603ebe772cfcd34ed3669ce46bc9112ba902ae
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 8322f90..bf42a4e 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -141,6 +141,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/inspection
ObjectInspectorModel \
StringRepresentation \
))
+$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/i18n,\
+ BreakIterator \
+))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/linguistic2,\
LanguageGuessing \
Proofreader \
@@ -822,7 +825,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/graphic
MediaProperties \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/i18n,\
- BreakIterator \
ChapterCollator \
CharacterClassification \
Collator \
diff --git a/svx/inc/svx/SmartTagMgr.hxx b/svx/inc/svx/SmartTagMgr.hxx
index c7a33f1..ce60a1a 100644
--- a/svx/inc/svx/SmartTagMgr.hxx
+++ b/svx/inc/svx/SmartTagMgr.hxx
@@ -52,7 +52,6 @@ namespace com { namespace sun { namespace star { namespace lang {
struct Locale;
struct EventObject;
struct ChangesEvent;
- class XMultiServiceFactory;
} } } }
namespace com { namespace sun { namespace star { namespace beans {
@@ -92,7 +91,6 @@ private:
std::set< rtl::OUString > maDisabledSmartTagTypes;
std::multimap < rtl::OUString, ActionReference > maSmartTagMap;
mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > mxBreakIter;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext> mxContext;
com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > mxConfigurationSettings;
bool mbLabelTextWithSmartTags;
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx
index 5235594..6fcbcb8 100644
--- a/svx/source/smarttags/SmartTagMgr.cxx
+++ b/svx/source/smarttags/SmartTagMgr.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/deployment/ExtensionManager.hpp>
#include <com/sun/star/text/XTextMarkup.hpp>
#include <com/sun/star/smarttags/SmartTagRecognizerMode.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/BreakIterator.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/EventObject.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -45,6 +45,7 @@
using namespace com::sun::star;
using namespace com::sun::star::uno;
+using namespace com::sun::star::i18n;
#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
@@ -55,7 +56,7 @@ SmartTagMgr::SmartTagMgr( const rtl::OUString& rApplicationName )
maActionList(),
maDisabledSmartTagTypes(),
maSmartTagMap(),
- mxMSF( ::comphelper::getProcessServiceFactory() ),
+ mxContext( ::comphelper::getProcessComponentContext() ),
mbLabelTextWithSmartTags(true)
{
}
@@ -67,27 +68,20 @@ SmartTagMgr::~SmartTagMgr()
void SmartTagMgr::Init( const rtl::OUString& rConfigurationGroupName )
{
// get component context to pass to components:
- if ( mxMSF.is() )
+ if ( mxContext.is() )
{
- Reference< beans::XPropertySet > xPropSet = Reference< beans::XPropertySet>( mxMSF, UNO_QUERY);
- const Any aAny = xPropSet->getPropertyValue( C2U("DefaultContext"));
- aAny >>= mxContext;
-
- if ( mxContext.is() )
- {
- PrepareConfiguration( rConfigurationGroupName );
- ReadConfiguration( true, true );
- RegisterListener();
- LoadLibraries();
- }
+ PrepareConfiguration( rConfigurationGroupName );
+ ReadConfiguration( true, true );
+ RegisterListener();
+ LoadLibraries();
}
}
void SmartTagMgr::CreateBreakIterator() const
{
- if ( !mxBreakIter.is() && mxMSF.is() && mxContext.is() )
+ if ( !mxBreakIter.is() && mxContext.is() )
{
// get the break iterator
- mxBreakIter.set(mxMSF->createInstance( C2U( "com.sun.star.i18n.BreakIterator" ) ), UNO_QUERY);
+ mxBreakIter.set( BreakIterator::create(mxContext) );
}
}
@@ -316,7 +310,7 @@ void SmartTagMgr::changesOccurred( const util::ChangesEvent& rEvent ) throw( Run
*/
void SmartTagMgr::LoadLibraries()
{
- Reference< container::XContentEnumerationAccess > rContent( mxMSF , UNO_QUERY );
+ Reference< container::XContentEnumerationAccess > rContent( mxContext , UNO_QUERY );
if ( !rContent.is() )
return;
@@ -388,7 +382,7 @@ void SmartTagMgr::PrepareConfiguration( const rtl::OUString& rConfigurationGroup
aPathArgument.Value = aAny;
Sequence< Any > aArguments( 1 );
aArguments[ 0 ] <<= aPathArgument;
- Reference< lang::XMultiServiceFactory > xConfProv( mxMSF->createInstance(C2U ("com.sun.star.configuration.ConfigurationProvider")), UNO_QUERY );
+ Reference< lang::XMultiServiceFactory > xConfProv( mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", mxContext), UNO_QUERY );
if ( !xConfProv.is() )
return;
commit 170cfbc62549e4a74077c4ec403baf35ec4d42f6
Author: Noel Grandin <noel at peralex.com>
Date: Thu Aug 23 15:49:36 2012 +0200
fdo#46808, Adapt document::DocumentProperties UNO service to new style
Change-Id: I19015d3e3e9aa6e4b3b4bb011183c73ab00365ca
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 5d20b52..01f2776 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -57,6 +57,7 @@
#include <com/sun/star/drawing/Hatch.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/document/DocumentProperties.hpp>
// header for class SvNumberFormatter
#include <svl/zforlist.hxx>
@@ -695,10 +696,7 @@ uno::Reference< document::XDocumentProperties > SAL_CALL
::osl::MutexGuard aGuard( m_aModelMutex );
if ( !m_xDocumentProperties.is() )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list