diff options
Diffstat (limited to 'xmlsecurity/source/framework')
27 files changed, 1468 insertions, 1468 deletions
diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx index 2cf283cf5bc4..1ce46eb188a3 100644 --- a/xmlsecurity/source/framework/buffernode.cxx +++ b/xmlsecurity/source/framework/buffernode.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,42 +50,42 @@ bool BufferNode::isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const /****** BufferNode/isECOfBeforeModifyIncluded ******************************** * * NAME - * isECOfBeforeModifyIncluded -- checks whether there is some - * ElementCollector on this BufferNode, that has BEFORE-MODIFY priority. + * isECOfBeforeModifyIncluded -- checks whether there is some + * ElementCollector on this BufferNode, that has BEFORE-MODIFY priority. * * SYNOPSIS - * bExist = isECOfBeforeModifyIncluded(nIgnoredSecurityId); + * bExist = isECOfBeforeModifyIncluded(nIgnoredSecurityId); * * FUNCTION - * checks each ElementCollector on this BufferNode, if all following - * conditions are satisfied, then returns true: - * 1. the ElementCollector's priority is BEFOREMODIFY; - * 2. the ElementCollector's securityId can't be ignored. - * otherwise, returns false. + * checks each ElementCollector on this BufferNode, if all following + * conditions are satisfied, then returns true: + * 1. the ElementCollector's priority is BEFOREMODIFY; + * 2. the ElementCollector's securityId can't be ignored. + * otherwise, returns false. * * INPUTS - * nIgnoredSecurityId - the security Id to be ignored. If it equals - * to UNDEFINEDSECURITYID, then no security Id - * will be ignored. + * nIgnoredSecurityId - the security Id to be ignored. If it equals + * to UNDEFINEDSECURITYID, then no security Id + * will be ignored. * * RESULT - * bExist - true if a match found, false otherwise + * bExist - true if a match found, false otherwise * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { bool rc = false; std::vector< const ElementCollector* >::const_iterator ii = m_vElementCollectors.begin(); - for( ; ii != m_vElementCollectors.end() ; ++ii ) + for( ; ii != m_vElementCollectors.end() ; ++ii ) { ElementCollector* pElementCollector = (ElementCollector*)*ii; - + if ((nIgnoredSecurityId == cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID || pElementCollector->getSecurityId() != nIgnoredSecurityId) && (pElementCollector->getPriority() == cssxc::sax::ElementMarkPriority_BEFOREMODIFY)) @@ -94,7 +94,7 @@ bool BufferNode::isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const break; } } - + return rc; } @@ -102,28 +102,28 @@ void BufferNode::setReceivedAll() /****** BufferNode/setReceiveAll ********************************************* * * NAME - * setReceivedAll -- indicates that the element in this BufferNode has - * been compeletely bufferred. + * setReceivedAll -- indicates that the element in this BufferNode has + * been compeletely bufferred. * * SYNOPSIS - * setReceivedAll(); + * setReceivedAll(); * * FUNCTION - * sets the all-received flag and launches ElementCollector's notify - * process. + * sets the all-received flag and launches ElementCollector's notify + * process. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { m_bAllReceived = true; @@ -139,26 +139,26 @@ void BufferNode::addElementCollector(const ElementCollector* pElementCollector) /****** BufferNode/addElementCollector *************************************** * * NAME - * addElementCollector -- adds a new ElementCollector to this BufferNode. + * addElementCollector -- adds a new ElementCollector to this BufferNode. * * SYNOPSIS - * addElementCollector(pElementCollector); + * addElementCollector(pElementCollector); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pElementCollector - the ElementCollector to be added + * pElementCollector - the ElementCollector to be added * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { m_vElementCollectors.push_back( pElementCollector ); @@ -169,34 +169,34 @@ void BufferNode::removeElementCollector(const ElementCollector* pElementCollecto /****** BufferNode/removeElementCollector ************************************ * * NAME - * removeElementCollector -- removes an ElementCollector from this - * BufferNode. + * removeElementCollector -- removes an ElementCollector from this + * BufferNode. * * SYNOPSIS - * removeElementCollector(pElementCollector); + * removeElementCollector(pElementCollector); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pElementCollector - the ElementCollector to be removed + * pElementCollector - the ElementCollector to be removed * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { std::vector< const ElementCollector* >::iterator ii = m_vElementCollectors.begin(); - for( ; ii != m_vElementCollectors.end() ; ++ii ) + for( ; ii != m_vElementCollectors.end() ; ++ii ) { - if( *ii == pElementCollector ) + if( *ii == pElementCollector ) { m_vElementCollectors.erase( ii ); ((ElementCollector*)pElementCollector)->setBufferNode(NULL); @@ -214,34 +214,34 @@ void BufferNode::setBlocker(const ElementMark* pBlocker) /****** BufferNode/setBlocker ************************************************ * * NAME - * setBlocker -- adds a blocker to this BufferNode. + * setBlocker -- adds a blocker to this BufferNode. * * SYNOPSIS - * setBlocker(pBlocker); + * setBlocker(pBlocker); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pBlocker - the new blocker to be attached + * pBlocker - the new blocker to be attached * * RESULT - * empty + * empty * * NOTES - * Because there is only one blocker permited for a BufferNode, so the - * old blocker on this BufferNode, if there is one, will be overcasted. + * Because there is only one blocker permited for a BufferNode, so the + * old blocker on this BufferNode, if there is one, will be overcasted. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { OSL_ASSERT(!(m_pBlocker != NULL && pBlocker != NULL)); - + m_pBlocker = (ElementMark*)pBlocker; if (m_pBlocker != NULL) { @@ -253,32 +253,32 @@ rtl::OUString BufferNode::printChildren() const /****** BufferNode/printChildren ********************************************* * * NAME - * printChildren -- prints children information into a string. + * printChildren -- prints children information into a string. * * SYNOPSIS - * result = printChildren(); + * result = printChildren(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * empty + * empty * * RESULT - * result - the information string + * result - the information string * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ -{ +{ rtl::OUString rc; std::vector< const ElementCollector* >::const_iterator ii = m_vElementCollectors.begin(); - - for( ; ii != m_vElementCollectors.end() ; ++ii ) + + for( ; ii != m_vElementCollectors.end() ; ++ii ) { rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BufID=" )); rc += rtl::OUString::valueOf((*ii)->getBufferId()); @@ -287,9 +287,9 @@ rtl::OUString BufferNode::printChildren() const { rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[M]" )); } - + rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ",Pri=" )); - + switch (((ElementCollector*)(*ii))->getPriority()) { case cssxc::sax::ElementMarkPriority_BEFOREMODIFY: @@ -302,7 +302,7 @@ rtl::OUString BufferNode::printChildren() const rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UNKNOWN" )); break; } - + rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "(" )); /* if (((ElementCollector*)(*ii))->isInternalNotificationSuppressed()) @@ -315,7 +315,7 @@ rtl::OUString BufferNode::printChildren() const rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" )); rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " )); } - + return rc; } @@ -323,27 +323,27 @@ bool BufferNode::hasAnything() const /****** BufferNode/hasAnything *********************************************** * * NAME - * hasAnything -- checks whether there is any ElementCollector or blocker - * on this BufferNode. + * hasAnything -- checks whether there is any ElementCollector or blocker + * on this BufferNode. * * SYNOPSIS - * bExist = hasAnything(); + * bExist = hasAnything(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * empty + * empty * * RESULT - * bExist - true if there is, false otherwise. + * bExist - true if there is, false otherwise. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { return (m_pBlocker != NULL || m_vElementCollectors.size() > 0); @@ -353,27 +353,27 @@ bool BufferNode::hasChildren() const /****** BufferNode/hasChildren *********************************************** * * NAME - * hasChildren -- checks whether this BufferNode has any child - * BufferNode. + * hasChildren -- checks whether this BufferNode has any child + * BufferNode. * * SYNOPSIS - * bExist = hasChildren(); + * bExist = hasChildren(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * empty + * empty * * RESULT - * bExist - true if there is, false otherwise. + * bExist - true if there is, false otherwise. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { return (m_vChildren.size() > 0); @@ -388,36 +388,36 @@ const BufferNode* BufferNode::getFirstChild() const /****** BufferNode/getFirstChild ********************************************* * * NAME - * getFirstChild -- retrieves the first child BufferNode. + * getFirstChild -- retrieves the first child BufferNode. * * SYNOPSIS - * child = getFirstChild(); + * child = getFirstChild(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * empty + * empty * * RESULT - * child - the first child BufferNode, or NULL if there is no child - * BufferNode. + * child - the first child BufferNode, or NULL if there is no child + * BufferNode. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { BufferNode* rc = NULL; - + if (m_vChildren.size() > 0) { rc = (BufferNode*)m_vChildren.front(); } - + return (const BufferNode*)rc; } @@ -425,31 +425,31 @@ void BufferNode::addChild(const BufferNode* pChild, sal_Int32 nPosition) /****** BufferNode/addChild(pChild,nPosition) ******************************** * * NAME - * addChild -- inserts a child BufferNode at specific position. + * addChild -- inserts a child BufferNode at specific position. * * SYNOPSIS - * addChild(pChild, nPosition); + * addChild(pChild, nPosition); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pChild - the child BufferNode to be added. - * nPosition - the position where the new child locates. + * pChild - the child BufferNode to be added. + * nPosition - the position where the new child locates. * * RESULT - * empty + * empty * * NOTES - * If the nPosition is -1, then the new child BufferNode is appended - * at the end. + * If the nPosition is -1, then the new child BufferNode is appended + * at the end. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { if (nPosition == -1) @@ -468,29 +468,29 @@ void BufferNode::addChild(const BufferNode* pChild) /****** BufferNode/addChild() ************************************************ * * NAME - * addChild -- add a new child BufferNode. + * addChild -- add a new child BufferNode. * * SYNOPSIS - * addChild(pChild); + * addChild(pChild); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pChild - the child BufferNode to be added. + * pChild - the child BufferNode to be added. * * RESULT - * empty + * empty * * NOTES - * The new child BufferNode is appended at the end. + * The new child BufferNode is appended at the end. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { addChild(pChild, -1); @@ -500,33 +500,33 @@ void BufferNode::removeChild(const BufferNode* pChild) /****** BufferNode/removeChild *********************************************** * * NAME - * removeChild -- removes a child BufferNode from the children list. + * removeChild -- removes a child BufferNode from the children list. * * SYNOPSIS - * removeChild(pChild); + * removeChild(pChild); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pChild - the child BufferNode to be removed + * pChild - the child BufferNode to be removed * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { std::vector< const BufferNode* >::iterator ii = m_vChildren.begin(); - for( ; ii != m_vChildren.end() ; ++ii ) + for( ; ii != m_vChildren.end() ; ++ii ) { - if( *ii == pChild ) + if( *ii == pChild ) { m_vChildren.erase( ii ); break; @@ -538,49 +538,49 @@ sal_Int32 BufferNode::indexOfChild(const BufferNode* pChild) const /****** BufferNode/indexOfChild ********************************************** * * NAME - * indexOfChild -- gets the index of a child BufferNode. + * indexOfChild -- gets the index of a child BufferNode. * * SYNOPSIS - * index = indexOfChild(pChild); + * index = indexOfChild(pChild); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pChild - the child BufferNode whose index to be gotten + * pChild - the child BufferNode whose index to be gotten * * RESULT - * index - the index of that child BufferNode. If that child BufferNode - * is not found, -1 is returned. + * index - the index of that child BufferNode. If that child BufferNode + * is not found, -1 is returned. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { sal_Int32 nIndex = 0; bool bFound = false; - + std::vector< const BufferNode * >::const_iterator ii = m_vChildren.begin(); - for( ; ii != m_vChildren.end() ; ++ii ) + for( ; ii != m_vChildren.end() ; ++ii ) { - if( *ii == pChild ) + if( *ii == pChild ) { bFound = true; break; } nIndex++; } - + if (!bFound ) { nIndex = -1; } - + return nIndex; } @@ -588,36 +588,36 @@ const BufferNode* BufferNode::childAt(sal_Int32 nIndex) const /****** BufferNode/childAt *************************************************** * * NAME - * childAt -- retrieves the child BufferNode at specific possition. + * childAt -- retrieves the child BufferNode at specific possition. * * SYNOPSIS - * child = childAt(nIndex); + * child = childAt(nIndex); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * nIndex - the index of the child BufferNode to be retrieved + * nIndex - the index of the child BufferNode to be retrieved * * RESULT - * child - the child BufferNode at index position, or NULL if the index - * is out of the range of children. + * child - the child BufferNode at index position, or NULL if the index + * is out of the range of children. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { BufferNode* rc = NULL; - + if (nIndex < ((sal_Int32)m_vChildren.size()) && nIndex >= 0) { rc = (BufferNode*)m_vChildren[nIndex]; } - + return (const BufferNode*)rc; } @@ -635,35 +635,35 @@ const BufferNode* BufferNode::getNextSibling() const /****** BufferNode/getNextSibling ******************************************** * * NAME - * getNextSibling -- retrieves the next sibling BufferNode. + * getNextSibling -- retrieves the next sibling BufferNode. * * SYNOPSIS - * sibling = getNextSibling(); + * sibling = getNextSibling(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * empty + * empty * * RESULT - * sibling - the next sibling BufferNode, or NULL if there is none. + * sibling - the next sibling BufferNode, or NULL if there is none. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { BufferNode* rc = NULL; - + if (m_pParent != NULL) { rc = (BufferNode*)m_pParent->getNextChild(this); } - + return (const BufferNode*)rc; } @@ -671,46 +671,46 @@ const BufferNode* BufferNode::isAncestor(const BufferNode* pDescendant) const /****** BufferNode/isAncestor ************************************************ * * NAME - * isAncestor -- checks whether this BufferNode is an ancestor of another - * BufferNode. + * isAncestor -- checks whether this BufferNode is an ancestor of another + * BufferNode. * * SYNOPSIS - * bIs = isAncestor(pDescendant); + * bIs = isAncestor(pDescendant); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pDescendant - the BufferNode to be checked as a descendant + * pDescendant - the BufferNode to be checked as a descendant * * RESULT - * bIs - true if this BufferNode is an ancestor of the pDescendant, - * false otherwise. + * bIs - true if this BufferNode is an ancestor of the pDescendant, + * false otherwise. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { BufferNode* rc = NULL; - + if (pDescendant != NULL) { std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin(); - - for( ; ii != m_vChildren.end() ; ++ii ) + + for( ; ii != m_vChildren.end() ; ++ii ) { BufferNode* pChild = (BufferNode*)*ii; - + if (pChild == pDescendant) { rc = pChild; break; } - + if (pChild->isAncestor(pDescendant) != NULL) { rc = pChild; @@ -720,38 +720,38 @@ const BufferNode* BufferNode::isAncestor(const BufferNode* pDescendant) const } return (const BufferNode*)rc; -} +} bool BufferNode::isPrevious(const BufferNode* pFollowing) const /****** BufferNode/isPrevious ************************************************ * * NAME - * isPrevious -- checks whether this BufferNode is ahead of another - * BufferNode in the tree order. + * isPrevious -- checks whether this BufferNode is ahead of another + * BufferNode in the tree order. * * SYNOPSIS - * bIs = isPrevious(pFollowing); + * bIs = isPrevious(pFollowing); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pFollowing - the BufferNode to be checked as a following + * pFollowing - the BufferNode to be checked as a following * * RESULT - * bIs - true if this BufferNode is ahead in the tree order, false - * otherwise. + * bIs - true if this BufferNode is ahead in the tree order, false + * otherwise. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { bool rc = false; - + BufferNode* pNextBufferNode = (BufferNode*)getNextNodeByTreeOrder(); while (pNextBufferNode != NULL) { @@ -760,47 +760,47 @@ bool BufferNode::isPrevious(const BufferNode* pFollowing) const rc = true; break; } - + pNextBufferNode = (BufferNode*)(pNextBufferNode->getNextNodeByTreeOrder()); } - + return rc; -} +} const BufferNode* BufferNode::getNextNodeByTreeOrder() const /****** BufferNode/getNextNodeByTreeOrder ************************************ * * NAME - * getNextNodeByTreeOrder -- retrieves the next BufferNode in the tree - * order. + * getNextNodeByTreeOrder -- retrieves the next BufferNode in the tree + * order. * * SYNOPSIS - * next = getNextNodeByTreeOrder(); + * next = getNextNodeByTreeOrder(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * empty + * empty * * RESULT - * next - the BufferNode following this BufferNode in the tree order, - * or NULL if there is none. + * next - the BufferNode following this BufferNode in the tree order, + * or NULL if there is none. * * NOTES - * The "next" node in tree order is defined as: - * 1. If a node has children, then the first child is; - * 2. otherwise, if it has a following sibling, then this sibling node is; - * 3. otherwise, if it has a parent node, the the parent's next sibling - * node is; - * 4. otherwise, no "next" node exists. + * The "next" node in tree order is defined as: + * 1. If a node has children, then the first child is; + * 2. otherwise, if it has a following sibling, then this sibling node is; + * 3. otherwise, if it has a parent node, the the parent's next sibling + * node is; + * 4. otherwise, no "next" node exists. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { /* @@ -813,7 +813,7 @@ const BufferNode* BufferNode::getNextNodeByTreeOrder() const } /* - * Otherwise, it this buffer node has a following sibling, + * Otherwise, it this buffer node has a following sibling, * then return that sibling. */ BufferNode* pNextSibling = (BufferNode*)getNextSibling(); @@ -821,7 +821,7 @@ const BufferNode* BufferNode::getNextNodeByTreeOrder() const { return pNextSibling; } - + /* * Otherwise, it this buffer node has parent, then return * its parent's following sibling. @@ -829,23 +829,23 @@ const BufferNode* BufferNode::getNextNodeByTreeOrder() const BufferNode* pNode = (BufferNode*)this; BufferNode* pParent; BufferNode* pNextSiblingParent = NULL; - + do { if (pNode == NULL) { break; } - + pParent = (BufferNode*)pNode->getParent(); if (pParent != NULL) { pNextSiblingParent = (BufferNode*)pParent->getNextSibling(); } pNode = pParent; - + }while (pNextSiblingParent == NULL); - + return pNextSiblingParent; } @@ -857,38 +857,38 @@ cssu::Reference< cssxw::XXMLElementWrapper > BufferNode::getXMLElement() const void BufferNode::setXMLElement( const cssu::Reference< cssxw::XXMLElementWrapper >& xXMLElement ) { m_xXMLElement = xXMLElement; -} +} void BufferNode::notifyBranch() /****** BufferNode/notifyBranch ********************************************** * * NAME - * notifyBranch -- notifies each BufferNode in the branch of this - * BufferNode in the tree order. + * notifyBranch -- notifies each BufferNode in the branch of this + * BufferNode in the tree order. * * SYNOPSIS - * notifyBranch(); + * notifyBranch(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin(); - for( ; ii != m_vChildren.end() ; ++ii ) + for( ; ii != m_vChildren.end() ; ++ii ) { BufferNode* pBufferNode = (BufferNode*)*ii; pBufferNode->elementCollectorNotify(); @@ -900,27 +900,27 @@ void BufferNode::notifyAncestor() /****** BufferNode/notifyAncestor ******************************************** * * NAME - * notifyAncestor -- notifies each ancestor BufferNode through the parent - * link. + * notifyAncestor -- notifies each ancestor BufferNode through the parent + * link. * * SYNOPSIS - * notifyAncestor(); + * notifyAncestor(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { BufferNode* pParent = m_pParent; @@ -935,39 +935,39 @@ void BufferNode::elementCollectorNotify() /****** BufferNode/elementCollectorNotify ************************************ * * NAME - * elementCollectorNotify -- notifies this BufferNode. + * elementCollectorNotify -- notifies this BufferNode. * * SYNOPSIS - * elementCollectorNotify(); + * elementCollectorNotify(); * * FUNCTION - * Notifies this BufferNode if the notification is not suppressed. + * Notifies this BufferNode if the notification is not suppressed. * * INPUTS - * empty + * empty * * RESULT - * child - the first child BufferNode, or NULL if there is no child - * BufferNode. + * child - the first child BufferNode, or NULL if there is no child + * BufferNode. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { if (m_vElementCollectors.size()>0) { cssxc::sax::ElementMarkPriority nMaxPriority = cssxc::sax::ElementMarkPriority_MINIMUM; cssxc::sax::ElementMarkPriority nPriority; - + /* * get the max priority among ElementCollectors on this BufferNode */ std::vector< const ElementCollector* >::const_iterator ii = m_vElementCollectors.begin(); - for( ; ii != m_vElementCollectors.end() ; ++ii ) + for( ; ii != m_vElementCollectors.end() ; ++ii ) { ElementCollector* pElementCollector = (ElementCollector*)*ii; nPriority = pElementCollector->getPriority(); @@ -976,16 +976,16 @@ void BufferNode::elementCollectorNotify() nMaxPriority = nPriority; } } - + std::vector< const ElementCollector* > vElementCollectors( m_vElementCollectors ); ii = vElementCollectors.begin(); - - for( ; ii != vElementCollectors.end() ; ++ii ) + + for( ; ii != vElementCollectors.end() ; ++ii ) { ElementCollector* pElementCollector = (ElementCollector*)*ii; nPriority = pElementCollector->getPriority(); bool bToModify = pElementCollector->getModify(); - + /* * Only ElementCollector with the max priority can * perform notify operation. @@ -1007,7 +1007,7 @@ void BufferNode::elementCollectorNotify() * will destroy the bufferred element, in turn, ElementCollectors * mentioned above can't perform their mission. */ - //if (!(nMaxPriority == cssxc::sax::ElementMarkPriority_PRI_MODIFY && + //if (!(nMaxPriority == cssxc::sax::ElementMarkPriority_PRI_MODIFY && if (!(bToModify && (isECInSubTreeIncluded(pElementCollector->getSecurityId()) || isECOfBeforeModifyInAncestorIncluded(pElementCollector->getSecurityId())) @@ -1024,38 +1024,38 @@ bool BufferNode::isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const /****** BufferNode/isECInSubTreeIncluded ************************************* * * NAME - * isECInSubTreeIncluded -- checks whether there is any ElementCollector - * in the branch of this BufferNode. + * isECInSubTreeIncluded -- checks whether there is any ElementCollector + * in the branch of this BufferNode. * * SYNOPSIS - * bExist = isECInSubTreeIncluded(nIgnoredSecurityId); + * bExist = isECInSubTreeIncluded(nIgnoredSecurityId); * * FUNCTION - * checks each BufferNode in the branch of this BufferNode, if there is - * an ElementCollector whose signatureId is not ignored, then return - * true, otherwise, false returned. + * checks each BufferNode in the branch of this BufferNode, if there is + * an ElementCollector whose signatureId is not ignored, then return + * true, otherwise, false returned. * * INPUTS - * nIgnoredSecurityId - the security Id to be ignored. If it equals - * to UNDEFINEDSECURITYID, then no security Id - * will be ignored. + * nIgnoredSecurityId - the security Id to be ignored. If it equals + * to UNDEFINEDSECURITYID, then no security Id + * will be ignored. * * RESULT - * bExist - true if a match found, false otherwise. + * bExist - true if a match found, false otherwise. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { bool rc = false; - + std::vector< const ElementCollector* >::const_iterator jj = m_vElementCollectors.begin(); - - for( ; jj != m_vElementCollectors.end() ; ++jj ) + + for( ; jj != m_vElementCollectors.end() ; ++jj ) { ElementCollector* pElementCollector = (ElementCollector*)*jj; if (nIgnoredSecurityId == cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID || @@ -1065,15 +1065,15 @@ bool BufferNode::isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const break; } } - + if ( !rc ) { std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin(); - - for( ; ii != m_vChildren.end() ; ++ii ) + + for( ; ii != m_vChildren.end() ; ++ii ) { BufferNode* pBufferNode = (BufferNode*)*ii; - + if ( pBufferNode->isECInSubTreeIncluded(nIgnoredSecurityId)) { rc = true; @@ -1081,7 +1081,7 @@ bool BufferNode::isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const } } } - + return rc; } @@ -1089,37 +1089,37 @@ bool BufferNode::isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurity /****** BufferNode/isECOfBeforeModifyInAncestorIncluded ********************** * * NAME - * isECOfBeforeModifyInAncestorIncluded -- checks whether there is some - * ancestor BufferNode which has ElementCollector with PRI_BEFPREMODIFY - * priority. + * isECOfBeforeModifyInAncestorIncluded -- checks whether there is some + * ancestor BufferNode which has ElementCollector with PRI_BEFPREMODIFY + * priority. * * SYNOPSIS - * bExist = isECOfBeforeModifyInAncestorIncluded(nIgnoredSecurityId); + * bExist = isECOfBeforeModifyInAncestorIncluded(nIgnoredSecurityId); * * FUNCTION - * checks each ancestor BufferNode through the parent link, if there is - * an ElementCollector with PRI_BEFPREMODIFY priority and its - * signatureId is not ignored, then return true, otherwise, false - * returned. + * checks each ancestor BufferNode through the parent link, if there is + * an ElementCollector with PRI_BEFPREMODIFY priority and its + * signatureId is not ignored, then return true, otherwise, false + * returned. * * INPUTS - * nIgnoredSecurityId - the security Id to be ignored. If it equals - * to UNDEFINEDSECURITYID, then no security Id - * will be ignored. + * nIgnoredSecurityId - the security Id to be ignored. If it equals + * to UNDEFINEDSECURITYID, then no security Id + * will be ignored. * * RESULT - * bExist - true if a match found, false otherwise. + * bExist - true if a match found, false otherwise. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { bool rc = false; - + BufferNode* pParentNode = m_pParent; while (pParentNode != NULL) { @@ -1128,10 +1128,10 @@ bool BufferNode::isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurity rc = true; break; } - + pParentNode = (BufferNode*)pParentNode->getParent(); } - + return rc; } @@ -1139,57 +1139,57 @@ bool BufferNode::isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const /****** BufferNode/isBlockerInSubTreeIncluded ******************************** * * NAME - * isBlockerInSubTreeIncluded -- checks whether there is some BufferNode - * which has blocker on it + * isBlockerInSubTreeIncluded -- checks whether there is some BufferNode + * which has blocker on it * * SYNOPSIS - * bExist = isBlockerInSubTreeIncluded(nIgnoredSecurityId); + * bExist = isBlockerInSubTreeIncluded(nIgnoredSecurityId); * * FUNCTION - * checks each BufferNode in the branch of this BufferNode, if one has - * a blocker on it, and the blocker's securityId is not ignored, then - * returns true; otherwise, false returns. + * checks each BufferNode in the branch of this BufferNode, if one has + * a blocker on it, and the blocker's securityId is not ignored, then + * returns true; otherwise, false returns. * * INPUTS - * nIgnoredSecurityId - the security Id to be ignored. If it equals - * to UNDEFINEDSECURITYID, then no security Id - * will be ignored. + * nIgnoredSecurityId - the security Id to be ignored. If it equals + * to UNDEFINEDSECURITYID, then no security Id + * will be ignored. * * RESULT - * bExist - true if a match found, false otherwise. + * bExist - true if a match found, false otherwise. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { bool rc = false; - + std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin(); - for( ; ii != m_vChildren.end() ; ++ii ) + for( ; ii != m_vChildren.end() ; ++ii ) { BufferNode* pBufferNode = (BufferNode*)*ii; ElementMark* pBlocker = pBufferNode->getBlocker(); - + if (pBlocker != NULL && (nIgnoredSecurityId == cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID || - pBlocker->getSecurityId() != nIgnoredSecurityId )) + pBlocker->getSecurityId() != nIgnoredSecurityId )) { rc = true; break; } - + if (rc || pBufferNode->isBlockerInSubTreeIncluded(nIgnoredSecurityId)) { rc = true; break; } } - + return rc; } @@ -1197,47 +1197,47 @@ const BufferNode* BufferNode::getNextChild(const BufferNode* pChild) const /****** BufferNode/getNextChild ********************************************** * * NAME - * getNextChild -- get the next child BufferNode. + * getNextChild -- get the next child BufferNode. * * SYNOPSIS - * nextChild = getNextChild(); + * nextChild = getNextChild(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * pChild - the child BufferNode whose next node is retrieved. + * pChild - the child BufferNode whose next node is retrieved. * * RESULT - * nextChild - the next child BufferNode after the pChild, or NULL if - * there is none. + * nextChild - the next child BufferNode after the pChild, or NULL if + * there is none. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { BufferNode* rc = NULL; bool bChildFound = false; - + std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin(); - for( ; ii != m_vChildren.end() ; ++ii ) + for( ; ii != m_vChildren.end() ; ++ii ) { if (bChildFound) { rc = (BufferNode*)*ii; break; } - - if( *ii == pChild ) + + if( *ii == pChild ) { bChildFound = true; } } - + return (const BufferNode*)rc; } @@ -1246,36 +1246,36 @@ void BufferNode::freeAllChildren() /****** BufferNode/freeAllChildren ******************************************* * * NAME - * freeAllChildren -- free all his child BufferNode. + * freeAllChildren -- free all his child BufferNode. * * SYNOPSIS - * freeAllChildren(); + * freeAllChildren(); * * FUNCTION - * see NAME + * see NAME * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 30.03.2004 - the correct the memory leak bug + * 30.03.2004 - the correct the memory leak bug * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin(); - for( ; ii != m_vChildren.end() ; ++ii ) + for( ; ii != m_vChildren.end() ; ++ii ) { BufferNode *pChild = (BufferNode *)(*ii); pChild->freeAllChildren(); delete pChild; } - + m_vChildren.clear(); } diff --git a/xmlsecurity/source/framework/buffernode.hxx b/xmlsecurity/source/framework/buffernode.hxx index cb6d596edecc..3cb103524a51 100644 --- a/xmlsecurity/source/framework/buffernode.hxx +++ b/xmlsecurity/source/framework/buffernode.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,63 +44,63 @@ class BufferNode /****** buffernode.hxx/CLASS BufferNode *************************************** * * NAME - * BufferNode -- Class to maintain the tree of bufferred elements + * BufferNode -- Class to maintain the tree of bufferred elements * * FUNCTION - * One BufferNode object represents a bufferred element in the document - * wrapper component. - * All BufferNode objects construct a tree which has the same structure - * of all bufferred elements. That is to say, if one bufferred element is - * an ancestor of another bufferred element, then the corresponding - * BufferNode objects are also in ancestor/descendant relationship. - * This class is used to manipulate the tree of bufferred elements. + * One BufferNode object represents a bufferred element in the document + * wrapper component. + * All BufferNode objects construct a tree which has the same structure + * of all bufferred elements. That is to say, if one bufferred element is + * an ancestor of another bufferred element, then the corresponding + * BufferNode objects are also in ancestor/descendant relationship. + * This class is used to manipulate the tree of bufferred elements. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { private: /* the parent BufferNode */ BufferNode* m_pParent; - + /* all child BufferNodes */ - std::vector< const BufferNode* > m_vChildren; - + std::vector< const BufferNode* > m_vChildren; + /* all ElementCollector holding this BufferNode */ std::vector< const ElementCollector* > m_vElementCollectors; - + /* * the blocker holding this BufferNode, one BufferNode can have one * blocker at most */ ElementMark* m_pBlocker; - + /* * whether the element has completely bufferred by the document wrapper * component */ bool m_bAllReceived; - + /* the XMLElementWrapper of the bufferred element */ com::sun::star::uno::Reference< com::sun::star::xml::wrapper::XXMLElementWrapper > m_xXMLElement; -private: +private: bool isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const; bool isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId) const; bool isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const; const BufferNode* getNextChild(const BufferNode* pChild) const; - + public: explicit BufferNode( const com::sun::star::uno::Reference< com::sun::star::xml::wrapper::XXMLElementWrapper >& xXMLElement); virtual ~BufferNode() {}; - + bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const; void setReceivedAll(); bool isAllReceived() const; diff --git a/xmlsecurity/source/framework/decryptorimpl.cxx b/xmlsecurity/source/framework/decryptorimpl.cxx index a2636f61cdf1..6201920d04c5 100644 --- a/xmlsecurity/source/framework/decryptorimpl.cxx +++ b/xmlsecurity/source/framework/decryptorimpl.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ namespace cssxw = com::sun::star::xml::wrapper; #define SERVICE_NAME "com.sun.star.xml.crypto.sax.Decryptor" #define IMPLEMENTATION_NAME "com.sun.star.xml.security.framework.DecryptorImpl" -#define DECLARE_ASCII( SASCIIVALUE ) \ +#define DECLARE_ASCII( SASCIIVALUE ) \ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) DecryptorImpl::DecryptorImpl( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF) @@ -58,28 +58,28 @@ bool DecryptorImpl::checkReady() const /****** DecryptorImpl/checkReady ********************************************* * * NAME - * checkReady -- checks the conditions for the decryption. + * checkReady -- checks the conditions for the decryption. * * SYNOPSIS - * bReady = checkReady( ); + * bReady = checkReady( ); * * FUNCTION - * checks whether all following conditions are satisfied: - * 1. the result listener is ready; - * 2. the EncryptionEngine is ready. + * checks whether all following conditions are satisfied: + * 1. the result listener is ready; + * 2. the EncryptionEngine is ready. * * INPUTS - * empty + * empty * * RESULT - * bReady - true if all conditions are satisfied, false otherwise + * bReady - true if all conditions are satisfied, false otherwise * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { return (m_xResultListener.is() && EncryptionEngine::checkReady()); @@ -90,64 +90,64 @@ void DecryptorImpl::notifyResultListener() const /****** DecryptorImpl/notifyResultListener *********************************** * * NAME - * notifyResultListener -- notifies the listener about the decryption - * result. + * notifyResultListener -- notifies the listener about the decryption + * result. * * SYNOPSIS - * notifyResultListener( ); + * notifyResultListener( ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference< cssxc::sax::XDecryptionResultListener > xDecryptionResultListener ( m_xResultListener , cssu::UNO_QUERY ) ; - + xDecryptionResultListener->decrypted(m_nSecurityId,m_nStatus); } -void DecryptorImpl::startEngine( const cssu::Reference< +void DecryptorImpl::startEngine( const cssu::Reference< cssxc::XXMLEncryptionTemplate >& xEncryptionTemplate) throw (cssu::Exception, cssu::RuntimeException) /****** DecryptorImpl/startEngine ******************************************** * * NAME - * startEngine -- decrypts the encryption. + * startEngine -- decrypts the encryption. * * SYNOPSIS - * startEngine( xEncryptionTemplate ); + * startEngine( xEncryptionTemplate ); * * FUNCTION - * decrypts the encryption element, then if succeeds, updates the link - * of old template element to the new encryption element in - * SAXEventKeeper. + * decrypts the encryption element, then if succeeds, updates the link + * of old template element to the new encryption element in + * SAXEventKeeper. * * INPUTS - * xEncryptionTemplate - the encryption template to be decrypted. + * xEncryptionTemplate - the encryption template to be decrypted. * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference< cssxc::XXMLEncryptionTemplate > xResultTemplate; @@ -160,7 +160,7 @@ void DecryptorImpl::startEngine( const cssu::Reference< { m_nStatus = cssxc::SecurityOperationStatus_RUNTIMEERROR_FAILED; } - + if (m_nStatus == cssxc::SecurityOperationStatus_OPERATION_SUCCEEDED) { cssu::Reference< cssxw::XXMLElementWrapper > xDecryptedElement @@ -168,7 +168,7 @@ void DecryptorImpl::startEngine( const cssu::Reference< m_xSAXEventKeeper->setElement(m_nIdOfTemplateEC, xDecryptedElement); } } - + /* XDecryptionResultBroadcaster */ void SAL_CALL DecryptorImpl::addDecryptionResultListener( const cssu::Reference< cssxc::sax::XDecryptionResultListener >& listener ) throw (cssu::Exception, cssu::RuntimeException) @@ -183,13 +183,13 @@ void SAL_CALL DecryptorImpl::removeDecryptionResultListener( const cssu::Referen } /* XInitialization */ -void SAL_CALL DecryptorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments ) +void SAL_CALL DecryptorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments ) throw (cssu::Exception, cssu::RuntimeException) { OSL_ASSERT(aArguments.getLength() == 5); - + rtl::OUString ouTempString; - + aArguments[0] >>= ouTempString; m_nSecurityId = ouTempString.toInt32(); aArguments[1] >>= m_xSAXEventKeeper; @@ -205,13 +205,13 @@ rtl::OUString DecryptorImpl_getImplementationName () return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); } -sal_Bool SAL_CALL DecryptorImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL DecryptorImpl_supportsService( const rtl::OUString& ServiceName ) throw (cssu::RuntimeException) { return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME )); } -cssu::Sequence< rtl::OUString > SAL_CALL DecryptorImpl_getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL DecryptorImpl_getSupportedServiceNames( ) throw (cssu::RuntimeException) { cssu::Sequence < rtl::OUString > aRet(1); @@ -228,17 +228,17 @@ cssu::Reference< cssu::XInterface > SAL_CALL DecryptorImpl_createInstance( const } /* XServiceInfo */ -rtl::OUString SAL_CALL DecryptorImpl::getImplementationName( ) +rtl::OUString SAL_CALL DecryptorImpl::getImplementationName( ) throw (cssu::RuntimeException) { return DecryptorImpl_getImplementationName(); } -sal_Bool SAL_CALL DecryptorImpl::supportsService( const rtl::OUString& rServiceName ) +sal_Bool SAL_CALL DecryptorImpl::supportsService( const rtl::OUString& rServiceName ) throw (cssu::RuntimeException) { return DecryptorImpl_supportsService( rServiceName ); } -cssu::Sequence< rtl::OUString > SAL_CALL DecryptorImpl::getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL DecryptorImpl::getSupportedServiceNames( ) throw (cssu::RuntimeException) { return DecryptorImpl_getSupportedServiceNames(); diff --git a/xmlsecurity/source/framework/decryptorimpl.hxx b/xmlsecurity/source/framework/decryptorimpl.hxx index fa558e97ec9b..cc13ec1b9930 100644 --- a/xmlsecurity/source/framework/decryptorimpl.hxx +++ b/xmlsecurity/source/framework/decryptorimpl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,7 +39,7 @@ #include "encryptionengine.hxx" class DecryptorImpl : public cppu::ImplInheritanceHelper3 -< +< EncryptionEngine, com::sun::star::xml::crypto::sax::XDecryptionResultBroadcaster, com::sun::star::lang::XInitialization, @@ -48,19 +48,19 @@ class DecryptorImpl : public cppu::ImplInheritanceHelper3 /****** DecryptorImpl.hxx/CLASS DecryptorImpl ********************************* * * NAME - * DecryptorImpl -- decrypts an encryption + * DecryptorImpl -- decrypts an encryption * * FUNCTION - * Collects all resources for decrypting an encryption, then decrypts the - * encryption by invoking a xmlsec-based encryption bridge component. + * Collects all resources for decrypting an encryption, then decrypts the + * encryption by invoking a xmlsec-based encryption bridge component. * * HISTORY - * 05.01.2004 - Interface supported: XDecryptionResultBroadcaster, - * XInitialization, XServiceInfo + * 05.01.2004 - Interface supported: XDecryptionResultBroadcaster, + * XInitialization, XServiceInfo * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { private: @@ -68,7 +68,7 @@ private: * the Id of the encryption, which is used for the result listener to * identify the encryption. */ - sal_Int32 m_nEncryptionId; + sal_Int32 m_nEncryptionId; /* * the decryption result, @@ -76,59 +76,59 @@ private: */ bool m_bDecryptionSucceed; - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSecurityContext > m_xXMLSecurityContext; - + virtual void notifyResultListener() const throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); virtual bool checkReady() const; - virtual void startEngine( const com::sun::star::uno::Reference< + virtual void startEngine( const com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLEncryptionTemplate >& xEncryptionTemplate) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - + public: - explicit DecryptorImpl( const com::sun::star::uno::Reference< + explicit DecryptorImpl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF); virtual ~DecryptorImpl(); /* XDecryptionResultBroadcaster */ virtual void SAL_CALL addDecryptionResultListener( - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XDecryptionResultListener >& listener ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeDecryptionResultListener( - const com::sun::star::uno::Reference< - com::sun::star::xml::crypto::sax::XDecryptionResultListener >& + virtual void SAL_CALL removeDecryptionResultListener( + const com::sun::star::uno::Reference< + com::sun::star::xml::crypto::sax::XDecryptionResultListener >& listener ) throw (com::sun::star::uno::RuntimeException); - + /* XInitialization */ - virtual void SAL_CALL initialize( - const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) + virtual void SAL_CALL initialize( + const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); /* XServiceInfo */ - virtual rtl::OUString SAL_CALL getImplementationName( ) + virtual rtl::OUString SAL_CALL getImplementationName( ) throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw (com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (com::sun::star::uno::RuntimeException); }; rtl::OUString DecryptorImpl_getImplementationName() throw ( com::sun::star::uno::RuntimeException ); -sal_Bool SAL_CALL DecryptorImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL DecryptorImpl_supportsService( const rtl::OUString& ServiceName ) throw ( com::sun::star::uno::RuntimeException ); -com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL DecryptorImpl_getSupportedServiceNames( ) +com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL DecryptorImpl_getSupportedServiceNames( ) throw ( com::sun::star::uno::RuntimeException ); com::sun::star::uno::Reference< com::sun::star::uno::XInterface > -SAL_CALL DecryptorImpl_createInstance( +SAL_CALL DecryptorImpl_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr) throw ( com::sun::star::uno::Exception ); diff --git a/xmlsecurity/source/framework/elementcollector.cxx b/xmlsecurity/source/framework/elementcollector.cxx index bb001e699aad..a9411d7e5f88 100644 --- a/xmlsecurity/source/framework/elementcollector.cxx +++ b/xmlsecurity/source/framework/elementcollector.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -54,41 +54,41 @@ ElementCollector::ElementCollector( /****** ElementCollector/ElementCollector ************************************* * * NAME - * ElementCollector -- constructor method + * ElementCollector -- constructor method * * SYNOPSIS - * ElementCollector(nSecurityId, nBufferId, nPriority, bToModify - * xReferenceResolvedListener); + * ElementCollector(nSecurityId, nBufferId, nPriority, bToModify + * xReferenceResolvedListener); * * FUNCTION - * construct an ElementCollector object. + * construct an ElementCollector object. * * INPUTS - * nSecurityId - represents which security entity the buffer node is - * related with. Either a signature or an encryption is - * a security entity. - * nBufferId - the id of the element bufferred in the document - * wrapper component. The document wrapper component - * uses this id to search the particular bufferred - * element. - * nPriority - the priority value. ElementCollector with lower - * priority value can't notify until all ElementCollectors - * with higher priority value have notified. - * bToModify - A flag representing whether this ElementCollector - * notification will cause the modification of its working - * element. - * xReferenceResolvedListener - * - the listener that this ElementCollector notifies to. + * nSecurityId - represents which security entity the buffer node is + * related with. Either a signature or an encryption is + * a security entity. + * nBufferId - the id of the element bufferred in the document + * wrapper component. The document wrapper component + * uses this id to search the particular bufferred + * element. + * nPriority - the priority value. ElementCollector with lower + * priority value can't notify until all ElementCollectors + * with higher priority value have notified. + * bToModify - A flag representing whether this ElementCollector + * notification will cause the modification of its working + * element. + * xReferenceResolvedListener + * - the listener that this ElementCollector notifies to. * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { m_type = cssxc::sax::ElementMarkType_ELEMENTCOLLECTOR; @@ -115,26 +115,26 @@ void ElementCollector::notifyListener() /****** ElementCollector/notifyListener *************************************** * * NAME - * notifyListener -- enable the ability to notify the listener + * notifyListener -- enable the ability to notify the listener * * SYNOPSIS - * notifyListener(); + * notifyListener(); * * FUNCTION - * enable the ability to notify the listener and try to notify then. + * enable the ability to notify the listener and try to notify then. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { m_bAbleToNotify = true; @@ -151,27 +151,27 @@ void ElementCollector::setReferenceResolvedListener( /****** ElementCollector/setReferenceResolvedListener ************************* * * NAME - * setReferenceResolvedListener -- configures a listener for the buffer - * node in this object + * setReferenceResolvedListener -- configures a listener for the buffer + * node in this object * * SYNOPSIS - * setReferenceResolvedListener(xReferenceResolvedListener); + * setReferenceResolvedListener(xReferenceResolvedListener); * * FUNCTION - * configures a new listener and try to notify then. + * configures a new listener and try to notify then. * * INPUTS - * xReferenceResolvedListener - the new listener + * xReferenceResolvedListener - the new listener * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { m_xReferenceResolvedListener = xReferenceResolvedListener; @@ -182,26 +182,26 @@ void ElementCollector::setSecurityId(sal_Int32 nSecurityId) /****** ElementCollector/setSecurityId **************************************** * * NAME - * setSecurityId -- configures the security Id of the buffer node + * setSecurityId -- configures the security Id of the buffer node * * SYNOPSIS - * setSecurityId(nSecurityId); + * setSecurityId(nSecurityId); * * FUNCTION - * configures the security Id and try to notify then + * configures the security Id and try to notify then * * INPUTS - * nSecurityId - the security Id + * nSecurityId - the security Id * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { m_nSecurityId = nSecurityId; @@ -212,30 +212,30 @@ void ElementCollector::doNotify() /****** ElementCollector/doNotify ********************************************* * * NAME - * doNotify -- tries to notify the listener + * doNotify -- tries to notify the listener * * SYNOPSIS - * doNotify(); + * doNotify(); * * FUNCTION - * notifies the listener when all below conditions are satisfied: - * the listener has not been notified; - * the notify right is granted; - * the listener has already been configured; - * the security id has already been configure + * notifies the listener when all below conditions are satisfied: + * the listener has not been notified; + * the notify right is granted; + * the listener has already been configured; + * the security id has already been configure * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { if (!m_bNotified && @@ -254,44 +254,44 @@ ElementCollector* ElementCollector::clone( /****** ElementCollector/clone ************************************************ * * NAME - * clone -- duplicates this ElementCollector object + * clone -- duplicates this ElementCollector object * * SYNOPSIS - * cloned = clone(nBufferId, nPriority); + * cloned = clone(nBufferId, nPriority); * * FUNCTION - * duplicates this ElementCollector object with new buffer Id, priority. + * duplicates this ElementCollector object with new buffer Id, priority. * * INPUTS - * nBufferId - the buffer node's Id - * nPriority - the priority + * nBufferId - the buffer node's Id + * nPriority - the priority * * RESULT - * clone - a new ElementCollector + * clone - a new ElementCollector * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { - ElementCollector* pClonedOne - = new ElementCollector(m_nSecurityId, + ElementCollector* pClonedOne + = new ElementCollector(m_nSecurityId, nBufferId, nPriority, m_bToModify, m_xReferenceResolvedListener); - + if (m_bAbleToNotify) { pClonedOne->notifyListener(); } - + if (m_pBufferNode != NULL) { m_pBufferNode->addElementCollector(pClonedOne); } - + return pClonedOne; } diff --git a/xmlsecurity/source/framework/elementcollector.hxx b/xmlsecurity/source/framework/elementcollector.hxx index 12343bac2675..25e8bcce0c76 100644 --- a/xmlsecurity/source/framework/elementcollector.hxx +++ b/xmlsecurity/source/framework/elementcollector.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,19 +37,19 @@ class ElementCollector : public ElementMark /****** elementcollector.hxx/CLASS ElementCollector *************************** * * NAME - * ElementCollector -- Class to manipulate an element collector + * ElementCollector -- Class to manipulate an element collector * * FUNCTION - * This class is derived from the ElementMark class. Beyond the function - * of the ElementMark class, this class also maintains the priority, and - * manages the notify process + * This class is derived from the ElementMark class. Beyond the function + * of the ElementMark class, this class also maintains the priority, and + * manages the notify process * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { private: @@ -61,23 +61,23 @@ private: * internal modification happens. */ com::sun::star::xml::crypto::sax::ElementMarkPriority m_nPriority; - + /* * the modify flag, representing whether which elementcollector will * modify its data. */ bool m_bToModify; - + /* the notify enable flag, see notifyListener method */ bool m_bAbleToNotify; - + /* whether the listener has been notified */ bool m_bNotified; - + /* the listener to be notified */ com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XReferenceResolvedListener > m_xReferenceResolvedListener; - + public: ElementCollector( sal_Int32 nSecurityId, @@ -88,7 +88,7 @@ public: com::sun::star::xml::crypto::sax::XReferenceResolvedListener >& xReferenceResolvedListener); virtual ~ElementCollector() {}; - + //bool isInternalNotificationSuppressed() const; com::sun::star::xml::crypto::sax::ElementMarkPriority getPriority() const; bool getModify() const; diff --git a/xmlsecurity/source/framework/elementmark.cxx b/xmlsecurity/source/framework/elementmark.cxx index 8393af447d83..44ee850307d0 100644 --- a/xmlsecurity/source/framework/elementmark.cxx +++ b/xmlsecurity/source/framework/elementmark.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,32 +42,32 @@ ElementMark::ElementMark(sal_Int32 nSecurityId, sal_Int32 nBufferId) /****** ElementMark/ElementMark *********************************************** * * NAME - * ElementMark -- constructor method + * ElementMark -- constructor method * * SYNOPSIS - * ElementMark(nSecurityId, nBufferId); + * ElementMark(nSecurityId, nBufferId); * * FUNCTION - * construct an ElementMark object. + * construct an ElementMark object. * * INPUTS - * nSecurityId - represents which security entity the buffer node is - * related with. Either a signature or an encryption is - * a security entity. - * nBufferId - the id of the element bufferred in the document - * wrapper component. The document wrapper component - * uses this id to search the particular bufferred - * element. + * nSecurityId - represents which security entity the buffer node is + * related with. Either a signature or an encryption is + * a security entity. + * nBufferId - the id of the element bufferred in the document + * wrapper component. The document wrapper component + * uses this id to search the particular bufferred + * element. * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { } diff --git a/xmlsecurity/source/framework/elementmark.hxx b/xmlsecurity/source/framework/elementmark.hxx index bc844cf66541..7cb0378448e6 100644 --- a/xmlsecurity/source/framework/elementmark.hxx +++ b/xmlsecurity/source/framework/elementmark.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,38 +38,38 @@ class ElementMark /****** elementmark.hxx/CLASS ElementMark ************************************* * * NAME - * ElementMark -- Class to manipulate an element mark + * ElementMark -- Class to manipulate an element mark * * FUNCTION - * This class maintains the security id, buffer id and its type for a - * buffer node. + * This class maintains the security id, buffer id and its type for a + * buffer node. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { protected: /* the BufferNode maintained by this object */ BufferNode* m_pBufferNode; - + /* the security Id */ sal_Int32 m_nSecurityId; - + /* the buffer Id */ sal_Int32 m_nBufferId; - + /* * the type value, is one of following values: - * TYPEOFELEMENTMARK - the default value, represents an blocker if + * TYPEOFELEMENTMARK - the default value, represents an blocker if * not changed * TYPEOFELEMENTCOLLECTOR - represents an ElementCollector */ com::sun::star::xml::crypto::sax::ElementMarkType m_type; - + public: ElementMark(sal_Int32 nSecurityId, sal_Int32 nBufferId); virtual ~ElementMark() {}; diff --git a/xmlsecurity/source/framework/encryptionengine.cxx b/xmlsecurity/source/framework/encryptionengine.cxx index 43df7f677b48..d05600dabd38 100644 --- a/xmlsecurity/source/framework/encryptionengine.cxx +++ b/xmlsecurity/source/framework/encryptionengine.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,7 +41,7 @@ namespace cssxw = com::sun::star::xml::wrapper; #define ENCRYPTION_TEMPLATE "com.sun.star.xml.crypto.XMLEncryptionTemplate" -#define DECLARE_ASCII( SASCIIVALUE ) \ +#define DECLARE_ASCII( SASCIIVALUE ) \ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) EncryptionEngine::EncryptionEngine( ) @@ -53,31 +53,31 @@ bool EncryptionEngine::checkReady() const /****** EncryptionEngine/checkReady ****************************************** * * NAME - * checkReady -- checks the conditions for the main operation. + * checkReady -- checks the conditions for the main operation. * * SYNOPSIS - * bReady = checkReady( ); + * bReady = checkReady( ); * * FUNCTION - * checks whether all following conditions are satisfied: - * 1. the main operation has't begun yet; - * 2. the key material is known; - * 3. the id of the template blocker is known; - * 4. both the key element and the encryption template - * are bufferred. + * checks whether all following conditions are satisfied: + * 1. the main operation has't begun yet; + * 2. the key material is known; + * 3. the id of the template blocker is known; + * 4. both the key element and the encryption template + * are bufferred. * * INPUTS - * empty + * empty * * RESULT - * bReady - true if all conditions are satisfied, false otherwise + * bReady - true if all conditions are satisfied, false otherwise * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { bool rc = true; @@ -95,65 +95,65 @@ bool EncryptionEngine::checkReady() const { rc = false; } - + return rc; } -void EncryptionEngine::tryToPerform( ) +void EncryptionEngine::tryToPerform( ) throw (cssu::Exception, cssu::RuntimeException) /****** EncryptionEngine/tryToPerform **************************************** * * NAME - * tryToPerform -- tries to perform the encryption/decryption operation. + * tryToPerform -- tries to perform the encryption/decryption operation. * * SYNOPSIS - * tryToPerform( ); + * tryToPerform( ); * * FUNCTION - * if the situation is ready, perform following operations. - * 1. prepares a encryption template; - * 2. calls the encryption bridge component; - * 3. clears up all used resources; - * 4. notifies the result listener; - * 5. sets the "accomplishment" flag. + * if the situation is ready, perform following operations. + * 1. prepares a encryption template; + * 2. calls the encryption bridge component; + * 3. clears up all used resources; + * 4. notifies the result listener; + * 5. sets the "accomplishment" flag. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { if (checkReady()) { - const rtl::OUString sEncryptionTemplate ( - RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_TEMPLATE ) ); + const rtl::OUString sEncryptionTemplate ( + RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_TEMPLATE ) ); cssu::Reference < cssxc::XXMLEncryptionTemplate > xEncryptionTemplate( mxMSF->createInstance( sEncryptionTemplate ), cssu::UNO_QUERY ); - + OSL_ASSERT( xEncryptionTemplate.is() ); - - cssu::Reference< cssxw::XXMLElementWrapper > xXMLElement + + cssu::Reference< cssxw::XXMLElementWrapper > xXMLElement = m_xSAXEventKeeper->getElement( m_nIdOfTemplateEC ); - + xEncryptionTemplate->setTemplate(xXMLElement); - + startEngine( xEncryptionTemplate ); - + /* * done */ clearUp( ); - + notifyResultListener(); - + m_bMissionDone = true; } } @@ -162,45 +162,45 @@ void EncryptionEngine::clearUp( ) const /****** EncryptionEngine/clearup ********************************************* * * NAME - * clearUp -- clear up all resources used by this operation. + * clearUp -- clear up all resources used by this operation. * * SYNOPSIS - * clearUp( ); + * clearUp( ); * * FUNCTION - * cleaning resources up includes: - * 1. releases the ElementCollector for the encryption template element; - * 2. releases the Blocker for the encryption template element; - * 3. releases the ElementCollector for the key element, if there is one. + * cleaning resources up includes: + * 1. releases the ElementCollector for the encryption template element; + * 2. releases the Blocker for the encryption template element; + * 3. releases the ElementCollector for the key element, if there is one. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { - cssu::Reference < cssxc::sax::XReferenceResolvedBroadcaster > + cssu::Reference < cssxc::sax::XReferenceResolvedBroadcaster > xReferenceResolvedBroadcaster( m_xSAXEventKeeper, cssu::UNO_QUERY ); - + xReferenceResolvedBroadcaster->removeReferenceResolvedListener( - m_nIdOfTemplateEC, + m_nIdOfTemplateEC, (const cssu::Reference < cssxc::sax::XReferenceResolvedListener >)((SecurityEngine *)this)); - + m_xSAXEventKeeper->removeElementCollector(m_nIdOfTemplateEC); - + if (m_nIdOfBlocker != -1) { m_xSAXEventKeeper->removeBlocker(m_nIdOfBlocker); } - + if (m_nIdOfKeyEC != 0 && m_nIdOfKeyEC != -1) { m_xSAXEventKeeper->removeElementCollector(m_nIdOfKeyEC); diff --git a/xmlsecurity/source/framework/encryptionengine.hxx b/xmlsecurity/source/framework/encryptionengine.hxx index ef6f2dc09fb2..094a039e86b2 100644 --- a/xmlsecurity/source/framework/encryptionengine.hxx +++ b/xmlsecurity/source/framework/encryptionengine.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,24 +42,24 @@ #include "securityengine.hxx" class EncryptionEngine : public cppu::ImplInheritanceHelper1 -< - SecurityEngine, +< + SecurityEngine, com::sun::star::xml::crypto::sax::XBlockerMonitor > /****** encryptionEngine.hxx/CLASS encryptionEngine *************************** * * NAME - * EncryptionEngine -- Base class of Encryptor and Decryptor + * EncryptionEngine -- Base class of Encryptor and Decryptor * * FUNCTION - * Maintains common members and methods related with encryption. + * Maintains common members and methods related with encryption. * * HISTORY - * 05.01.2004 - Interface supported: XBlockerMonitor + * 05.01.2004 - Interface supported: XBlockerMonitor * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { protected: @@ -67,29 +67,29 @@ protected: * the Encryption bridge component, which performs encrypt and decrypt * operation based on xmlsec library. */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLEncryption > m_xXMLEncryption; /* * the Id of template blocker. */ sal_Int32 m_nIdOfBlocker; - + protected: EncryptionEngine( ); virtual ~EncryptionEngine(){}; - - virtual void tryToPerform( ) + + virtual void tryToPerform( ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - virtual void clearUp( ) const; + virtual void clearUp( ) const; virtual bool checkReady() const; - + /* * starts the main function. This method will be implemented by any sub-class. * For a Encryptor, it performs encryption operation; * for a Decryptor, decryption operation is performed. */ - virtual void startEngine( const com::sun::star::uno::Reference< + virtual void startEngine( const com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLEncryptionTemplate >&) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException) {}; diff --git a/xmlsecurity/source/framework/encryptorimpl.cxx b/xmlsecurity/source/framework/encryptorimpl.cxx index b6d86ee8b1f1..2c2328eb5299 100644 --- a/xmlsecurity/source/framework/encryptorimpl.cxx +++ b/xmlsecurity/source/framework/encryptorimpl.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ namespace cssxw = com::sun::star::xml::wrapper; #define SERVICE_NAME "com.sun.star.xml.crypto.sax.Encryptor" #define IMPLEMENTATION_NAME "com.sun.star.xml.security.framework.EncryptorImpl" -#define DECLARE_ASCII( SASCIIVALUE ) \ +#define DECLARE_ASCII( SASCIIVALUE ) \ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) EncryptorImpl::EncryptorImpl( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF) @@ -59,28 +59,28 @@ bool EncryptorImpl::checkReady() const /****** EncryptorImpl/checkReady ********************************************* * * NAME - * checkReady -- checks the conditions for the encryption. + * checkReady -- checks the conditions for the encryption. * * SYNOPSIS - * bReady = checkReady( ); + * bReady = checkReady( ); * * FUNCTION - * checks whether all following conditions are satisfied: - * 1. the result listener is ready; - * 2. the EncryptionEngine is ready. + * checks whether all following conditions are satisfied: + * 1. the result listener is ready; + * 2. the EncryptionEngine is ready. * * INPUTS - * empty + * empty * * RESULT - * bReady - true if all conditions are satisfied, false otherwise + * bReady - true if all conditions are satisfied, false otherwise * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { sal_Int32 nKeyInc = 0; @@ -88,9 +88,9 @@ bool EncryptorImpl::checkReady() const { nKeyInc = 1; } - + return (m_xResultListener.is() && - (m_nReferenceId != -1) && + (m_nReferenceId != -1) && (2+nKeyInc == m_nNumOfResolvedReferences) && EncryptionEngine::checkReady()); } @@ -100,73 +100,73 @@ void EncryptorImpl::notifyResultListener() const /****** DecryptorImpl/notifyResultListener *********************************** * * NAME - * notifyResultListener -- notifies the listener about the encryption - * result. + * notifyResultListener -- notifies the listener about the encryption + * result. * * SYNOPSIS - * notifyResultListener( ); + * notifyResultListener( ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference< cssxc::sax::XEncryptionResultListener > xEncryptionResultListener ( m_xResultListener , cssu::UNO_QUERY ) ; - + xEncryptionResultListener->encrypted( m_nSecurityId, m_nStatus ); } -void EncryptorImpl::startEngine( const cssu::Reference< +void EncryptorImpl::startEngine( const cssu::Reference< cssxc::XXMLEncryptionTemplate >& xEncryptionTemplate) throw (cssu::Exception, cssu::RuntimeException) /****** EncryptorImpl/startEngine ******************************************** * * NAME - * startEngine -- generates the encryption. + * startEngine -- generates the encryption. * * SYNOPSIS - * startEngine( xEncryptionTemplate ); + * startEngine( xEncryptionTemplate ); * * FUNCTION - * generates the encryption element, then if succeeds, updates the link - * of old template element to the new encryption element in - * SAXEventKeeper. + * generates the encryption element, then if succeeds, updates the link + * of old template element to the new encryption element in + * SAXEventKeeper. * * INPUTS - * xEncryptionTemplate - the encryption template to be encrypted. + * xEncryptionTemplate - the encryption template to be encrypted. * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference < cssxc::XXMLEncryptionTemplate > xResultTemplate; - + cssu::Reference< cssxw::XXMLElementWrapper > xXMLElement = m_xSAXEventKeeper->getElement( m_nReferenceId ); xEncryptionTemplate->setTarget(xXMLElement); - - try + + try { xResultTemplate = m_xXMLEncryption->encrypt( xEncryptionTemplate, m_xSecurityEnvironment); @@ -176,10 +176,10 @@ void EncryptorImpl::startEngine( const cssu::Reference< { m_nStatus = cssxc::SecurityOperationStatus_RUNTIMEERROR_FAILED; } - + if (m_nStatus == cssxc::SecurityOperationStatus_OPERATION_SUCCEEDED) { - cssu::Reference < cssxw::XXMLElementWrapper > xResultEncryption + cssu::Reference < cssxw::XXMLElementWrapper > xResultEncryption = xResultTemplate->getTemplate(); m_xSAXEventKeeper->setElement(m_nIdOfTemplateEC, xResultEncryption); m_xSAXEventKeeper->setElement(m_nReferenceId, NULL); @@ -196,7 +196,7 @@ void SAL_CALL EncryptorImpl::setReferenceCount(sal_Int32) * so the referenceNumber is always 1 */ } - + void SAL_CALL EncryptorImpl::setReferenceId( sal_Int32 id ) throw (cssu::Exception, cssu::RuntimeException) { @@ -215,15 +215,15 @@ void SAL_CALL EncryptorImpl::removeEncryptionResultListener( const cssu::Referen throw (cssu::RuntimeException) { } - + /* XInitialization */ -void SAL_CALL EncryptorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments ) +void SAL_CALL EncryptorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments ) throw (cssu::Exception, cssu::RuntimeException) { OSL_ASSERT(aArguments.getLength() == 5); rtl::OUString ouTempString; - + aArguments[0] >>= ouTempString; m_nSecurityId = ouTempString.toInt32(); aArguments[1] >>= m_xSAXEventKeeper; @@ -232,7 +232,7 @@ void SAL_CALL EncryptorImpl::initialize( const cssu::Sequence< cssu::Any >& aArg aArguments[3] >>= m_xSecurityEnvironment; aArguments[4] >>= m_xXMLEncryption; } - + rtl::OUString EncryptorImpl_getImplementationName () throw (cssu::RuntimeException) @@ -240,13 +240,13 @@ rtl::OUString EncryptorImpl_getImplementationName () return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); } -sal_Bool SAL_CALL EncryptorImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL EncryptorImpl_supportsService( const rtl::OUString& ServiceName ) throw (cssu::RuntimeException) { return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME )); } -cssu::Sequence< rtl::OUString > SAL_CALL EncryptorImpl_getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL EncryptorImpl_getSupportedServiceNames( ) throw (cssu::RuntimeException) { cssu::Sequence < rtl::OUString > aRet(1); @@ -256,7 +256,7 @@ cssu::Sequence< rtl::OUString > SAL_CALL EncryptorImpl_getSupportedServiceNames( } #undef SERVICE_NAME -cssu::Reference< cssu::XInterface > SAL_CALL EncryptorImpl_createInstance( +cssu::Reference< cssu::XInterface > SAL_CALL EncryptorImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory >& rSMgr) throw( cssu::Exception ) { @@ -264,17 +264,17 @@ cssu::Reference< cssu::XInterface > SAL_CALL EncryptorImpl_createInstance( } /* XServiceInfo */ -rtl::OUString SAL_CALL EncryptorImpl::getImplementationName( ) +rtl::OUString SAL_CALL EncryptorImpl::getImplementationName( ) throw (cssu::RuntimeException) { return EncryptorImpl_getImplementationName(); } -sal_Bool SAL_CALL EncryptorImpl::supportsService( const rtl::OUString& rServiceName ) +sal_Bool SAL_CALL EncryptorImpl::supportsService( const rtl::OUString& rServiceName ) throw (cssu::RuntimeException) { return EncryptorImpl_supportsService( rServiceName ); } -cssu::Sequence< rtl::OUString > SAL_CALL EncryptorImpl::getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL EncryptorImpl::getSupportedServiceNames( ) throw (cssu::RuntimeException) { return EncryptorImpl_getSupportedServiceNames(); diff --git a/xmlsecurity/source/framework/encryptorimpl.hxx b/xmlsecurity/source/framework/encryptorimpl.hxx index 2d5e2e8aa444..51b579dad51c 100644 --- a/xmlsecurity/source/framework/encryptorimpl.hxx +++ b/xmlsecurity/source/framework/encryptorimpl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,18 +50,18 @@ class EncryptorImpl : public cppu::ImplInheritanceHelper4 /****** EncryptorImpl.hxx/CLASS EncryptorImpl ********************************* * * NAME - * EncryptorImpl -- generates an encryption + * EncryptorImpl -- generates an encryption * * FUNCTION - * Collects all resources for an encryption generation, then generates the - * encryption by invoking a xmlsec-based encryption bridge component. + * Collects all resources for an encryption generation, then generates the + * encryption by invoking a xmlsec-based encryption bridge component. * * HISTORY - * 05.01.2004 - Interface supported: XInitialization, XServiceInfo + * 05.01.2004 - Interface supported: XInitialization, XServiceInfo * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { private: @@ -69,79 +69,79 @@ private: * the Id of the encryption, which is used for the result listener to * identify the encryption. */ - sal_Int32 m_nEncryptionId; - + sal_Int32 m_nEncryptionId; + /* * the Id of the element to be encrypted. */ sal_Int32 m_nReferenceId; - + /* * the decryption result, * remembers whether the encryption succeeds. */ bool m_bEncryptionSucceed; - - com::sun::star::uno::Reference< + + com::sun::star::uno::Reference< com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment; - + virtual void notifyResultListener() const throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); virtual bool checkReady() const; - virtual void startEngine( const com::sun::star::uno::Reference< + virtual void startEngine( const com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLEncryptionTemplate >& xEncryptionTemplate) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - + public: - explicit EncryptorImpl( const com::sun::star::uno::Reference< + explicit EncryptorImpl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF); virtual ~EncryptorImpl(); /* XEncryptionResultBroadcaster */ virtual void SAL_CALL addEncryptionResultListener( - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XEncryptionResultListener >& listener ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeEncryptionResultListener( - const com::sun::star::uno::Reference< - com::sun::star::xml::crypto::sax::XEncryptionResultListener >& + virtual void SAL_CALL removeEncryptionResultListener( + const com::sun::star::uno::Reference< + com::sun::star::xml::crypto::sax::XEncryptionResultListener >& listener ) throw (com::sun::star::uno::RuntimeException); /* XReferenceCollector */ virtual void SAL_CALL setReferenceCount( sal_Int32 count ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - + virtual void SAL_CALL setReferenceId( sal_Int32 id ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); /* XInitialization */ - virtual void SAL_CALL initialize( - const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) + virtual void SAL_CALL initialize( + const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); /* XServiceInfo */ - virtual rtl::OUString SAL_CALL getImplementationName( ) + virtual rtl::OUString SAL_CALL getImplementationName( ) throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw (com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (com::sun::star::uno::RuntimeException); }; rtl::OUString EncryptorImpl_getImplementationName() throw ( com::sun::star::uno::RuntimeException ); -sal_Bool SAL_CALL EncryptorImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL EncryptorImpl_supportsService( const rtl::OUString& ServiceName ) throw ( com::sun::star::uno::RuntimeException ); -com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL EncryptorImpl_getSupportedServiceNames( ) +com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL EncryptorImpl_getSupportedServiceNames( ) throw ( com::sun::star::uno::RuntimeException ); com::sun::star::uno::Reference< com::sun::star::uno::XInterface > -SAL_CALL EncryptorImpl_createInstance( +SAL_CALL EncryptorImpl_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr) throw ( com::sun::star::uno::Exception ); diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx index 5f19a305a748..f3519f46206b 100644 --- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx +++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -70,17 +70,17 @@ SAXEventKeeperImpl::~SAXEventKeeperImpl() m_pRootBufferNode->freeAllChildren(); delete m_pRootBufferNode; } - + m_pRootBufferNode = m_pCurrentBufferNode = m_pCurrentBlockingBufferNode = NULL; - + /* * delete all unfreed ElementMarks */ m_vNewElementCollectors.clear(); m_pNewBlocker = NULL; - + std::vector< const ElementMark* >::const_iterator ii = m_vElementMarkBuffers.begin(); - for( ; ii != m_vElementMarkBuffers.end(); ++ii ) + for( ; ii != m_vElementMarkBuffers.end(); ++ii ) { delete (*ii); } @@ -91,32 +91,32 @@ void SAXEventKeeperImpl::setCurrentBufferNode(BufferNode* pBufferNode) /****** SAXEventKeeperImpl/setCurrentBufferNode ****************************** * * NAME - * setCurrentBufferNode -- set a new active BufferNode. + * setCurrentBufferNode -- set a new active BufferNode. * * SYNOPSIS - * setCurrentBufferNode( pBufferNode ); + * setCurrentBufferNode( pBufferNode ); * * FUNCTION - * connects this BufferNode into the BufferNode tree as a child of the - * current active BufferNode. Then makes this BufferNode as the current - * active BufferNode. - * If the previous active BufferNode points to the root - * BufferNode, which means that no buffering operation was proceeding, - * then notifies the status change listener that buffering operation - * will begin at once. + * connects this BufferNode into the BufferNode tree as a child of the + * current active BufferNode. Then makes this BufferNode as the current + * active BufferNode. + * If the previous active BufferNode points to the root + * BufferNode, which means that no buffering operation was proceeding, + * then notifies the status change listener that buffering operation + * will begin at once. * * INPUTS - * pBufferNode - a BufferNode which will be the new active BufferNode + * pBufferNode - a BufferNode which will be the new active BufferNode * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { if (pBufferNode != m_pCurrentBufferNode) @@ -126,13 +126,13 @@ void SAXEventKeeperImpl::setCurrentBufferNode(BufferNode* pBufferNode) { m_xSAXEventKeeperStatusChangeListener->collectionStatusChanged(sal_True); } - + if (pBufferNode->getParent() == NULL) { m_pCurrentBufferNode->addChild(pBufferNode); pBufferNode->setParent(m_pCurrentBufferNode); } - + m_pCurrentBufferNode = pBufferNode; } } @@ -141,30 +141,30 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() /****** SAXEventKeeperImpl/addNewElementMarkBuffers ************************** * * NAME - * addNewElementMarkBuffers -- add new ElementCollectors and new Blocker. + * addNewElementMarkBuffers -- add new ElementCollectors and new Blocker. * * SYNOPSIS - * pBufferNode = addNewElementMarkBuffers( ); + * pBufferNode = addNewElementMarkBuffers( ); * * FUNCTION - * if there are new ElementCollector or new Blocker to be added, then - * connect all of them with the current BufferNode. In case of the - * current BufferNode doesn't exist, creates one. - * Clears up the new ElementCollector list and the new Blocker pointer. + * if there are new ElementCollector or new Blocker to be added, then + * connect all of them with the current BufferNode. In case of the + * current BufferNode doesn't exist, creates one. + * Clears up the new ElementCollector list and the new Blocker pointer. * * INPUTS - * empty + * empty * * RESULT - * pBufferNode - the BufferNode that has been connected with both new - * ElementCollectors and new Blocker. + * pBufferNode - the BufferNode that has been connected with both new + * ElementCollectors and new Blocker. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { BufferNode* pBufferNode = NULL; @@ -178,7 +178,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() * no new BufferNode is needed to create. * This situation can only happen in the "Forwarding" mode. */ - if ( (m_pCurrentBufferNode != NULL) && + if ( (m_pCurrentBufferNode != NULL) && (m_xXMLDocument->isCurrent(m_pCurrentBufferNode->getXMLElement()))) { pBufferNode = m_pCurrentBufferNode; @@ -187,11 +187,11 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() { pBufferNode = new BufferNode(m_xXMLDocument->getCurrentElement()); } - + if (m_pNewBlocker != NULL) { pBufferNode->setBlocker(m_pNewBlocker); - + /* * If no blocking before, then notify the status change listener that * the SAXEventKeeper has entered "blocking" status, during which, no @@ -200,29 +200,29 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() if (m_pCurrentBlockingBufferNode == NULL) { m_pCurrentBlockingBufferNode = pBufferNode; - + if (m_xSAXEventKeeperStatusChangeListener.is()) { m_xSAXEventKeeperStatusChangeListener->blockingStatusChanged(sal_True); } } - + m_pNewBlocker = NULL; } - + if (m_vNewElementCollectors.size()>0) { std::vector< const ElementCollector* >::const_iterator ii = m_vNewElementCollectors.begin(); - - for( ; ii != m_vNewElementCollectors.end(); ++ii ) + + for( ; ii != m_vNewElementCollectors.end(); ++ii ) { pBufferNode->addElementCollector(*ii); } - + m_vNewElementCollectors.clear(); } } - + return pBufferNode; } @@ -230,35 +230,35 @@ ElementMark* SAXEventKeeperImpl::findElementMarkBuffer(sal_Int32 nId) const /****** SAXEventKeeperImpl/findElementMarkBuffer ***************************** * * NAME - * findElementMarkBuffer -- finds an ElementMark. + * findElementMarkBuffer -- finds an ElementMark. * * SYNOPSIS - * pElementMark = findElementMarkBuffer( nId ); + * pElementMark = findElementMarkBuffer( nId ); * * FUNCTION - * searches an ElementMark with the particular Id in the ElementMark - * list. + * searches an ElementMark with the particular Id in the ElementMark + * list. * * INPUTS - * nId - the Id of the ElementMark to be searched. + * nId - the Id of the ElementMark to be searched. * * RESULT - * pElementMark - the ElementMark with the particular Id, or NULL when - * no such Id exists. + * pElementMark - the ElementMark with the particular Id, or NULL when + * no such Id exists. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { ElementMark* pElementMark = NULL; - + std::vector< const ElementMark* >::const_iterator ii = m_vElementMarkBuffers.begin(); - - for( ; ii != m_vElementMarkBuffers.end(); ++ii ) + + for( ; ii != m_vElementMarkBuffers.end(); ++ii ) { if ( nId == (*ii)->getBufferId()) { @@ -266,7 +266,7 @@ ElementMark* SAXEventKeeperImpl::findElementMarkBuffer(sal_Int32 nId) const break; } } - + return pElementMark; } @@ -274,31 +274,31 @@ void SAXEventKeeperImpl::removeElementMarkBuffer(sal_Int32 nId) /****** SAXEventKeeperImpl/removeElementMarkBuffer *************************** * * NAME - * removeElementMarkBuffer -- removes an ElementMark + * removeElementMarkBuffer -- removes an ElementMark * * SYNOPSIS - * removeElementMarkBuffer( nId ); + * removeElementMarkBuffer( nId ); * * FUNCTION - * removes an ElementMark with the particular Id in the ElementMark list. + * removes an ElementMark with the particular Id in the ElementMark list. * * INPUTS - * nId - the Id of the ElementMark to be removed. + * nId - the Id of the ElementMark to be removed. * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { std::vector< const ElementMark* >::iterator ii = m_vElementMarkBuffers.begin(); - - for( ; ii != m_vElementMarkBuffers.end(); ++ii ) + + for( ; ii != m_vElementMarkBuffers.end(); ++ii ) { if ( nId == (*ii)->getBufferId()) { @@ -306,7 +306,7 @@ void SAXEventKeeperImpl::removeElementMarkBuffer(sal_Int32 nId) * checks whether this ElementMark still in the new ElementCollect array */ std::vector< const ElementCollector* >::iterator jj = m_vNewElementCollectors.begin(); - for( ; jj != m_vNewElementCollectors.end(); ++jj ) + for( ; jj != m_vNewElementCollectors.end(); ++jj ) { if ((*ii) == (*jj)) { @@ -314,7 +314,7 @@ void SAXEventKeeperImpl::removeElementMarkBuffer(sal_Int32 nId) break; } } - + /* * checks whether this ElementMark is the new Blocker */ @@ -322,12 +322,12 @@ void SAXEventKeeperImpl::removeElementMarkBuffer(sal_Int32 nId) { m_pNewBlocker = NULL; } - + /* * destory the ElementMark */ delete (*ii); - + m_vElementMarkBuffers.erase( ii ); break; } @@ -339,36 +339,36 @@ rtl::OUString SAXEventKeeperImpl::printBufferNode( /****** SAXEventKeeperImpl/printBufferNode *********************************** * * NAME - * printBufferNode -- retrieves the information of a BufferNode and its - * branch. + * printBufferNode -- retrieves the information of a BufferNode and its + * branch. * * SYNOPSIS - * info = printBufferNode( pBufferNode, nIndent ); + * info = printBufferNode( pBufferNode, nIndent ); * * FUNCTION - * all retrieved information includes: - * 1. whether it is the current BufferNode; - * 2. whether it is the current blocking BufferNode; - * 3. the name of the parent element; - * 4. the name of this element; - * 5. all ElementCollectors working on this BufferNode; - * 6. the Blocker working on this BufferNode; - * 7. all child BufferNodes' information. + * all retrieved information includes: + * 1. whether it is the current BufferNode; + * 2. whether it is the current blocking BufferNode; + * 3. the name of the parent element; + * 4. the name of this element; + * 5. all ElementCollectors working on this BufferNode; + * 6. the Blocker working on this BufferNode; + * 7. all child BufferNodes' information. * * INPUTS - * pBufferNode - the BufferNode from where information will be retrieved. - * nIndent - how many space characters prefixed before the output - * message. + * pBufferNode - the BufferNode from where information will be retrieved. + * nIndent - how many space characters prefixed before the output + * message. * * RESULT - * info - the information string + * info - the information string * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { rtl::OUString rc; @@ -382,7 +382,7 @@ rtl::OUString SAXEventKeeperImpl::printBufferNode( { rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[%]" )); } - + if (pBufferNode == m_pCurrentBlockingBufferNode) { rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[B]" )); @@ -390,7 +390,7 @@ rtl::OUString SAXEventKeeperImpl::printBufferNode( rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " )); rc += m_xXMLDocument->getNodeName(pBufferNode->getXMLElement()); - + BufferNode* pParent = (BufferNode*)pBufferNode->getParent(); if (pParent != NULL) { @@ -398,11 +398,11 @@ rtl::OUString SAXEventKeeperImpl::printBufferNode( rc += m_xXMLDocument->getNodeName(pParent->getXMLElement()); rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "]" )); } - + rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ":EC=" )); rc += pBufferNode->printChildren(); rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " BR=" )); - + ElementMark * pBlocker = pBufferNode->getBlocker(); if (pBlocker != NULL) { @@ -413,63 +413,63 @@ rtl::OUString SAXEventKeeperImpl::printBufferNode( rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " )); } rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n" )); - + std::vector< const BufferNode* >* vChildren = pBufferNode->getChildren(); std::vector< const BufferNode* >::const_iterator jj = vChildren->begin(); - for( ; jj != vChildren->end(); ++jj ) + for( ; jj != vChildren->end(); ++jj ) { rc += printBufferNode((BufferNode *)*jj, nIndent+4); } - + delete vChildren; - + return rc; } -cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > > +cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > > SAXEventKeeperImpl::collectChildWorkingElement(BufferNode* pBufferNode) const /****** SAXEventKeeperImpl/collectChildWorkingElement ************************ * * NAME - * collectChildWorkingElement -- collects a BufferNode's all child - * Elements. + * collectChildWorkingElement -- collects a BufferNode's all child + * Elements. * * SYNOPSIS - * list = collectChildWorkingElement( pBufferNode ); + * list = collectChildWorkingElement( pBufferNode ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * pBufferNode - the BufferNode whose child Elements will be collected. + * pBufferNode - the BufferNode whose child Elements will be collected. * * RESULT - * list - the child Elements list. + * list - the child Elements list. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { std::vector< const BufferNode* >* vChildren = pBufferNode->getChildren(); - - cssu::Sequence < cssu::Reference< + + cssu::Sequence < cssu::Reference< cssxw::XXMLElementWrapper > > aChildrenCollection ( vChildren->size()); - + std::vector< const BufferNode* >::const_iterator ii = vChildren->begin(); - + sal_Int32 nIndex = 0; - for( ; ii != vChildren->end(); ++ii ) + for( ; ii != vChildren->end(); ++ii ) { aChildrenCollection[nIndex] = (*ii)->getXMLElement(); nIndex++; } - + delete vChildren; - + return aChildrenCollection; } @@ -478,47 +478,47 @@ void SAXEventKeeperImpl::smashBufferNode( /****** SAXEventKeeperImpl/smashBufferNode *********************************** * * NAME - * smashBufferNode -- removes a BufferNode along with its working - * element. + * smashBufferNode -- removes a BufferNode along with its working + * element. * * SYNOPSIS - * smashBufferNode( pBufferNode, bClearRoot ); + * smashBufferNode( pBufferNode, bClearRoot ); * * FUNCTION - * removes the BufferNode's working element from the DOM document, while - * reserves all ancestor paths for its child BufferNodes. - * when any of the BufferNode's ancestor element is useless, removes it - * too. - * removes the BufferNode from the BufferNode tree. + * removes the BufferNode's working element from the DOM document, while + * reserves all ancestor paths for its child BufferNodes. + * when any of the BufferNode's ancestor element is useless, removes it + * too. + * removes the BufferNode from the BufferNode tree. * * INPUTS - * pBufferNode - the BufferNode to be removed - * bClearRoot - whether the root element also needs to be cleared up. + * pBufferNode - the BufferNode to be removed + * bClearRoot - whether the root element also needs to be cleared up. * * RESULT - * empty + * empty * * NOTES - * when removeing a Blocker's BufferNode, the bClearRoot flag should be - * true. Because a Blocker can buffer many SAX events which are not used - * by any other ElementCollector or Blocker. - * When the bClearRoot is set to true, the root BufferNode will be first - * cleared, with a stop flag seting at the next Blocking BufferNode. This - * operation can delete all useless bufferred SAX events which are only - * needed by the Blocker to be deleted. + * when removeing a Blocker's BufferNode, the bClearRoot flag should be + * true. Because a Blocker can buffer many SAX events which are not used + * by any other ElementCollector or Blocker. + * When the bClearRoot is set to true, the root BufferNode will be first + * cleared, with a stop flag seting at the next Blocking BufferNode. This + * operation can delete all useless bufferred SAX events which are only + * needed by the Blocker to be deleted. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { if (!pBufferNode->hasAnything()) { BufferNode* pParent = (BufferNode*)pBufferNode->getParent(); - + /* * delete the XML data */ @@ -527,7 +527,7 @@ void SAXEventKeeperImpl::smashBufferNode( bool bIsNotBlocking = (m_pCurrentBlockingBufferNode == NULL); bool bIsBlockInside = false; bool bIsBlockingAfterward = false; - + /* * If this is a blocker, then remove any out-element data * which caused by blocking. The removal process will stop @@ -535,18 +535,18 @@ void SAXEventKeeperImpl::smashBufferNode( */ if (bClearRoot) { - cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > > + cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > > aChildElements = collectChildWorkingElement(m_pRootBufferNode); - + /* - * the clearUselessData only clearup the content in the + * the clearUselessData only clearup the content in the * node, not the node itself. */ m_xXMLDocument->clearUselessData(m_pRootBufferNode->getXMLElement(), aChildElements, bIsNotBlocking?(NULL): (m_pCurrentBlockingBufferNode->getXMLElement())); - + /* * remove the node if it is empty, then if its parent is also * empty, remove it, then if the next parent is also empty, @@ -554,9 +554,9 @@ void SAXEventKeeperImpl::smashBufferNode( */ m_xXMLDocument->collapse( m_pRootBufferNode->getXMLElement() ); } - + /* - * if blocking, check the relationship between this BufferNode and + * if blocking, check the relationship between this BufferNode and * the current blocking BufferNode. */ if ( !bIsNotBlocking ) @@ -565,18 +565,18 @@ void SAXEventKeeperImpl::smashBufferNode( * the current blocking BufferNode is a descendant of this BufferNode. */ bIsBlockInside = (NULL != pBufferNode->isAncestor(m_pCurrentBlockingBufferNode)); - + /* * the current blocking BufferNode locates behind this BufferNode in tree * order. */ bIsBlockingAfterward = pBufferNode->isPrevious(m_pCurrentBlockingBufferNode); } - + /* * this BufferNode's working element needs to be deleted only when * 1. there is no blocking, or - * 2. the current blocking BufferNode is a descendant of this BufferNode, + * 2. the current blocking BufferNode is a descendant of this BufferNode, * (then in the BufferNode's working element, the useless data before the blocking * element should be deleted.) or * 3. the current blocking BufferNode is locates behind this BufferNode in tree, @@ -586,18 +586,18 @@ void SAXEventKeeperImpl::smashBufferNode( */ if ( bIsNotBlocking || bIsBlockInside || bIsBlockingAfterward ) { - cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > > + cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > > aChildElements = collectChildWorkingElement(pBufferNode); - + /* - * the clearUselessData only clearup the content in the + * the clearUselessData only clearup the content in the * node, not the node itself. */ m_xXMLDocument->clearUselessData(pBufferNode->getXMLElement(), aChildElements, bIsBlockInside?(m_pCurrentBlockingBufferNode->getXMLElement()): (NULL)); - + /* * remove the node if it is empty, then if its parent is also * empty, remove it, then if the next parent is also empty, @@ -612,17 +612,17 @@ void SAXEventKeeperImpl::smashBufferNode( std::vector< const BufferNode* >* vChildren = pBufferNode->getChildren(); pParent->removeChild(pBufferNode); pBufferNode->setParent(NULL); - + std::vector< const BufferNode * >::const_iterator ii = vChildren->begin(); - for( ; ii != vChildren->end(); ++ii ) + for( ; ii != vChildren->end(); ++ii ) { ((BufferNode *)(*ii))->setParent(pParent); pParent->addChild(*ii, nIndex); nIndex++; } - + delete vChildren; - + /* * delete the BufferNode */ @@ -635,37 +635,37 @@ BufferNode* SAXEventKeeperImpl::findNextBlockingBufferNode( /****** SAXEventKeeperImpl/findNextBlockingBufferNode ************************ * * NAME - * findNextBlockingBufferNode -- finds the next blocking BufferNode - * behind the particular BufferNode. + * findNextBlockingBufferNode -- finds the next blocking BufferNode + * behind the particular BufferNode. * * SYNOPSIS - * pBufferNode = findNextBlockingBufferNode( pStartBufferNode ); + * pBufferNode = findNextBlockingBufferNode( pStartBufferNode ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * pStartBufferNode - the BufferNode from where to search the next - * blocking BufferNode. + * pStartBufferNode - the BufferNode from where to search the next + * blocking BufferNode. * * RESULT - * pBufferNode - the next blocking BufferNode, or NULL if no such - * BufferNode exists. + * pBufferNode - the next blocking BufferNode, or NULL if no such + * BufferNode exists. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { BufferNode* pNext = NULL; - + if (pStartBufferNode != NULL) { pNext = pStartBufferNode; - + while (NULL != (pNext = (BufferNode*)pNext->getNextNodeByTreeOrder())) { if (pNext->getBlocker() != NULL) @@ -674,7 +674,7 @@ BufferNode* SAXEventKeeperImpl::findNextBlockingBufferNode( } } } - + return pNext; } @@ -682,33 +682,33 @@ void SAXEventKeeperImpl::diffuse(BufferNode* pBufferNode) const /****** SAXEventKeeperImpl/diffuse ******************************************* * * NAME - * diffuse -- diffuse the notification. + * diffuse -- diffuse the notification. * * SYNOPSIS - * diffuse( pBufferNode ); + * diffuse( pBufferNode ); * * FUNCTION - * diffuse the collecting completion notification from the specific - * BufferNode along its parent link, until an ancestor which is not - * completely received is met. + * diffuse the collecting completion notification from the specific + * BufferNode along its parent link, until an ancestor which is not + * completely received is met. * * INPUTS - * pBufferNode - the BufferNode from which the notification will be - * diffused. + * pBufferNode - the BufferNode from which the notification will be + * diffused. * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { BufferNode* pParent = pBufferNode; - + while(pParent->isAllReceived()) { pParent->elementCollectorNotify(); @@ -720,28 +720,28 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() /****** SAXEventKeeperImpl/releaseElementMarkBuffer ************************** * * NAME - * releaseElementMarkBuffer -- releases useless ElementMarks + * releaseElementMarkBuffer -- releases useless ElementMarks * * SYNOPSIS - * releaseElementMarkBuffer( ); + * releaseElementMarkBuffer( ); * * FUNCTION - * releases each ElementMark in the releasing list - * m_vReleasedElementMarkBuffers. - * The operation differs between an ElementCollector and a Blocker. + * releases each ElementMark in the releasing list + * m_vReleasedElementMarkBuffers. + * The operation differs between an ElementCollector and a Blocker. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { m_bIsReleasing = true; @@ -750,22 +750,22 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() std::vector< sal_Int32 >::iterator pId = m_vReleasedElementMarkBuffers.begin(); sal_Int32 nId = *pId; m_vReleasedElementMarkBuffers.erase( pId ); - + ElementMark* pElementMark = findElementMarkBuffer(nId); if (pElementMark != NULL) { - if (cssxc::sax::ElementMarkType_ELEMENTCOLLECTOR - == pElementMark->getType()) + if (cssxc::sax::ElementMarkType_ELEMENTCOLLECTOR + == pElementMark->getType()) /* * it is a EC */ { ElementCollector* pElementCollector = (ElementCollector*)pElementMark; - + cssxc::sax::ElementMarkPriority nPriority = pElementCollector->getPriority(); bool bToModify = pElementCollector->getModify(); - + /* * Delete the EC from the buffer node. */ @@ -776,26 +776,26 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() { pBufferNode->notifyBranch(); } - + if (bToModify) { pBufferNode->notifyAncestor(); } - + /* * delete the ElementMark - */ + */ pElementCollector = NULL; pElementMark = NULL; - removeElementMarkBuffer(nId); - + removeElementMarkBuffer(nId); + /* * delete the BufferNode */ diffuse(pBufferNode); smashBufferNode(pBufferNode, false); } - else + else /* * it is a Blocker */ @@ -805,7 +805,7 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() */ BufferNode *pBufferNode = pElementMark->getBufferNode(); pBufferNode->setBlocker(NULL); - + /* * If there is a following handler and no blocking now, then * forward this event @@ -813,11 +813,11 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() if (m_pCurrentBlockingBufferNode == pBufferNode) { /* - * Before forwarding, the next blocking point needs to be + * Before forwarding, the next blocking point needs to be * found. */ m_pCurrentBlockingBufferNode = findNextBlockingBufferNode(pBufferNode); - + /* * Forward the blocked events between these two STHs. */ @@ -825,10 +825,10 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() { BufferNode* pTempCurrentBufferNode = m_pCurrentBufferNode; BufferNode* pTempCurrentBlockingBufferNode = m_pCurrentBlockingBufferNode; - + m_pCurrentBufferNode = pBufferNode; m_pCurrentBlockingBufferNode = NULL; - + m_bIsForwarding = true; m_xXMLDocument->generateSAXEvents( @@ -838,15 +838,15 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() (pTempCurrentBlockingBufferNode == NULL)?NULL:(pTempCurrentBlockingBufferNode->getXMLElement())); m_bIsForwarding = false; - + m_pCurrentBufferNode = pTempCurrentBufferNode; if (m_pCurrentBlockingBufferNode == NULL) { m_pCurrentBlockingBufferNode = pTempCurrentBlockingBufferNode; } } - - if (m_pCurrentBlockingBufferNode == NULL && + + if (m_pCurrentBlockingBufferNode == NULL && m_xSAXEventKeeperStatusChangeListener.is()) { m_xSAXEventKeeperStatusChangeListener->blockingStatusChanged(sal_False); @@ -855,10 +855,10 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() /* * delete the ElementMark - */ + */ pElementMark = NULL; removeElementMarkBuffer(nId); - + /* * delete the BufferNode */ @@ -867,11 +867,11 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() } } } - + m_bIsReleasing = false; - - if (!m_pRootBufferNode->hasAnything() && - !m_pRootBufferNode->hasChildren() && + + if (!m_pRootBufferNode->hasAnything() && + !m_pRootBufferNode->hasChildren() && m_xSAXEventKeeperStatusChangeListener.is()) { m_xSAXEventKeeperStatusChangeListener->bufferStatusChanged(sal_True); @@ -882,28 +882,28 @@ void SAXEventKeeperImpl::markElementMarkBuffer(sal_Int32 nId) /****** SAXEventKeeperImpl/markElementMarkBuffer ***************************** * * NAME - * markElementMarkBuffer -- marks an ElementMark to be released + * markElementMarkBuffer -- marks an ElementMark to be released * * SYNOPSIS - * markElementMarkBuffer( nId ); + * markElementMarkBuffer( nId ); * * FUNCTION - * puts the ElementMark with the particular Id into the releasing list, - * checks whether the releasing process is runing, if not then launch - * this process. + * puts the ElementMark with the particular Id into the releasing list, + * checks whether the releasing process is runing, if not then launch + * this process. * * INPUTS - * nId - the Id of the ElementMark which will be released + * nId - the Id of the ElementMark which will be released * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { m_vReleasedElementMarkBuffers.push_back( nId ); @@ -921,82 +921,82 @@ sal_Int32 SAXEventKeeperImpl::createElementCollector( /****** SAXEventKeeperImpl/createElementCollector **************************** * * NAME - * createElementCollector -- creates a new ElementCollector on the - * incoming element. + * createElementCollector -- creates a new ElementCollector on the + * incoming element. * * SYNOPSIS - * nId = createElementCollector( nSecurityId, nPriority, - * bModifyElement, - * xReferenceResolvedListener ); + * nId = createElementCollector( nSecurityId, nPriority, + * bModifyElement, + * xReferenceResolvedListener ); * * FUNCTION - * allocs a new Id, then create an ElementCollector with this Id value. - * Add the new created ElementCollector to the new ElementCollecotor list. + * allocs a new Id, then create an ElementCollector with this Id value. + * Add the new created ElementCollector to the new ElementCollecotor list. * * INPUTS - * nSecurityId - the security Id of the new ElementCollector - * nPriority - the prirority of the new ElementCollector - * bModifyElement -whether this BufferNode will modify the content of - * the corresponding element it works on - * xReferenceResolvedListener - the listener for the new ElementCollector. + * nSecurityId - the security Id of the new ElementCollector + * nPriority - the prirority of the new ElementCollector + * bModifyElement -whether this BufferNode will modify the content of + * the corresponding element it works on + * xReferenceResolvedListener - the listener for the new ElementCollector. * * RESULT - * nId - the Id of the new ElementCollector + * nId - the Id of the new ElementCollector * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { sal_Int32 nId = m_nNextElementMarkId; m_nNextElementMarkId ++; - - ElementCollector* pElementCollector + + ElementCollector* pElementCollector = new ElementCollector( nSecurityId, nId, nPriority, bModifyElement, xReferenceResolvedListener); - + m_vElementMarkBuffers.push_back( pElementCollector ); - + /* * All the new EC to initial EC array. */ m_vNewElementCollectors.push_back( pElementCollector ); - + return nId; } - + sal_Int32 SAXEventKeeperImpl::createBlocker(sal_Int32 nSecurityId) /****** SAXEventKeeperImpl/createBlocker ************************************* * * NAME - * createBlocker -- creates a new Blocker on the incoming element. + * createBlocker -- creates a new Blocker on the incoming element. * * SYNOPSIS - * nId = createBlocker( nSecurityId ); + * nId = createBlocker( nSecurityId ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * nSecurityId - the security Id of the new Blocker + * nSecurityId - the security Id of the new Blocker * * RESULT - * nId - the Id of the new Blocker + * nId - the Id of the new Blocker * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { sal_Int32 nId = m_nNextElementMarkId; @@ -1006,7 +1006,7 @@ sal_Int32 SAXEventKeeperImpl::createBlocker(sal_Int32 nSecurityId) m_pNewBlocker = new ElementMark(nSecurityId, nId); m_vElementMarkBuffers.push_back( m_pNewBlocker ); - + return nId; } @@ -1026,51 +1026,51 @@ void SAL_CALL SAXEventKeeperImpl::removeElementCollector( sal_Int32 id ) { markElementMarkBuffer(id); } - + sal_Int32 SAL_CALL SAXEventKeeperImpl::addBlocker( ) throw (cssu::RuntimeException) { return createBlocker(cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID); } - + void SAL_CALL SAXEventKeeperImpl::removeBlocker( sal_Int32 id ) throw (cssu::RuntimeException) { markElementMarkBuffer(id); } - + sal_Bool SAL_CALL SAXEventKeeperImpl::isBlocking( ) throw (cssu::RuntimeException) { return (m_pCurrentBlockingBufferNode != NULL); } - -cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL + +cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL SAXEventKeeperImpl::getElement( sal_Int32 id ) throw (cssu::RuntimeException) { cssu::Reference< cssxw::XXMLElementWrapper > rc; - + ElementMark* pElementMark = findElementMarkBuffer(id); if (pElementMark != NULL) { rc = pElementMark->getBufferNode()->getXMLElement(); } - + return rc; } -void SAL_CALL SAXEventKeeperImpl::setElement( - sal_Int32 id, +void SAL_CALL SAXEventKeeperImpl::setElement( + sal_Int32 id, const cssu::Reference< cssxw::XXMLElementWrapper >& aElement ) throw (cssu::RuntimeException) { if (aElement.is()) { m_xXMLDocument->rebuildIDLink(aElement); - + ElementMark* pElementMark = findElementMarkBuffer(id); - + if (pElementMark != NULL) { BufferNode* pBufferNode = pElementMark->getBufferNode(); @@ -1078,7 +1078,7 @@ void SAL_CALL SAXEventKeeperImpl::setElement( { bool bIsCurrent = m_xXMLDocument->isCurrent(pBufferNode->getXMLElement()); pBufferNode->setXMLElement(aElement); - + if (bIsCurrent) { m_xXMLDocument->setCurrentElement(aElement); @@ -1091,47 +1091,47 @@ void SAL_CALL SAXEventKeeperImpl::setElement( removeElementCollector( id ); } } - + cssu::Reference< cssxs::XDocumentHandler > SAL_CALL SAXEventKeeperImpl::setNextHandler( const cssu::Reference< cssxs::XDocumentHandler >& xNewHandler ) throw (cssu::RuntimeException) { cssu::Reference< cssxs::XDocumentHandler > xOldHandler = m_xNextHandler; - + m_xNextHandler = xNewHandler; return xOldHandler; } - + rtl::OUString SAL_CALL SAXEventKeeperImpl::printBufferNodeTree() throw (cssu::RuntimeException) { rtl::OUString rc; - + rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ElementMarkBuffers: size = " )); rc += rtl::OUString::valueOf((sal_Int32)m_vElementMarkBuffers.size()); rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\nCurrentBufferNode: " )); rc += m_xXMLDocument->getNodeName(m_pCurrentBufferNode->getXMLElement()); rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n" )); rc += printBufferNode(m_pRootBufferNode, 0); - + return rc; } - + cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL SAXEventKeeperImpl::getCurrentBlockingNode() throw (cssu::RuntimeException) { cssu::Reference< cssxw::XXMLElementWrapper > rc; - + if (m_pCurrentBlockingBufferNode != NULL) { rc = m_pCurrentBlockingBufferNode->getXMLElement(); } - + return rc; } /* XSecuritySAXEventKeeper */ -sal_Int32 SAL_CALL SAXEventKeeperImpl::addSecurityElementCollector( +sal_Int32 SAL_CALL SAXEventKeeperImpl::addSecurityElementCollector( cssxc::sax::ElementMarkPriority priority, sal_Bool modifyElement ) throw (cssu::RuntimeException) @@ -1142,23 +1142,23 @@ sal_Int32 SAL_CALL SAXEventKeeperImpl::addSecurityElementCollector( modifyElement, NULL); } - + sal_Int32 SAL_CALL SAXEventKeeperImpl::cloneElementCollector( sal_Int32 referenceId, cssxc::sax::ElementMarkPriority priority ) throw (cssu::RuntimeException) { sal_Int32 nId = -1; - + ElementCollector* pElementCollector = (ElementCollector*)findElementMarkBuffer(referenceId); if (pElementCollector != NULL) { nId = m_nNextElementMarkId; m_nNextElementMarkId ++; - - ElementCollector* pClonedOne + + ElementCollector* pClonedOne = pElementCollector->clone(nId, priority); - + /* * add this EC into the security data buffer array. */ @@ -1173,10 +1173,10 @@ sal_Int32 SAL_CALL SAXEventKeeperImpl::cloneElementCollector( m_vNewElementCollectors.push_back(pClonedOne); } } - + return nId; } - + void SAL_CALL SAXEventKeeperImpl::setSecurityId( sal_Int32 id, sal_Int32 securityId ) throw (cssu::RuntimeException) { @@ -1187,7 +1187,7 @@ void SAL_CALL SAXEventKeeperImpl::setSecurityId( sal_Int32 id, sal_Int32 securit } } - + /* XReferenceResolvedBroadcaster */ void SAL_CALL SAXEventKeeperImpl::addReferenceResolvedListener( sal_Int32 referenceId, @@ -1200,14 +1200,14 @@ void SAL_CALL SAXEventKeeperImpl::addReferenceResolvedListener( pElementCollector->setReferenceResolvedListener(listener); } } - -void SAL_CALL SAXEventKeeperImpl::removeReferenceResolvedListener( - sal_Int32 /*referenceId*/, + +void SAL_CALL SAXEventKeeperImpl::removeReferenceResolvedListener( + sal_Int32 /*referenceId*/, const cssu::Reference< cssxc::sax::XReferenceResolvedListener >&) throw (cssu::RuntimeException) { } - + /* XSAXEventKeeperStatusChangeBroadcaster */ void SAL_CALL SAXEventKeeperImpl::addSAXEventKeeperStatusChangeListener( const cssu::Reference< cssxc::sax::XSAXEventKeeperStatusChangeListener >& listener ) @@ -1215,13 +1215,13 @@ void SAL_CALL SAXEventKeeperImpl::addSAXEventKeeperStatusChangeListener( { m_xSAXEventKeeperStatusChangeListener = listener; } - + void SAL_CALL SAXEventKeeperImpl::removeSAXEventKeeperStatusChangeListener( const cssu::Reference< cssxc::sax::XSAXEventKeeperStatusChangeListener >&) throw (cssu::RuntimeException) { } - + /* XDocumentHandler */ void SAL_CALL SAXEventKeeperImpl::startDocument( ) throw (cssxs::SAXException, cssu::RuntimeException) @@ -1231,7 +1231,7 @@ void SAL_CALL SAXEventKeeperImpl::startDocument( ) m_xNextHandler->startDocument(); } } - + void SAL_CALL SAXEventKeeperImpl::endDocument( ) throw (cssxs::SAXException, cssu::RuntimeException) { @@ -1240,7 +1240,7 @@ void SAL_CALL SAXEventKeeperImpl::endDocument( ) m_xNextHandler->endDocument(); } } - + void SAL_CALL SAXEventKeeperImpl::startElement( const rtl::OUString& aName, const cssu::Reference< cssxs::XAttributeList >& xAttribs ) @@ -1251,8 +1251,8 @@ void SAL_CALL SAXEventKeeperImpl::startElement( * forward this event */ if ((m_pCurrentBlockingBufferNode == NULL) && - (m_xNextHandler.is()) && - (!m_bIsForwarding) && + (m_xNextHandler.is()) && + (!m_bIsForwarding) && (m_pNewBlocker == NULL)) { m_xNextHandler->startElement(aName, xAttribs); @@ -1268,43 +1268,43 @@ void SAL_CALL SAXEventKeeperImpl::startElement( #else sal_Int32 nLength = xAttribs->getLength(); cssu::Sequence< cssxcsax::XMLAttribute > aAttributes (nLength); - - for ( int i = 0; i<nLength; ++i ) + + for ( int i = 0; i<nLength; ++i ) { aAttributes[i].sName = xAttribs->getNameByIndex((short)i); aAttributes[i].sValue =xAttribs->getValueByIndex((short)i); } - + m_xCompressedDocumentHandler->_startElement(aName, aAttributes); - #endif - + #endif + } - + BufferNode* pBufferNode = addNewElementMarkBuffers(); if (pBufferNode != NULL) { setCurrentBufferNode(pBufferNode); } } - -void SAL_CALL SAXEventKeeperImpl::endElement( const rtl::OUString& aName ) + +void SAL_CALL SAXEventKeeperImpl::endElement( const rtl::OUString& aName ) throw (cssxs::SAXException, cssu::RuntimeException) { sal_Bool bIsCurrent = m_xXMLDocument->isCurrent(m_pCurrentBufferNode->getXMLElement()); - + /* * If there is a following handler and no blocking now, then * forward this event */ - if ((m_pCurrentBlockingBufferNode == NULL) && - (m_xNextHandler.is()) && + if ((m_pCurrentBlockingBufferNode == NULL) && + (m_xNextHandler.is()) && (!m_bIsForwarding)) { m_xNextHandler->endElement(aName); } - - if ((m_pCurrentBlockingBufferNode != NULL) || - (m_pCurrentBufferNode != m_pRootBufferNode) || + + if ((m_pCurrentBlockingBufferNode != NULL) || + (m_pCurrentBufferNode != m_pRootBufferNode) || (!m_xXMLDocument->isCurrentElementEmpty())) { if (!m_bIsForwarding) @@ -1313,11 +1313,11 @@ void SAL_CALL SAXEventKeeperImpl::endElement( const rtl::OUString& aName ) m_xDocumentHandler->endElement(aName); #else m_xCompressedDocumentHandler->_endElement(aName); - #endif + #endif } - + /* - * If the current buffer node has not notified yet, and + * If the current buffer node has not notified yet, and * the current buffer node is waiting for the current element, * then let it notify. */ @@ -1325,10 +1325,10 @@ void SAL_CALL SAXEventKeeperImpl::endElement( const rtl::OUString& aName ) { BufferNode* pOldCurrentBufferNode = m_pCurrentBufferNode; m_pCurrentBufferNode = (BufferNode*)m_pCurrentBufferNode->getParent(); - + pOldCurrentBufferNode->setReceivedAll(); - - if ((m_pCurrentBufferNode == m_pRootBufferNode) && + + if ((m_pCurrentBufferNode == m_pRootBufferNode) && m_xSAXEventKeeperStatusChangeListener.is()) { m_xSAXEventKeeperStatusChangeListener->collectionStatusChanged(sal_False); @@ -1343,7 +1343,7 @@ void SAL_CALL SAXEventKeeperImpl::endElement( const rtl::OUString& aName ) } } } - + void SAL_CALL SAXEventKeeperImpl::characters( const rtl::OUString& aChars ) throw (cssxs::SAXException, cssu::RuntimeException) { @@ -1353,26 +1353,26 @@ void SAL_CALL SAXEventKeeperImpl::characters( const rtl::OUString& aChars ) { m_xNextHandler->characters(aChars); } - - if ((m_pCurrentBlockingBufferNode != NULL) || + + if ((m_pCurrentBlockingBufferNode != NULL) || (m_pCurrentBufferNode != m_pRootBufferNode)) { #ifndef _USECOMPRESSEDDOCUMENTHANDLER m_xDocumentHandler->characters(aChars); #else m_xCompressedDocumentHandler->_characters(aChars); - #endif + #endif } } } - + void SAL_CALL SAXEventKeeperImpl::ignorableWhitespace( const rtl::OUString& aWhitespaces ) throw (cssxs::SAXException, cssu::RuntimeException) { characters( aWhitespaces ); } - -void SAL_CALL SAXEventKeeperImpl::processingInstruction( + +void SAL_CALL SAXEventKeeperImpl::processingInstruction( const rtl::OUString& aTarget, const rtl::OUString& aData ) throw (cssxs::SAXException, cssu::RuntimeException) { @@ -1382,53 +1382,53 @@ void SAL_CALL SAXEventKeeperImpl::processingInstruction( { m_xNextHandler->processingInstruction(aTarget, aData); } - - if ((m_pCurrentBlockingBufferNode != NULL) || + + if ((m_pCurrentBlockingBufferNode != NULL) || (m_pCurrentBufferNode != m_pRootBufferNode)) { #ifndef _USECOMPRESSEDDOCUMENTHANDLER m_xDocumentHandler->processingInstruction(aTarget, aData); #else m_xCompressedDocumentHandler->_processingInstruction(aTarget, aData); - #endif + #endif } } } - + void SAL_CALL SAXEventKeeperImpl::setDocumentLocator( const cssu::Reference< cssxs::XLocator >&) throw (cssxs::SAXException, cssu::RuntimeException) { } - + /* XInitialization */ -void SAL_CALL SAXEventKeeperImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments ) +void SAL_CALL SAXEventKeeperImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments ) throw (cssu::Exception, cssu::RuntimeException) { OSL_ASSERT(aArguments.getLength() == 1); - + aArguments[0] >>= m_xXMLDocument; - m_xDocumentHandler = cssu::Reference< cssxs::XDocumentHandler >( + m_xDocumentHandler = cssu::Reference< cssxs::XDocumentHandler >( m_xXMLDocument, cssu::UNO_QUERY ); - m_xCompressedDocumentHandler = cssu::Reference< cssxcsax::XCompressedDocumentHandler >( + m_xCompressedDocumentHandler = cssu::Reference< cssxcsax::XCompressedDocumentHandler >( m_xXMLDocument, cssu::UNO_QUERY ); - + m_pRootBufferNode = new BufferNode(m_xXMLDocument->getCurrentElement()); m_pCurrentBufferNode = m_pRootBufferNode; } - + rtl::OUString SAXEventKeeperImpl_getImplementationName () throw (cssu::RuntimeException) { return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); } -sal_Bool SAL_CALL SAXEventKeeperImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL SAXEventKeeperImpl_supportsService( const rtl::OUString& ServiceName ) throw (cssu::RuntimeException) { return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME )); } -cssu::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl_getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl_getSupportedServiceNames( ) throw (cssu::RuntimeException) { cssu::Sequence < rtl::OUString > aRet(1); @@ -1438,7 +1438,7 @@ cssu::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl_getSupportedServiceN } #undef SERVICE_NAME -cssu::Reference< cssu::XInterface > SAL_CALL SAXEventKeeperImpl_createInstance( +cssu::Reference< cssu::XInterface > SAL_CALL SAXEventKeeperImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > &) throw( cssu::Exception ) { @@ -1446,17 +1446,17 @@ cssu::Reference< cssu::XInterface > SAL_CALL SAXEventKeeperImpl_createInstance( } /* XServiceInfo */ -rtl::OUString SAL_CALL SAXEventKeeperImpl::getImplementationName( ) +rtl::OUString SAL_CALL SAXEventKeeperImpl::getImplementationName( ) throw (cssu::RuntimeException) { return SAXEventKeeperImpl_getImplementationName(); } -sal_Bool SAL_CALL SAXEventKeeperImpl::supportsService( const rtl::OUString& rServiceName ) +sal_Bool SAL_CALL SAXEventKeeperImpl::supportsService( const rtl::OUString& rServiceName ) throw (cssu::RuntimeException) { return SAXEventKeeperImpl_supportsService( rServiceName ); } -cssu::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl::getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl::getSupportedServiceNames( ) throw (cssu::RuntimeException) { return SAXEventKeeperImpl_getSupportedServiceNames(); diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.hxx b/xmlsecurity/source/framework/saxeventkeeperimpl.hxx index c78d58808586..175a3ae247be 100644 --- a/xmlsecurity/source/framework/saxeventkeeperimpl.hxx +++ b/xmlsecurity/source/framework/saxeventkeeperimpl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,8 +49,8 @@ #define INCLUDED_VECTOR #endif -class SAXEventKeeperImpl : public cppu::WeakImplHelper6 -< +class SAXEventKeeperImpl : public cppu::WeakImplHelper6 +< com::sun::star::xml::crypto::sax::XSecuritySAXEventKeeper, com::sun::star::xml::crypto::sax::XReferenceResolvedBroadcaster, com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeBroadcaster, @@ -61,21 +61,21 @@ class SAXEventKeeperImpl : public cppu::WeakImplHelper6 /****** SAXEventKeeperImpl.hxx/CLASS SAXEventKeeperImpl *********************** * * NAME - * SAXEventKeeperImpl -- SAX events buffer controller + * SAXEventKeeperImpl -- SAX events buffer controller * * FUNCTION - * Controls SAX events to be bufferred, and controls bufferred SAX events - * to be released. + * Controls SAX events to be bufferred, and controls bufferred SAX events + * to be released. * * HISTORY - * 05.01.2004 - Interface supported: XSecuritySAXEventKeeper, - * XReferenceResolvedBroadcaster, - * XSAXEventKeeperStatusChangeBroadcaster, - * XDocumentHandler, XInitialization, XServiceInfo + * 05.01.2004 - Interface supported: XSecuritySAXEventKeeper, + * XReferenceResolvedBroadcaster, + * XSAXEventKeeperStatusChangeBroadcaster, + * XDocumentHandler, XInitialization, XServiceInfo * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { private: @@ -83,63 +83,63 @@ private: * the XMLDocumentWrapper component which maintains all bufferred SAX * in DOM format. */ - com::sun::star::uno::Reference< - com::sun::star::xml::wrapper::XXMLDocumentWrapper > + com::sun::star::uno::Reference< + com::sun::star::xml::wrapper::XXMLDocumentWrapper > m_xXMLDocument; - + /* * the document handler provided by the XMLDocumentWrapper component. */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > m_xDocumentHandler; - + /* * the compressed document handler provided by the XMLDocumentWrapper - * component, the handler has more effient method definition that the + * component, the handler has more effient method definition that the * normal document handler. */ - com::sun::star::uno::Reference< - com::sun::star::xml::csax::XCompressedDocumentHandler > + com::sun::star::uno::Reference< + com::sun::star::xml::csax::XCompressedDocumentHandler > m_xCompressedDocumentHandler; - + /* * a listener which receives this SAXEventKeeper's status change * notification. - * Based on the status changes, the listener can decide whether the + * Based on the status changes, the listener can decide whether the * SAXEventKeeper should chain on/chain off the SAX chain, or whether * the SAXEventKeeper is useless any long. */ - com::sun::star::uno::Reference< - com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener > + com::sun::star::uno::Reference< + com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener > m_xSAXEventKeeperStatusChangeListener; - + /* * the root node of the BufferNode tree. * the BufferNode tree is used to keep track of all bufferred elements, - * it has the same structure with the document which maintains those + * it has the same structure with the document which maintains those * elements physically. */ BufferNode* m_pRootBufferNode; - + /* * the current active BufferNode. * this is used to keep track the current location in the BufferNode tree, * the next generated BufferNode will become a child BufferNode of it. */ BufferNode* m_pCurrentBufferNode; - + /* * the next Id for a coming ElementMark. * the variable is increased by 1 when an new ElementMark is generated, * in this way, we can promise the Id of any ElementMark is unique. */ sal_Int32 m_nNextElementMarkId; - + /* * maintains a collection of all ElementMarks. */ std::vector< const ElementMark* > m_vElementMarkBuffers; - + /* * maintains a list of new ElementCollectors that will be created * on the element represented by the next incoming startElement SAX @@ -151,27 +151,27 @@ private: * SAX event comes. */ std::vector< const ElementCollector* > m_vNewElementCollectors; - + /* * maintains the new Blocker that will be created * on the element represented by the next incoming startElement SAX * event. */ ElementMark* m_pNewBlocker; - + /* * the document handler to which all received SAX events will be * forwarded. */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > m_xNextHandler; - + /* * the current BufferNode which prevents the SAX events to be * forwarded to the m_xNextHandler. */ BufferNode* m_pCurrentBlockingBufferNode; - + /* * maintains a list of ElementMark that has been asked to release. * Because during processing a request of releasing an ElementMark, @@ -181,7 +181,7 @@ private: * order. */ std::vector< sal_Int32 > m_vReleasedElementMarkBuffers; - + /* * a flag to indicate whether the ElementMark releasing process is runing. * When a releasing request comes, the assigned ElementMark is added to @@ -190,59 +190,59 @@ private: * method. */ bool m_bIsReleasing; - + /* * a flag to indicate whether it is the "Forwarding" mode now. * A "Forwarding" mode means that all received SAX events are from the - * XMLDocumentWrapper component, instead of up-stream component in the + * XMLDocumentWrapper component, instead of up-stream component in the * SAX chain. * The difference between "Forwarding" mode and normal mode is that: * no SAX events need to be transferred to the XMLDocumentWrapper component * again even if a buffer request happens. */ bool m_bIsForwarding; - + void setCurrentBufferNode(BufferNode* pBufferNode); - + BufferNode* addNewElementMarkBuffers(); - + ElementMark* findElementMarkBuffer(sal_Int32 nId) const; - + void removeElementMarkBuffer(sal_Int32 nId); - + rtl::OUString printBufferNode( BufferNode* pBufferNode, sal_Int32 nIndent) const; - - com::sun::star::uno::Sequence< com::sun::star::uno::Reference< - com::sun::star::xml::wrapper::XXMLElementWrapper > > + + com::sun::star::uno::Sequence< com::sun::star::uno::Reference< + com::sun::star::xml::wrapper::XXMLElementWrapper > > collectChildWorkingElement(BufferNode* pBufferNode) const; - + void smashBufferNode( BufferNode* pBufferNode, bool bClearRoot) const; - + BufferNode* findNextBlockingBufferNode( BufferNode* pStartBufferNode) const; - + void diffuse(BufferNode* pBufferNode) const; - + void releaseElementMarkBuffer(); - + void markElementMarkBuffer(sal_Int32 nId); - + sal_Int32 createElementCollector( sal_Int32 nSecurityId, com::sun::star::xml::crypto::sax::ElementMarkPriority nPriority, bool bModifyElement, - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XReferenceResolvedListener>& xReferenceResolvedListener); - + sal_Int32 createBlocker(sal_Int32 nSecurityId); - + public: SAXEventKeeperImpl(); virtual ~SAXEventKeeperImpl(); - + /* XSAXEventKeeper */ virtual sal_Int32 SAL_CALL addElementCollector( ) throw (com::sun::star::uno::RuntimeException); @@ -254,110 +254,110 @@ public: throw (com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL isBlocking( ) throw (com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Reference< - com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL + virtual com::sun::star::uno::Reference< + com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL getElement( sal_Int32 id ) throw (com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setElement( - sal_Int32 id, - const com::sun::star::uno::Reference< - com::sun::star::xml::wrapper::XXMLElementWrapper >& + virtual void SAL_CALL setElement( + sal_Int32 id, + const com::sun::star::uno::Reference< + com::sun::star::xml::wrapper::XXMLElementWrapper >& aElement ) throw (com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Reference< - com::sun::star::xml::sax::XDocumentHandler > SAL_CALL - setNextHandler( const com::sun::star::uno::Reference< + virtual com::sun::star::uno::Reference< + com::sun::star::xml::sax::XDocumentHandler > SAL_CALL + setNextHandler( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler >& xNewHandler ) throw (com::sun::star::uno::RuntimeException); virtual rtl::OUString SAL_CALL printBufferNodeTree() throw (com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Reference< - com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL + virtual com::sun::star::uno::Reference< + com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL getCurrentBlockingNode() throw (com::sun::star::uno::RuntimeException); /* XSecuritySAXEventKeeper */ - virtual sal_Int32 SAL_CALL addSecurityElementCollector( - com::sun::star::xml::crypto::sax::ElementMarkPriority priority, + virtual sal_Int32 SAL_CALL addSecurityElementCollector( + com::sun::star::xml::crypto::sax::ElementMarkPriority priority, sal_Bool modifyElement ) throw (com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL cloneElementCollector( - sal_Int32 referenceId, + virtual sal_Int32 SAL_CALL cloneElementCollector( + sal_Int32 referenceId, com::sun::star::xml::crypto::sax::ElementMarkPriority priority ) throw (com::sun::star::uno::RuntimeException); virtual void SAL_CALL setSecurityId( sal_Int32 id, sal_Int32 securityId ) throw (com::sun::star::uno::RuntimeException); - + /* XReferenceResolvedBroadcaster */ - virtual void SAL_CALL addReferenceResolvedListener( - sal_Int32 referenceId, - const com::sun::star::uno::Reference< - com::sun::star::xml::crypto::sax::XReferenceResolvedListener >& + virtual void SAL_CALL addReferenceResolvedListener( + sal_Int32 referenceId, + const com::sun::star::uno::Reference< + com::sun::star::xml::crypto::sax::XReferenceResolvedListener >& listener ) throw (com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeReferenceResolvedListener( - sal_Int32 referenceId, - const com::sun::star::uno::Reference< - com::sun::star::xml::crypto::sax::XReferenceResolvedListener >& + virtual void SAL_CALL removeReferenceResolvedListener( + sal_Int32 referenceId, + const com::sun::star::uno::Reference< + com::sun::star::xml::crypto::sax::XReferenceResolvedListener >& listener ) throw (com::sun::star::uno::RuntimeException); /* XSAXEventKeeperStatusChangeBroadcaster */ - virtual void SAL_CALL addSAXEventKeeperStatusChangeListener( - const com::sun::star::uno::Reference< - com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener >& + virtual void SAL_CALL addSAXEventKeeperStatusChangeListener( + const com::sun::star::uno::Reference< + com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener >& listener ) throw (com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeSAXEventKeeperStatusChangeListener( - const com::sun::star::uno::Reference< - com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener >& + virtual void SAL_CALL removeSAXEventKeeperStatusChangeListener( + const com::sun::star::uno::Reference< + com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener >& listener ) throw (com::sun::star::uno::RuntimeException); - + /* XDocumentHandler */ virtual void SAL_CALL startDocument( ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); virtual void SAL_CALL endDocument( ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); - virtual void SAL_CALL startElement( - const rtl::OUString& aName, - const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endElement( const rtl::OUString& aName ) + virtual void SAL_CALL endElement( const rtl::OUString& aName ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); virtual void SAL_CALL characters( const rtl::OUString& aChars ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); virtual void SAL_CALL ignorableWhitespace( const rtl::OUString& aWhitespaces ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); - virtual void SAL_CALL processingInstruction( + virtual void SAL_CALL processingInstruction( const rtl::OUString& aTarget, const rtl::OUString& aData ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDocumentLocator( + virtual void SAL_CALL setDocumentLocator( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XLocator >& xLocator ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); /* XInitialization */ - virtual void SAL_CALL initialize( - const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) + virtual void SAL_CALL initialize( + const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - + /* XServiceInfo */ - virtual rtl::OUString SAL_CALL getImplementationName( ) + virtual rtl::OUString SAL_CALL getImplementationName( ) throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw (com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (com::sun::star::uno::RuntimeException); }; rtl::OUString SAXEventKeeperImpl_getImplementationName() throw ( com::sun::star::uno::RuntimeException ); -sal_Bool SAL_CALL SAXEventKeeperImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL SAXEventKeeperImpl_supportsService( const rtl::OUString& ServiceName ) throw ( com::sun::star::uno::RuntimeException ); -com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl_getSupportedServiceNames( ) +com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl_getSupportedServiceNames( ) throw ( com::sun::star::uno::RuntimeException ); com::sun::star::uno::Reference< com::sun::star::uno::XInterface > diff --git a/xmlsecurity/source/framework/securityengine.cxx b/xmlsecurity/source/framework/securityengine.cxx index b6554e343354..a7cf002c0d7d 100644 --- a/xmlsecurity/source/framework/securityengine.cxx +++ b/xmlsecurity/source/framework/securityengine.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ namespace cssl = com::sun::star::lang; namespace cssxc = com::sun::star::xml::crypto; namespace cssxw = com::sun::star::xml::wrapper; -#define DECLARE_ASCII( SASCIIVALUE ) \ +#define DECLARE_ASCII( SASCIIVALUE ) \ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) SecurityEngine::SecurityEngine( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF ) @@ -72,18 +72,18 @@ sal_Bool SAL_CALL SecurityEngine::endMission( ) throw (com::sun::star::uno::RuntimeException) { sal_Bool rc = m_bMissionDone; - + if (!rc) { clearUp( ); - + notifyResultListener(); m_bMissionDone = true; } - + m_xResultListener = NULL; m_xSAXEventKeeper = NULL; - + return rc; } diff --git a/xmlsecurity/source/framework/securityengine.hxx b/xmlsecurity/source/framework/securityengine.hxx index 925b45b2a26e..75594f7dbeb8 100644 --- a/xmlsecurity/source/framework/securityengine.hxx +++ b/xmlsecurity/source/framework/securityengine.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,11 +35,11 @@ #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp> #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp> #include <com/sun/star/xml/crypto/XXMLSignature.hpp> - + #include <cppuhelper/implbase3.hxx> class SecurityEngine : public cppu::WeakImplHelper3 -< +< com::sun::star::xml::crypto::sax::XReferenceResolvedListener, com::sun::star::xml::crypto::sax::XKeyCollector, com::sun::star::xml::crypto::sax::XMissionTaker @@ -47,54 +47,54 @@ class SecurityEngine : public cppu::WeakImplHelper3 /****** securityengine.hxx/CLASS SecurityEngine ******************************* * * NAME - * SecurityEngine -- Base class of SignatureEngine and EncryptionEngine + * SecurityEngine -- Base class of SignatureEngine and EncryptionEngine * * FUNCTION - * Maintains common members and methods related with security engine - * operation. + * Maintains common members and methods related with security engine + * operation. * * HISTORY - * 05.01.2004 - Interface supported: XReferenceResolvedListener, - * XKeyCollector, and XMissionTaker + * 05.01.2004 - Interface supported: XReferenceResolvedListener, + * XKeyCollector, and XMissionTaker * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { protected: - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF; /* * A SAXEventKeeper internally maintians all resources that a security - * operation needs. The m_xSAXEventKeeper member is used to release + * operation needs. The m_xSAXEventKeeper member is used to release * those resources when the security operation finishes. */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XSAXEventKeeper > m_xSAXEventKeeper; - + /* * the id of ElementCollector of the template element. * For a signature, the template element is the Signature element, * for a encryption, the EncryptedData/EncryptedKey element is. - */ + */ sal_Int32 m_nIdOfTemplateEC; - + /* * remembers how many referenced elements have been bufferred completely, * including the key element, template element, and referenced element of * signature. */ sal_Int32 m_nNumOfResolvedReferences; - + /* * the id of ElementCollector of the key element. * If a Signature element or EncryptedData/EncryptedKey element has * an internal key sub-element, then this member should be -1 */ sal_Int32 m_nIdOfKeyEC; - + /* * remembers whether the current opertion has finished. */ @@ -105,13 +105,13 @@ protected: * the result listener to identify the entity. */ sal_Int32 m_nSecurityId; - + /* * the status of the operation */ //bool m_bOperationSucceed; com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus; - + /* * the result listener, which will receives the security operation result. */ @@ -120,25 +120,25 @@ protected: m_xResultListener; protected: - explicit SecurityEngine( const com::sun::star::uno::Reference< + explicit SecurityEngine( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF = NULL ); virtual ~SecurityEngine() {}; - - /* + + /* * perform the security operation. * Any derived class will implement this method respectively. */ virtual void tryToPerform( ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException){}; - + /* * clear up all resources used by this operation. * This method is called after the operation finishes, or a End-Your-Mission * message is received. * Any derived class will implement this method respectively. */ - virtual void clearUp( ) const {}; - + virtual void clearUp( ) const {}; + /* * notifies any possible result listener. * When verify a signature or conduct a decryption, the operation result will @@ -154,7 +154,7 @@ protected: * Any derived class will implement this method respectively. */ virtual bool checkReady() const { return true; }; - + public: /* XReferenceResolvedListener */ virtual void SAL_CALL referenceResolved( sal_Int32 referenceId ) @@ -163,7 +163,7 @@ public: /* XKeyCollector */ virtual void SAL_CALL setKeyId( sal_Int32 id ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - + /* XMissionTaker */ virtual sal_Bool SAL_CALL endMission( ) throw (com::sun::star::uno::RuntimeException); diff --git a/xmlsecurity/source/framework/signaturecreatorimpl.cxx b/xmlsecurity/source/framework/signaturecreatorimpl.cxx index a0d0199957c7..3129af3f82a8 100644 --- a/xmlsecurity/source/framework/signaturecreatorimpl.cxx +++ b/xmlsecurity/source/framework/signaturecreatorimpl.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ namespace cssxw = com::sun::star::xml::wrapper; #define SERVICE_NAME "com.sun.star.xml.crypto.sax.SignatureCreator" #define IMPLEMENTATION_NAME "com.sun.star.xml.security.framework.SignatureCreatorImpl" -#define DECLARE_ASCII( SASCIIVALUE ) \ +#define DECLARE_ASCII( SASCIIVALUE ) \ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) SignatureCreatorImpl::SignatureCreatorImpl( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF ) @@ -59,33 +59,33 @@ bool SignatureCreatorImpl::checkReady() const /****** SignatureCreatorImpl/checkReady ************************************** * * NAME - * checkReady -- checks the conditions for the signature generation. + * checkReady -- checks the conditions for the signature generation. * * SYNOPSIS - * bReady = checkReady( ); + * bReady = checkReady( ); * * FUNCTION - * checks whether all following conditions are satisfied: - * 1. the result listener is ready; - * 2. the id of the template blocker is known; - * 3. the SignatureEngine is ready. + * checks whether all following conditions are satisfied: + * 1. the result listener is ready; + * 2. the id of the template blocker is known; + * 3. the SignatureEngine is ready. * * INPUTS - * empty + * empty * * RESULT - * bReady - true if all conditions are satisfied, false otherwise + * bReady - true if all conditions are satisfied, false otherwise * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { return (m_xResultListener.is() && - (m_nIdOfBlocker != -1) && + (m_nIdOfBlocker != -1) && SignatureEngine::checkReady()); } @@ -94,69 +94,69 @@ void SignatureCreatorImpl::notifyResultListener() const /****** SignatureCreatorImpl/notifyResultListener ***************************** * * NAME - * notifyResultListener -- notifies the listener about the signature - * creation result. + * notifyResultListener -- notifies the listener about the signature + * creation result. * * SYNOPSIS - * notifyResultListener( ); + * notifyResultListener( ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference< cssxc::sax::XSignatureCreationResultListener > xSignatureCreationResultListener ( m_xResultListener , cssu::UNO_QUERY ) ; - + xSignatureCreationResultListener->signatureCreated( m_nSecurityId, m_nStatus ); } -void SignatureCreatorImpl::startEngine( const cssu::Reference< +void SignatureCreatorImpl::startEngine( const cssu::Reference< cssxc::XXMLSignatureTemplate >& xSignatureTemplate) throw (cssu::Exception, cssu::RuntimeException) /****** SignatureCreatorImpl/startEngine ************************************* * * NAME - * startEngine -- generates the signature. + * startEngine -- generates the signature. * * SYNOPSIS - * startEngine( xSignatureTemplate ); + * startEngine( xSignatureTemplate ); * * FUNCTION - * generates the signature element, then if succeeds, updates the link - * of old template element to the new signature element in - * SAXEventKeeper. + * generates the signature element, then if succeeds, updates the link + * of old template element to the new signature element in + * SAXEventKeeper. * * INPUTS - * xSignatureTemplate - the signature template (along with all referenced - * elements) to be signed. + * xSignatureTemplate - the signature template (along with all referenced + * elements) to be signed. * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference< cssxc::XXMLSignatureTemplate > xResultTemplate; - try + try { xResultTemplate = m_xXMLSignature->generate(xSignatureTemplate, m_xSecurityEnvironment); m_nStatus = xResultTemplate->getStatus(); @@ -165,11 +165,11 @@ void SignatureCreatorImpl::startEngine( const cssu::Reference< { m_nStatus = cssxc::SecurityOperationStatus_RUNTIMEERROR_FAILED; } - + if (m_nStatus == cssxc::SecurityOperationStatus_OPERATION_SUCCEEDED) { cssu::Reference < cssxw::XXMLElementWrapper > xResultSignature = xResultTemplate->getTemplate(); - m_xSAXEventKeeper->setElement(m_nIdOfTemplateEC, xResultSignature); + m_xSAXEventKeeper->setElement(m_nIdOfTemplateEC, xResultSignature); } } @@ -177,32 +177,32 @@ void SignatureCreatorImpl::clearUp() const /****** SignatureCreatorImpl/clearUp ***************************************** * * NAME - * clearUp -- clear up all resources used by the signature generation. + * clearUp -- clear up all resources used by the signature generation. * * SYNOPSIS - * clearUp( ); + * clearUp( ); * * FUNCTION - * cleaning resources up includes: - * 1. SignatureEngine's clearing up; - * 2. releases the Blocker for the signature template element. + * cleaning resources up includes: + * 1. SignatureEngine's clearing up; + * 2. releases the Blocker for the signature template element. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { SignatureEngine::clearUp(); - + if (m_nIdOfBlocker != -1) { m_xSAXEventKeeper->removeBlocker(m_nIdOfBlocker); @@ -218,7 +218,7 @@ void SAL_CALL SignatureCreatorImpl::setBlockerId( sal_Int32 id ) } /* XSignatureCreationResultBroadcaster */ -void SAL_CALL SignatureCreatorImpl::addSignatureCreationResultListener( +void SAL_CALL SignatureCreatorImpl::addSignatureCreationResultListener( const cssu::Reference< cssxc::sax::XSignatureCreationResultListener >& listener ) throw (cssu::Exception, cssu::RuntimeException) { @@ -226,20 +226,20 @@ void SAL_CALL SignatureCreatorImpl::addSignatureCreationResultListener( tryToPerform(); } -void SAL_CALL SignatureCreatorImpl::removeSignatureCreationResultListener( +void SAL_CALL SignatureCreatorImpl::removeSignatureCreationResultListener( const cssu::Reference< cssxc::sax::XSignatureCreationResultListener >&) throw (cssu::RuntimeException) { } /* XInitialization */ -void SAL_CALL SignatureCreatorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments ) +void SAL_CALL SignatureCreatorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments ) throw (cssu::Exception, cssu::RuntimeException) { OSL_ASSERT(aArguments.getLength() == 5); - + rtl::OUString ouTempString; - + aArguments[0] >>= ouTempString; m_nSecurityId = ouTempString.toInt32(); aArguments[1] >>= m_xSAXEventKeeper; @@ -248,7 +248,7 @@ void SAL_CALL SignatureCreatorImpl::initialize( const cssu::Sequence< cssu::Any aArguments[3] >>= m_xSecurityEnvironment; aArguments[4] >>= m_xXMLSignature; } - + rtl::OUString SignatureCreatorImpl_getImplementationName () throw (cssu::RuntimeException) @@ -256,13 +256,13 @@ rtl::OUString SignatureCreatorImpl_getImplementationName () return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); } -sal_Bool SAL_CALL SignatureCreatorImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL SignatureCreatorImpl_supportsService( const rtl::OUString& ServiceName ) throw (cssu::RuntimeException) { return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME )); } -cssu::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl_getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl_getSupportedServiceNames( ) throw (cssu::RuntimeException) { cssu::Sequence < rtl::OUString > aRet(1); @@ -272,7 +272,7 @@ cssu::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl_getSupportedServic } #undef SERVICE_NAME -cssu::Reference< cssu::XInterface > SAL_CALL SignatureCreatorImpl_createInstance( +cssu::Reference< cssu::XInterface > SAL_CALL SignatureCreatorImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory >& rSMgr) throw( cssu::Exception ) { @@ -280,17 +280,17 @@ cssu::Reference< cssu::XInterface > SAL_CALL SignatureCreatorImpl_createInstance } /* XServiceInfo */ -rtl::OUString SAL_CALL SignatureCreatorImpl::getImplementationName( ) +rtl::OUString SAL_CALL SignatureCreatorImpl::getImplementationName( ) throw (cssu::RuntimeException) { return SignatureCreatorImpl_getImplementationName(); } -sal_Bool SAL_CALL SignatureCreatorImpl::supportsService( const rtl::OUString& rServiceName ) +sal_Bool SAL_CALL SignatureCreatorImpl::supportsService( const rtl::OUString& rServiceName ) throw (cssu::RuntimeException) { return SignatureCreatorImpl_supportsService( rServiceName ); } -cssu::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl::getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl::getSupportedServiceNames( ) throw (cssu::RuntimeException) { return SignatureCreatorImpl_getSupportedServiceNames(); diff --git a/xmlsecurity/source/framework/signaturecreatorimpl.hxx b/xmlsecurity/source/framework/signaturecreatorimpl.hxx index 52d04352a2d9..10641fdce96f 100644 --- a/xmlsecurity/source/framework/signaturecreatorimpl.hxx +++ b/xmlsecurity/source/framework/signaturecreatorimpl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,7 +41,7 @@ class SignatureCreatorImpl : public cppu::ImplInheritanceHelper4 < - SignatureEngine, + SignatureEngine, com::sun::star::xml::crypto::sax::XBlockerMonitor, com::sun::star::xml::crypto::sax::XSignatureCreationResultBroadcaster, com::sun::star::lang::XInitialization, @@ -50,19 +50,19 @@ class SignatureCreatorImpl : public cppu::ImplInheritanceHelper4 /****** SignatureCreatorImpl.hxx/CLASS SignatureCreatorImpl ******************* * * NAME - * SignatureCreatorImpl -- generates a signature + * SignatureCreatorImpl -- generates a signature * * FUNCTION - * Collects all resources for a signature generation, then generates the - * signature by invoking a xmlsec-based signature bridge component. + * Collects all resources for a signature generation, then generates the + * signature by invoking a xmlsec-based signature bridge component. * * HISTORY - * 05.01.2004 - Interface supported: XBlockerMonitor, - * XInitialization, XServiceInfo + * 05.01.2004 - Interface supported: XBlockerMonitor, + * XInitialization, XServiceInfo * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { private: @@ -71,7 +71,7 @@ private: * identify the signature. */ sal_Int32 m_nSignatureId; - + /* * the Id of template blocker. */ @@ -81,64 +81,64 @@ private: * the signature creation result */ bool m_bCreationSucceed; - - com::sun::star::uno::Reference< + + com::sun::star::uno::Reference< com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment; - + virtual void notifyResultListener() const throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - virtual void clearUp( ) const; + virtual void clearUp( ) const; virtual bool checkReady() const; - virtual void startEngine( const com::sun::star::uno::Reference< + virtual void startEngine( const com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSignatureTemplate >& xSignatureTemplate) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - + public: - explicit SignatureCreatorImpl( const com::sun::star::uno::Reference< + explicit SignatureCreatorImpl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF); virtual ~SignatureCreatorImpl(); /* XBlockerMonitor */ virtual void SAL_CALL setBlockerId( sal_Int32 id ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - + /* XSignatureCreationResultBroadcaster */ - void SAL_CALL addSignatureCreationResultListener( - const com::sun::star::uno::Reference< + void SAL_CALL addSignatureCreationResultListener( + const com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XSignatureCreationResultListener >& listener ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - - void SAL_CALL removeSignatureCreationResultListener( - const com::sun::star::uno::Reference< + + void SAL_CALL removeSignatureCreationResultListener( + const com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XSignatureCreationResultListener >& listener ) throw (com::sun::star::uno::RuntimeException); /* XInitialization */ - virtual void SAL_CALL initialize( - const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) + virtual void SAL_CALL initialize( + const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); /* XServiceInfo */ - virtual rtl::OUString SAL_CALL getImplementationName( ) + virtual rtl::OUString SAL_CALL getImplementationName( ) throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw (com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (com::sun::star::uno::RuntimeException); }; rtl::OUString SignatureCreatorImpl_getImplementationName() throw ( com::sun::star::uno::RuntimeException ); -sal_Bool SAL_CALL SignatureCreatorImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL SignatureCreatorImpl_supportsService( const rtl::OUString& ServiceName ) throw ( com::sun::star::uno::RuntimeException ); -com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl_getSupportedServiceNames( ) +com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl_getSupportedServiceNames( ) throw ( com::sun::star::uno::RuntimeException ); com::sun::star::uno::Reference< com::sun::star::uno::XInterface > -SAL_CALL SignatureCreatorImpl_createInstance( +SAL_CALL SignatureCreatorImpl_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw ( com::sun::star::uno::Exception ); diff --git a/xmlsecurity/source/framework/signatureengine.cxx b/xmlsecurity/source/framework/signatureengine.cxx index 3eea00e41434..bd5a52075099 100644 --- a/xmlsecurity/source/framework/signatureengine.cxx +++ b/xmlsecurity/source/framework/signatureengine.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,7 +41,7 @@ namespace cssxw = com::sun::star::xml::wrapper; #define SIGNATURE_TEMPLATE "com.sun.star.xml.crypto.XMLSignatureTemplate" -#define DECLARE_ASCII( SASCIIVALUE ) \ +#define DECLARE_ASCII( SASCIIVALUE ) \ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) SignatureEngine::SignatureEngine( ) @@ -53,33 +53,33 @@ bool SignatureEngine::checkReady() const /****** SignatureEngine/checkReady ******************************************* * * NAME - * checkReady -- checks the conditions for the main operation. + * checkReady -- checks the conditions for the main operation. * * SYNOPSIS - * bReady = checkReady( ); + * bReady = checkReady( ); * * FUNCTION - * checks whether all following conditions are satisfied: - * 1. the main operation has't begun yet; - * 2. the key material is known; - * 3. the amount of reference is known; - * 4. all of referenced elements, the key element and the signature - * template are bufferred. + * checks whether all following conditions are satisfied: + * 1. the main operation has't begun yet; + * 2. the key material is known; + * 3. the amount of reference is known; + * 4. all of referenced elements, the key element and the signature + * template are bufferred. * * INPUTS - * empty + * empty * * RESULT - * bReady - true if all conditions are satisfied, false otherwise + * bReady - true if all conditions are satisfied, false otherwise * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ -{ +{ bool rc = true; sal_Int32 nKeyInc = 0; @@ -87,7 +87,7 @@ bool SignatureEngine::checkReady() const { nKeyInc = 1; } - + if (m_bMissionDone || m_nIdOfKeyEC == -1 || m_nTotalReferenceNumber == -1 || @@ -95,78 +95,78 @@ bool SignatureEngine::checkReady() const { rc = false; } - + return rc; } -void SignatureEngine::tryToPerform( ) +void SignatureEngine::tryToPerform( ) throw (cssu::Exception, cssu::RuntimeException) /****** SignatureEngine/tryToPerform ***************************************** * * NAME - * tryToPerform -- tries to perform the signature operation. + * tryToPerform -- tries to perform the signature operation. * * SYNOPSIS - * tryToPerform( ); + * tryToPerform( ); * * FUNCTION - * if the situation is ready, perform following operations. - * 1. prepares a signature template; - * 2. calls the signature bridge component; - * 3. clears up all used resources; - * 4. notifies the result listener; - * 5. sets the "accomplishment" flag. + * if the situation is ready, perform following operations. + * 1. prepares a signature template; + * 2. calls the signature bridge component; + * 3. clears up all used resources; + * 4. notifies the result listener; + * 5. sets the "accomplishment" flag. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { if (checkReady()) { const rtl::OUString ouSignatureTemplate ( - RTL_CONSTASCII_USTRINGPARAM( SIGNATURE_TEMPLATE ) ); + RTL_CONSTASCII_USTRINGPARAM( SIGNATURE_TEMPLATE ) ); cssu::Reference < cssxc::XXMLSignatureTemplate > xSignatureTemplate( mxMSF->createInstance( ouSignatureTemplate ), cssu::UNO_QUERY ); - + OSL_ASSERT( xSignatureTemplate.is() ); - + cssu::Reference< cssxw::XXMLElementWrapper > xXMLElement = m_xSAXEventKeeper->getElement( m_nIdOfTemplateEC ); - + xSignatureTemplate->setTemplate(xXMLElement); - + std::vector< sal_Int32 >::const_iterator ii = m_vReferenceIds.begin(); - - for( ; ii != m_vReferenceIds.end() ; ++ii ) + + for( ; ii != m_vReferenceIds.end() ; ++ii ) { xXMLElement = m_xSAXEventKeeper->getElement( *ii ); xSignatureTemplate->setTarget(xXMLElement); } - + /* * set the Uri binding */ xSignatureTemplate->setBinding( this ); - + startEngine( xSignatureTemplate ); - + /* * done */ clearUp( ); - + notifyResultListener(); - + m_bMissionDone = true; } } @@ -175,49 +175,49 @@ void SignatureEngine::clearUp( ) const /****** SignatureEngine/clearUp ********************************************** * * NAME - * clearUp -- clear up all resources used by this operation. + * clearUp -- clear up all resources used by this operation. * * SYNOPSIS - * clearUp( ); + * clearUp( ); * * FUNCTION - * cleaning resources up includes: - * 1. releases the ElementCollector for the signature template element; - * 2. releases ElementCollectors for referenced elements; - * 3. releases the ElementCollector for the key element, if there is one. + * cleaning resources up includes: + * 1. releases the ElementCollector for the signature template element; + * 2. releases ElementCollectors for referenced elements; + * 3. releases the ElementCollector for the key element, if there is one. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference < cssxc::sax::XReferenceResolvedBroadcaster > xReferenceResolvedBroadcaster( m_xSAXEventKeeper, cssu::UNO_QUERY ); xReferenceResolvedBroadcaster->removeReferenceResolvedListener( - m_nIdOfTemplateEC, + m_nIdOfTemplateEC, (const cssu::Reference < cssxc::sax::XReferenceResolvedListener >)((SecurityEngine *)this)); - + m_xSAXEventKeeper->removeElementCollector(m_nIdOfTemplateEC); - + std::vector< sal_Int32 >::const_iterator ii = m_vReferenceIds.begin(); - - for( ; ii != m_vReferenceIds.end() ; ++ii ) + + for( ; ii != m_vReferenceIds.end() ; ++ii ) { xReferenceResolvedBroadcaster->removeReferenceResolvedListener( - *ii, + *ii, (const cssu::Reference < cssxc::sax::XReferenceResolvedListener >)((SecurityEngine *)this)); m_xSAXEventKeeper->removeElementCollector(*ii); } - + if (m_nIdOfKeyEC != 0 && m_nIdOfKeyEC != -1) { m_xSAXEventKeeper->removeElementCollector(m_nIdOfKeyEC); @@ -231,7 +231,7 @@ void SAL_CALL SignatureEngine::setReferenceCount( sal_Int32 count ) m_nTotalReferenceNumber = count; tryToPerform(); } - + void SAL_CALL SignatureEngine::setReferenceId( sal_Int32 id ) throw (cssu::Exception, cssu::RuntimeException) { @@ -247,14 +247,14 @@ void SAL_CALL SignatureEngine::setUriBinding( m_vUris.push_back(uri); m_vXInputStreams.push_back(aInputStream); } - + cssu::Reference< com::sun::star::io::XInputStream > SAL_CALL SignatureEngine::getUriBinding( const rtl::OUString& uri ) throw (cssu::Exception, cssu::RuntimeException) { cssu::Reference< com::sun::star::io::XInputStream > xInputStream; - + int size = m_vUris.size(); - + for( int i=0; i<size; ++i) { if (m_vUris[i] == uri) @@ -263,9 +263,9 @@ cssu::Reference< com::sun::star::io::XInputStream > SAL_CALL SignatureEngine::ge break; } } - + return xInputStream; } - + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/framework/signatureengine.hxx b/xmlsecurity/source/framework/signatureengine.hxx index 138ee6f883f5..7733785321e7 100644 --- a/xmlsecurity/source/framework/signatureengine.hxx +++ b/xmlsecurity/source/framework/signatureengine.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,7 +39,7 @@ #include <com/sun/star/xml/crypto/XXMLSignature.hpp> #include <com/sun/star/xml/crypto/XUriBinding.hpp> #include <com/sun/star/io/XInputStream.hpp> - + #include <cppuhelper/implbase2.hxx> #include "securityengine.hxx" @@ -51,35 +51,35 @@ class SignatureEngine : public cppu::ImplInheritanceHelper2 < - SecurityEngine, + SecurityEngine, com::sun::star::xml::crypto::sax::XReferenceCollector, com::sun::star::xml::crypto::XUriBinding > /****** signatureengine.hxx/CLASS SignatureEngine ***************************** * * NAME - * SignatureEngine -- Base class of SignatureCreator and SignatureVerifier + * SignatureEngine -- Base class of SignatureCreator and SignatureVerifier * * FUNCTION - * Maintains common members and methods related with signature operation. + * Maintains common members and methods related with signature operation. * * HISTORY - * 05.01.2004 - Interface supported: XReferenceCollector + * 05.01.2004 - Interface supported: XReferenceCollector * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { protected: - + /* * the Signature bridge component, which performs signature generation * and verification based on xmlsec library. */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSignature > m_xXMLSignature; - + /* * a collection of ElementCollector's ids. Each ElementCollector * represents one element signed by this signature. @@ -104,27 +104,27 @@ protected: protected: SignatureEngine( ); virtual ~SignatureEngine() {}; - - virtual void tryToPerform( ) + + virtual void tryToPerform( ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - virtual void clearUp( ) const; + virtual void clearUp( ) const; virtual bool checkReady() const; - + /* * starts the main function. This method will be implemented by any sub-class. * For a SignatureCreator, it performs signing operation; * for a SignatureVerifier, verification operation is performed. */ - virtual void startEngine( const com::sun::star::uno::Reference< + virtual void startEngine( const com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSignatureTemplate >&) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException) {}; - + public: /* XReferenceCollector */ virtual void SAL_CALL setReferenceCount( sal_Int32 count ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - + virtual void SAL_CALL setReferenceId( sal_Int32 id ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); diff --git a/xmlsecurity/source/framework/signatureverifierimpl.cxx b/xmlsecurity/source/framework/signatureverifierimpl.cxx index d516e8761f6c..408e8f7b91a3 100644 --- a/xmlsecurity/source/framework/signatureverifierimpl.cxx +++ b/xmlsecurity/source/framework/signatureverifierimpl.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ namespace cssxw = com::sun::star::xml::wrapper; #define SERVICE_NAME "com.sun.star.xml.crypto.sax.SignatureVerifier" #define IMPLEMENTATION_NAME "com.sun.star.xml.security.framework.SignatureVerifierImpl" -#define DECLARE_ASCII( SASCIIVALUE ) \ +#define DECLARE_ASCII( SASCIIVALUE ) \ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) SignatureVerifierImpl::SignatureVerifierImpl( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF) @@ -58,28 +58,28 @@ bool SignatureVerifierImpl::checkReady() const /****** SignatureVerifierImpl/checkReady ************************************* * * NAME - * checkReady -- checks the conditions for the signature verification. + * checkReady -- checks the conditions for the signature verification. * * SYNOPSIS - * bReady = checkReady( ); + * bReady = checkReady( ); * * FUNCTION - * checks whether all following conditions are satisfied: - * 1. the result listener is ready; - * 2. the SignatureEngine is ready. + * checks whether all following conditions are satisfied: + * 1. the result listener is ready; + * 2. the SignatureEngine is ready. * * INPUTS - * empty + * empty * * RESULT - * bReady - true if all conditions are satisfied, false otherwise + * bReady - true if all conditions are satisfied, false otherwise * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { return (m_xResultListener.is() && SignatureEngine::checkReady()); @@ -90,66 +90,66 @@ void SignatureVerifierImpl::notifyResultListener() const /****** SignatureVerifierImpl/notifyResultListener *************************** * * NAME - * notifyResultListener -- notifies the listener about the verify result. + * notifyResultListener -- notifies the listener about the verify result. * * SYNOPSIS - * notifyResultListener( ); + * notifyResultListener( ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference< cssxc::sax::XSignatureVerifyResultListener > xSignatureVerifyResultListener ( m_xResultListener , cssu::UNO_QUERY ) ; - + xSignatureVerifyResultListener->signatureVerified( m_nSecurityId, m_nStatus ); } -void SignatureVerifierImpl::startEngine( const cssu::Reference< +void SignatureVerifierImpl::startEngine( const cssu::Reference< cssxc::XXMLSignatureTemplate >& xSignatureTemplate) throw (cssu::Exception, cssu::RuntimeException) /****** SignatureVerifierImpl/startEngine ************************************ * * NAME - * startEngine -- verifies the signature. + * startEngine -- verifies the signature. * * SYNOPSIS - * startEngine( xSignatureTemplate ); + * startEngine( xSignatureTemplate ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * xSignatureTemplate - the signature template (along with all referenced - * elements) to be verified. + * xSignatureTemplate - the signature template (along with all referenced + * elements) to be verified. * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference< cssxc::XXMLSignatureTemplate > xResultTemplate; - try + try { xResultTemplate = m_xXMLSignature->validate(xSignatureTemplate, m_xXMLSecurityContext); m_nStatus = xResultTemplate->getStatus(); @@ -161,7 +161,7 @@ void SignatureVerifierImpl::startEngine( const cssu::Reference< } /* XSignatureVerifyResultBroadcaster */ -void SAL_CALL SignatureVerifierImpl::addSignatureVerifyResultListener( +void SAL_CALL SignatureVerifierImpl::addSignatureVerifyResultListener( const cssu::Reference< cssxc::sax::XSignatureVerifyResultListener >& listener ) throw (cssu::Exception, cssu::RuntimeException) { @@ -169,21 +169,21 @@ void SAL_CALL SignatureVerifierImpl::addSignatureVerifyResultListener( tryToPerform(); } -void SAL_CALL SignatureVerifierImpl::removeSignatureVerifyResultListener( +void SAL_CALL SignatureVerifierImpl::removeSignatureVerifyResultListener( const cssu::Reference< cssxc::sax::XSignatureVerifyResultListener >&) throw (cssu::RuntimeException) { } /* XInitialization */ -void SAL_CALL SignatureVerifierImpl::initialize( - const cssu::Sequence< cssu::Any >& aArguments ) +void SAL_CALL SignatureVerifierImpl::initialize( + const cssu::Sequence< cssu::Any >& aArguments ) throw (cssu::Exception, cssu::RuntimeException) { OSL_ASSERT(aArguments.getLength() == 5); - + rtl::OUString ouTempString; - + aArguments[0] >>= ouTempString; m_nSecurityId = ouTempString.toInt32(); aArguments[1] >>= m_xSAXEventKeeper; @@ -192,22 +192,22 @@ void SAL_CALL SignatureVerifierImpl::initialize( aArguments[3] >>= m_xXMLSecurityContext; aArguments[4] >>= m_xXMLSignature; } - + rtl::OUString SignatureVerifierImpl_getImplementationName () throw (cssu::RuntimeException) { - return rtl::OUString( + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); } -sal_Bool SAL_CALL SignatureVerifierImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL SignatureVerifierImpl_supportsService( const rtl::OUString& ServiceName ) throw (cssu::RuntimeException) { return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME )); } -cssu::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl_getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl_getSupportedServiceNames( ) throw (cssu::RuntimeException) { cssu::Sequence < rtl::OUString > aRet(1); @@ -217,7 +217,7 @@ cssu::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl_getSupportedServi } #undef SERVICE_NAME -cssu::Reference< cssu::XInterface > SAL_CALL SignatureVerifierImpl_createInstance( +cssu::Reference< cssu::XInterface > SAL_CALL SignatureVerifierImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory >& rSMgr) throw( cssu::Exception ) { @@ -225,17 +225,17 @@ cssu::Reference< cssu::XInterface > SAL_CALL SignatureVerifierImpl_createInstanc } /* XServiceInfo */ -rtl::OUString SAL_CALL SignatureVerifierImpl::getImplementationName( ) +rtl::OUString SAL_CALL SignatureVerifierImpl::getImplementationName( ) throw (cssu::RuntimeException) { return SignatureVerifierImpl_getImplementationName(); } -sal_Bool SAL_CALL SignatureVerifierImpl::supportsService( const rtl::OUString& rServiceName ) +sal_Bool SAL_CALL SignatureVerifierImpl::supportsService( const rtl::OUString& rServiceName ) throw (cssu::RuntimeException) { return SignatureVerifierImpl_supportsService( rServiceName ); } -cssu::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl::getSupportedServiceNames( ) +cssu::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl::getSupportedServiceNames( ) throw (cssu::RuntimeException) { return SignatureVerifierImpl_getSupportedServiceNames(); diff --git a/xmlsecurity/source/framework/signatureverifierimpl.hxx b/xmlsecurity/source/framework/signatureverifierimpl.hxx index 77dede5b9272..f4db3fc0a5d5 100644 --- a/xmlsecurity/source/framework/signatureverifierimpl.hxx +++ b/xmlsecurity/source/framework/signatureverifierimpl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,8 +39,8 @@ #include "signatureengine.hxx" class SignatureVerifierImpl : public cppu::ImplInheritanceHelper3 -< - SignatureEngine, +< + SignatureEngine, com::sun::star::xml::crypto::sax::XSignatureVerifyResultBroadcaster, com::sun::star::lang::XInitialization, com::sun::star::lang::XServiceInfo @@ -48,19 +48,19 @@ class SignatureVerifierImpl : public cppu::ImplInheritanceHelper3 /****** SignatureVerifier.hxx/CLASS SignatureVerifierImpl ********************* * * NAME - * SignatureVerifierImpl -- verifies a signature + * SignatureVerifierImpl -- verifies a signature * * FUNCTION - * Collects all resources for a signature verification, then verifies the - * signature by invoking a xmlsec-based signature bridge component. + * Collects all resources for a signature verification, then verifies the + * signature by invoking a xmlsec-based signature bridge component. * * HISTORY - * 05.01.2004 - Interface supported: XSignatureVerifyResultBroadcaster, - * XInitialization, XServiceInfo + * 05.01.2004 - Interface supported: XSignatureVerifyResultBroadcaster, + * XInitialization, XServiceInfo * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { private: @@ -69,65 +69,65 @@ private: * identify the signature. */ sal_Int32 m_nSignatureId; - + /* * the verify result */ bool m_bVerifySucceed; - - com::sun::star::uno::Reference< + + com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSecurityContext > m_xXMLSecurityContext; - + virtual void notifyResultListener() const throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); virtual bool checkReady() const; - virtual void startEngine( const com::sun::star::uno::Reference< + virtual void startEngine( const com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSignatureTemplate >& xSignatureTemplate) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); public: - explicit SignatureVerifierImpl( const com::sun::star::uno::Reference< + explicit SignatureVerifierImpl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF); virtual ~SignatureVerifierImpl(); /* XSignatureVerifyResultBroadcaster */ - virtual void SAL_CALL addSignatureVerifyResultListener( - const com::sun::star::uno::Reference< + virtual void SAL_CALL addSignatureVerifyResultListener( + const com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener >& listener ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeSignatureVerifyResultListener( - const com::sun::star::uno::Reference< - com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener >& + virtual void SAL_CALL removeSignatureVerifyResultListener( + const com::sun::star::uno::Reference< + com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener >& listener ) throw (com::sun::star::uno::RuntimeException); /* XInitialization */ - virtual void SAL_CALL initialize( - const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) + virtual void SAL_CALL initialize( + const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); /* XServiceInfo */ - virtual rtl::OUString SAL_CALL getImplementationName( ) + virtual rtl::OUString SAL_CALL getImplementationName( ) throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw (com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (com::sun::star::uno::RuntimeException); }; rtl::OUString SignatureVerifierImpl_getImplementationName() throw ( com::sun::star::uno::RuntimeException ); -sal_Bool SAL_CALL SignatureVerifierImpl_supportsService( const rtl::OUString& ServiceName ) +sal_Bool SAL_CALL SignatureVerifierImpl_supportsService( const rtl::OUString& ServiceName ) throw ( com::sun::star::uno::RuntimeException ); -com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl_getSupportedServiceNames( ) +com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl_getSupportedServiceNames( ) throw ( com::sun::star::uno::RuntimeException ); com::sun::star::uno::Reference< com::sun::star::uno::XInterface > -SAL_CALL SignatureVerifierImpl_createInstance( +SAL_CALL SignatureVerifierImpl_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw ( com::sun::star::uno::Exception ); diff --git a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx index 86e19756b9d6..e2c213e5565a 100644 --- a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx +++ b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,7 +40,7 @@ using ::rtl::OUString ; using ::com::sun::star::xml::wrapper::XXMLElementWrapper ; using ::com::sun::star::xml::crypto::XXMLEncryptionTemplate ; -XMLEncryptionTemplateImpl :: XMLEncryptionTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) +XMLEncryptionTemplateImpl :: XMLEncryptionTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_xTemplate( NULL ), m_xTarget( NULL ), m_xServiceManager( aFactory ), @@ -51,27 +51,27 @@ XMLEncryptionTemplateImpl :: ~XMLEncryptionTemplateImpl() { } /* XXMLEncryptionTemplate */ -void SAL_CALL XMLEncryptionTemplateImpl :: setTemplate( const Reference< XXMLElementWrapper >& aTemplate ) +void SAL_CALL XMLEncryptionTemplateImpl :: setTemplate( const Reference< XXMLElementWrapper >& aTemplate ) throw (com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException) { m_xTemplate = aTemplate ; } /* XXMLEncryptionTemplate */ -Reference< XXMLElementWrapper > SAL_CALL XMLEncryptionTemplateImpl :: getTemplate() +Reference< XXMLElementWrapper > SAL_CALL XMLEncryptionTemplateImpl :: getTemplate() throw (com::sun::star::uno::RuntimeException) { return m_xTemplate ; } /* XXMLEncryptionTemplate */ -void SAL_CALL XMLEncryptionTemplateImpl :: setTarget( const Reference< XXMLElementWrapper >& aTarget ) +void SAL_CALL XMLEncryptionTemplateImpl :: setTarget( const Reference< XXMLElementWrapper >& aTarget ) throw( com::sun::star::lang::IllegalArgumentException ) { m_xTarget = aTarget ; } /* XXMLEncryptionTemplate */ -Reference< XXMLElementWrapper > SAL_CALL XMLEncryptionTemplateImpl :: getTarget() +Reference< XXMLElementWrapper > SAL_CALL XMLEncryptionTemplateImpl :: getTarget() throw (com::sun::star::uno::RuntimeException) { return m_xTarget ; diff --git a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx index 87aad120ff53..10b33c8a5154 100644 --- a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx +++ b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,7 +62,7 @@ class XMLEncryptionTemplateImpl : public ::cppu::WeakImplHelper3< //Methods from XXMLEncryptionTemplate virtual void SAL_CALL setTemplate( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper >& aXmlElement - ) + ) throw (com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL getTemplate( @@ -74,7 +74,7 @@ class XMLEncryptionTemplateImpl : public ::cppu::WeakImplHelper3< virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL getTarget( ) throw (com::sun::star::uno::RuntimeException) ; - + virtual void SAL_CALL setStatus( ::com::sun::star::xml::crypto::SecurityOperationStatus status ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); @@ -107,6 +107,6 @@ class XMLEncryptionTemplateImpl : public ::cppu::WeakImplHelper3< static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ) ; } ; -#endif // _XMLENCRYPTIONTEMPLATE_XMLSECIMPL_HXX_ +#endif // _XMLENCRYPTIONTEMPLATE_XMLSECIMPL_HXX_ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx index c03ef50243e0..9dc76e96c542 100644 --- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx +++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,7 +41,7 @@ using ::rtl::OUString ; using ::com::sun::star::xml::wrapper::XXMLElementWrapper ; using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ; -XMLSignatureTemplateImpl :: XMLSignatureTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) +XMLSignatureTemplateImpl :: XMLSignatureTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) :m_xTemplate( NULL ), m_xServiceManager( aFactory ), m_nStatus ( ::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN ) @@ -52,40 +52,40 @@ XMLSignatureTemplateImpl :: ~XMLSignatureTemplateImpl() { } /* XXMLSignatureTemplate */ -void SAL_CALL XMLSignatureTemplateImpl :: setTemplate( const Reference< XXMLElementWrapper >& aTemplate ) +void SAL_CALL XMLSignatureTemplateImpl :: setTemplate( const Reference< XXMLElementWrapper >& aTemplate ) throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException) { m_xTemplate = aTemplate ; } /* XXMLSignatureTemplate */ -Reference< XXMLElementWrapper > SAL_CALL XMLSignatureTemplateImpl :: getTemplate() +Reference< XXMLElementWrapper > SAL_CALL XMLSignatureTemplateImpl :: getTemplate() throw (com::sun::star::uno::RuntimeException) { return m_xTemplate ; } -void SAL_CALL XMLSignatureTemplateImpl :: setTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper >& aXmlElement ) +void SAL_CALL XMLSignatureTemplateImpl :: setTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper >& aXmlElement ) throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException) { targets.push_back( aXmlElement ); } -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > > SAL_CALL XMLSignatureTemplateImpl :: getTargets() +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > > SAL_CALL XMLSignatureTemplateImpl :: getTargets() throw (com::sun::star::uno::RuntimeException) { sal_Int32 length = targets.size(); ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > > aTargets (length); - + sal_Int32 i; - + for (i=0; i<length; i++) { aTargets[i] = targets[i]; } - + return aTargets; } diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.hxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.hxx index a38c73b44821..b8cc82480122 100644 --- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.hxx +++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -77,7 +77,7 @@ class XMLSignatureTemplateImpl : public ::cppu::WeakImplHelper3< virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > > SAL_CALL getTargets( ) throw (com::sun::star::uno::RuntimeException); - + virtual void SAL_CALL setBinding( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XUriBinding >& aUriBinding ) @@ -86,7 +86,7 @@ class XMLSignatureTemplateImpl : public ::cppu::WeakImplHelper3< ::com::sun::star::xml::crypto::XUriBinding > SAL_CALL getBinding( ) throw (::com::sun::star::uno::RuntimeException); - + virtual void SAL_CALL setStatus( ::com::sun::star::xml::crypto::SecurityOperationStatus status ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); @@ -119,6 +119,6 @@ class XMLSignatureTemplateImpl : public ::cppu::WeakImplHelper3< static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ) ; } ; -#endif // _XMLSIGNATURETEMPLATE_XMLSECIMPL_HXX_ +#endif // _XMLSIGNATURETEMPLATE_XMLSECIMPL_HXX_ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/framework/xsec_framework.cxx b/xmlsecurity/source/framework/xsec_framework.cxx index 3a03e3738d53..1597e32422ea 100644 --- a/xmlsecurity/source/framework/xsec_framework.cxx +++ b/xmlsecurity/source/framework/xsec_framework.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -70,16 +70,16 @@ sal_Bool SAL_CALL component_writeInfo( //Decryptor sal_Int32 nPos = 0; Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( DecryptorImpl_getImplementationName() ) ); + reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( DecryptorImpl_getImplementationName() ) ); xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - + const Sequence< OUString > & rSNL = DecryptorImpl_getSupportedServiceNames(); const OUString * pArray = rSNL.getConstArray(); for ( nPos = rSNL.getLength(); nPos--; ) xNewKey->createKey( pArray[nPos] ); - + //Encryptor - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( EncryptorImpl_getImplementationName() ); + xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( EncryptorImpl_getImplementationName() ); xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); const Sequence< OUString > & rSNL2 = EncryptorImpl_getSupportedServiceNames(); pArray = rSNL2.getConstArray(); @@ -87,7 +87,7 @@ sal_Bool SAL_CALL component_writeInfo( xNewKey->createKey( pArray[nPos] ); //SignatureCreator - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SignatureCreatorImpl_getImplementationName() ); + xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SignatureCreatorImpl_getImplementationName() ); xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); const Sequence< OUString > & rSNL3 = SignatureCreatorImpl_getSupportedServiceNames(); pArray = rSNL3.getConstArray(); @@ -95,7 +95,7 @@ sal_Bool SAL_CALL component_writeInfo( xNewKey->createKey( pArray[nPos] ); //SignatureVerifier - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SignatureVerifierImpl_getImplementationName() ); + xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SignatureVerifierImpl_getImplementationName() ); xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); const Sequence< OUString > & rSNL4 = SignatureVerifierImpl_getSupportedServiceNames(); pArray = rSNL4.getConstArray(); @@ -103,7 +103,7 @@ sal_Bool SAL_CALL component_writeInfo( xNewKey->createKey( pArray[nPos] ); //SAXEventKeeper - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SAXEventKeeperImpl_getImplementationName() ); + xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SAXEventKeeperImpl_getImplementationName() ); xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); const Sequence< OUString > & rSNL5 = SAXEventKeeperImpl_getSupportedServiceNames(); pArray = rSNL5.getConstArray(); @@ -111,7 +111,7 @@ sal_Bool SAL_CALL component_writeInfo( xNewKey->createKey( pArray[nPos] ); //XMLSignatureTemplateImpl - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( XMLSignatureTemplateImpl::impl_getImplementationName() ); + xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( XMLSignatureTemplateImpl::impl_getImplementationName() ); xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); const Sequence< OUString > & rSNL6 = XMLSignatureTemplateImpl::impl_getSupportedServiceNames(); pArray = rSNL6.getConstArray(); @@ -119,13 +119,13 @@ sal_Bool SAL_CALL component_writeInfo( xNewKey->createKey( pArray[nPos] ); // XMLEncryptionTemplateImpl - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( XMLEncryptionTemplateImpl::impl_getImplementationName() ); + xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( XMLEncryptionTemplateImpl::impl_getImplementationName() ); xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); const Sequence< OUString > & rSNL7 = XMLEncryptionTemplateImpl::impl_getSupportedServiceNames(); pArray = rSNL7.getConstArray(); for ( nPos = rSNL7.getLength(); nPos--; ) xNewKey->createKey( pArray[nPos] ); - + return sal_True; } catch (InvalidRegistryException &) @@ -141,7 +141,7 @@ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; - + //Decryptor OUString implName = OUString::createFromAscii( pImplName ); if ( pServiceManager && implName.equals(DecryptorImpl_getImplementationName()) ) @@ -150,7 +150,7 @@ void * SAL_CALL component_getFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), DecryptorImpl_createInstance, DecryptorImpl_getSupportedServiceNames() ) ); - + if (xFactory.is()) { xFactory->acquire(); @@ -165,7 +165,7 @@ void * SAL_CALL component_getFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), EncryptorImpl_createInstance, EncryptorImpl_getSupportedServiceNames() ) ); - + if (xFactory.is()) { xFactory->acquire(); @@ -180,14 +180,14 @@ void * SAL_CALL component_getFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), SignatureCreatorImpl_createInstance, SignatureCreatorImpl_getSupportedServiceNames() ) ); - + if (xFactory.is()) { xFactory->acquire(); pRet = xFactory.get(); } } - + //SignatureVerifier if ( pServiceManager && implName.equals(SignatureVerifierImpl_getImplementationName()) ) { @@ -195,7 +195,7 @@ void * SAL_CALL component_getFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), SignatureVerifierImpl_createInstance, SignatureVerifierImpl_getSupportedServiceNames() ) ); - + if (xFactory.is()) { xFactory->acquire(); @@ -210,7 +210,7 @@ void * SAL_CALL component_getFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), SAXEventKeeperImpl_createInstance, SAXEventKeeperImpl_getSupportedServiceNames() ) ); - + if (xFactory.is()) { xFactory->acquire(); @@ -243,7 +243,7 @@ void * SAL_CALL component_getFactory( pRet = xFactory.get(); } } - + return pRet; } } |