[Libreoffice-commits] core.git: 2 commits - extensions/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 23 17:59:02 UTC 2020
extensions/source/update/check/updatecheckconfig.cxx | 26 ++---
extensions/source/update/check/updatecheckconfig.hxx | 3
extensions/source/update/check/updatecheckjob.cxx | 71 +--------------
extensions/source/update/check/updchk.uno.component | 8 +
extensions/source/update/feed/updatefeed.component | 5 -
extensions/source/update/feed/updatefeed.cxx | 89 ++++---------------
extensions/source/update/ui/updatecheckui.cxx | 45 +--------
extensions/source/update/ui/updchk.component | 5 -
8 files changed, 57 insertions(+), 195 deletions(-)
New commits:
commit d122dbd0600d1511c94a2764e0ae63015dc946e3
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 23 16:11:33 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 23 19:58:31 2020 +0200
extensions/updateui: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: I3380e987be8bf24005676705e26f3135c83d2b2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99324
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx
index f3622f34914d..b76284ff759b 100644
--- a/extensions/source/update/check/updatecheckconfig.cxx
+++ b/extensions/source/update/check/updatecheckconfig.cxx
@@ -18,6 +18,7 @@
*/
#include "updatecheckconfig.hxx"
+#include "updatecheck.hxx"
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@@ -428,19 +429,6 @@ UpdateCheckConfig::clearUpdateFound()
commitChanges();
}
-uno::Sequence< OUString >
-UpdateCheckConfig::getServiceNames()
-{
- uno::Sequence< OUString > aServiceList { "com.sun.star.setup.UpdateCheckConfig" };
- return aServiceList;
-}
-
-OUString
-UpdateCheckConfig::getImplName()
-{
- return "vnd.sun.UpdateCheckConfig";
-}
-
uno::Type SAL_CALL
UpdateCheckConfig::getElementType()
{
@@ -651,7 +639,7 @@ bool UpdateCheckConfig::isVersionGreater( const OUString& rVersion1,
OUString SAL_CALL
UpdateCheckConfig::getImplementationName()
{
- return getImplName();
+ return "vnd.sun.UpdateCheckConfig";
}
sal_Bool SAL_CALL
@@ -663,7 +651,15 @@ UpdateCheckConfig::supportsService(OUString const & serviceName)
uno::Sequence< OUString > SAL_CALL
UpdateCheckConfig::getSupportedServiceNames()
{
- return getServiceNames();
+ return { "com.sun.star.setup.UpdateCheckConfig" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+extensions_update_UpdateCheckConfig_get_implementation(
+ css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(UpdateCheckConfig::get(context, *UpdateCheck::get()).get());
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx
index 6215161d0b0b..3c6232ea8a93 100644
--- a/extensions/source/update/check/updatecheckconfig.hxx
+++ b/extensions/source/update/check/updatecheckconfig.hxx
@@ -90,9 +90,6 @@ class UpdateCheckConfig : public ::cppu::WeakImplHelper<
public:
- static css::uno::Sequence< OUString > getServiceNames();
- static OUString getImplName();
-
static ::rtl::Reference< UpdateCheckConfig > get(
const css::uno::Reference< css::uno::XComponentContext >& xContext,
const ::rtl::Reference< UpdateCheckConfigListener >& rListener = ::rtl::Reference< UpdateCheckConfigListener >());
diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx
index 72015e75fd72..d457269e9ca6 100644
--- a/extensions/source/update/check/updatecheckjob.cxx
+++ b/extensions/source/update/check/updatecheckjob.cxx
@@ -75,9 +75,6 @@ public:
m_xContext(context), m_xDesktop(desktop)
{}
- static uno::Sequence< OUString > getServiceNames();
- static OUString getImplName();
-
// XJob
virtual uno::Any SAL_CALL execute(const uno::Sequence<beans::NamedValue>&) override;
@@ -147,21 +144,6 @@ UpdateCheckJob::~UpdateCheckJob()
{
}
-uno::Sequence< OUString >
-UpdateCheckJob::getServiceNames()
-{
- uno::Sequence< OUString > aServiceList { "com.sun.star.setup.UpdateCheck" };
- return aServiceList;
-};
-
-
-OUString
-UpdateCheckJob::getImplName()
-{
- return "vnd.sun.UpdateCheck";
-}
-
-
uno::Any
UpdateCheckJob::execute(const uno::Sequence<beans::NamedValue>& namedValues)
{
@@ -245,14 +227,14 @@ void UpdateCheckJob::handleExtensionUpdates( const uno::Sequence< beans::NamedVa
OUString SAL_CALL
UpdateCheckJob::getImplementationName()
{
- return getImplName();
+ return "vnd.sun.UpdateCheck";
}
uno::Sequence< OUString > SAL_CALL
UpdateCheckJob::getSupportedServiceNames()
{
- return getServiceNames();
+ return { "com.sun.star.setup.UpdateCheck" };
}
sal_Bool SAL_CALL
@@ -298,53 +280,16 @@ void SAL_CALL UpdateCheckJob::notifyTermination( lang::EventObject const & )
} // anonymous namespace
-static uno::Reference<uno::XInterface>
-createJobInstance(const uno::Reference<uno::XComponentContext>& xContext)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+extensions_update_UpdateCheckJob_get_implementation(
+ css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
{
css::uno::Reference<css::frame::XDesktop2> desktop(
- css::frame::Desktop::create(xContext));
- rtl::Reference<UpdateCheckJob> job(new UpdateCheckJob(xContext, desktop));
+ css::frame::Desktop::create(context));
+ rtl::Reference<UpdateCheckJob> job(new UpdateCheckJob(context, desktop));
desktop->addTerminateListener(job.get());
- return static_cast<cppu::OWeakObject *>(job.get());
+ return cppu::acquire(job.get());
}
-static uno::Reference<uno::XInterface>
-createConfigInstance(const uno::Reference<uno::XComponentContext>& xContext)
-{
- return *UpdateCheckConfig::get(xContext, *UpdateCheck::get());
-}
-
-
-const cppu::ImplementationEntry kImplementations_entries[] =
-{
- {
- createJobInstance,
- UpdateCheckJob::getImplName,
- UpdateCheckJob::getServiceNames,
- cppu::createSingleComponentFactory,
- nullptr,
- 0
- },
- {
- createConfigInstance,
- UpdateCheckConfig::getImplName,
- UpdateCheckConfig::getServiceNames,
- cppu::createSingleComponentFactory,
- nullptr,
- 0
- },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-} ;
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * updchk_component_getFactory(const char *pszImplementationName, void *pServiceManager, void *pRegistryKey)
-{
- return cppu::component_getFactoryHelper(
- pszImplementationName,
- pServiceManager,
- pRegistryKey,
- kImplementations_entries) ;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/check/updchk.uno.component b/extensions/source/update/check/updchk.uno.component
index 3f41b1211f9d..f147e3065d98 100644
--- a/extensions/source/update/check/updchk.uno.component
+++ b/extensions/source/update/check/updchk.uno.component
@@ -18,11 +18,13 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="updchk" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="vnd.sun.UpdateCheck">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="vnd.sun.UpdateCheck"
+ constructor="extensions_update_UpdateCheckJob_get_implementation">
<service name="com.sun.star.setup.UpdateCheck"/>
</implementation>
- <implementation name="vnd.sun.UpdateCheckConfig">
+ <implementation name="vnd.sun.UpdateCheckConfig"
+ constructor="extensions_update_UpdateCheckConfig_get_implementation">
<service name="com.sun.star.setup.UpdateCheckConfig"/>
</implementation>
</component>
diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx
index 85a888523841..c2aad90abf59 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -56,19 +56,6 @@
using namespace ::com::sun::star;
-static uno::Sequence< OUString > getServiceNames()
-{
- uno::Sequence< OUString > aServiceList { "com.sun.star.setup.UpdateCheckUI" };
- return aServiceList;
-}
-
-
-static OUString getImplementationName()
-{
- return "vnd.sun.UpdateCheckUI";
-}
-
-
namespace
{
@@ -218,13 +205,13 @@ UpdateCheckUI::~UpdateCheckUI()
OUString SAL_CALL
UpdateCheckUI::getImplementationName()
{
- return ::getImplementationName();
+ return "vnd.sun.UpdateCheckUI";
}
uno::Sequence< OUString > SAL_CALL
UpdateCheckUI::getSupportedServiceNames()
{
- return ::getServiceNames();
+ return { "com.sun.star.setup.UpdateCheckUI" };
}
sal_Bool SAL_CALL
@@ -891,35 +878,15 @@ void BubbleWindow::RecalcTextRects()
} // anonymous namespace
-static uno::Reference<uno::XInterface>
-createInstance(const uno::Reference<uno::XComponentContext>& xContext)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+extensions_update_UpdateCheckUI_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
SolarMutexGuard aGuard;
- return *new UpdateCheckUI(xContext);
+ return cppu::acquire(new UpdateCheckUI(context));
}
-const cppu::ImplementationEntry kImplementations_entries[] =
-{
- {
- createInstance,
- getImplementationName,
- getServiceNames,
- cppu::createSingleComponentFactory,
- nullptr,
- 0
- },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-} ;
-extern "C" SAL_DLLPUBLIC_EXPORT void * updchkui_component_getFactory(const char *pszImplementationName, void *pServiceManager, void *pRegistryKey)
-{
- return cppu::component_getFactoryHelper(
- pszImplementationName,
- pServiceManager,
- pRegistryKey,
- kImplementations_entries) ;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/ui/updchk.component b/extensions/source/update/ui/updchk.component
index 5b80c68310dd..19c7dd86e69d 100644
--- a/extensions/source/update/ui/updchk.component
+++ b/extensions/source/update/ui/updchk.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="updchkui" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="vnd.sun.UpdateCheckUI">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="vnd.sun.UpdateCheckUI"
+ constructor="extensions_update_UpdateCheckUI_get_implementation">
<service name="com.sun.star.setup.UpdateCheckUI"/>
</implementation>
</component>
commit dc1ba0e22be772724e8a1922fbdcdc58f4fc3472
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 23 16:02:52 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 23 19:58:17 2020 +0200
extensions/updatefeed: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: I1e0303f3fa6295de1f1970bcf8da1edbabb330d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99323
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/extensions/source/update/feed/updatefeed.component b/extensions/source/update/feed/updatefeed.component
index f53977ac5330..83e30a8c2455 100644
--- a/extensions/source/update/feed/updatefeed.component
+++ b/extensions/source/update/feed/updatefeed.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="updatefeed" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="vnd.sun.UpdateInformationProvider">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="vnd.sun.UpdateInformationProvider"
+ constructor="extensions_update_UpdateInformationProvider_get_implementation">
<service name="com.sun.star.deployment.UpdateInformationProvider"/>
</implementation>
</component>
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index 182c3ffa5483..08ca0429203b 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -120,11 +120,6 @@ class UpdateInformationProvider :
OUString getUserAgent(bool bExtended);
bool isUserAgentExtended() const;
public:
- static uno::Reference< uno::XInterface > createInstance(const uno::Reference<uno::XComponentContext>& xContext);
-
- static uno::Sequence< OUString > getServiceNames();
- static OUString getImplName();
-
uno::Reference< xml::dom::XElement > getDocumentRoot(const uno::Reference< xml::dom::XNode >& rxNode);
uno::Reference< xml::dom::XNode > getChildNode(const uno::Reference< xml::dom::XNode >& rxNode, const OUString& rName);
@@ -161,6 +156,11 @@ public:
virtual sal_Bool SAL_CALL supportsService(OUString const & serviceName) override;
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+ UpdateInformationProvider(const uno::Reference<uno::XComponentContext>& xContext,
+ const uno::Reference< ucb::XUniversalContentBroker >& xUniversalContentBroker,
+ const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder,
+ const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI);
+
protected:
virtual ~UpdateInformationProvider() override;
@@ -173,11 +173,6 @@ private:
void storeCommandInfo( sal_Int32 nCommandId,
uno::Reference< ucb::XCommandProcessor > const & rxCommandProcessor);
- UpdateInformationProvider(const uno::Reference<uno::XComponentContext>& xContext,
- const uno::Reference< ucb::XUniversalContentBroker >& xUniversalContentBroker,
- const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder,
- const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI);
-
const uno::Reference< uno::XComponentContext> m_xContext;
const uno::Reference< ucb::XUniversalContentBroker > m_xUniversalContentBroker;
@@ -394,22 +389,6 @@ uno::Sequence< beans::StringPair > SAL_CALL UpdateInformationProvider::getUserRe
return aPair;
};
-uno::Reference< uno::XInterface >
-UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentContext>& xContext)
-{
- uno::Reference< ucb::XUniversalContentBroker > xUniversalContentBroker =
- ucb::UniversalContentBroker::create(xContext);
-
- uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder(
- xml::dom::DocumentBuilder::create(xContext));
-
- uno::Reference< xml::xpath::XXPathAPI > xXPath = xml::xpath::XPathAPI::create( xContext );
-
- xXPath->registerNS( "atom", "http://www.w3.org/2005/Atom" );
-
- return *new UpdateInformationProvider(xContext, xUniversalContentBroker, xDocumentBuilder, xXPath);
-}
-
UpdateInformationProvider::~UpdateInformationProvider()
{
}
@@ -729,32 +708,18 @@ UpdateInformationProvider::getInteractionHandler()
}
-uno::Sequence< OUString >
-UpdateInformationProvider::getServiceNames()
-{
- uno::Sequence< OUString > aServiceList { "com.sun.star.deployment.UpdateInformationProvider" };
- return aServiceList;
-};
-
-
-OUString
-UpdateInformationProvider::getImplName()
-{
- return "vnd.sun.UpdateInformationProvider";
-}
-
OUString SAL_CALL
UpdateInformationProvider::getImplementationName()
{
- return getImplName();
+ return "vnd.sun.UpdateInformationProvider";
}
uno::Sequence< OUString > SAL_CALL
UpdateInformationProvider::getSupportedServiceNames()
{
- return getServiceNames();
+ return { "com.sun.star.deployment.UpdateInformationProvider" };
}
sal_Bool SAL_CALL
@@ -765,35 +730,23 @@ UpdateInformationProvider::supportsService( OUString const & serviceName )
} // anonymous namespace
-
-static uno::Reference<uno::XInterface>
-createInstance(uno::Reference<uno::XComponentContext> const & xContext)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+extensions_update_UpdateInformationProvider_get_implementation(
+ css::uno::XComponentContext* xContext , css::uno::Sequence<css::uno::Any> const&)
{
- return UpdateInformationProvider::createInstance(xContext);
-}
+ uno::Reference< ucb::XUniversalContentBroker > xUniversalContentBroker =
+ ucb::UniversalContentBroker::create(xContext);
+ uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder(
+ xml::dom::DocumentBuilder::create(xContext));
-const cppu::ImplementationEntry kImplementations_entries[] =
-{
- {
- createInstance,
- UpdateInformationProvider::getImplName,
- UpdateInformationProvider::getServiceNames,
- cppu::createSingleComponentFactory,
- nullptr,
- 0
- },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-} ;
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * updatefeed_component_getFactory(const char *pszImplementationName, void *pServiceManager, void *pRegistryKey)
-{
- return cppu::component_getFactoryHelper(
- pszImplementationName,
- pServiceManager,
- pRegistryKey,
- kImplementations_entries) ;
+ uno::Reference< xml::xpath::XXPathAPI > xXPath = xml::xpath::XPathAPI::create( xContext );
+
+ xXPath->registerNS( "atom", "http://www.w3.org/2005/Atom" );
+
+ return cppu::acquire(
+ new UpdateInformationProvider(xContext, xUniversalContentBroker, xDocumentBuilder, xXPath));
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list