LibreOffice Module xmlsecurity (master) 1
buffernode.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <com/sun/star/uno/Reference.hxx>
23
24#include <memory>
25#include <vector>
26
28{
29class XXMLElementWrapper;
30}
31
32class ElementMark;
34
35class BufferNode final
36/****** buffernode.hxx/CLASS BufferNode ***************************************
37 *
38 * NAME
39 * BufferNode -- Class to maintain the tree of buffered elements
40 *
41 * FUNCTION
42 * One BufferNode object represents a buffered element in the document
43 * wrapper component.
44 * All BufferNode objects construct a tree which has the same structure
45 * of all buffered elements. That is to say, if one buffered element is
46 * an ancestor of another buffered element, then the corresponding
47 * BufferNode objects are also in ancestor/descendant relationship.
48 * This class is used to manipulate the tree of buffered elements.
49 ******************************************************************************/
50{
51private:
52 /* the parent BufferNode */
54
55 /* all child BufferNodes */
56 std::vector<std::unique_ptr<BufferNode>> m_vChildren;
57
58 /* all ElementCollector holding this BufferNode */
59 std::vector<const ElementCollector*> m_vElementCollectors;
60
61 /*
62 * the blocker holding this BufferNode, one BufferNode can have one
63 * blocker at most
64 */
66
67 /*
68 * whether the element has completely buffered by the document wrapper
69 * component
70 */
72
73 /* the XMLElementWrapper of the buffered element */
74 css::uno::Reference<css::xml::wrapper::XXMLElementWrapper> m_xXMLElement;
75
76private:
77 bool isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const;
78 bool isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId) const;
79 bool isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const;
80 const BufferNode* getNextChild(const BufferNode* pChild) const;
81
82public:
83 explicit BufferNode(css::uno::Reference<css::xml::wrapper::XXMLElementWrapper> xXMLElement);
84
85 bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const;
86 void setReceivedAll();
87 bool isAllReceived() const { return m_bAllReceived; }
88 void addElementCollector(const ElementCollector* pElementCollector);
89 void removeElementCollector(const ElementCollector* pElementCollector);
90 ElementMark* getBlocker() const { return m_pBlocker; }
91 void setBlocker(const ElementMark* pBlocker);
92 OUString printChildren() const;
93 bool hasAnything() const;
94 bool hasChildren() const;
95 std::vector<std::unique_ptr<BufferNode>> const& getChildren() const;
96 std::vector<std::unique_ptr<BufferNode>> releaseChildren();
97 const BufferNode* getFirstChild() const;
98 void addChild(std::unique_ptr<BufferNode> pChild, sal_Int32 nPosition);
99 void addChild(std::unique_ptr<BufferNode> pChild);
100 void removeChild(const BufferNode* pChild);
101 sal_Int32 indexOfChild(const BufferNode* pChild) const;
102 const BufferNode* getParent() const { return m_pParent; }
103 void setParent(const BufferNode* pParent);
104 const BufferNode* getNextSibling() const;
105 const BufferNode* isAncestor(const BufferNode* pDescendant) const;
106 bool isPrevious(const BufferNode* pFollowing) const;
107 const BufferNode* getNextNodeByTreeOrder() const;
108 const css::uno::Reference<css::xml::wrapper::XXMLElementWrapper>& getXMLElement() const
109 {
110 return m_xXMLElement;
111 }
112 void
113 setXMLElement(const css::uno::Reference<css::xml::wrapper::XXMLElementWrapper>& xXMLElement);
114 void notifyBranch();
116};
117
118/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void notifyBranch()
Definition: buffernode.cxx:623
const BufferNode * getFirstChild() const
Definition: buffernode.cxx:288
void removeChild(const BufferNode *pChild)
Definition: buffernode.cxx:377
std::vector< std::unique_ptr< BufferNode > > releaseChildren()
Definition: buffernode.cxx:283
void setParent(const BufferNode *pParent)
Definition: buffernode.cxx:433
const BufferNode * getNextChild(const BufferNode *pChild) const
Definition: buffernode.cxx:847
void elementCollectorNotify()
Definition: buffernode.cxx:650
BufferNode(css::uno::Reference< css::xml::wrapper::XXMLElementWrapper > xXMLElement)
Definition: buffernode.cxx:29
const css::uno::Reference< css::xml::wrapper::XXMLElementWrapper > & getXMLElement() const
Definition: buffernode.hxx:108
bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const
Definition: buffernode.cxx:37
bool hasChildren() const
Definition: buffernode.cxx:255
bool isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId) const
Definition: buffernode.cxx:770
void setBlocker(const ElementMark *pBlocker)
Definition: buffernode.cxx:149
const BufferNode * getNextNodeByTreeOrder() const
Definition: buffernode.cxx:542
void setXMLElement(const css::uno::Reference< css::xml::wrapper::XXMLElementWrapper > &xXMLElement)
Definition: buffernode.cxx:618
void removeElementCollector(const ElementCollector *pElementCollector)
Definition: buffernode.cxx:120
bool isAllReceived() const
Definition: buffernode.hxx:87
OUString printChildren() const
Definition: buffernode.cxx:181
bool isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const
Definition: buffernode.cxx:813
bool isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const
Definition: buffernode.cxx:729
ElementMark * getBlocker() const
Definition: buffernode.hxx:90
const BufferNode * getNextSibling() const
Definition: buffernode.cxx:438
const BufferNode * getParent() const
Definition: buffernode.hxx:102
bool m_bAllReceived
Definition: buffernode.hxx:71
void addElementCollector(const ElementCollector *pElementCollector)
Definition: buffernode.cxx:97
bool isPrevious(const BufferNode *pFollowing) const
Definition: buffernode.cxx:504
void setReceivedAll()
Definition: buffernode.cxx:71
ElementMark * m_pBlocker
Definition: buffernode.hxx:65
void addChild(std::unique_ptr< BufferNode > pChild, sal_Int32 nPosition)
Definition: buffernode.cxx:318
const BufferNode * isAncestor(const BufferNode *pDescendant) const
Definition: buffernode.cxx:467
css::uno::Reference< css::xml::wrapper::XXMLElementWrapper > m_xXMLElement
Definition: buffernode.hxx:74
std::vector< std::unique_ptr< BufferNode > > m_vChildren
Definition: buffernode.hxx:56
BufferNode * m_pParent
Definition: buffernode.hxx:53
std::vector< std::unique_ptr< BufferNode > > const & getChildren() const
Definition: buffernode.cxx:278
sal_Int32 indexOfChild(const BufferNode *pChild) const
Definition: buffernode.cxx:403
std::vector< const ElementCollector * > m_vElementCollectors
Definition: buffernode.hxx:59
bool hasAnything() const
Definition: buffernode.cxx:232