1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_XMLSECURITY_SOURCE_FRAMEWORK_BUFFERNODE_HXX
21 #define INCLUDED_XMLSECURITY_SOURCE_FRAMEWORK_BUFFERNODE_HXX
23 #include <com/sun/star/uno/Reference.hxx>
28 namespace com::sun::star::xml::wrapper
{ class XXMLElementWrapper
; }
31 class ElementCollector
;
33 class BufferNode final
34 /****** buffernode.hxx/CLASS BufferNode ***************************************
37 * BufferNode -- Class to maintain the tree of buffered elements
40 * One BufferNode object represents a buffered element in the document
42 * All BufferNode objects construct a tree which has the same structure
43 * of all buffered elements. That is to say, if one buffered element is
44 * an ancestor of another buffered element, then the corresponding
45 * BufferNode objects are also in ancestor/descendant relationship.
46 * This class is used to manipulate the tree of buffered elements.
47 ******************************************************************************/
50 /* the parent BufferNode */
51 BufferNode
* m_pParent
;
53 /* all child BufferNodes */
54 std::vector
< std::unique_ptr
<BufferNode
> > m_vChildren
;
56 /* all ElementCollector holding this BufferNode */
57 std::vector
< const ElementCollector
* > m_vElementCollectors
;
60 * the blocker holding this BufferNode, one BufferNode can have one
63 ElementMark
* m_pBlocker
;
66 * whether the element has completely buffered by the document wrapper
71 /* the XMLElementWrapper of the buffered element */
72 css::uno::Reference
< css::xml::wrapper::XXMLElementWrapper
> m_xXMLElement
;
75 bool isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId
) const;
76 bool isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId
) const;
77 bool isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId
) const;
78 const BufferNode
* getNextChild(const BufferNode
* pChild
) const;
82 const css::uno::Reference
< css::xml::wrapper::XXMLElementWrapper
>& xXMLElement
);
84 bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId
) const;
85 void setReceivedAll();
86 bool isAllReceived() const { return m_bAllReceived
;}
87 void addElementCollector(const ElementCollector
* pElementCollector
);
88 void removeElementCollector(const ElementCollector
* pElementCollector
);
89 ElementMark
* getBlocker() const { return m_pBlocker
;}
90 void setBlocker(const ElementMark
* pBlocker
);
91 OUString
printChildren() const;
92 bool hasAnything() const;
93 bool hasChildren() const;
94 std::vector
< std::unique_ptr
< BufferNode
> > const & getChildren() const;
95 std::vector
< std::unique_ptr
< BufferNode
> > releaseChildren();
96 const BufferNode
* getFirstChild() const;
97 void addChild(std::unique_ptr
<BufferNode
> pChild
, sal_Int32 nPosition
);
98 void addChild(std::unique_ptr
<BufferNode
> pChild
);
99 void removeChild(const BufferNode
* pChild
);
100 sal_Int32
indexOfChild(const BufferNode
* pChild
) const;
101 const BufferNode
* getParent() const { return m_pParent
;}
102 void setParent(const BufferNode
* pParent
);
103 const BufferNode
* getNextSibling() const;
104 const BufferNode
* isAncestor(const BufferNode
* pDescendant
) const;
105 bool isPrevious(const BufferNode
* pFollowing
) const;
106 const BufferNode
* getNextNodeByTreeOrder() const;
107 const css::uno::Reference
< css::xml::wrapper::XXMLElementWrapper
>& getXMLElement() const { return m_xXMLElement
;}
108 void setXMLElement(const css::uno::Reference
<
109 css::xml::wrapper::XXMLElementWrapper
>& xXMLElement
);
111 void elementCollectorNotify();
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */