diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-10-02 11:38:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-10-02 11:38:58 +0100 |
commit | 446be18a3e6636f40f6ae2f6f8749e068f48aad3 (patch) | |
tree | 4662af40090e1e5af06d590fe36d712565a4a3fb /xmloff/source | |
parent | 9ad516a00cabba1383bc5c53b133ecc33b1c71ff (diff) |
make CppunitTest_sw_ww8export work again
revert xmloff portion of
commit 35e68754ec3cff30c5cdb665688a9b13f29dd439
Author: Noel Grandin <noel@peralex.com>
Date: Thu Oct 1 15:10:56 2015 +0200
loplugin:unusedmethods
Change-Id: I3d6f1300f4fae2af9e580d1d3b2c2c80fa9e9268
Reviewed-on: https://gerrit.libreoffice.org/19075
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Change-Id: I24aa3f113a77d93c789b063b3c099bf2038e1dad
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/core/DomExport.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/forms/elementimport.hxx | 15 | ||||
-rw-r--r-- | xmloff/source/forms/elementimport_impl.hxx | 67 |
3 files changed, 88 insertions, 0 deletions
diff --git a/xmloff/source/core/DomExport.cxx b/xmloff/source/core/DomExport.cxx index 450271858d19..ec55a174adc1 100644 --- a/xmloff/source/core/DomExport.cxx +++ b/xmloff/source/core/DomExport.cxx @@ -257,4 +257,10 @@ void exportDom( SvXMLExport& rExport, const Reference<XDocument>& xDocument ) visit( aDomExport, xDocument ); } +void exportDom( SvXMLExport& rExport, const Reference<XNode>& xNode ) +{ + DomExport aDomExport( rExport ); + visit( aDomExport, xNode ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/forms/elementimport.hxx b/xmloff/source/forms/elementimport.hxx index 0affa225123d..c74ba87ef0a5 100644 --- a/xmloff/source/forms/elementimport.hxx +++ b/xmloff/source/forms/elementimport.hxx @@ -572,7 +572,17 @@ namespace xmloff { } + // SvXMLImportContext overridables + virtual SvXMLImportContext* CreateChildContext( + sal_uInt16 _nPrefix, const OUString& _rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList); + virtual void EndElement(); + protected: + // OElementImport overridables + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + createElement(); + // create the child context for the given control type virtual SvXMLImportContext* implCreateControlWrapper( sal_uInt16 _nPrefix, const OUString& _rLocalName) = 0; @@ -595,6 +605,11 @@ namespace xmloff OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType); + + protected: + // OElementImport overridables + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + createElement(); }; //= OColumnWrapperImport diff --git a/xmloff/source/forms/elementimport_impl.hxx b/xmloff/source/forms/elementimport_impl.hxx index 16783673c19c..a9cfc99aa9c2 100644 --- a/xmloff/source/forms/elementimport_impl.hxx +++ b/xmloff/source/forms/elementimport_impl.hxx @@ -28,6 +28,58 @@ // no namespace. Same as above: this file is included from elementimport.hxx only, // and this is done inside the namespace +//= OContainerImport +template <class BASE> +inline SvXMLImportContext* OContainerImport< BASE >::CreateChildContext( + sal_uInt16 _nPrefix, const OUString& _rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) +{ + // maybe it's a sub control + if (_rLocalName == m_sWrapperElementName) + { + if (m_xMeAsContainer.is()) + return implCreateControlWrapper(_nPrefix, _rLocalName); + else + { + OSL_FAIL("OContainerImport::CreateChildContext: don't have an element!"); + return NULL; + } + } + + return BASE::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList); +} + +template <class BASE> +inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + OContainerImport< BASE >::createElement() +{ + // let the base class create the object + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReturn = BASE::createElement(); + if (!xReturn.is()) + return xReturn; + + // ensure that the object is a XNameContainer (we strongly need this for inserting child elements) + m_xMeAsContainer = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >(xReturn, ::com::sun::star::uno::UNO_QUERY); + if (!m_xMeAsContainer.is()) + { + OSL_FAIL("OContainerImport::createElement: invalid element (no XNameContainer) created!"); + xReturn.clear(); + } + + return xReturn; +} + +template <class BASE> +inline void OContainerImport< BASE >::EndElement() +{ + BASE::EndElement(); + + // now that we have all children, attach the events + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xIndexContainer(m_xMeAsContainer, ::com::sun::star::uno::UNO_QUERY); + if (xIndexContainer.is()) + ODefaultEventAttacherManager::setEvents(xIndexContainer); +} + //= OColumnImport template <class BASE> OColumnImport< BASE >::OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, @@ -39,4 +91,19 @@ OColumnImport< BASE >::OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventA OSL_ENSURE(m_xColumnFactory.is(), "OColumnImport::OColumnImport: invalid parent container (no factory)!"); } +// OElementImport overridables +template <class BASE> +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > OColumnImport< BASE >::createElement() +{ + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReturn; + // no call to the base class' method. We have to use the grid column factory + if (m_xColumnFactory.is()) + { + // create the column + xReturn = m_xColumnFactory->createColumn(this->m_sServiceName); + OSL_ENSURE(xReturn.is(), "OColumnImport::createElement: the factory returned an invalid object!"); + } + return xReturn; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |