summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-08 18:01:19 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-10 10:05:11 +0100
commitc25fe48143b716855dfc06ffd0d65bb50b2a0cbf (patch)
tree60050c4a224ab51ba3be216e27bb9044b49d23ce
parentba9ddcd7b31163b896fe8e6eae8ce6f1662916bd (diff)
svt: Use constructor feature for GObjectImpl.
Change-Id: I324dd00205319fe4e8f7b0b352ed2ab6422fcbbd
-rw-r--r--svtools/source/graphic/graphicunofactory.cxx54
-rw-r--r--svtools/source/uno/miscservices.cxx17
-rw-r--r--svtools/util/svt.component3
3 files changed, 46 insertions, 28 deletions
diff --git a/svtools/source/graphic/graphicunofactory.cxx b/svtools/source/graphic/graphicunofactory.cxx
index b7fffe7645ec..85f5ef3c2a16 100644
--- a/svtools/source/graphic/graphicunofactory.cxx
+++ b/svtools/source/graphic/graphicunofactory.cxx
@@ -17,18 +17,20 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-#include <comphelper/servicedecl.hxx>
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/graphic/XGraphicObject.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <svtools/grfmgr.hxx>
+#include <rtl/ref.hxx>
using namespace com::sun::star;
-namespace unographic {
+namespace {
-typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE;
+typedef ::cppu::WeakImplHelper2< graphic::XGraphicObject, css::lang::XServiceInfo > GObjectAccess_BASE;
// Simple uno wrapper around the GraphicObject class to allow basic
// access. ( and solves a horrible cyclic link problem between
// goodies/toolkit/extensions )
@@ -37,15 +39,36 @@ class GObjectImpl : public GObjectAccess_BASE
::osl::Mutex m_aMutex;
std::auto_ptr< GraphicObject > mpGObject;
public:
- GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException);
+ GObjectImpl( uno::Sequence< uno::Any > const & args ) throw (uno::RuntimeException);
// XGraphicObject
virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException);
virtual void SAL_CALL setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException);
OUString SAL_CALL getUniqueID() throw (uno::RuntimeException);
+
+ virtual OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ {
+ return OUString("com.sun.star.graphic.GraphicObject");
+ }
+
+ virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+ {
+ return cppu::supportsService(this, ServiceName);
+ }
+
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+ throw (css::uno::RuntimeException)
+ {
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString("com.sun.star.graphic.GraphicObject");
+ return aRet;
+ }
};
-GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & /*xComponentContext*/ ) throw (uno::RuntimeException)
+GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args) throw (uno::RuntimeException)
{
if ( args.getLength() == 1 )
{
@@ -85,11 +108,20 @@ OUString SAL_CALL GObjectImpl::getUniqueID() throw (uno::RuntimeException)
return sId;
}
+}
-namespace sdecl = comphelper::service_decl;
-sdecl::class_<GObjectImpl, sdecl::with_args<true> > serviceBI;
-extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicObject", "com.sun.star.graphic.GraphicObject" );
-
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_graphic_GraphicObject_get_implementation(
+ SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
+ uno_Sequence * arguments)
+{
+ assert(arguments != 0);
+ css::uno::Sequence<css::uno::Any> aArgs(
+ reinterpret_cast<css::uno::Any *>(arguments->elements),
+ arguments->nElements);
+ rtl::Reference<GObjectImpl> x(new GObjectImpl(aArgs));
+ x->acquire();
+ return static_cast<cppu::OWeakObject *>(x.get());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx
index 90feccf47473..2a9671941951 100644
--- a/svtools/source/uno/miscservices.cxx
+++ b/svtools/source/uno/miscservices.cxx
@@ -37,13 +37,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::lang;
-
-namespace sdecl = comphelper::service_decl;
-
-namespace unographic {
-extern sdecl::ServiceDecl const serviceDecl;
-}
-
// for CreateInstance functions implemented elsewhere, while the function is within a namespace
#define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \
namespace nmspe { \
@@ -56,7 +49,7 @@ extern "C"
{
SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory (
- const sal_Char * pImplementationName, void * _pServiceManager, void * pRegistryKey)
+ const sal_Char * pImplementationName, void * _pServiceManager, void * )
{
void * pResult = 0;
if ( _pServiceManager )
@@ -76,14 +69,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory (
svt::OAddressBookSourceDialogUno_CreateInstance,
aServiceNames);
}
- else
- {
- pResult = comphelper::service_decl::component_getFactoryHelper(
- pImplementationName,
- static_cast<css::lang::XMultiServiceFactory *>(_pServiceManager),
- static_cast<css::registry::XRegistryKey *>(pRegistryKey),
- unographic::serviceDecl );
- }
if ( xFactory.is() )
{
diff --git a/svtools/util/svt.component b/svtools/util/svt.component
index 759657ec15ba..ccb0dff116d8 100644
--- a/svtools/util/svt.component
+++ b/svtools/util/svt.component
@@ -34,7 +34,8 @@
constructor="com_sun_star_comp_svtools_uno_Wizard_get_implementation">
<service name="com.sun.star.ui.dialogs.Wizard"/>
</implementation>
- <implementation name="com.sun.star.graphic.GraphicObject">
+ <implementation name="com.sun.star.graphic.GraphicObject"
+ constructor="com_sun_star_graphic_GraphicObject_get_implementation">
<service name="com.sun.star.graphic.GraphicObject"/>
</implementation>
<implementation name="com.sun.star.svtools.SvFilterOptionsDialog"