You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2025/06/05 17:35:16 UTC
(openoffice) branch trunk updated (0a1e220dee -> 1890034f73)
This is an automated email from the ASF dual-hosted git repository.
damjan pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
from 0a1e220dee Cleanup
new 7e7d909f7b Port main/unotools component_getFactory() to the component context API.
new cde5ecdaa5 Port main/fileaccess component_getFactory() to the component context API.
new 1890034f73 Port main/linguistic component_getFactory() to the component context API.
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
main/fileaccess/source/FileAccess.cxx | 65 +++++-------
main/linguistic/source/convdiclist.cxx | 22 +---
main/linguistic/source/dlistimp.cxx | 21 +---
main/linguistic/source/gciterator.cxx | 50 +++------
main/linguistic/source/gciterator.hxx | 7 +-
main/linguistic/source/lngopt.cxx | 21 +---
main/linguistic/source/lngreg.cxx | 152 +++++++++++++--------------
main/linguistic/source/lngsvcmgr.cxx | 24 +----
main/unotools/source/ucbhelper/XTempFile.hxx | 3 -
main/unotools/source/ucbhelper/xtempfile.cxx | 32 +++---
10 files changed, 136 insertions(+), 261 deletions(-)
(openoffice) 01/03: Port main/unotools component_getFactory() to the component context API.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
damjan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 7e7d909f7b346ca319119ba7253c8eae03fb7764
Author: Damjan Jovanovic <da...@apache.org>
AuthorDate: Thu Jun 5 19:06:47 2025 +0200
Port main/unotools component_getFactory() to the component context API.
Patch by: me
---
main/unotools/source/ucbhelper/XTempFile.hxx | 3 ---
main/unotools/source/ucbhelper/xtempfile.cxx | 32 ++++++++++++----------------
2 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/main/unotools/source/ucbhelper/XTempFile.hxx b/main/unotools/source/ucbhelper/XTempFile.hxx
index a7eca2713a..8489548043 100644
--- a/main/unotools/source/ucbhelper/XTempFile.hxx
+++ b/main/unotools/source/ucbhelper/XTempFile.hxx
@@ -30,7 +30,6 @@
#include <com/sun/star/io/XTempFile.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase5.hxx>
#ifndef _CPPUHELPER_PROPERTYSETMIXIN_HXX_
@@ -139,8 +138,6 @@ public:
static ::rtl::OUString getImplementationName_Static ();
static ::com::sun::star::uno::Sequence < ::rtl::OUString > getSupportedServiceNames_Static();
- static ::com::sun::star::uno::Reference < com::sun::star::lang::XSingleComponentFactory > createServiceFactory_Static( com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory );
-
private:
OTempFileService( OTempFileService & );
virtual ~OTempFileService ();
diff --git a/main/unotools/source/ucbhelper/xtempfile.cxx b/main/unotools/source/ucbhelper/xtempfile.cxx
index 0f9bd6adb0..bd81e5bdaf 100644
--- a/main/unotools/source/ucbhelper/xtempfile.cxx
+++ b/main/unotools/source/ucbhelper/xtempfile.cxx
@@ -24,6 +24,7 @@
#include <XTempFile.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/implementationentry.hxx>
#include <unotools/tempfile.hxx>
#include <osl/file.hxx>
#include <unotools/configmgr.hxx>
@@ -474,10 +475,18 @@ throw ( ::css::uno::RuntimeException )
return static_cast< ::cppu::OWeakObject * >( new OTempFileService(context) );
}
-::css::uno::Reference < ::css::lang::XSingleComponentFactory > OTempFileService::createServiceFactory_Static( ::css::uno::Reference < ::css::lang::XMultiServiceFactory > const & )
+static struct ::cppu::ImplementationEntry g_component_entries[] =
{
- return ::cppu::createSingleComponentFactory( XTempFile_createInstance, getImplementationName_Static(), getSupportedServiceNames_Static() );
-}
+ {
+ XTempFile_createInstance,
+ OTempFileService::getImplementationName_Static,
+ OTempFileService::getSupportedServiceNames_Static,
+ ::cppu::createSingleComponentFactory,
+ 0,
+ 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
// C functions to implement this as a component
@@ -495,20 +504,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnviron
* @return a component factory (generic uno interface)
*/
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
- const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
- void * pRet = 0;
- ::css::uno::Reference< ::css::lang::XMultiServiceFactory > xSMgr(
- reinterpret_cast< ::css::lang::XMultiServiceFactory * >( pServiceManager ) );
- ::css::uno::Reference< ::css::lang::XSingleComponentFactory > xFactory;
-
- if (OTempFileService::getImplementationName_Static().compareToAscii( pImplName ) == 0)
- xFactory = OTempFileService::createServiceFactory_Static ( xSMgr );
-
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- return pRet;
+ return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, g_component_entries );
}
(openoffice) 02/03: Port main/fileaccess component_getFactory() to the component context API.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
damjan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit cde5ecdaa53a1689dbdb9e55f18eebac44065c1b
Author: Damjan Jovanovic <da...@apache.org>
AuthorDate: Thu Jun 5 19:07:59 2025 +0200
Port main/fileaccess component_getFactory() to the component context API.
Patch by: me
---
main/fileaccess/source/FileAccess.cxx | 65 ++++++++++++++---------------------
1 file changed, 26 insertions(+), 39 deletions(-)
diff --git a/main/fileaccess/source/FileAccess.cxx b/main/fileaccess/source/FileAccess.cxx
index e99e69185e..f4f1f743d6 100644
--- a/main/fileaccess/source/FileAccess.cxx
+++ b/main/fileaccess/source/FileAccess.cxx
@@ -30,6 +30,7 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implementationentry.hxx>
#include <tools/ref.hxx>
#include <tools/urlobj.hxx>
@@ -59,9 +60,6 @@
#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
-#define IMPLEMENTATION_NAME "com.sun.star.comp.ucb.SimpleFileAccess"
-#define SERVICE_NAME "com.sun.star.ucb.SimpleFileAccess"
-
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::io;
@@ -85,7 +83,7 @@ class OCommandEnvironment;
class OFileAccess : public FileAccessHelper
{
- Reference< XMultiServiceFactory > mxSMgr;
+ Reference< XComponentContext > mxCtx;
Reference< XCommandEnvironment > mxEnvironment;
OCommandEnvironment* mpEnvironment;
@@ -97,8 +95,8 @@ class OFileAccess : public FileAccessHelper
throw ( Exception );
public:
- OFileAccess( const Reference< XMultiServiceFactory > & xSMgr )
- : mxSMgr( xSMgr), mpEnvironment( NULL ) {}
+ OFileAccess( const Reference< XComponentContext > & xCtx )
+ : mxCtx( xCtx ), mpEnvironment( NULL ) {}
// Methods
virtual void SAL_CALL copy( const ::rtl::OUString& SourceURL, const ::rtl::OUString& DestURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
@@ -322,19 +320,9 @@ void OFileAccess::transferImpl( const rtl::OUString& rSource,
try
{
- Reference< XComponentContext > xCtx;
- Reference< XPropertySet > xPropSet( mxSMgr, UNO_QUERY_THROW );
- if ( xPropSet.is() )
- {
- xPropSet->getPropertyValue(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) )
- >>= xCtx;
- }
-
Reference< XMacroExpander > xExpander;
- xCtx->getValueByName(
+ mxCtx->getValueByName(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"/singletons/com.sun.star.util.theMacroExpander" ) ) )
>>= xExpander;
@@ -875,11 +863,15 @@ void OFileAccess::setHidden( const ::rtl::OUString& FileURL, sal_Bool bHidden )
//==================================================================================================
//==================================================================================================
-Reference< XInterface > SAL_CALL FileAccess_CreateInstance( const Reference< XMultiServiceFactory > & xSMgr )
+Reference< XInterface > SAL_CALL FileAccess_CreateInstance( const Reference< XComponentContext > & xCtx )
{
- return Reference < XInterface >( ( cppu::OWeakObject * ) new OFileAccess( xSMgr ) );
+ return Reference < XInterface >( ( cppu::OWeakObject * ) new OFileAccess( xCtx ) );
}
+rtl::OUString FileAccess_getImplementationName()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ucb.SimpleFileAccess" ) );
+}
Sequence< rtl::OUString > FileAccess_getSupportedServiceNames()
{
@@ -890,13 +882,25 @@ Sequence< rtl::OUString > FileAccess_getSupportedServiceNames()
if( !pNames )
{
static Sequence< rtl::OUString > seqNames(1);
- seqNames.getArray()[0] = rtl::OUString::createFromAscii( SERVICE_NAME );
+ seqNames.getArray()[0] = rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" );
pNames = &seqNames;
}
}
return *pNames;
}
+struct ::cppu::ImplementationEntry g_component_entries [] =
+{
+ {
+ FileAccess_CreateInstance,
+ FileAccess_getImplementationName,
+ FileAccess_getSupportedServiceNames,
+ ::cppu::createSingleComponentFactory,
+ 0,
+ 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
}
@@ -913,25 +917,8 @@ FILEACCESS_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment(
}
//==================================================================================================
FILEACCESS_DLLPUBLIC void * SAL_CALL component_getFactory(
- const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
- void * pRet = 0;
-
- if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0)
- {
- Reference< XSingleServiceFactory > xFactory( cppu::createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- rtl::OUString::createFromAscii( pImplName ),
- io_FileAccess::FileAccess_CreateInstance,
- io_FileAccess::FileAccess_getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, ::io_FileAccess::g_component_entries );
}
}
(openoffice) 03/03: Port main/linguistic component_getFactory() to the component context API.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
damjan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 1890034f73947872dc88f59af6226fed5174e2b5
Author: Damjan Jovanovic <da...@apache.org>
AuthorDate: Thu Jun 5 19:09:02 2025 +0200
Port main/linguistic component_getFactory() to the component context API.
Patch by: me
---
main/linguistic/source/convdiclist.cxx | 22 +----
main/linguistic/source/dlistimp.cxx | 21 +----
main/linguistic/source/gciterator.cxx | 50 +++--------
main/linguistic/source/gciterator.hxx | 7 +-
main/linguistic/source/lngopt.cxx | 21 +----
main/linguistic/source/lngreg.cxx | 152 ++++++++++++++++-----------------
main/linguistic/source/lngsvcmgr.cxx | 24 +-----
7 files changed, 96 insertions(+), 201 deletions(-)
diff --git a/main/linguistic/source/convdiclist.cxx b/main/linguistic/source/convdiclist.cxx
index 11181f0fa2..1533c2fb9a 100644
--- a/main/linguistic/source/convdiclist.cxx
+++ b/main/linguistic/source/convdiclist.cxx
@@ -682,30 +682,10 @@ uno::Sequence< OUString > ConvDicList::getSupportedServiceNames_Static()
///////////////////////////////////////////////////////////////////////////
uno::Reference< uno::XInterface > SAL_CALL ConvDicList_CreateInstance(
- const uno::Reference< XMultiServiceFactory > & /*rSMgr*/ )
+ const uno::Reference< XComponentContext > & /*rCtx*/ )
throw(Exception)
{
return StaticConvDicList::get();
}
-void * SAL_CALL ConvDicList_getFactory(
- const sal_Char * pImplName,
- XMultiServiceFactory * pServiceManager, void * )
-{
- void * pRet = 0;
- if ( !ConvDicList::getImplementationName_Static().compareToAscii( pImplName ) )
- {
- uno::Reference< XSingleServiceFactory > xFactory =
- cppu::createOneInstanceFactory(
- pServiceManager,
- ConvDicList::getImplementationName_Static(),
- ConvDicList_CreateInstance,
- ConvDicList::getSupportedServiceNames_Static());
- // acquire, because we return an interface pointer instead of a reference
- xFactory->acquire();
- pRet = xFactory.get();
- }
- return pRet;
-}
-
///////////////////////////////////////////////////////////////////////////
diff --git a/main/linguistic/source/dlistimp.cxx b/main/linguistic/source/dlistimp.cxx
index 9d5284df8f..a7bed3013b 100644
--- a/main/linguistic/source/dlistimp.cxx
+++ b/main/linguistic/source/dlistimp.cxx
@@ -409,7 +409,7 @@ sal_Int32 DicList::GetDicPos(const uno::Reference< XDictionary > &xDic)
uno::Reference< XInterface > SAL_CALL
- DicList_CreateInstance( const uno::Reference< XMultiServiceFactory > & /*rSMgr*/ )
+ DicList_CreateInstance( const uno::Reference< XComponentContext > & /*rCtx*/ )
throw(Exception)
{
uno::Reference< XInterface > xService = (cppu::OWeakObject *) new DicList;
@@ -792,25 +792,6 @@ uno::Sequence< rtl::OUString > DicList::getSupportedServiceNames_Static() throw(
return aSNS;
}
-void * SAL_CALL DicList_getFactory( const sal_Char * pImplName,
- XMultiServiceFactory * pServiceManager, void * )
-{
- void * pRet = 0;
- if ( !DicList::getImplementationName_Static().compareToAscii( pImplName ) )
- {
- uno::Reference< XSingleServiceFactory > xFactory =
- cppu::createOneInstanceFactory(
- pServiceManager,
- DicList::getImplementationName_Static(),
- DicList_CreateInstance,
- DicList::getSupportedServiceNames_Static());
- // acquire, because we return an interface pointer instead of a reference
- xFactory->acquire();
- pRet = xFactory.get();
- }
- return pRet;
-}
-
///////////////////////////////////////////////////////////////////////////
xub_StrLen lcl_GetToken( String &rToken,
diff --git a/main/linguistic/source/gciterator.cxx b/main/linguistic/source/gciterator.cxx
index c0a889a0bb..929f6a50a9 100644
--- a/main/linguistic/source/gciterator.cxx
+++ b/main/linguistic/source/gciterator.cxx
@@ -73,10 +73,6 @@ using ::rtl::OUString;
using namespace linguistic;
using namespace ::com::sun::star;
-// forward declarations
-static ::rtl::OUString GrammarCheckingIterator_getImplementationName() throw();
-static uno::Sequence< OUString > GrammarCheckingIterator_getSupportedServiceNames() throw();
-
//////////////////////////////////////////////////////////////////////
@@ -270,8 +266,8 @@ void stopGrammarChecking ()
}
*/
-GrammarCheckingIterator::GrammarCheckingIterator( const uno::Reference< lang::XMultiServiceFactory > & rxMgr ) :
- m_xMSF( rxMgr ),
+GrammarCheckingIterator::GrammarCheckingIterator( const uno::Reference< uno::XComponentContext > & rxCtx ) :
+ m_xContext( rxCtx ),
m_bEnd( sal_False ),
m_aCurCheckedDocId(),
m_bGCServicesChecked( sal_False ),
@@ -954,7 +950,7 @@ throw (uno::RuntimeException)
// release all UNO references
- m_xMSF.clear();
+ m_xContext.clear();
m_xBreakIterator.clear();
// clear containers with UNO references AND have those references released
@@ -1152,9 +1148,9 @@ void GrammarCheckingIterator::GetMatchingGCSvcs_Impl()
void GrammarCheckingIterator::GetAvailableGCSvcs_Impl()
{
// internal method; will always be called with locked mutex
- if (m_xMSF.is())
+ if (m_xContext.is())
{
- uno::Reference< container::XContentEnumerationAccess > xEnumAccess( m_xMSF, uno::UNO_QUERY );
+ uno::Reference< container::XContentEnumerationAccess > xEnumAccess( m_xContext.getServiceManager(), uno::UNO_QUERY );
uno::Reference< container::XEnumeration > xEnum;
if (xEnumAccess.is())
xEnum = xEnumAccess->createContentEnumeration( A2OU( SN_GRAMMARCHECKER ) );
@@ -1168,7 +1164,7 @@ void GrammarCheckingIterator::GetAvailableGCSvcs_Impl()
uno::Reference< lang::XSingleServiceFactory > xFactory;
uno::Reference< uno::XComponentContext > xContext;
- uno::Reference< beans::XPropertySet > xProps( m_xMSF, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProps( m_xContext.getServiceManager(), uno::UNO_QUERY );
xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
if ( xContext.is() &&
@@ -1225,13 +1221,13 @@ throw(uno::RuntimeException)
OUString SAL_CALL GrammarCheckingIterator::getImplementationName( ) throw (uno::RuntimeException)
{
- return GrammarCheckingIterator_getImplementationName();
+ return getImplementationName_Static();
}
uno::Sequence< OUString > SAL_CALL GrammarCheckingIterator::getSupportedServiceNames( ) throw (uno::RuntimeException)
{
- return GrammarCheckingIterator_getSupportedServiceNames();
+ return getSupportedServiceNames_Static();
}
@@ -1287,13 +1283,13 @@ LinguDispatcher::DspType GrammarCheckingIterator::GetDspType() const
///////////////////////////////////////////////////////////////////////////
-static OUString GrammarCheckingIterator_getImplementationName() throw()
+OUString GrammarCheckingIterator::getImplementationName_Static() throw()
{
return A2OU( "com.sun.star.lingu2.ProofreadingIterator" );
}
-static uno::Sequence< OUString > GrammarCheckingIterator_getSupportedServiceNames() throw()
+uno::Sequence< OUString > GrammarCheckingIterator::getSupportedServiceNames_Static() throw()
{
uno::Sequence< OUString > aSNS( 1 );
aSNS.getArray()[0] = A2OU( SN_GRAMMARCHECKINGITERATOR );
@@ -1301,31 +1297,11 @@ static uno::Sequence< OUString > GrammarCheckingIterator_getSupportedServiceName
}
-static uno::Reference< uno::XInterface > SAL_CALL GrammarCheckingIterator_createInstance(
- const uno::Reference< lang::XMultiServiceFactory > & rxSMgr )
+uno::Reference< uno::XInterface > SAL_CALL GrammarCheckingIterator_createInstance(
+ const uno::Reference< uno::XComponentContext > & rxCtx )
throw(uno::Exception)
{
- return static_cast< ::cppu::OWeakObject * >(new GrammarCheckingIterator( rxSMgr ));
+ return static_cast< ::cppu::OWeakObject * >(new GrammarCheckingIterator( rxCtx ));
}
-void * SAL_CALL GrammarCheckingIterator_getFactory(
- const sal_Char *pImplName,
- lang::XMultiServiceFactory *pServiceManager,
- void * /*pRegistryKey*/ )
-{
- void * pRet = 0;
- if ( !GrammarCheckingIterator_getImplementationName().compareToAscii( pImplName ) )
- {
- uno::Reference< lang::XSingleServiceFactory > xFactory =
- cppu::createOneInstanceFactory(
- pServiceManager,
- GrammarCheckingIterator_getImplementationName(),
- GrammarCheckingIterator_createInstance,
- GrammarCheckingIterator_getSupportedServiceNames());
- // acquire, because we return an interface pointer instead of a reference
- xFactory->acquire();
- pRet = xFactory.get();
- }
- return pRet;
-}
diff --git a/main/linguistic/source/gciterator.hxx b/main/linguistic/source/gciterator.hxx
index 144bf22d67..30ff6b947d 100644
--- a/main/linguistic/source/gciterator.hxx
+++ b/main/linguistic/source/gciterator.hxx
@@ -88,7 +88,7 @@ class GrammarCheckingIterator:
>,
public LinguDispatcher
{
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
//the queue is keeping track of all senteces to be checked
@@ -163,7 +163,7 @@ public:
void DequeueAndCheck();
- explicit GrammarCheckingIterator( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rxMgr );
+ explicit GrammarCheckingIterator( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxCtx );
virtual ~GrammarCheckingIterator();
// XProofreadingIterator
@@ -196,6 +196,9 @@ public:
virtual void SetServiceList( const ::com::sun::star::lang::Locale &rLocale, const ::com::sun::star::uno::Sequence< rtl::OUString > &rSvcImplNames );
virtual ::com::sun::star::uno::Sequence< rtl::OUString > GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const;
virtual DspType GetDspType() const;
+
+ static ::rtl::OUString getImplementationName_Static() throw();
+ static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
};
diff --git a/main/linguistic/source/lngopt.cxx b/main/linguistic/source/lngopt.cxx
index 6cf21e2416..f7281d024f 100644
--- a/main/linguistic/source/lngopt.cxx
+++ b/main/linguistic/source/lngopt.cxx
@@ -385,7 +385,7 @@ void LinguProps::launchEvent( const PropertyChangeEvent &rEvt ) const
}
Reference< XInterface > SAL_CALL LinguProps_CreateInstance(
- const Reference< XMultiServiceFactory > & /*rSMgr*/ )
+ const Reference< XComponentContext > & /*rCtx*/ )
throw(Exception)
{
Reference< XInterface > xService = (cppu::OWeakObject*)new LinguProps;
@@ -661,23 +661,4 @@ uno::Sequence< OUString > LinguProps::getSupportedServiceNames_Static()
return aSNS;
}
-void * SAL_CALL LinguProps_getFactory( const sal_Char * pImplName,
- XMultiServiceFactory *pServiceManager, void * )
-{
- void * pRet = 0;
- if ( !LinguProps::getImplementationName_Static().compareToAscii( pImplName ) )
- {
- Reference< XSingleServiceFactory > xFactory =
- cppu::createOneInstanceFactory(
- pServiceManager,
- LinguProps::getImplementationName_Static(),
- LinguProps_CreateInstance,
- LinguProps::getSupportedServiceNames_Static());
- // acquire, because we return an interface pointer instead of a reference
- xFactory->acquire();
- pRet = xFactory.get();
- }
- return pRet;
-}
-
///////////////////////////////////////////////////////////////////////////
diff --git a/main/linguistic/source/lngreg.cxx b/main/linguistic/source/lngreg.cxx
index 50f0d87fbf..27079044c5 100644
--- a/main/linguistic/source/lngreg.cxx
+++ b/main/linguistic/source/lngreg.cxx
@@ -26,60 +26,92 @@
#include <cppuhelper/factory.hxx> // helper for factories
+#include <cppuhelper/implementationentry.hxx>
#include <rtl/string.hxx>
+#include "lngsvcmgr.hxx"
+#include "lngopt.hxx"
+#include "dlistimp.hxx"
+#include "convdiclist.hxx"
+#include "gciterator.hxx"
+
#include <com/sun/star/registry/XRegistryKey.hpp>
using namespace com::sun::star::lang;
using namespace com::sun::star::registry;
-extern void * SAL_CALL LngSvcMgr_getFactory
-(
- const sal_Char * pImplName,
- XMultiServiceFactory * pServiceManager,
- void * /*pRegistryKey*/
-);
-
-extern void * SAL_CALL DicList_getFactory
-(
- const sal_Char * pImplName,
- XMultiServiceFactory * pServiceManager,
- void *
-);
-
-void * SAL_CALL LinguProps_getFactory
-(
- const sal_Char * pImplName,
- XMultiServiceFactory * pServiceManager,
- void *
-);
-
-extern void * SAL_CALL ConvDicList_getFactory
-(
- const sal_Char * pImplName,
- XMultiServiceFactory * pServiceManager,
- void *
-);
-
-extern void * SAL_CALL GrammarCheckingIterator_getFactory
-(
- const sal_Char * pImplName,
- XMultiServiceFactory * pServiceManager,
- void *
-);
-
-//extern void * SAL_CALL GrammarChecker_getFactory
-//(
-// const sal_Char * pImplName,
-// XMultiServiceFactory * pServiceManager,
-// void *
-//);
+using namespace com::sun::star;
+
+extern uno::Reference< uno::XInterface > SAL_CALL LngSvcMgr_CreateInstance(
+ const uno::Reference< uno::XComponentContext > & /*rCtx*/ )
+ throw(uno::Exception);
+
+extern uno::Reference< uno::XInterface > SAL_CALL LinguProps_CreateInstance(
+ const uno::Reference< uno::XComponentContext > & /*rCtx*/ )
+ throw(uno::Exception);
+
+extern uno::Reference< uno::XInterface > SAL_CALL DicList_CreateInstance(
+ const uno::Reference< uno::XComponentContext > & /*rCtx*/ )
+ throw(uno::Exception);
+
+extern uno::Reference< uno::XInterface > SAL_CALL ConvDicList_CreateInstance(
+ const uno::Reference< uno::XComponentContext > & /*rCtx*/ )
+ throw(uno::Exception);
+
+extern uno::Reference< uno::XInterface > SAL_CALL GrammarCheckingIterator_createInstance(
+ const uno::Reference< uno::XComponentContext > & rxCtx )
+ throw(uno::Exception);
////////////////////////////////////////
// definition of the two functions that are used to provide the services
//
+struct ::cppu::ImplementationEntry g_component_entries [] =
+{
+ {
+ LngSvcMgr_CreateInstance,
+ LngSvcMgr::getImplementationName_Static,
+ LngSvcMgr::getSupportedServiceNames_Static,
+ ::cppu::createSingleComponentFactory,
+ 0,
+ 0
+ },
+ {
+ LinguProps_CreateInstance,
+ LinguProps::getImplementationName_Static,
+ LinguProps::getSupportedServiceNames_Static,
+ ::cppu::createSingleComponentFactory,
+ 0,
+ 0
+ },
+ {
+ DicList_CreateInstance,
+ DicList::getImplementationName_Static,
+ DicList::getSupportedServiceNames_Static,
+ ::cppu::createSingleComponentFactory,
+ 0,
+ 0
+ },
+ {
+ ConvDicList_CreateInstance,
+ ConvDicList::getImplementationName_Static,
+ ConvDicList::getSupportedServiceNames_Static,
+ ::cppu::createSingleComponentFactory,
+ 0,
+ 0
+ },
+ {
+ GrammarCheckingIterator_createInstance,
+ GrammarCheckingIterator::getImplementationName_Static,
+ GrammarCheckingIterator::getSupportedServiceNames_Static,
+ ::cppu::createSingleComponentFactory,
+ 0,
+ 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
extern "C"
{
@@ -92,43 +124,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
- void * pRet =
- LngSvcMgr_getFactory(
- pImplName,
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- pRegistryKey );
-
- if(!pRet)
- pRet = LinguProps_getFactory(
- pImplName,
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- pRegistryKey );
-
- if(!pRet)
- pRet = DicList_getFactory(
- pImplName,
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- pRegistryKey );
-
- if(!pRet)
- pRet = ConvDicList_getFactory(
- pImplName,
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- pRegistryKey );
-
- if(!pRet)
- pRet = GrammarCheckingIterator_getFactory(
- pImplName,
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- pRegistryKey );
-/*
- if(!pRet)
- pRet = GrammarChecker_getFactory(
- pImplName,
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- pRegistryKey );
-*/
- return pRet;
+ return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, g_component_entries );
}
}
diff --git a/main/linguistic/source/lngsvcmgr.cxx b/main/linguistic/source/lngsvcmgr.cxx
index be59d438cd..e7eb0440f9 100644
--- a/main/linguistic/source/lngsvcmgr.cxx
+++ b/main/linguistic/source/lngsvcmgr.cxx
@@ -1990,34 +1990,12 @@ uno::Sequence< OUString > LngSvcMgr::getSupportedServiceNames_Static()
uno::Reference< uno::XInterface > SAL_CALL LngSvcMgr_CreateInstance(
- const uno::Reference< lang::XMultiServiceFactory > & /*rSMgr*/ )
+ const uno::Reference< uno::XComponentContext > & /*rCtx*/ )
throw(uno::Exception)
{
uno::Reference< uno::XInterface > xService = (cppu::OWeakObject*) new LngSvcMgr;
return xService;
}
-void * SAL_CALL LngSvcMgr_getFactory(
- const sal_Char * pImplName,
- lang::XMultiServiceFactory * pServiceManager,
- void * /*pRegistryKey*/ )
-{
-
- void * pRet = 0;
- if ( !LngSvcMgr::getImplementationName_Static().compareToAscii( pImplName ) )
- {
- uno::Reference< lang::XSingleServiceFactory > xFactory =
- cppu::createOneInstanceFactory(
- pServiceManager,
- LngSvcMgr::getImplementationName_Static(),
- LngSvcMgr_CreateInstance,
- LngSvcMgr::getSupportedServiceNames_Static());
- // acquire, because we return an interface pointer instead of a reference
- xFactory->acquire();
- pRet = xFactory.get();
- }
- return pRet;
-}
-
///////////////////////////////////////////////////////////////////////////