summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/dlged/dlgedclip.cxx21
-rw-r--r--dtrans/Library_dnd.mk1
-rw-r--r--dtrans/Library_ftransl.mk1
-rw-r--r--dtrans/Library_sysdtrans.mk1
-rw-r--r--dtrans/source/win32/dtobj/DOTransferable.cxx6
-rw-r--r--dtrans/source/win32/dtobj/FetcList.cxx23
-rw-r--r--dtrans/source/win32/dtobj/FetcList.hxx6
-rw-r--r--dtrans/source/win32/dtobj/XTDataObject.cxx3
-rw-r--r--dtrans/source/win32/ftransl/ftransl.cxx12
-rw-r--r--dtrans/source/win32/ftransl/ftransl.hxx5
-rw-r--r--dtrans/source/win32/ftransl/ftranslentry.cxx3
-rw-r--r--svtools/source/misc/transfer.cxx171
-rw-r--r--vcl/aqua/source/dtrans/DataFlavorMapping.cxx10
-rw-r--r--vcl/aqua/source/dtrans/aqua_clipboard.cxx14
-rw-r--r--vcl/ios/source/dtrans/ios_clipboard.cxx13
15 files changed, 126 insertions, 164 deletions
diff --git a/basctl/source/dlged/dlgedclip.cxx b/basctl/source/dlged/dlgedclip.cxx
index 54cd68b9e00b..68fbf4fb3896 100644
--- a/basctl/source/dlged/dlgedclip.cxx
+++ b/basctl/source/dlged/dlgedclip.cxx
@@ -22,7 +22,7 @@
#include <vcl/svapp.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/datatransfer/XMimeContentType.hpp>
-#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
+#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
namespace basctl
{
@@ -56,21 +56,18 @@ sal_Bool DlgEdTransferableImpl::compareDataFlavors( const DataFlavor& lFlavor, c
bool bRet = false;
// compare mime content types
- Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory();
+ Reference< uno::XComponentContext > xContext = getProcessComponentContext();
Reference< datatransfer::XMimeContentTypeFactory >
- xMCntTypeFactory( xMSF->createInstance( "com.sun.star.datatransfer.MimeContentTypeFactory" ), UNO_QUERY );
+ xMCntTypeFactory = MimeContentTypeFactory::create(xContext);;
- if ( xMCntTypeFactory.is( ) )
- {
- // compare full media types
- Reference< datatransfer::XMimeContentType > xLType = xMCntTypeFactory->createMimeContentType( lFlavor.MimeType );
- Reference< datatransfer::XMimeContentType > xRType = xMCntTypeFactory->createMimeContentType( rFlavor.MimeType );
+ // compare full media types
+ Reference< datatransfer::XMimeContentType > xLType = xMCntTypeFactory->createMimeContentType( lFlavor.MimeType );
+ Reference< datatransfer::XMimeContentType > xRType = xMCntTypeFactory->createMimeContentType( rFlavor.MimeType );
- OUString aLFullMediaType = xLType->getFullMediaType();
- OUString aRFullMediaType = xRType->getFullMediaType();
+ OUString aLFullMediaType = xLType->getFullMediaType();
+ OUString aRFullMediaType = xRType->getFullMediaType();
- bRet = aLFullMediaType.equalsIgnoreAsciiCase( aRFullMediaType );
- }
+ bRet = aLFullMediaType.equalsIgnoreAsciiCase( aRFullMediaType );
return bRet;
}
diff --git a/dtrans/Library_dnd.mk b/dtrans/Library_dnd.mk
index 6314a648a1a2..05ed37e555b6 100644
--- a/dtrans/Library_dnd.mk
+++ b/dtrans/Library_dnd.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_Library_set_componentfile,dnd,dtrans/util/dnd))
$(eval $(call gb_Library_use_sdk_api,dnd))
$(eval $(call gb_Library_use_libraries,dnd,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/dtrans/Library_ftransl.mk b/dtrans/Library_ftransl.mk
index fcad409984ba..8e062bfd400d 100644
--- a/dtrans/Library_ftransl.mk
+++ b/dtrans/Library_ftransl.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_Library_set_componentfile,ftransl,dtrans/util/ftransl))
$(eval $(call gb_Library_use_sdk_api,ftransl))
$(eval $(call gb_Library_use_libraries,ftransl,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/dtrans/Library_sysdtrans.mk b/dtrans/Library_sysdtrans.mk
index 9ab23961cf7e..8d456ae6eb84 100644
--- a/dtrans/Library_sysdtrans.mk
+++ b/dtrans/Library_sysdtrans.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_Library_add_defs,sysdtrans,\
))
$(eval $(call gb_Library_use_libraries,sysdtrans,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/dtrans/source/win32/dtobj/DOTransferable.cxx b/dtrans/source/win32/dtobj/DOTransferable.cxx
index 15f8fb9d9d79..b2bbb0323228 100644
--- a/dtrans/source/win32/dtobj/DOTransferable.cxx
+++ b/dtrans/source/win32/dtobj/DOTransferable.cxx
@@ -29,6 +29,8 @@
#include "MimeAttrib.hxx"
#include "FmtFilter.hxx"
#include "Fetc.hxx"
+#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
+#include <comphelper/processfactory.hxx>
#define STR2(x) #x
#define STR(x) STR2(x)
@@ -491,10 +493,8 @@ sal_Bool SAL_CALL CDOTransferable::compareDataFlavors(
{
if ( !m_rXMimeCntFactory.is( ) )
{
- m_rXMimeCntFactory = Reference< XMimeContentTypeFactory >( m_SrvMgr->createInstance(
- OUString("com.sun.star.datatransfer.MimeContentTypeFactory") ), UNO_QUERY );
+ m_rXMimeCntFactory = MimeContentTypeFactory::create( comphelper::getComponentContext(m_SrvMgr) );
}
- OSL_ASSERT( m_rXMimeCntFactory.is( ) );
sal_Bool bRet = sal_False;
diff --git a/dtrans/source/win32/dtobj/FetcList.cxx b/dtrans/source/win32/dtobj/FetcList.cxx
index 7031dacda8ea..00bc9d32a235 100644
--- a/dtrans/source/win32/dtobj/FetcList.cxx
+++ b/dtrans/source/win32/dtobj/FetcList.cxx
@@ -20,7 +20,7 @@
#include <osl/diagnose.h>
#include "FetcList.hxx"
#include "Fetc.hxx"
-#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
+#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
#include <com/sun/star/datatransfer/XMimeContentType.hpp>
#include "DataFmtTransl.hxx"
@@ -165,11 +165,11 @@ sal_Bool SAL_CALL CFormatEtcContainer::skipFormatEtc( sal_uInt32 aNum )
//
//------------------------------------------------------------------------
-CFormatRegistrar::CFormatRegistrar( const Reference< XMultiServiceFactory >& ServiceManager,
+CFormatRegistrar::CFormatRegistrar( const Reference< XComponentContext >& rxContext,
const CDataFormatTranslator& aDataFormatTranslator ) :
m_DataFormatTranslator( aDataFormatTranslator ),
m_bHasSynthesizedLocale( sal_False ),
- m_SrvMgr( ServiceManager )
+ m_xContext( rxContext )
{
}
@@ -346,17 +346,14 @@ OUString SAL_CALL CFormatRegistrar::getCharsetFromDataFlavor( const DataFlavor&
try
{
- Reference< XMimeContentTypeFactory > xMimeFac(
- m_SrvMgr->createInstance( OUString( "com.sun.star.datatransfer.MimeContentTypeFactory" ) ), UNO_QUERY );
+ Reference< XMimeContentTypeFactory > xMimeFac =
+ MimeContentTypeFactory::create(m_xContext);
- if( xMimeFac.is( ) )
- {
- Reference< XMimeContentType > xMimeType( xMimeFac->createMimeContentType( aFlavor.MimeType ) );
- if ( xMimeType->hasParameter( TEXTPLAIN_PARAM_CHARSET ) )
- charset = xMimeType->getParameterValue( TEXTPLAIN_PARAM_CHARSET );
- else
- charset = getMimeCharsetFromWinCP( GetACP( ), PRE_WINDOWS_CODEPAGE );
- }
+ Reference< XMimeContentType > xMimeType( xMimeFac->createMimeContentType( aFlavor.MimeType ) );
+ if ( xMimeType->hasParameter( TEXTPLAIN_PARAM_CHARSET ) )
+ charset = xMimeType->getParameterValue( TEXTPLAIN_PARAM_CHARSET );
+ else
+ charset = getMimeCharsetFromWinCP( GetACP( ), PRE_WINDOWS_CODEPAGE );
}
catch(NoSuchElementException&)
{
diff --git a/dtrans/source/win32/dtobj/FetcList.hxx b/dtrans/source/win32/dtobj/FetcList.hxx
index e980130c00b6..7e3058b08bbc 100644
--- a/dtrans/source/win32/dtobj/FetcList.hxx
+++ b/dtrans/source/win32/dtobj/FetcList.hxx
@@ -23,7 +23,7 @@
#include <sal/types.h>
#include <com/sun/star/datatransfer/XTransferable.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include "Fetc.hxx"
#if defined _MSC_VER
@@ -97,7 +97,7 @@ class CDataFormatTranslator;
class CFormatRegistrar
{
public:
- CFormatRegistrar( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager,
+ CFormatRegistrar( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const CDataFormatTranslator& aDataFormatTranslator );
void SAL_CALL RegisterFormats( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >& aXTransferable,
@@ -131,7 +131,7 @@ private:
sal_Bool m_bHasSynthesizedLocale;
com::sun::star::datatransfer::DataFlavor m_RegisteredTextFlavor;
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
static LCID m_TxtLocale;
static sal_uInt32 m_TxtCodePage;
diff --git a/dtrans/source/win32/dtobj/XTDataObject.cxx b/dtrans/source/win32/dtobj/XTDataObject.cxx
index a8e2ad2818ae..c343a01bb928 100644
--- a/dtrans/source/win32/dtobj/XTDataObject.cxx
+++ b/dtrans/source/win32/dtobj/XTDataObject.cxx
@@ -26,6 +26,7 @@
#include "TxtCnvtHlp.hxx"
#include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
#include "FmtFilter.hxx"
+#include <comphelper/processfactory.hxx>
#if defined _MSC_VER
#pragma warning(push,1)
@@ -77,7 +78,7 @@ CXTDataObject::CXTDataObject( const Reference< XMultiServiceFactory >& aServiceM
, m_XTransferable( aXTransferable )
, m_bFormatEtcContainerInitialized( sal_False )
, m_DataFormatTranslator( aServiceManager )
- , m_FormatRegistrar( m_SrvMgr, m_DataFormatTranslator )
+ , m_FormatRegistrar( comphelper::getComponentContext(m_SrvMgr), m_DataFormatTranslator )
{
}
diff --git a/dtrans/source/win32/ftransl/ftransl.cxx b/dtrans/source/win32/ftransl/ftransl.cxx
index 422ea63a79d4..53611cba47d4 100644
--- a/dtrans/source/win32/ftransl/ftransl.cxx
+++ b/dtrans/source/win32/ftransl/ftransl.cxx
@@ -21,6 +21,8 @@
#include "ftransl.hxx"
#include <com/sun/star/datatransfer/XMimeContentType.hpp>
+#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include "../misc/ImplHelper.hxx"
#if defined _MSC_VER
@@ -107,8 +109,8 @@ FormatEntry::FormatEntry(
// ctor
//------------------------------------------------------------------------
-CDataFormatTranslator::CDataFormatTranslator( const Reference< XMultiServiceFactory >& rSrvMgr ) :
- m_SrvMgr( rSrvMgr )
+CDataFormatTranslator::CDataFormatTranslator( const Reference< XComponentContext >& rxContext ) :
+ m_xContext( rxContext )
{
initTranslationTable( );
}
@@ -124,11 +126,7 @@ Any SAL_CALL CDataFormatTranslator::getSystemDataTypeFromDataFlavor( const DataF
try
{
- Reference< XMimeContentTypeFactory > refXMimeCntFactory( m_SrvMgr->createInstance(
- "com.sun.star.datatransfer.MimeContentTypeFactory" ), UNO_QUERY );
-
- if ( !refXMimeCntFactory.is( ) )
- throw RuntimeException( );
+ Reference< XMimeContentTypeFactory > refXMimeCntFactory = MimeContentTypeFactory::create( m_xContext );
Reference< XMimeContentType >
refXMimeCntType( refXMimeCntFactory->createMimeContentType( aDataFlavor.MimeType ) );
diff --git a/dtrans/source/win32/ftransl/ftransl.hxx b/dtrans/source/win32/ftransl/ftransl.hxx
index 195dc52cb8e4..4650fc06cd1c 100644
--- a/dtrans/source/win32/ftransl/ftransl.hxx
+++ b/dtrans/source/win32/ftransl/ftransl.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/datatransfer/XDataFormatTranslator.hpp>
#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include "../misc/WinClip.hxx"
#include <vector>
@@ -66,7 +67,7 @@ class CDataFormatTranslator : public
{
public:
- CDataFormatTranslator( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSrvMgr );
+ CDataFormatTranslator( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
//------------------------------------------------
// XDataFormatTranslator
@@ -108,7 +109,7 @@ private:
private:
std::vector< FormatEntry > m_TranslTable;
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
};
diff --git a/dtrans/source/win32/ftransl/ftranslentry.cxx b/dtrans/source/win32/ftransl/ftranslentry.cxx
index eecdb3c486f2..2b04e1877c29 100644
--- a/dtrans/source/win32/ftransl/ftranslentry.cxx
+++ b/dtrans/source/win32/ftransl/ftranslentry.cxx
@@ -18,6 +18,7 @@
*/
#include <cppuhelper/factory.hxx>
+#include <comphelper/processfactory.hxx>
#include <com/sun/star/container/XSet.hpp>
#include <osl/diagnose.h>
@@ -60,7 +61,7 @@ namespace
Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
{
- return Reference< XInterface >( static_cast< XDataFormatTranslator* >( new CDataFormatTranslator( rServiceManager ) ) );
+ return Reference< XInterface >( static_cast< XDataFormatTranslator* >( new CDataFormatTranslator( comphelper::getComponentContext(rServiceManager) ) ) );
}
}
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 6e6cda2144ef..97988ce067ca 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -43,7 +43,7 @@
#include <comphelper/seqstream.hxx>
#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
-#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
+#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
#include <com/sun/star/datatransfer/XMimeContentType.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
@@ -212,73 +212,65 @@ static ::rtl::OUString ImplGetParameterString( const TransferableObjectDescripto
static void ImplSetParameterString( TransferableObjectDescriptor& rObjDesc, const DataFlavorEx& rFlavorEx )
{
- Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
- Reference< XMimeContentTypeFactory > xMimeFact;
+ Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
try
{
- if( xFact.is() )
- {
- xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.datatransfer.MimeContentTypeFactory" )) ),
- UNO_QUERY );
- }
+ Reference< XMimeContentTypeFactory > xMimeFact = MimeContentTypeFactory::create( xContext );
- if( xMimeFact.is() )
- {
- Reference< XMimeContentType > xMimeType( xMimeFact->createMimeContentType( rFlavorEx.MimeType ) );
+ Reference< XMimeContentType > xMimeType( xMimeFact->createMimeContentType( rFlavorEx.MimeType ) );
- if( xMimeType.is() )
+ if( xMimeType.is() )
+ {
+ const ::rtl::OUString aClassNameString(RTL_CONSTASCII_USTRINGPARAM( "classname" ));
+ const ::rtl::OUString aTypeNameString(RTL_CONSTASCII_USTRINGPARAM( "typename" ));
+ const ::rtl::OUString aDisplayNameString(RTL_CONSTASCII_USTRINGPARAM( "displayname" ));
+ const ::rtl::OUString aViewAspectString(RTL_CONSTASCII_USTRINGPARAM( "viewaspect" ));
+ const ::rtl::OUString aWidthString(RTL_CONSTASCII_USTRINGPARAM( "width" ));
+ const ::rtl::OUString aHeightString(RTL_CONSTASCII_USTRINGPARAM( "height" ));
+ const ::rtl::OUString aPosXString(RTL_CONSTASCII_USTRINGPARAM( "posx" ));
+ const ::rtl::OUString aPosYString(RTL_CONSTASCII_USTRINGPARAM( "posy" ));
+
+ if( xMimeType->hasParameter( aClassNameString ) )
{
- const ::rtl::OUString aClassNameString(RTL_CONSTASCII_USTRINGPARAM( "classname" ));
- const ::rtl::OUString aTypeNameString(RTL_CONSTASCII_USTRINGPARAM( "typename" ));
- const ::rtl::OUString aDisplayNameString(RTL_CONSTASCII_USTRINGPARAM( "displayname" ));
- const ::rtl::OUString aViewAspectString(RTL_CONSTASCII_USTRINGPARAM( "viewaspect" ));
- const ::rtl::OUString aWidthString(RTL_CONSTASCII_USTRINGPARAM( "width" ));
- const ::rtl::OUString aHeightString(RTL_CONSTASCII_USTRINGPARAM( "height" ));
- const ::rtl::OUString aPosXString(RTL_CONSTASCII_USTRINGPARAM( "posx" ));
- const ::rtl::OUString aPosYString(RTL_CONSTASCII_USTRINGPARAM( "posy" ));
-
- if( xMimeType->hasParameter( aClassNameString ) )
- {
- rObjDesc.maClassName.MakeId( xMimeType->getParameterValue( aClassNameString ) );
- }
+ rObjDesc.maClassName.MakeId( xMimeType->getParameterValue( aClassNameString ) );
+ }
- if( xMimeType->hasParameter( aTypeNameString ) )
- {
- rObjDesc.maTypeName = xMimeType->getParameterValue( aTypeNameString );
- }
+ if( xMimeType->hasParameter( aTypeNameString ) )
+ {
+ rObjDesc.maTypeName = xMimeType->getParameterValue( aTypeNameString );
+ }
- if( xMimeType->hasParameter( aDisplayNameString ) )
- {
- // the display name might contain unacceptable characters, in this case they should be encoded
- // this seems to be the only parameter currently that might contain such characters
- rObjDesc.maDisplayName = ::rtl::Uri::decode( xMimeType->getParameterValue( aDisplayNameString ), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- }
+ if( xMimeType->hasParameter( aDisplayNameString ) )
+ {
+ // the display name might contain unacceptable characters, in this case they should be encoded
+ // this seems to be the only parameter currently that might contain such characters
+ rObjDesc.maDisplayName = ::rtl::Uri::decode( xMimeType->getParameterValue( aDisplayNameString ), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+ }
- if( xMimeType->hasParameter( aViewAspectString ) )
- {
- rObjDesc.mnViewAspect = static_cast< sal_uInt16 >( xMimeType->getParameterValue( aViewAspectString ).toInt32() );
- }
+ if( xMimeType->hasParameter( aViewAspectString ) )
+ {
+ rObjDesc.mnViewAspect = static_cast< sal_uInt16 >( xMimeType->getParameterValue( aViewAspectString ).toInt32() );
+ }
- if( xMimeType->hasParameter( aWidthString ) )
- {
- rObjDesc.maSize.Width() = xMimeType->getParameterValue( aWidthString ).toInt32();
- }
+ if( xMimeType->hasParameter( aWidthString ) )
+ {
+ rObjDesc.maSize.Width() = xMimeType->getParameterValue( aWidthString ).toInt32();
+ }
- if( xMimeType->hasParameter( aHeightString ) )
- {
- rObjDesc.maSize.Height() = xMimeType->getParameterValue( aHeightString ).toInt32();
- }
+ if( xMimeType->hasParameter( aHeightString ) )
+ {
+ rObjDesc.maSize.Height() = xMimeType->getParameterValue( aHeightString ).toInt32();
+ }
- if( xMimeType->hasParameter( aPosXString ) )
- {
- rObjDesc.maDragStartPos.X() = xMimeType->getParameterValue( aPosXString ).toInt32();
- }
+ if( xMimeType->hasParameter( aPosXString ) )
+ {
+ rObjDesc.maDragStartPos.X() = xMimeType->getParameterValue( aPosXString ).toInt32();
+ }
- if( xMimeType->hasParameter( aPosYString ) )
- {
- rObjDesc.maDragStartPos.Y() = xMimeType->getParameterValue( aPosYString ).toInt32();
- }
+ if( xMimeType->hasParameter( aPosYString ) )
+ {
+ rObjDesc.maDragStartPos.Y() = xMimeType->getParameterValue( aPosYString ).toInt32();
}
}
}
@@ -1350,14 +1342,11 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor
{
try
{
- Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
- Reference< XMimeContentTypeFactory > xMimeFact;
+ Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ Reference< XMimeContentTypeFactory > xMimeFact = MimeContentTypeFactory::create( xContext );
DataFlavorEx aFlavorEx;
const ::rtl::OUString aCharsetStr(RTL_CONSTASCII_USTRINGPARAM( "charset" ));
- if( xFact.is() )
- xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.datatransfer.MimeContentTypeFactory" )) ),
- UNO_QUERY );
for( sal_Int32 i = 0; i < rDataFlavorSeq.getLength(); i++ )
{
@@ -1366,7 +1355,7 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor
try
{
- if( xMimeFact.is() && !rFlavor.MimeType.isEmpty() )
+ if( !rFlavor.MimeType.isEmpty() )
xMimeType = xMimeFact->createMimeContentType( rFlavor.MimeType );
}
catch( const ::com::sun::star::uno::Exception& )
@@ -2275,52 +2264,46 @@ sal_Bool TransferableDataHelper::IsEqual( const ::com::sun::star::datatransfer::
const ::com::sun::star::datatransfer::DataFlavor& rRequestFlavor,
sal_Bool )
{
- Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
- Reference< XMimeContentTypeFactory > xMimeFact;
+ Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
sal_Bool bRet = sal_False;
try
{
- if( xFact.is() )
- xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.datatransfer.MimeContentTypeFactory" )) ),
- UNO_QUERY );
+ Reference< XMimeContentTypeFactory > xMimeFact = MimeContentTypeFactory::create( xContext );
- if( xMimeFact.is() )
- {
- Reference< XMimeContentType > xRequestType1( xMimeFact->createMimeContentType( rInternalFlavor.MimeType ) );
- Reference< XMimeContentType > xRequestType2( xMimeFact->createMimeContentType( rRequestFlavor.MimeType ) );
+ Reference< XMimeContentType > xRequestType1( xMimeFact->createMimeContentType( rInternalFlavor.MimeType ) );
+ Reference< XMimeContentType > xRequestType2( xMimeFact->createMimeContentType( rRequestFlavor.MimeType ) );
- if( xRequestType1.is() && xRequestType2.is() )
+ if( xRequestType1.is() && xRequestType2.is() )
+ {
+ if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( xRequestType2->getFullMediaType() ) )
{
- if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( xRequestType2->getFullMediaType() ) )
+ if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/plain" )) ) )
{
- if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/plain" )) ) )
- {
- // special handling for text/plain media types
- const ::rtl::OUString aCharsetString(RTL_CONSTASCII_USTRINGPARAM( "charset" ));
+ // special handling for text/plain media types
+ const ::rtl::OUString aCharsetString(RTL_CONSTASCII_USTRINGPARAM( "charset" ));
- if( !xRequestType2->hasParameter( aCharsetString ) ||
- xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "utf-16" )) ) ||
- xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unicode" )) ) )
- {
- bRet = sal_True;
- }
- }
- else if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice" )) ) )
+ if( !xRequestType2->hasParameter( aCharsetString ) ||
+ xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "utf-16" )) ) ||
+ xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unicode" )) ) )
{
- // special handling for application/x-openoffice media types
- const ::rtl::OUString aFormatString(RTL_CONSTASCII_USTRINGPARAM( "windows_formatname" ));
-
- if( xRequestType1->hasParameter( aFormatString ) &&
- xRequestType2->hasParameter( aFormatString ) &&
- xRequestType1->getParameterValue( aFormatString ).equalsIgnoreAsciiCase( xRequestType2->getParameterValue( aFormatString ) ) )
- {
- bRet = sal_True;
- }
+ bRet = sal_True;
}
- else
+ }
+ else if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice" )) ) )
+ {
+ // special handling for application/x-openoffice media types
+ const ::rtl::OUString aFormatString(RTL_CONSTASCII_USTRINGPARAM( "windows_formatname" ));
+
+ if( xRequestType1->hasParameter( aFormatString ) &&
+ xRequestType2->hasParameter( aFormatString ) &&
+ xRequestType1->getParameterValue( aFormatString ).equalsIgnoreAsciiCase( xRequestType2->getParameterValue( aFormatString ) ) )
+ {
bRet = sal_True;
+ }
}
+ else
+ bRet = sal_True;
}
}
}
diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
index 01dbde52a52c..a338bd2dfee9 100644
--- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
+++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
@@ -22,7 +22,7 @@
#include "PictToBmpFlt.hxx"
#include "com/sun/star/datatransfer/UnsupportedFlavorException.hpp"
#include "com/sun/star/datatransfer/XMimeContentType.hpp"
-#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/datatransfer/MimeContentTypeFactory.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "comphelper/processfactory.hxx"
@@ -498,12 +498,8 @@ Any FileListDataProvider::getOOoData()
DataFlavorMapper::DataFlavorMapper()
{
- Reference<XMultiServiceFactory> mrServiceManager = comphelper::getProcessServiceFactory();
- mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceManager->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY);
-
- if (!mrXMimeCntFactory.is())
- throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("AquaClipboard: Cannot create com.sun.star.datatransfer.MimeContentTypeFactory")), NULL);
+ Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
+ mrXMimeCntFactory = MimeContentTypeFactory::create( xContext );
}
DataFlavor DataFlavorMapper::systemToOpenOfficeFlavor(NSString* systemDataFlavor) const
diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
index 06b4e487debe..87a7b6d10f74 100644
--- a/vcl/aqua/source/dtrans/aqua_clipboard.cxx
+++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
@@ -21,7 +21,7 @@
#include "DataFlavorMapping.hxx"
#include "OSXTransferable.hxx"
-
+#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
#include "comphelper/makesequence.hxx"
#include "comphelper/processfactory.hxx"
@@ -85,17 +85,9 @@ AquaClipboard::AquaClipboard(NSPasteboard* pasteboard, bool bUseSystemPasteboard
WeakComponentImplHelper3<XSystemClipboard, XFlushableClipboard, XServiceInfo>(m_aMutex),
mIsSystemPasteboard(bUseSystemPasteboard)
{
- Reference<XMultiServiceFactory> mrServiceMgr = comphelper::getProcessServiceFactory();
-
- mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceMgr->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY);
+ Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
- if (!mrXMimeCntFactory.is())
- {
- throw RuntimeException(OUString(
- RTL_CONSTASCII_USTRINGPARAM("AquaClipboard: Cannot create com.sun.star.datatransfer.MimeContentTypeFactory")),
- static_cast<XClipboardEx*>(this));
- }
+ mrXMimeCntFactory = MimeContentTypeFactory::create(xContext);
mpDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper());
diff --git a/vcl/ios/source/dtrans/ios_clipboard.cxx b/vcl/ios/source/dtrans/ios_clipboard.cxx
index 03c8c9c7e629..03e493713bef 100644
--- a/vcl/ios/source/dtrans/ios_clipboard.cxx
+++ b/vcl/ios/source/dtrans/ios_clipboard.cxx
@@ -20,7 +20,7 @@
#include "ios_clipboard.hxx"
#include "iOSTransferable.hxx"
-
+#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
#include "comphelper/makesequence.hxx"
#include "comphelper/processfactory.hxx"
@@ -84,17 +84,10 @@ IosClipboard::IosClipboard(UIPasteboard* pasteboard, bool bUseSystemPasteboard)
WeakComponentImplHelper3<XSystemClipboard, XFlushableClipboard, XServiceInfo>(m_aMutex),
mIsSystemPasteboard(bUseSystemPasteboard)
{
- Reference<XMultiServiceFactory> mrServiceMgr = comphelper::getProcessServiceFactory();
+ Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
- mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceMgr->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY);
+ mrXMimeCntFactory = MimeContentTypeFactory::create(xContext);
- if (!mrXMimeCntFactory.is())
- {
- throw RuntimeException(OUString(
- RTL_CONSTASCII_USTRINGPARAM("IosClipboard: Cannot create com.sun.star.datatransfer.MimeContentTypeFactory")),
- static_cast<XClipboardEx*>(this));
- }
#if 0 // ???
mpDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper());
#endif