merged tag ooo/OOO330_m14
[LibreOffice.git] / xmlsecurity / source / framework / buffernode.hxx
blobec5d071d234bda61ca49406e193f1010caabd1be
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _BUFFERNODE_HXX
29 #define _BUFFERNODE_HXX
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
34 #ifndef INCLUDED_VECTOR
35 #include <vector>
36 #define INCLUDED_VECTOR
37 #endif
39 class ElementMark;
40 class ElementCollector;
42 class BufferNode
43 /****** buffernode.hxx/CLASS BufferNode ***************************************
45 * NAME
46 * BufferNode -- Class to maintain the tree of bufferred elements
48 * FUNCTION
49 * One BufferNode object represents a bufferred element in the document
50 * wrapper component.
51 * All BufferNode objects construct a tree which has the same structure
52 * of all bufferred elements. That is to say, if one bufferred element is
53 * an ancestor of another bufferred element, then the corresponding
54 * BufferNode objects are also in ancestor/descendant relationship.
55 * This class is used to manipulate the tree of bufferred elements.
57 * HISTORY
58 * 05.01.2004 - implemented
60 * AUTHOR
61 * Michael Mi
62 * Email: michael.mi@sun.com
63 ******************************************************************************/
65 private:
66 /* the parent BufferNode */
67 BufferNode* m_pParent;
69 /* all child BufferNodes */
70 std::vector< const BufferNode* > m_vChildren;
72 /* all ElementCollector holding this BufferNode */
73 std::vector< const ElementCollector* > m_vElementCollectors;
76 * the blocker holding this BufferNode, one BufferNode can have one
77 * blocker at most
79 ElementMark* m_pBlocker;
82 * whether the element has completely bufferred by the document wrapper
83 * component
85 bool m_bAllReceived;
87 /* the XMLElementWrapper of the bufferred element */
88 com::sun::star::uno::Reference<
89 com::sun::star::xml::wrapper::XXMLElementWrapper > m_xXMLElement;
91 private:
92 bool isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const;
93 bool isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId) const;
94 bool isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const;
95 const BufferNode* getNextChild(const BufferNode* pChild) const;
97 public:
98 explicit BufferNode(
99 const com::sun::star::uno::Reference<
100 com::sun::star::xml::wrapper::XXMLElementWrapper >& xXMLElement);
101 virtual ~BufferNode() {};
103 bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const;
104 void setReceivedAll();
105 bool isAllReceived() const;
106 void addElementCollector(const ElementCollector* pElementCollector);
107 void removeElementCollector(const ElementCollector* pElementCollector);
108 ElementMark* getBlocker() const;
109 void setBlocker(const ElementMark* pBlocker);
110 rtl::OUString printChildren() const;
111 bool hasAnything() const;
112 bool hasChildren() const;
113 std::vector< const BufferNode* >* getChildren() const;
114 const BufferNode* getFirstChild() const;
115 void addChild(const BufferNode* pChild, sal_Int32 nPosition);
116 void addChild(const BufferNode* pChild);
117 void removeChild(const BufferNode* pChild);
118 sal_Int32 indexOfChild(const BufferNode* pChild) const;
119 const BufferNode* childAt(sal_Int32 nIndex) const;
120 const BufferNode* getParent() const;
121 void setParent(const BufferNode* pParent);
122 const BufferNode* getNextSibling() const;
123 const BufferNode* isAncestor(const BufferNode* pDescendant) const;
124 bool isPrevious(const BufferNode* pFollowing) const;
125 const BufferNode* getNextNodeByTreeOrder() const;
126 com::sun::star::uno::Reference<
127 com::sun::star::xml::wrapper::XXMLElementWrapper > getXMLElement() const;
128 void setXMLElement(const com::sun::star::uno::Reference<
129 com::sun::star::xml::wrapper::XXMLElementWrapper >& xXMLElement);
130 void notifyBranch();
131 void notifyAncestor();
132 void elementCollectorNotify();
133 void freeAllChildren();
136 #endif