[Libreoffice-commits] core.git: xmlsecurity/inc xmlsecurity/source xmlsecurity/util
Miklos Vajna
vmiklos at collabora.co.uk
Thu Mar 22 08:06:05 UTC 2018
xmlsecurity/inc/xmlsec/xmldocumentwrapper_xmlsecimpl.hxx | 12 -
xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx | 101 +++++-------
xmlsecurity/source/xmlsec/xsec_xmlsec.cxx | 9 -
xmlsecurity/util/xsec_xmlsec.component | 3
xmlsecurity/util/xsec_xmlsec.windows.component | 3
5 files changed, 50 insertions(+), 78 deletions(-)
New commits:
commit f3e8d0fb317090aade384784a1e16a8c8afe3437
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Mar 21 22:09:02 2018 +0100
xmlsecurity: create XMLDocumentWrapper instances with a constructor
Change-Id: I23bca00fb0fbcae92e73c4a106b08edd5caf5cf9
Reviewed-on: https://gerrit.libreoffice.org/51720
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/xmlsecurity/inc/xmlsec/xmldocumentwrapper_xmlsecimpl.hxx b/xmlsecurity/inc/xmlsec/xmldocumentwrapper_xmlsecimpl.hxx
index 3140ce93587b..f4e3a37f06ba 100644
--- a/xmlsecurity/inc/xmlsec/xmldocumentwrapper_xmlsecimpl.hxx
+++ b/xmlsecurity/inc/xmlsec/xmldocumentwrapper_xmlsecimpl.hxx
@@ -211,18 +211,6 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
};
-/// @throws css::uno::RuntimeException
-OUString XMLDocumentWrapper_XmlSecImpl_getImplementationName();
-
-/// @throws css::uno::RuntimeException
-css::uno::Sequence< OUString >
- XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames( );
-
-/// @throws css::uno::Exception
-css::uno::Reference< css::uno::XInterface >
-XMLDocumentWrapper_XmlSecImpl_createInstance(
- const css::uno::Reference< css::uno::XComponentContext > &);
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
index a03f62cb3379..b0d0835e8a81 100644
--- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
+++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
@@ -39,15 +39,13 @@
#define stricmp strcasecmp
#endif
-namespace cssu = com::sun::star::uno;
+using namespace com::sun::star;
namespace cssl = com::sun::star::lang;
namespace cssxc = com::sun::star::xml::crypto;
namespace cssxcsax = com::sun::star::xml::csax;
namespace cssxs = com::sun::star::xml::sax;
namespace cssxw = com::sun::star::xml::wrapper;
-#define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.XMLDocumentWrapper_XmlSecImpl"
-
#define STRXMLNS "xmlns"
/* used by the recursiveDelete method */
@@ -67,7 +65,7 @@ XMLDocumentWrapper_XmlSecImpl::XMLDocumentWrapper_XmlSecImpl()
/*
* creates the virtual root element
*/
- saxHelper.startElement("root", cssu::Sequence<cssxcsax::XMLAttribute>());
+ saxHelper.startElement("root", uno::Sequence<cssxcsax::XMLAttribute>());
m_pRootElement = saxHelper.getCurrentNode();
m_pCurrentElement = m_pRootElement;
@@ -165,8 +163,8 @@ void XMLDocumentWrapper_XmlSecImpl::getNextSAXEvent()
}
void XMLDocumentWrapper_XmlSecImpl::sendStartElement(
- const cssu::Reference< cssxs::XDocumentHandler >& xHandler,
- const cssu::Reference< cssxs::XDocumentHandler >& xHandler2,
+ const uno::Reference< cssxs::XDocumentHandler >& xHandler,
+ const uno::Reference< cssxs::XDocumentHandler >& xHandler2,
const xmlNodePtr pNode)
/****** XMLDocumentWrapper_XmlSecImpl/sendStartElement ************************
*
@@ -188,7 +186,7 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement(
******************************************************************************/
{
SvXMLAttributeList* pAttributeList = new SvXMLAttributeList();
- cssu::Reference < cssxs::XAttributeList > xAttrList(pAttributeList);
+ uno::Reference < cssxs::XAttributeList > xAttrList(pAttributeList);
xmlNsPtr pNsDef = pNode->nsDef;
@@ -253,8 +251,8 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement(
}
void XMLDocumentWrapper_XmlSecImpl::sendEndElement(
- const cssu::Reference< cssxs::XDocumentHandler >& xHandler,
- const cssu::Reference< cssxs::XDocumentHandler >& xHandler2,
+ const uno::Reference< cssxs::XDocumentHandler >& xHandler,
+ const uno::Reference< cssxs::XDocumentHandler >& xHandler2,
const xmlNodePtr pNode)
/****** XMLDocumentWrapper_XmlSecImpl/sendEndElement **************************
*
@@ -286,8 +284,8 @@ void XMLDocumentWrapper_XmlSecImpl::sendEndElement(
}
void XMLDocumentWrapper_XmlSecImpl::sendNode(
- const cssu::Reference< cssxs::XDocumentHandler >& xHandler,
- const cssu::Reference< cssxs::XDocumentHandler >& xHandler2,
+ const uno::Reference< cssxs::XDocumentHandler >& xHandler,
+ const uno::Reference< cssxs::XDocumentHandler >& xHandler2,
const xmlNodePtr pNode)
/****** XMLDocumentWrapper_XmlSecImpl/sendNode ********************************
*
@@ -366,7 +364,7 @@ OString XMLDocumentWrapper_XmlSecImpl::getNodeQName(const xmlNodePtr pNode)
return sNodeName;
}
-xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( const cssu::Reference< cssxw::XXMLElementWrapper >& xXMLElement)
+xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( const uno::Reference< cssxw::XXMLElementWrapper >& xXMLElement)
/****** XMLDocumentWrapper_XmlSecImpl/checkElement ****************************
*
* NAME
@@ -384,7 +382,7 @@ xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( const cssu::Reference< c
if (xXMLElement.is())
{
- cssu::Reference< cssl::XUnoTunnel > xNodTunnel( xXMLElement, cssu::UNO_QUERY_THROW ) ;
+ uno::Reference< cssl::XUnoTunnel > xNodTunnel( xXMLElement, uno::UNO_QUERY_THROW ) ;
XMLElementWrapper_XmlSecImpl* pElement
= reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(
sal::static_int_cast<sal_uIntPtr>(
@@ -392,7 +390,7 @@ xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( const cssu::Reference< c
XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))) ;
if( pElement == nullptr ) {
- throw cssu::RuntimeException() ;
+ throw uno::RuntimeException() ;
}
rc = pElement->getNativeElement();
@@ -465,7 +463,7 @@ sal_Int32 XMLDocumentWrapper_XmlSecImpl::recursiveDelete(
removeNode(pChild);
break;
default:
- throw cssu::RuntimeException();
+ throw uno::RuntimeException();
}
pChild = pNextSibling;
@@ -590,13 +588,13 @@ void XMLDocumentWrapper_XmlSecImpl::rebuildIDLink(xmlNodePtr pNode) const
}
/* XXMLDocumentWrapper */
-cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL XMLDocumentWrapper_XmlSecImpl::getCurrentElement( )
+uno::Reference< cssxw::XXMLElementWrapper > SAL_CALL XMLDocumentWrapper_XmlSecImpl::getCurrentElement( )
{
XMLElementWrapper_XmlSecImpl* pElement = new XMLElementWrapper_XmlSecImpl(m_pCurrentElement);
- return cssu::Reference< cssxw::XXMLElementWrapper >(pElement);
+ return uno::Reference< cssxw::XXMLElementWrapper >(pElement);
}
-void SAL_CALL XMLDocumentWrapper_XmlSecImpl::setCurrentElement( const cssu::Reference< cssxw::XXMLElementWrapper >& element )
+void SAL_CALL XMLDocumentWrapper_XmlSecImpl::setCurrentElement( const uno::Reference< cssxw::XXMLElementWrapper >& element )
{
m_pCurrentElement = checkElement( element );
saxHelper.setCurrentNode( m_pCurrentElement );
@@ -623,7 +621,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::removeCurrentElement( )
removeNode(pOldCurrentElement);
}
-sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::isCurrent( const cssu::Reference< cssxw::XXMLElementWrapper >& node )
+sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::isCurrent( const uno::Reference< cssxw::XXMLElementWrapper >& node )
{
xmlNodePtr pNode = checkElement(node);
return (pNode == m_pCurrentElement);
@@ -641,16 +639,16 @@ sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::isCurrentElementEmpty( )
return rc;
}
-OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getNodeName( const cssu::Reference< cssxw::XXMLElementWrapper >& node )
+OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getNodeName( const uno::Reference< cssxw::XXMLElementWrapper >& node )
{
xmlNodePtr pNode = checkElement(node);
return OUString::fromUtf8(reinterpret_cast<char const *>(pNode->name));
}
void SAL_CALL XMLDocumentWrapper_XmlSecImpl::clearUselessData(
- const cssu::Reference< cssxw::XXMLElementWrapper >& node,
- const cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > >& reservedDescendants,
- const cssu::Reference< cssxw::XXMLElementWrapper >& stopAtNode )
+ const uno::Reference< cssxw::XXMLElementWrapper >& node,
+ const uno::Sequence< uno::Reference< cssxw::XXMLElementWrapper > >& reservedDescendants,
+ const uno::Reference< cssxw::XXMLElementWrapper >& stopAtNode )
{
xmlNodePtr pTargetNode = checkElement(node);
@@ -663,7 +661,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::clearUselessData(
recursiveDelete(pTargetNode);
}
-void SAL_CALL XMLDocumentWrapper_XmlSecImpl::collapse( const cssu::Reference< cssxw::XXMLElementWrapper >& node )
+void SAL_CALL XMLDocumentWrapper_XmlSecImpl::collapse( const uno::Reference< cssxw::XXMLElementWrapper >& node )
{
xmlNodePtr pTargetNode = checkElement(node);
xmlNodePtr pParent;
@@ -681,7 +679,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::collapse( const cssu::Reference< cs
}
}
-void SAL_CALL XMLDocumentWrapper_XmlSecImpl::getTree( const cssu::Reference< cssxs::XDocumentHandler >& handler )
+void SAL_CALL XMLDocumentWrapper_XmlSecImpl::getTree( const uno::Reference< cssxs::XDocumentHandler >& handler )
{
if (m_pRootElement != nullptr)
{
@@ -721,10 +719,10 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::getTree( const cssu::Reference< css
}
void SAL_CALL XMLDocumentWrapper_XmlSecImpl::generateSAXEvents(
- const cssu::Reference< cssxs::XDocumentHandler >& handler,
- const cssu::Reference< cssxs::XDocumentHandler >& xEventKeeperHandler,
- const cssu::Reference< cssxw::XXMLElementWrapper >& startNode,
- const cssu::Reference< cssxw::XXMLElementWrapper >& endNode )
+ const uno::Reference< cssxs::XDocumentHandler >& handler,
+ const uno::Reference< cssxs::XDocumentHandler >& xEventKeeperHandler,
+ const uno::Reference< cssxw::XXMLElementWrapper >& startNode,
+ const uno::Reference< cssxw::XXMLElementWrapper >& endNode )
{
/*
* The first SAX event is the startElement of the startNode
@@ -747,9 +745,9 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::generateSAXEvents(
xmlNodePtr pEndNode = checkElement(endNode);
- cssu::Reference < cssxc::sax::XSAXEventKeeper > xSAXEventKeeper( xEventKeeperHandler, cssu::UNO_QUERY );
+ uno::Reference < cssxc::sax::XSAXEventKeeper > xSAXEventKeeper( xEventKeeperHandler, uno::UNO_QUERY );
- cssu::Reference< cssxs::XDocumentHandler > xHandler = handler;
+ uno::Reference< cssxs::XDocumentHandler > xHandler = handler;
while(true)
{
@@ -765,7 +763,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::generateSAXEvents(
sendNode(xHandler, xEventKeeperHandler, m_pCurrentElement);
break;
default:
- throw cssu::RuntimeException();
+ throw uno::RuntimeException();
}
if (xSAXEventKeeper->isBlocking())
@@ -813,10 +811,10 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::endDocument( )
{
}
-void SAL_CALL XMLDocumentWrapper_XmlSecImpl::startElement( const OUString& aName, const cssu::Reference< cssxs::XAttributeList >& xAttribs )
+void SAL_CALL XMLDocumentWrapper_XmlSecImpl::startElement( const OUString& aName, const uno::Reference< cssxs::XAttributeList >& xAttribs )
{
sal_Int32 nLength = xAttribs->getLength();
- cssu::Sequence< cssxcsax::XMLAttribute > aAttributes (nLength);
+ uno::Sequence< cssxcsax::XMLAttribute > aAttributes (nLength);
for (int i = 0; i < nLength; ++i)
{
@@ -848,7 +846,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::processingInstruction( const OUStri
saxHelper.processingInstruction(aTarget, aData);
}
-void SAL_CALL XMLDocumentWrapper_XmlSecImpl::setDocumentLocator( const cssu::Reference< cssxs::XLocator >& )
+void SAL_CALL XMLDocumentWrapper_XmlSecImpl::setDocumentLocator( const uno::Reference< cssxs::XLocator >& )
{
}
@@ -861,7 +859,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::compressedEndDocument( )
{
}
-void SAL_CALL XMLDocumentWrapper_XmlSecImpl::compressedStartElement( const OUString& aName, const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
+void SAL_CALL XMLDocumentWrapper_XmlSecImpl::compressedStartElement( const OUString& aName, const uno::Sequence< cssxcsax::XMLAttribute >& aAttributes )
{
saxHelper.startElement(aName, aAttributes);
m_pCurrentElement = saxHelper.getCurrentNode();
@@ -893,35 +891,28 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::compressedSetDocumentLocator( sal_I
{
}
-OUString XMLDocumentWrapper_XmlSecImpl_getImplementationName ()
+/* XServiceInfo */
+OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getImplementationName( )
{
- return OUString ( IMPLEMENTATION_NAME );
+ return OUString("com.sun.star.xml.wrapper.XMLDocumentWrapper");
}
-cssu::Sequence< OUString > XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames( )
+sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::supportsService( const OUString& rServiceName )
{
- cssu::Sequence<OUString> aRet { "com.sun.star.xml.wrapper.XMLDocumentWrapper" };
- return aRet;
+ return cppu::supportsService( this, rServiceName );
}
-cssu::Reference< cssu::XInterface > XMLDocumentWrapper_XmlSecImpl_createInstance(
- const cssu::Reference< cssu::XComponentContext > &)
+uno::Sequence< OUString > SAL_CALL XMLDocumentWrapper_XmlSecImpl::getSupportedServiceNames( )
{
- return static_cast<cppu::OWeakObject*>(new XMLDocumentWrapper_XmlSecImpl( ));
+ uno::Sequence<OUString> aRet{ "com.sun.star.xml.wrapper.XMLDocumentWrapper" };
+ return aRet;
}
-/* XServiceInfo */
-OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getImplementationName( )
-{
- return XMLDocumentWrapper_XmlSecImpl_getImplementationName();
-}
-sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::supportsService( const OUString& rServiceName )
-{
- return cppu::supportsService( this, rServiceName );
-}
-cssu::Sequence< OUString > SAL_CALL XMLDocumentWrapper_XmlSecImpl::getSupportedServiceNames( )
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+com_sun_star_xml_wrapper_XMLDocumentWrapper_get_implementation(
+ uno::XComponentContext* /*pCtx*/, uno::Sequence<uno::Any> const& /*rSeq*/)
{
- return XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames();
+ return cppu::acquire(new XMLDocumentWrapper_XmlSecImpl());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
index 371b500e6d5d..fe36fc3a5bd7 100644
--- a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
+++ b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
@@ -22,7 +22,6 @@
#include <cppuhelper/factory.hxx>
-#include <xmlsec/xmldocumentwrapper_xmlsecimpl.hxx>
#include "xsec_xmlsec.hxx"
#include <config_gpgme.h>
@@ -53,15 +52,7 @@ SAL_DLLPUBLIC_EXPORT void* xsec_xmlsec_component_getFactory( const sal_Char* pIm
{
xFactory = SEInitializerGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
}
- else
#endif
- if( XMLDocumentWrapper_XmlSecImpl_getImplementationName().equalsAscii( pImplName ) )
- {
- xFactory = cppu::createSingleComponentFactory(
- XMLDocumentWrapper_XmlSecImpl_createInstance,
- OUString::createFromAscii( pImplName ),
- XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames() );
- }
}
if( xFactory.is() ) {
diff --git a/xmlsecurity/util/xsec_xmlsec.component b/xmlsecurity/util/xsec_xmlsec.component
index d3fbf574482a..34ba5d18627f 100644
--- a/xmlsecurity/util/xsec_xmlsec.component
+++ b/xmlsecurity/util/xsec_xmlsec.component
@@ -29,7 +29,8 @@
<implementation name="com.sun.star.xml.security.bridge.xmlsec.SecurityEnvironment_NssImpl">
<service name="com.sun.star.xml.crypto.SecurityEnvironment"/>
</implementation>
- <implementation name="com.sun.star.xml.security.bridge.xmlsec.XMLDocumentWrapper_XmlSecImpl">
+ <implementation name="com.sun.star.xml.wrapper.XMLDocumentWrapper"
+ constructor="com_sun_star_xml_wrapper_XMLDocumentWrapper_get_implementation">
<service name="com.sun.star.xml.wrapper.XMLDocumentWrapper"/>
</implementation>
<implementation name="com.sun.star.xml.wrapper.XMLElementWrapper"
diff --git a/xmlsecurity/util/xsec_xmlsec.windows.component b/xmlsecurity/util/xsec_xmlsec.windows.component
index b01c61ca73ad..94a9629835c4 100644
--- a/xmlsecurity/util/xsec_xmlsec.windows.component
+++ b/xmlsecurity/util/xsec_xmlsec.windows.component
@@ -31,7 +31,8 @@
<implementation name="com.sun.star.xml.security.bridge.xmlsec.SecurityEnvironment_MSCryptImpl">
<service name="com.sun.star.xml.crypto.SecurityEnvironment"/>
</implementation>
- <implementation name="com.sun.star.xml.security.bridge.xmlsec.XMLDocumentWrapper_XmlSecImpl">
+ <implementation name="com.sun.star.xml.wrapper.XMLDocumentWrapper"
+ constructor="com_sun_star_xml_wrapper_XMLDocumentWrapper_get_implementation">
<service name="com.sun.star.xml.wrapper.XMLDocumentWrapper"/>
</implementation>
<implementation name="com.sun.star.xml.wrapper.XMLElementWrapper"
More information about the Libreoffice-commits
mailing list