1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: buffernode.hxx,v $
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
39 #define INCLUDED_VECTOR
43 class ElementCollector
;
46 /****** buffernode.hxx/CLASS BufferNode ***************************************
49 * BufferNode -- Class to maintain the tree of bufferred elements
52 * One BufferNode object represents a bufferred element in the document
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.
61 * 05.01.2004 - implemented
65 * Email: michael.mi@sun.com
66 ******************************************************************************/
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
82 ElementMark
* m_pBlocker
;
85 * whether the element has completely bufferred by the document wrapper
90 /* the XMLElementWrapper of the bufferred element */
91 com::sun::star::uno::Reference
<
92 com::sun::star::xml::wrapper::XXMLElementWrapper
> m_xXMLElement
;
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;
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
);
134 void notifyAncestor();
135 void elementCollectorNotify();
136 void freeAllChildren();