summaryrefslogtreecommitdiff
path: root/dtrans
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-02-06 17:14:00 +0200
committerNoel Grandin <noel@peralex.com>2013-02-12 10:14:46 +0200
commit851067c2684c68758afeaa7da23bb6dd69c51358 (patch)
tree2d20baf149274f6e5f2345ab757aafc9799dbb8f /dtrans
parent2969846c29402baec792e43cfd4524366fb05613 (diff)
fdo#46808, use constructor for datatransfer::MimeContentTypeFactory
Change-Id: I576a472e22ad0e3798f4b34d808ac320f13d3e6d
Diffstat (limited to 'dtrans')
-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
10 files changed, 31 insertions, 30 deletions
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) ) ) );
}
}