24#include <com/sun/star/xml/crypto/sax/ConstOfSecurityId.hpp>
25#include <osl/diagnose.h>
26#include <rtl/ustrbuf.hxx>
32 m_bAllReceived(false),
33 m_xXMLElement(
std::move(xXMLElement))
63 return std::any_of(m_vElementCollectors.cbegin(), m_vElementCollectors.cend(),
65 return (nIgnoredSecurityId == css::xml::crypto::sax::ConstOfSecurityId::UNDEFINEDSECURITYID ||
66 pElementCollector->getSecurityId() != nIgnoredSecurityId) &&
67 (pElementCollector->getPriority() == css::xml::crypto::sax::ElementMarkPriority_BEFOREMODIFY);
172 OSL_ASSERT(!(
m_pBlocker !=
nullptr && pBlocker !=
nullptr));
204 rc.append(
"BufID=" + OUString::number(ii->getBufferId()));
213 switch (ii->getPriority())
215 case css::xml::crypto::sax::ElementMarkPriority_BEFOREMODIFY:
216 rc.append(
"BEFOREMODIFY");
218 case css::xml::crypto::sax::ElementMarkPriority_AFTERMODIFY:
219 rc.append(
"AFTERMODIFY");
222 rc.append(
"UNKNOWN");
226 rc.append(
"(SecID=" + OUString::number(ii->getSecurityId()) +
") ");
229 return rc.makeStringAndClear();
397 [pChild] (
const std::unique_ptr<BufferNode>&
i)
398 { return i.get() == pChild; });
423 auto ii = std::find_if(m_vChildren.begin(), m_vChildren.end(),
424 [pChild] (
const std::unique_ptr<BufferNode>&
i)
425 { return i.get() == pChild; });
426 if (ii == m_vChildren.end())
429 return std::distance(m_vChildren.begin(), ii);
490 if (pDescendant !=
nullptr)
492 auto ii = std::find_if(m_vChildren.cbegin(), m_vChildren.cend(),
493 [&pDescendant](
const std::unique_ptr<BufferNode>& pChild) {
494 return (pChild.get() == pDescendant) || (pChild->isAncestor(pDescendant) != nullptr);
497 if (ii != m_vChildren.end())
528 while (pNextBufferNode !=
nullptr)
530 if (pNextBufferNode == pFollowing)
585 if (pNextSibling !=
nullptr)
600 if (pNode ==
nullptr)
606 if (pParent !=
nullptr)
612 }
while (pNextSiblingParent ==
nullptr);
614 return pNextSiblingParent;
643 for( std::unique_ptr<BufferNode>& pBufferNode :
m_vChildren )
645 pBufferNode->elementCollectorNotify();
646 pBufferNode->notifyBranch();
673 css::xml::crypto::sax::ElementMarkPriority nMaxPriority = css::xml::crypto::sax::ElementMarkPriority_MINIMUM;
674 css::xml::crypto::sax::ElementMarkPriority nPriority;
681 nPriority = pElementCollector->getPriority();
682 if (nPriority > nMaxPriority)
684 nMaxPriority = nPriority;
694 bool bToModify = pElementCollector->
getModify();
703 if (nPriority == nMaxPriority &&
704 (nPriority == css::xml::crypto::sax::ElementMarkPriority_BEFOREMODIFY ||
753 bool rc = std::any_of(m_vElementCollectors.begin(), m_vElementCollectors.end(),
755 return nIgnoredSecurityId == css::xml::crypto::sax::ConstOfSecurityId::UNDEFINEDSECURITYID ||
756 pElementCollector->getSecurityId() != nIgnoredSecurityId;
761 rc = std::any_of(m_vChildren.begin(), m_vChildren.end(),
762 [nIgnoredSecurityId](
const std::unique_ptr<BufferNode>& pBufferNode) {
763 return pBufferNode->isECInSubTreeIncluded(nIgnoredSecurityId);
799 while (pParentNode !=
nullptr)
837 return std::any_of(m_vChildren.begin(), m_vChildren.end(),
838 [nIgnoredSecurityId](
const std::unique_ptr<BufferNode>& pBufferNode) {
839 ElementMark* pBlocker = pBufferNode->getBlocker();
840 return (pBlocker != nullptr &&
841 (nIgnoredSecurityId == css::xml::crypto::sax::ConstOfSecurityId::UNDEFINEDSECURITYID ||
842 pBlocker->getSecurityId() != nIgnoredSecurityId )) ||
843 pBufferNode->isBlockerInSubTreeIncluded(nIgnoredSecurityId);
868 bool bChildFound =
false;
870 for( std::unique_ptr<BufferNode>
const &
i : m_vChildren )
878 if(
i.get() == pChild )
const BufferNode * getFirstChild() const
void removeChild(const BufferNode *pChild)
std::vector< std::unique_ptr< BufferNode > > releaseChildren()
void setParent(const BufferNode *pParent)
const BufferNode * getNextChild(const BufferNode *pChild) const
void elementCollectorNotify()
BufferNode(css::uno::Reference< css::xml::wrapper::XXMLElementWrapper > xXMLElement)
bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const
bool isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId) const
void setBlocker(const ElementMark *pBlocker)
const BufferNode * getNextNodeByTreeOrder() const
void setXMLElement(const css::uno::Reference< css::xml::wrapper::XXMLElementWrapper > &xXMLElement)
void removeElementCollector(const ElementCollector *pElementCollector)
OUString printChildren() const
bool isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const
bool isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const
const BufferNode * getNextSibling() const
const BufferNode * getParent() const
void addElementCollector(const ElementCollector *pElementCollector)
bool isPrevious(const BufferNode *pFollowing) const
void addChild(std::unique_ptr< BufferNode > pChild, sal_Int32 nPosition)
const BufferNode * isAncestor(const BufferNode *pDescendant) const
css::uno::Reference< css::xml::wrapper::XXMLElementWrapper > m_xXMLElement
std::vector< std::unique_ptr< BufferNode > > m_vChildren
std::vector< std::unique_ptr< BufferNode > > const & getChildren() const
sal_Int32 indexOfChild(const BufferNode *pChild) const
std::vector< const ElementCollector * > m_vElementCollectors
css::xml::crypto::sax::ElementMarkPriority getPriority() const
void setBufferNode(const BufferNode *pBufferNode)
sal_Int32 getSecurityId() const