diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-12 10:24:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-12 10:24:55 +0200 |
commit | fe1fd7c40caaa83fe2b86c9884dc1693d58741e7 (patch) | |
tree | fba9430a3b2c244eae076c03f11f5ecf16559c92 /xmloff/source | |
parent | 372f9801687cad620924b7ac6e4fe488ff998334 (diff) |
Improvement on previous commit
Change-Id: I51226f78ca60c32ebb908bcf4f74d38d0750eb00
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/chart/SchXMLImport.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/chart/contexts.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/chart/contexts.hxx | 3 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlimp.cxx | 20 | ||||
-rw-r--r-- | xmloff/source/meta/MetaImportComponent.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/meta/xmlmetai.cxx | 32 |
6 files changed, 25 insertions, 52 deletions
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index b3cd44db2240..ab0ae4dd5493 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -35,7 +35,6 @@ #include <tools/debug.hxx> #include <rtl/ustrbuf.hxx> -#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include "xmloff/xmlnmspe.hxx" #include <xmloff/xmltoken.hxx> @@ -57,7 +56,6 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> -#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp> #include <typeinfo> @@ -608,17 +606,14 @@ SvXMLImportContext *SchXMLImport::CreateContext( sal_uInt16 nPrefix, const OUStr GetModel(), uno::UNO_QUERY); // mst@: right now, this seems to be not supported, so it is untested if (xDPS.is()) { - uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( - xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()), - uno::UNO_QUERY_THROW); pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META)) ? new SvXMLMetaDocumentContext(*this, XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder) + xDPS->getDocumentProperties()) // flat OpenDocument file format : new SchXMLFlatDocContext_Impl( maImportHelper, *this, nPrefix, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); + xDPS->getDocumentProperties()); } else { pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META)) ? SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList ) diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx index 7b41a07aeaef..37eb7e2d4819 100644 --- a/xmloff/source/chart/contexts.cxx +++ b/xmloff/source/chart/contexts.cxx @@ -141,12 +141,11 @@ SchXMLFlatDocContext_Impl::SchXMLFlatDocContext_Impl( SchXMLImportHelper& i_rImpHelper, SchXMLImport& i_rImport, sal_uInt16 i_nPrefix, const ::rtl::OUString & i_rLName, - const uno::Reference<document::XDocumentProperties>& i_xDocProps, - const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) : + const uno::Reference<document::XDocumentProperties>& i_xDocProps) : SvXMLImportContext(i_rImport, i_nPrefix, i_rLName), SchXMLDocContext(i_rImpHelper, i_rImport, i_nPrefix, i_rLName), SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName, - i_xDocProps, i_xDocBuilder) + i_xDocProps) { } diff --git a/xmloff/source/chart/contexts.hxx b/xmloff/source/chart/contexts.hxx index 15fa75f01c0a..186c98f3838c 100644 --- a/xmloff/source/chart/contexts.hxx +++ b/xmloff/source/chart/contexts.hxx @@ -70,8 +70,7 @@ public: SchXMLImportHelper& i_rImpHelper, SchXMLImport& i_rImport, sal_uInt16 i_nPrefix, const ::rtl::OUString & i_rLName, - const com::sun::star::uno::Reference<com::sun::star::document::XDocumentProperties>& i_xDocProps, - const com::sun::star::uno::Reference<com::sun::star::xml::sax::XDocumentHandler>& i_xDocBuilder); + const com::sun::star::uno::Reference<com::sun::star::document::XDocumentProperties>& i_xDocProps); virtual ~SchXMLFlatDocContext_Impl(); diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index d581d8a121f7..01e4744b45aa 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -55,8 +55,6 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> -#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp> -#include <comphelper/componentcontext.hxx> using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -254,8 +252,7 @@ public: SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport, sal_uInt16 i_nPrefix, const OUString & i_rLName, const uno::Reference<xml::sax::XAttributeList>& i_xAttrList, - const uno::Reference<document::XDocumentProperties>& i_xDocProps, - const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder); + const uno::Reference<document::XDocumentProperties>& i_xDocProps); virtual ~SdXMLFlatDocContext_Impl(); @@ -267,12 +264,11 @@ public: SdXMLFlatDocContext_Impl::SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport, sal_uInt16 i_nPrefix, const OUString & i_rLName, const uno::Reference<xml::sax::XAttributeList>& i_xAttrList, - const uno::Reference<document::XDocumentProperties>& i_xDocProps, - const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) : + const uno::Reference<document::XDocumentProperties>& i_xDocProps) : SvXMLImportContext(i_rImport, i_nPrefix, i_rLName), SdXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList), SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName, - i_xDocProps, i_xDocBuilder) + i_xDocProps) { } @@ -733,14 +729,11 @@ SvXMLImportContext *SdXMLImport::CreateContext(sal_uInt16 nPrefix, pContext = CreateMetaContext(rLocalName, xAttrList); } else if ( (XML_NAMESPACE_OFFICE == nPrefix) && ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) { - uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( - xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()), - uno::UNO_QUERY_THROW); uno::Reference<document::XDocumentPropertiesSupplier> xDPS( GetModel(), uno::UNO_QUERY_THROW); // flat OpenDocument file format pContext = new SdXMLFlatDocContext_Impl( *this, nPrefix, rLocalName, - xAttrList, xDPS->getDocumentProperties(), xDocBuilder); + xAttrList, xDPS->getDocumentProperties()); } else { pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList); } @@ -757,16 +750,13 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName, if (getImportFlags() & IMPORT_META) { - uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( - xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()), - uno::UNO_QUERY_THROW); uno::Reference<document::XDocumentPropertiesSupplier> xDPS( GetModel(), uno::UNO_QUERY_THROW); uno::Reference<document::XDocumentProperties> const xDocProps( (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties()); pContext = new SvXMLMetaDocumentContext(*this, XML_NAMESPACE_OFFICE, rLocalName, - xDocProps, xDocBuilder); + xDocProps); } if(!pContext) diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx index 1acb47ea63c2..f2d66c7524b2 100644 --- a/xmloff/source/meta/MetaImportComponent.cxx +++ b/xmloff/source/meta/MetaImportComponent.cxx @@ -34,9 +34,6 @@ #include <xmloff/xmlmetai.hxx> #include <xmloff/nmspmap.hxx> -#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp> -#include <comphelper/componentcontext.hxx> - using namespace ::com::sun::star; using namespace ::xmloff::token; @@ -68,11 +65,8 @@ SvXMLImportContext* XMLMetaImportComponent::CreateContext( "XMLMetaImportComponent::CreateContext: setTargetDocument " "has not been called")), *this); } - uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( - xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()), - uno::UNO_QUERY_THROW); return new SvXMLMetaDocumentContext( - *this, nPrefix, rLocalName, mxDocProps, xDocBuilder); + *this, nPrefix, rLocalName, mxDocProps); } else { diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index 0a2a43ae2417..25b2c2c6805c 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -28,11 +28,12 @@ #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> -#include <com/sun/star/xml/dom/XSAXDocumentBuilder.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/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> - +#include <comphelper/processfactory.hxx> #include <xmloff/xmlmetai.hxx> #include <xmloff/xmlimp.hxx> #include <xmloff/nmspmap.hxx> @@ -53,7 +54,7 @@ class XMLDocumentBuilderContext : public SvXMLImportContext { private: ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XDocumentHandler> mxDocBuilder; + ::com::sun::star::xml::dom::XSAXDocumentBuilder2> mxDocBuilder; public: XMLDocumentBuilderContext(SvXMLImport& rImport, sal_uInt16 nPrfx, @@ -61,7 +62,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList, const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XDocumentHandler>& rDocBuilder); + ::com::sun::star::xml::dom::XSAXDocumentBuilder2>& rDocBuilder); virtual ~XMLDocumentBuilderContext(); @@ -81,7 +82,7 @@ public: XMLDocumentBuilderContext::XMLDocumentBuilderContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName, const uno::Reference<xml::sax::XAttributeList>&, - const uno::Reference<xml::sax::XDocumentHandler>& rDocBuilder) : + const uno::Reference<xml::dom::XSAXDocumentBuilder2>& rDocBuilder) : SvXMLImportContext( rImport, nPrfx, rLName ), mxDocBuilder(rDocBuilder) { @@ -124,13 +125,11 @@ void XMLDocumentBuilderContext::EndElement() static void lcl_initDocumentProperties(SvXMLImport & rImport, - uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder, + uno::Reference<xml::dom::XSAXDocumentBuilder2> const& xDocBuilder, uno::Reference<document::XDocumentProperties> const& xDocProps) { uno::Sequence< uno::Any > aSeq(1); - uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder, - uno::UNO_QUERY_THROW); - aSeq[0] <<= xDB->getDocument(); + aSeq[0] <<= xDocBuilder->getDocument(); uno::Reference< lang::XInitialization > const xInit(xDocProps, uno::UNO_QUERY_THROW); try { @@ -156,11 +155,9 @@ lcl_initDocumentProperties(SvXMLImport & rImport, static void lcl_initGenerator(SvXMLImport & rImport, - uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder) + uno::Reference<xml::dom::XSAXDocumentBuilder2> const& xDocBuilder) { - uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder, - uno::UNO_QUERY_THROW); - uno::Reference< xml::dom::XDocument > const xDoc(xDB->getDocument(), + uno::Reference< xml::dom::XDocument > const xDoc(xDocBuilder->getDocument(), uno::UNO_SET_THROW); try { uno::Reference< xml::xpath::XXPathAPI > const xPath( @@ -188,16 +185,15 @@ lcl_initGenerator(SvXMLImport & rImport, SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName, - const uno::Reference<document::XDocumentProperties>& xDocProps, - const uno::Reference<xml::sax::XDocumentHandler>& xDocBuilder) : + const uno::Reference<document::XDocumentProperties>& xDocProps) : SvXMLImportContext( rImport, nPrfx, rLName ), mxDocProps(xDocProps), - mxDocBuilder(xDocBuilder) + mxDocBuilder( + xml::dom::SAXDocumentBuilder::create( + comphelper::getProcessComponentContext())) { // #i103539#: must always read meta.xml for generator, xDocProps unwanted then // OSL_ENSURE(xDocProps.is(), "SvXMLMetaDocumentContext: no document props"); - OSL_ENSURE(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr"); - // here are no attributes } SvXMLMetaDocumentContext::~SvXMLMetaDocumentContext() |