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
30 class XXMLElementWrapper
;
34 class ElementCollector
;
36 class BufferNode final
37 /****** buffernode.hxx/CLASS BufferNode ***************************************
40 * BufferNode -- Class to maintain the tree of buffered elements
43 * One BufferNode object represents a buffered element in the document
45 * All BufferNode objects construct a tree which has the same structure
46 * of all buffered elements. That is to say, if one buffered element is
47 * an ancestor of another buffered element, then the corresponding
48 * BufferNode objects are also in ancestor/descendant relationship.
49 * This class is used to manipulate the tree of buffered elements.
50 ******************************************************************************/
53 /* the parent BufferNode */
54 BufferNode
* m_pParent
;
56 /* all child BufferNodes */
57 std::vector
<std::unique_ptr
<BufferNode
>> m_vChildren
;
59 /* all ElementCollector holding this BufferNode */
60 std::vector
<const ElementCollector
*> m_vElementCollectors
;
63 * the blocker holding this BufferNode, one BufferNode can have one
66 ElementMark
* m_pBlocker
;
69 * whether the element has completely buffered by the document wrapper
74 /* the XMLElementWrapper of the buffered element */
75 css::uno::Reference
<css::xml::wrapper::XXMLElementWrapper
> m_xXMLElement
;
78 bool isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId
) const;
79 bool isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId
) const;
80 bool isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId
) const;
81 const BufferNode
* getNextChild(const BufferNode
* pChild
) const;
85 const css::uno::Reference
<css::xml::wrapper::XXMLElementWrapper
>& xXMLElement
);
87 bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId
) const;
88 void setReceivedAll();
89 bool isAllReceived() const { return m_bAllReceived
; }
90 void addElementCollector(const ElementCollector
* pElementCollector
);
91 void removeElementCollector(const ElementCollector
* pElementCollector
);
92 ElementMark
* getBlocker() const { return m_pBlocker
; }
93 void setBlocker(const ElementMark
* pBlocker
);
94 OUString
printChildren() const;
95 bool hasAnything() const;
96 bool hasChildren() const;
97 std::vector
<std::unique_ptr
<BufferNode
>> const& getChildren() const;
98 std::vector
<std::unique_ptr
<BufferNode
>> releaseChildren();
99 const BufferNode
* getFirstChild() const;
100 void addChild(std::unique_ptr
<BufferNode
> pChild
, sal_Int32 nPosition
);
101 void addChild(std::unique_ptr
<BufferNode
> pChild
);
102 void removeChild(const BufferNode
* pChild
);
103 sal_Int32
indexOfChild(const BufferNode
* pChild
) const;
104 const BufferNode
* getParent() const { return m_pParent
; }
105 void setParent(const BufferNode
* pParent
);
106 const BufferNode
* getNextSibling() const;
107 const BufferNode
* isAncestor(const BufferNode
* pDescendant
) const;
108 bool isPrevious(const BufferNode
* pFollowing
) const;
109 const BufferNode
* getNextNodeByTreeOrder() const;
110 const css::uno::Reference
<css::xml::wrapper::XXMLElementWrapper
>& getXMLElement() const
112 return m_xXMLElement
;
115 setXMLElement(const css::uno::Reference
<css::xml::wrapper::XXMLElementWrapper
>& xXMLElement
);
117 void elementCollectorNotify();
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */