diff options
author | Noel Grandin <noel@peralex.com> | 2013-01-30 09:41:42 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-02-11 08:02:14 +0200 |
commit | fa3c9a9072ae05ae6d03014eb55ad5f7d895d1fe (patch) | |
tree | d21e344db111fa7937326c388998b26d795c522a /forms | |
parent | fdo#46808, convert svt::GraphicAccess to XComponentContext (diff) | |
download | core-fa3c9a9072ae05ae6d03014eb55ad5f7d895d1fe.tar.gz core-fa3c9a9072ae05ae6d03014eb55ad5f7d895d1fe.zip |
fdo#46808, convert some forms code to XComponentContext
Change-Id: Id36556018761a1961de8ccfb3c549d4af03230ea
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/xforms/computedexpression.cxx | 14 | ||||
-rw-r--r-- | forms/source/xforms/submission.cxx | 5 | ||||
-rw-r--r-- | forms/source/xforms/submission.hxx | 2 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_app_xml.cxx | 18 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_app_xml.hxx | 4 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_urlencoded.cxx | 3 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_urlencoded.hxx | 2 |
7 files changed, 17 insertions, 31 deletions
diff --git a/forms/source/xforms/computedexpression.cxx b/forms/source/xforms/computedexpression.cxx index 362921c8808e..e6fa125aba22 100644 --- a/forms/source/xforms/computedexpression.cxx +++ b/forms/source/xforms/computedexpression.cxx @@ -40,9 +40,7 @@ using rtl::OUString; using com::sun::star::beans::NamedValue; -using com::sun::star::uno::Any; -using com::sun::star::uno::Reference; -using com::sun::star::uno::Sequence; +using namespace com::sun::star::uno; using com::sun::star::lang::XInitialization; using com::sun::star::lang::XMultiServiceFactory; using com::sun::star::xml::dom::XNode; @@ -50,9 +48,6 @@ using com::sun::star::container::XNameContainer; using com::sun::star::xml::xpath::XXPathAPI; using com::sun::star::xml::xpath::XXPathExtension; using com::sun::star::xml::xpath::XXPathObject; -using com::sun::star::uno::RuntimeException; -using com::sun::star::uno::Exception; -using com::sun::star::uno::UNO_QUERY_THROW; using com::sun::star::xml::xpath::XPathObjectType_XPATH_UNDEFINED; using com::sun::star::util::SearchOptions; using com::sun::star::util::SearchAlgorithms_REGEXP; @@ -208,9 +203,10 @@ Reference<XXPathAPI> ComputedExpression::_getXPathAPI(const xforms::EvaluationCo aValue.Name = "ContextNode"; aValue.Value <<= aContext.mxContextNode; aSequence[1] <<= aValue; - Reference<XMultiServiceFactory> aFactory = comphelper::getProcessServiceFactory(); - Reference< XXPathExtension > aExtension( aFactory->createInstanceWithArguments( - "com.sun.star.comp.xml.xpath.XFormsExtension", aSequence), UNO_QUERY_THROW); + Reference< XComponentContext > aComponentContext = comphelper::getProcessComponentContext(); + Reference< XXPathExtension > aExtension( + aComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.xml.xpath.XFormsExtension", aSequence, aComponentContext), + UNO_QUERY_THROW); xXPath->registerExtensionInstance(aExtension); // register namespaces diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index 305045b355a9..8cd3f09c09f4 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -99,8 +99,7 @@ Submission::Submission() : msCDataSectionElement(), msReplace( "none" ), msSeparator(), - msIncludeNamespacePrefixes(), - m_aFactory(comphelper::getProcessServiceFactory()) + msIncludeNamespacePrefixes() { initializePropertySet(); } @@ -653,7 +652,7 @@ Reference< XDocument > Submission::getInstanceDocument(const Reference< XXPathOb Reference< XDocumentFragment > Submission::createSubmissionDocument(const Reference< XXPathObject >& aObj, sal_Bool bRemoveWSNodes) { using namespace com::sun::star::xml::xpath; - Reference< XDocumentBuilder > aDocBuilder(DocumentBuilder::create(comphelper::getComponentContext(m_aFactory))); + Reference< XDocumentBuilder > aDocBuilder = DocumentBuilder::create(comphelper::getProcessComponentContext()); Reference< XDocument > aDocument = aDocBuilder->newDocument(); Reference< XDocumentFragment > aFragment = aDocument->createDocumentFragment(); diff --git a/forms/source/xforms/submission.hxx b/forms/source/xforms/submission.hxx index 3a94aa98fff7..f811ad2dd524 100644 --- a/forms/source/xforms/submission.hxx +++ b/forms/source/xforms/submission.hxx @@ -35,7 +35,6 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <computedexpression.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> // forward declaractions namespace com { namespace sun { namespace star { @@ -93,7 +92,6 @@ private: com::sun::star::uno::Reference< com::sun::star::xml::dom::XDocument > getInstanceDocument(const com::sun::star::uno::Reference< com::sun::star::xml::xpath::XXPathObject >& aObject); - com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > m_aFactory; public: Submission(); virtual ~Submission() throw(); diff --git a/forms/source/xforms/submission/serialization_app_xml.cxx b/forms/source/xforms/submission/serialization_app_xml.cxx index adae3781f6d2..775e4a819880 100644 --- a/forms/source/xforms/submission/serialization_app_xml.cxx +++ b/forms/source/xforms/submission/serialization_app_xml.cxx @@ -23,6 +23,7 @@ /** === begin UNO includes === **/ #include <com/sun/star/io/Pipe.hpp> +#include <com/sun/star/xml/dom/DocumentBuilder.hpp> #include <com/sun/star/xml/dom/XNode.hpp> #include <com/sun/star/xml/dom/XDocument.hpp> #include <com/sun/star/xml/dom/XNodeList.hpp> @@ -30,6 +31,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/xml/xpath/XPathObjectType.hpp> #include <com/sun/star/xml/sax/XSAXSerializable.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/beans/StringPair.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/xml/dom/XDocumentBuilder.hpp> @@ -49,6 +51,7 @@ using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::xml::dom::DocumentBuilder; using ::com::sun::star::xml::dom::XNode; using ::com::sun::star::xml::dom::XDocument; using ::com::sun::star::xml::sax::XSAXSerializable; @@ -57,12 +60,12 @@ using ::com::sun::star::io::XActiveDataSource; using ::com::sun::star::xml::dom::NodeType_DOCUMENT_NODE; using ::com::sun::star::xml::dom::NodeType_ELEMENT_NODE; using ::com::sun::star::xml::dom::XDocumentBuilder; +using ::com::sun::star::xml::sax::Writer; using ::com::sun::star::xml::sax::XDocumentHandler; /** === end UNO using === **/ CSerializationAppXML::CSerializationAppXML() - : m_xFactory(comphelper::getProcessServiceFactory()) - , m_xBuffer(CSS::io::Pipe::create(comphelper::getProcessComponentContext())) + : m_xBuffer(CSS::io::Pipe::create(comphelper::getProcessComponentContext())) { } @@ -93,8 +96,7 @@ CSerializationAppXML::serialize_node(const Reference< XNode >& rNode) "CSerializationAppXML::serialize_node: invalid node type!" ); // create a new document - Reference< XDocumentBuilder > const xDocBuilder( - m_xFactory->createInstance( "com.sun.star.xml.dom.DocumentBuilder" ), UNO_QUERY_THROW ); + Reference< XDocumentBuilder > const xDocBuilder = DocumentBuilder::create( comphelper::getProcessComponentContext() ); Reference< XDocument > const xDocument( xDocBuilder->newDocument(), UNO_SET_THROW ); // copy the to-be-serialized node @@ -109,13 +111,11 @@ CSerializationAppXML::serialize_node(const Reference< XNode >& rNode) "CSerializationAppXML::serialize_node: no serialization access to the node/document!" ); // create a SAXWriter to take the serialization events, and connect it to our pipe - Reference< XDocumentHandler > const xSaxWriter( - m_xFactory->createInstance( "com.sun.star.xml.sax.Writer" ), UNO_QUERY_THROW ); - Reference< XActiveDataSource > const xDataSource( xSaxWriter, UNO_QUERY_THROW ); - xDataSource->setOutputStream( Reference< CSS::io::XOutputStream >( m_xBuffer, UNO_QUERY_THROW) ); + Reference< CSS::xml::sax::XWriter > const xSaxWriter = Writer::create( comphelper::getProcessComponentContext() ); + xSaxWriter->setOutputStream( Reference< CSS::io::XOutputStream >( m_xBuffer, UNO_QUERY_THROW) ); // do the serialization - xSerializer->serialize( xSaxWriter, Sequence< StringPair >() ); + xSerializer->serialize( Reference< XDocumentHandler >(xSaxWriter, UNO_QUERY_THROW), Sequence< StringPair >() ); } catch( const Exception& ) { diff --git a/forms/source/xforms/submission/serialization_app_xml.hxx b/forms/source/xforms/submission/serialization_app_xml.hxx index 42e77bfd9f37..c7c173ac4692 100644 --- a/forms/source/xforms/submission/serialization_app_xml.hxx +++ b/forms/source/xforms/submission/serialization_app_xml.hxx @@ -21,16 +21,12 @@ #define __SERIALIZATION_APP_XML_HXX #include <com/sun/star/io/XPipe.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include "serialization.hxx" -#include <comphelper/componentcontext.hxx> - class CSerializationAppXML : public CSerialization { private: - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_xFactory; CSS::uno::Reference< CSS::io::XPipe > m_xBuffer; void serialize_node(const CSS::uno::Reference< CSS::xml::dom::XNode >& aNode); diff --git a/forms/source/xforms/submission/serialization_urlencoded.cxx b/forms/source/xforms/submission/serialization_urlencoded.cxx index 4e0cada58d00..fcf80c267112 100644 --- a/forms/source/xforms/submission/serialization_urlencoded.cxx +++ b/forms/source/xforms/submission/serialization_urlencoded.cxx @@ -40,8 +40,7 @@ using namespace CSS::xml::xpath; using namespace CSS::xml::dom; CSerializationURLEncoded::CSerializationURLEncoded() - : m_aFactory(comphelper::getProcessServiceFactory()) - , m_aPipe(Pipe::create(comphelper::getProcessComponentContext())) + : m_aPipe(Pipe::create(comphelper::getProcessComponentContext())) { } diff --git a/forms/source/xforms/submission/serialization_urlencoded.hxx b/forms/source/xforms/submission/serialization_urlencoded.hxx index 0421acf5d3e8..0eb58872597e 100644 --- a/forms/source/xforms/submission/serialization_urlencoded.hxx +++ b/forms/source/xforms/submission/serialization_urlencoded.hxx @@ -20,7 +20,6 @@ #ifndef __SERIALIZATION_URLENCODED_HXX #define __SERIALIZATION_URLENCODED_HXX -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/io/XPipe.hpp> #include <rtl/strbuf.hxx> @@ -30,7 +29,6 @@ class CSerializationURLEncoded : public CSerialization { private: - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; CSS::uno::Reference< CSS::io::XPipe > m_aPipe; sal_Bool is_unreserved(sal_Char); |