Bump version to 5.0-14
[LibreOffice.git] / xmlsecurity / source / framework / buffernode.hxx
blob18f3bb63a27bce711fd56daceea1d97c58587555
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/lang/XServiceInfo.hpp>
24 #include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
26 #include <vector>
28 class ElementMark;
29 class ElementCollector;
31 class BufferNode
32 /****** buffernode.hxx/CLASS BufferNode ***************************************
34 * NAME
35 * BufferNode -- Class to maintain the tree of bufferred elements
37 * FUNCTION
38 * One BufferNode object represents a bufferred element in the document
39 * wrapper component.
40 * All BufferNode objects construct a tree which has the same structure
41 * of all bufferred elements. That is to say, if one bufferred element is
42 * an ancestor of another bufferred element, then the corresponding
43 * BufferNode objects are also in ancestor/descendant relationship.
44 * This class is used to manipulate the tree of bufferred elements.
46 * AUTHOR
47 * Michael Mi
48 * Email: michael.mi@sun.com
49 ******************************************************************************/
51 private:
52 /* the parent BufferNode */
53 BufferNode* m_pParent;
55 /* all child BufferNodes */
56 std::vector< const BufferNode* > m_vChildren;
58 /* all ElementCollector holding this BufferNode */
59 std::vector< const ElementCollector* > m_vElementCollectors;
62 * the blocker holding this BufferNode, one BufferNode can have one
63 * blocker at most
65 ElementMark* m_pBlocker;
68 * whether the element has completely bufferred by the document wrapper
69 * component
71 bool m_bAllReceived;
73 /* the XMLElementWrapper of the bufferred element */
74 com::sun::star::uno::Reference<
75 com::sun::star::xml::wrapper::XXMLElementWrapper > m_xXMLElement;
77 private:
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;
83 public:
84 explicit BufferNode(
85 const com::sun::star::uno::Reference<
86 com::sun::star::xml::wrapper::XXMLElementWrapper >& xXMLElement);
87 virtual ~BufferNode() {};
89 bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const;
90 void setReceivedAll();
91 bool isAllReceived() const { return m_bAllReceived;}
92 void addElementCollector(const ElementCollector* pElementCollector);
93 void removeElementCollector(const ElementCollector* pElementCollector);
94 ElementMark* getBlocker() const { return m_pBlocker;}
95 void setBlocker(const ElementMark* pBlocker);
96 OUString printChildren() const;
97 bool hasAnything() const;
98 bool hasChildren() const;
99 std::vector< const BufferNode* >* getChildren() const;
100 const BufferNode* getFirstChild() const;
101 void addChild(const BufferNode* pChild, sal_Int32 nPosition);
102 void addChild(const BufferNode* pChild);
103 void removeChild(const BufferNode* pChild);
104 sal_Int32 indexOfChild(const BufferNode* pChild) const;
105 const BufferNode* getParent() const { return m_pParent;}
106 void setParent(const BufferNode* pParent);
107 const BufferNode* getNextSibling() const;
108 const BufferNode* isAncestor(const BufferNode* pDescendant) const;
109 bool isPrevious(const BufferNode* pFollowing) const;
110 const BufferNode* getNextNodeByTreeOrder() const;
111 com::sun::star::uno::Reference<
112 com::sun::star::xml::wrapper::XXMLElementWrapper > getXMLElement() const { return m_xXMLElement;}
113 void setXMLElement(const com::sun::star::uno::Reference<
114 com::sun::star::xml::wrapper::XXMLElementWrapper >& xXMLElement);
115 void notifyBranch();
116 void elementCollectorNotify();
117 void freeAllChildren();
120 #endif
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */