summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-05-29 17:17:28 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-06-06 10:01:22 +0200
commitd08578912f2c9ef42d4349079422e25b951e544e (patch)
treed029b5a9110bcdc255e72ef9c98887f3f8521ea6 /odk
parent7d2a5b5114987f1ab415e32ebb5bb9a46b98dc17 (diff)
fdo#46808, Adapt UNO services to new style, Part 7, updating ::create
Update calls to factories to use new SimpleFileAccess::create method Change-Id: Ie5b0696fe2228a9033b19969245a53c21a61aa14 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, added some tweaks.
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx8
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx14
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx12
3 files changed, 19 insertions, 15 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
index 1bb950952392..e6b78850c65d 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
@@ -38,7 +38,7 @@
#include <osl/mutex.hxx>
#include <osl/thread.h>
#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include "filterdetect.hxx"
@@ -58,10 +58,10 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
OUString implName = OUString::createFromAscii( pImplName );
if ( pServiceManager && implName.equals(FilterDetect_getImplementationName()) )
{
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ Reference< XSingleComponentFactory > xFactory( createSingleComponentFactory(
+ FilterDetect_createInstance,
OUString::createFromAscii( pImplName ),
- FilterDetect_createInstance, FilterDetect_getSupportedServiceNames() ) );
+ FilterDetect_getSupportedServiceNames() ) );
if (xFactory.is())
{
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
index e26d7f6f5869..63c32c041aa0 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
@@ -35,7 +35,6 @@
#include "filterdetect.hxx"
#include <osl/diagnose.h>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -54,7 +53,9 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -97,9 +98,8 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments )
if (!xInStream.is())
{
// open the stream if it was not suplied by the framework
- Reference< XSimpleFileAccess > xSFI(mxMSF->createInstance(
- OUString("com.sun.star.ucb.SimpleFileAccess")), UNO_QUERY);
- if (sURL.getLength() > 0 && xSFI.is())
+ Reference< XSimpleFileAccess2 > xSFI(SimpleFileAccess::create(mxContext));
+ if (sURL.getLength() > 0)
{
try
{
@@ -231,10 +231,10 @@ Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( )
#undef SERVICE_NAME1
#undef SERVICE_NAME2
-Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XComponentContext > & rContext)
throw( Exception )
{
- return (cppu::OWeakObject*) new FilterDetect( rSMgr );
+ return (cppu::OWeakObject*) new FilterDetect( rContext );
}
// XServiceInfo
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx
index 210d59cf56e5..f3b0382c781f 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx
@@ -47,6 +47,10 @@
#include <cppuhelper/implbase3.hxx>
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
+
enum FilterType
{
FILTER_IMPORT,
@@ -61,7 +65,7 @@ class FilterDetect : public cppu::WeakImplHelper3 <com::sun::star::document::XEx
com::sun::star::lang::XServiceInfo>
{
protected:
- ::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::lang::XComponent > mxDoc;
::rtl::OUString msFilterName;
::com::sun::star::uno::Sequence< ::rtl::OUString > msUserData;
@@ -74,8 +78,8 @@ protected:
throw (::com::sun::star::uno::RuntimeException);
public:
- FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
- : mxMSF( rxMSF ) {}
+ FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext)
+ : mxContext( rxContext ) {}
virtual ~FilterDetect() {}
@@ -110,7 +114,7 @@ sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceNa
throw ( ::com::sun::star::uno::RuntimeException );
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rContext)
throw ( ::com::sun::star::uno::Exception );
#endif