diff options
-rw-r--r-- | desktop/source/deployment/misc/dp_descriptioninfoset.cxx | 10 | ||||
-rw-r--r-- | desktop/source/deployment/registry/dp_backenddb.cxx | 14 | ||||
-rw-r--r-- | desktop/source/migration/services/oo3extensionmigration.cxx | 7 | ||||
-rw-r--r-- | extensions/source/update/check/updateprotocol.cxx | 6 | ||||
-rw-r--r-- | extensions/source/update/feed/updatefeed.cxx | 12 | ||||
-rw-r--r-- | forms/source/xforms/computedexpression.cxx | 8 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 4 | ||||
-rw-r--r-- | offapi/com/sun/star/xml/xpath/XPathAPI.idl | 5 | ||||
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/meta/xmlmetai.cxx | 9 |
10 files changed, 23 insertions, 64 deletions
diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 75429e1423d4..dc7193fe4bcc 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -43,7 +43,7 @@ #include "com/sun/star/xml/dom/XNode.hpp" #include "com/sun/star/xml/dom/XNodeList.hpp" #include "com/sun/star/xml/dom/DocumentBuilder.hpp" -#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "com/sun/star/xml/xpath/XPathAPI.hpp" #include "com/sun/star/ucb/InteractiveIOException.hpp" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" @@ -349,14 +349,8 @@ DescriptionInfoset::DescriptionInfoset( m_context(context), m_element(element) { - css::uno::Reference< css::lang::XMultiComponentFactory > manager( - context->getServiceManager(), css::uno::UNO_QUERY_THROW); if (m_element.is()) { - m_xpath = css::uno::Reference< css::xml::xpath::XXPathAPI >( - manager->createInstanceWithContext( - "com.sun.star.xml.xpath.XPathAPI", - context), - css::uno::UNO_QUERY_THROW); + m_xpath = css::xml::xpath::XPathAPI::create(context); m_xpath->registerNS("desc", element->getNamespaceURI()); m_xpath->registerNS("xlink", "http://www.w3.org/1999/xlink"); } diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx index 140084457b3b..152a8f025279 100644 --- a/desktop/source/deployment/registry/dp_backenddb.cxx +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -25,7 +25,7 @@ #include "osl/file.hxx" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/xml/dom/DocumentBuilder.hpp" -#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "com/sun/star/xml/xpath/XPathAPI.hpp" #include "com/sun/star/io/XActiveDataSource.hpp" #include "com/sun/star/io/XActiveDataControl.hpp" #include "dp_ucb.h" @@ -111,17 +111,9 @@ Reference<css::xml::xpath::XXPathAPI> BackendDb::getXPathAPI() { if (!m_xpathApi.is()) { - m_xpathApi = Reference< css::xml::xpath::XXPathAPI >( - m_xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.xml.xpath.XPathAPI", - m_xContext), css::uno::UNO_QUERY); + m_xpathApi = css::xml::xpath::XPathAPI::create( m_xContext ); - if (!m_xpathApi.is()) - throw css::uno::RuntimeException( - " Could not create service com.sun.star.xml.xpath.XPathAPI", 0); - - m_xpathApi->registerNS( - getNSPrefix(), getDbNSName()); + m_xpathApi->registerNS( getNSPrefix(), getDbNSName() ); } return m_xpathApi; diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 023c4800cca4..a8f1f419cf20 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -36,7 +36,7 @@ #include <com/sun/star/ucb/TransferInfo.hpp> #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> -#include <com/sun/star/xml/xpath/XXPathAPI.hpp> +#include <com/sun/star/xml/xpath/XPathAPI.hpp> #include <com/sun/star/xml/dom/DocumentBuilder.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/deployment/ExtensionManager.hpp> @@ -228,10 +228,7 @@ bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescript uno::Reference< xml::dom::XElement > xRoot = xDoc->getDocumentElement(); if ( xRoot.is() && xRoot->getTagName() == "description" ) { - uno::Reference< xml::xpath::XXPathAPI > xPath( - m_ctx->getServiceManager()->createInstanceWithContext( "com.sun.star.xml.xpath.XPathAPI", - m_ctx), - uno::UNO_QUERY); + uno::Reference< xml::xpath::XXPathAPI > xPath = xml::xpath::XPathAPI::create(m_ctx); xPath->registerNS("desc", xRoot->getNamespaceURI()); xPath->registerNS("xlink", "http://www.w3.org/1999/xlink"); diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx index 989bf18e05f4..906cad094d70 100644 --- a/extensions/source/update/check/updateprotocol.cxx +++ b/extensions/source/update/check/updateprotocol.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/xml/xpath/XXPathAPI.hpp> +#include <com/sun/star/xml/xpath/XPathAPI.hpp> #include "updateprotocol.hxx" #include "updatecheckconfig.hxx" @@ -123,9 +123,7 @@ checkForUpdates( OSL_ASSERT( rxContext->getServiceManager().is() ); // XPath implementation - uno::Reference< xml::xpath::XXPathAPI > xXPath( - rxContext->getServiceManager()->createInstanceWithContext( UNISTRING( "com.sun.star.xml.xpath.XPathAPI" ), rxContext ), - uno::UNO_QUERY_THROW); + uno::Reference< xml::xpath::XXPathAPI > xXPath = xml::xpath::XPathAPI::create(rxContext); xXPath->registerNS( UNISTRING("inst"), UNISTRING("http://update.libreoffice.org/description") ); diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx index c2dfa99e6a86..7c514fd8d097 100644 --- a/extensions/source/update/feed/updatefeed.cxx +++ b/extensions/source/update/feed/updatefeed.cxx @@ -45,7 +45,7 @@ #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/task/PasswordContainerInteractionHandler.hpp> #include <com/sun/star/xml/dom/DocumentBuilder.hpp> -#include <com/sun/star/xml/xpath/XXPathAPI.hpp> +#include <com/sun/star/xml/xpath/XPathAPI.hpp> #include <rtl/ref.hxx> #include <rtl/bootstrap.hxx> @@ -391,21 +391,13 @@ UpdateInformationProvider::UpdateInformationProvider( uno::Reference< uno::XInterface > UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentContext>& xContext) { - uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING( "unable to obtain service manager from component context" ), - uno::Reference< uno::XInterface > ()); - 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( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.xml.xpath.XPathAPI" ), xContext ), - uno::UNO_QUERY_THROW); + uno::Reference< xml::xpath::XXPathAPI > xXPath = xml::xpath::XPathAPI::create( xContext ); xXPath->registerNS( UNISTRING("atom"), UNISTRING("http://www.w3.org/2005/Atom") ); diff --git a/forms/source/xforms/computedexpression.cxx b/forms/source/xforms/computedexpression.cxx index e6fa125aba22..9580d7ce958a 100644 --- a/forms/source/xforms/computedexpression.cxx +++ b/forms/source/xforms/computedexpression.cxx @@ -27,7 +27,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/xml/dom/NodeType.hpp> #include <com/sun/star/xml/dom/XNode.hpp> -#include <com/sun/star/xml/xpath/XXPathAPI.hpp> +#include <com/sun/star/xml/xpath/XPathAPI.hpp> #include <com/sun/star/xml/xpath/XXPathObject.hpp> #include <com/sun/star/xml/xpath/XXPathExtension.hpp> #include <com/sun/star/beans/NamedValue.hpp> @@ -45,6 +45,7 @@ using com::sun::star::lang::XInitialization; using com::sun::star::lang::XMultiServiceFactory; using com::sun::star::xml::dom::XNode; using com::sun::star::container::XNameContainer; +using com::sun::star::xml::xpath::XPathAPI; using com::sun::star::xml::xpath::XXPathAPI; using com::sun::star::xml::xpath::XXPathExtension; using com::sun::star::xml::xpath::XXPathObject; @@ -189,10 +190,7 @@ bool ComputedExpression::getBool( bool bDefault ) const Reference<XXPathAPI> ComputedExpression::_getXPathAPI(const xforms::EvaluationContext& aContext) { // create XPath API, then register namespaces - Reference<XXPathAPI> xXPath( createInstance( - "com.sun.star.xml.xpath.XPathAPI" ), - UNO_QUERY_THROW ); - OSL_ENSURE( xXPath.is(), "cannot get XPath API" ); + Reference<XXPathAPI> xXPath( XPathAPI::create( comphelper::getProcessComponentContext() ) ); // register xforms extension# Sequence< Any > aSequence(2); diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 6f848e27a86e..68cd560af255 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -368,6 +368,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/sax,\ Parser \ Writer \ )) +$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/xpath,\ + XPathAPI \ +)) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/xslt,\ XSLTTransformer \ XSLT2Transformer \ @@ -1539,7 +1542,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/wra XMLElementWrapper \ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/xpath,\ - XPathAPI \ XPathExtension \ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xsd,\ diff --git a/offapi/com/sun/star/xml/xpath/XPathAPI.idl b/offapi/com/sun/star/xml/xpath/XPathAPI.idl index 68aa6e5c0c90..694a07758e85 100644 --- a/offapi/com/sun/star/xml/xpath/XPathAPI.idl +++ b/offapi/com/sun/star/xml/xpath/XPathAPI.idl @@ -24,10 +24,7 @@ module com { module sun { module star { module xml { module xpath { - service XPathAPI - { - interface XXPathAPI; - }; +service XPathAPI : XXPathAPI; };};};};}; #endif diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index ae61ed75ed6a..eef17b72bab0 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -51,7 +51,7 @@ #include "com/sun/star/xml/dom/DocumentBuilder.hpp" #include "com/sun/star/xml/dom/XSAXDocumentBuilder.hpp" #include "com/sun/star/xml/dom/NodeType.hpp" -#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "com/sun/star/xml/xpath/XPathAPI.hpp" #include "com/sun/star/util/Date.hpp" #include "com/sun/star/util/Time.hpp" #include "com/sun/star/util/Duration.hpp" @@ -1144,15 +1144,7 @@ void SAL_CALL SfxDocumentMetaData::init( ::rtl::OUString( "SfxDocumentMetaData::init: no DOM tree given"), *this); - css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( - m_xContext->getServiceManager()); - css::uno::Reference<css::xml::xpath::XXPathAPI> xPath( - xMsf->createInstanceWithContext(::rtl::OUString( - "com.sun.star.xml.xpath.XPathAPI"), m_xContext), - css::uno::UNO_QUERY_THROW ); - if (!xPath.is()) throw css::uno::RuntimeException( - ::rtl::OUString("SfxDocumentMetaData::init:" - " cannot create XPathAPI service"), *this); + css::uno::Reference<css::xml::xpath::XXPathAPI> xPath = css::xml::xpath::XPathAPI::create(m_xContext); m_isInitialized = false; m_xDoc = i_xDoc; diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index af3362fc777b..bf9956298dde 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -21,7 +21,7 @@ #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp> #include <com/sun/star/xml/dom/XSAXDocumentBuilder2.hpp> -#include <com/sun/star/xml/xpath/XXPathAPI.hpp> +#include <com/sun/star/xml/xpath/XPathAPI.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <comphelper/processfactory.hxx> @@ -151,11 +151,8 @@ lcl_initGenerator(SvXMLImport & rImport, uno::Reference< xml::dom::XDocument > const xDoc(xDocBuilder->getDocument(), uno::UNO_SET_THROW); try { - uno::Reference< xml::xpath::XXPathAPI > const xPath( - rImport.getServiceFactory()->createInstance( - ::rtl::OUString( - "com.sun.star.xml.xpath.XPathAPI")), - uno::UNO_QUERY_THROW ); + uno::Reference< xml::xpath::XXPathAPI > const xPath = xml::xpath::XPathAPI::create( + comphelper::getComponentContext(rImport.getServiceFactory()) ); xPath->registerNS(GetXMLToken(XML_NP_OFFICE),GetXMLToken(XML_N_OFFICE)); xPath->registerNS(GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META)); |