summaryrefslogtreecommitdiff
path: root/unoxml/source/xpath
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-08 09:50:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-08 20:26:28 +0200
commitf4fc5dc31eeb728777104c9ece2788bcc4bdea89 (patch)
tree3d2be4743ac960bd6c5677e85e44b2e4ef284a07 /unoxml/source/xpath
parentd29a314300d523d29ed894f1822227497fcb68f8 (diff)
unoxml: create instances with uno constructors
See tdf#74608 for motivation Change-Id: I636d92faa3b26ac06c044c0485e632967daa709c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml/source/xpath')
-rw-r--r--unoxml/source/xpath/xpathapi.cxx34
-rw-r--r--unoxml/source/xpath/xpathapi.hxx15
2 files changed, 15 insertions, 34 deletions
diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index d36aa1164437..d6698c98a117 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -44,40 +44,23 @@ using namespace css::io;
using namespace css::uno;
using namespace css::xml::dom;
using namespace css::xml::xpath;
-using css::lang::XMultiServiceFactory;
namespace XPath
{
- // factory
- Reference< XInterface > CXPathAPI::_getInstance(const Reference< XMultiServiceFactory >& rSMgr)
- {
- return static_cast<XXPathAPI*>(new CXPathAPI(rSMgr));
- }
-
// ctor
- CXPathAPI::CXPathAPI(const Reference< XMultiServiceFactory >& rSMgr)
- : m_aFactory(rSMgr)
- {
- }
-
- OUString CXPathAPI::_getImplementationName()
- {
- return "com.sun.star.comp.xml.xpath.XPathAPI";
- }
-
- Sequence<OUString> CXPathAPI::_getSupportedServiceNames()
+ CXPathAPI::CXPathAPI(const Reference< XComponentContext >& rxContext)
+ : m_xContext(rxContext)
{
- return { "com.sun.star.xml.xpath.XPathAPI" };
}
Sequence< OUString > SAL_CALL CXPathAPI::getSupportedServiceNames()
{
- return CXPathAPI::_getSupportedServiceNames();
+ return { "com.sun.star.xml.xpath.XPathAPI" };
}
OUString SAL_CALL CXPathAPI::getImplementationName()
{
- return CXPathAPI::_getImplementationName();
+ return "com.sun.star.comp.xml.xpath.XPathAPI";
}
sal_Bool SAL_CALL CXPathAPI::supportsService(const OUString& aServiceName)
@@ -386,7 +369,7 @@ namespace XPath
// get extension from service manager
Reference< XXPathExtension > const xExtension(
- m_aFactory->createInstance(aName), UNO_QUERY_THROW);
+ m_xContext->getServiceManager()->createInstanceWithContext(aName, m_xContext), UNO_QUERY_THROW);
m_extensions.push_back(xExtension);
}
@@ -405,4 +388,11 @@ namespace XPath
}
}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+unoxml_CXPathAPI_get_implementation(
+ css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new XPath::CXPathAPI(context));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unoxml/source/xpath/xpathapi.hxx b/unoxml/source/xpath/xpathapi.hxx
index 77cf0dba7660..91d5c4b78750 100644
--- a/unoxml/source/xpath/xpathapi.hxx
+++ b/unoxml/source/xpath/xpathapi.hxx
@@ -37,7 +37,7 @@
#include <com/sun/star/xml/xpath/XXPathObject.hpp>
#include <com/sun/star/xml/xpath/XXPathExtension.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
namespace XPath
{
@@ -56,21 +56,12 @@ namespace XPath
private:
::osl::Mutex m_Mutex;
nsmap_t m_nsmap;
- const css::uno::Reference< css::lang::XMultiServiceFactory > m_aFactory;
+ const css::uno::Reference< css::uno::XComponentContext > m_xContext;
extensions_t m_extensions;
public:
// ctor
- explicit CXPathAPI(
- const css::uno::Reference< css::lang::XMultiServiceFactory >&
- rSMgr);
-
- // static helpers for service info and component management
- static OUString _getImplementationName();
- static css::uno::Sequence< OUString > _getSupportedServiceNames();
- static css::uno::Reference< XInterface > _getInstance(
- const css::uno::Reference< css::lang::XMultiServiceFactory >&
- rSMgr);
+ explicit CXPathAPI( const css::uno::Reference< css::uno::XComponentContext >& );
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;