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