summaryrefslogtreecommitdiff
path: root/unoxml/source/dom/childlist.cxx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-03-23 16:59:02 +0100
committerJan Holesovsky <kendy@suse.cz>2011-03-23 16:59:02 +0100
commit90087ebb40a6cf12c9464da4e4ea7cc8b5f24bc5 (patch)
treebb3d6cb01c18dd12ae7ec77234cd43a6092d5a4b /unoxml/source/dom/childlist.cxx
parent5d7d145d411c8974ceb12ac08759e7ccf3bb9b27 (diff)
parent82c070266d0440348c61c710e0caa89ae1e74b1b (diff)
Merge commit 'ooo/DEV300_m103'
Conflicts: binfilter/bf_xmloff/source/forms/formcellbinding.hxx binfilter/bf_xmloff/source/forms/xmloff_elementexport.cxx binfilter/bf_xmloff/source/forms/xmloff_formcellbinding.cxx filter/source/xsltfilter/makefile.mk unoxml/source/dom/characterdata.cxx unoxml/source/dom/document.cxx unoxml/source/dom/documentbuilder.cxx unoxml/source/dom/element.cxx unoxml/source/dom/elementlist.cxx unoxml/source/dom/node.cxx unoxml/source/dom/node.hxx unoxml/source/dom/text.cxx unoxml/source/events/event.cxx unoxml/source/events/event.hxx unoxml/source/events/eventdispatcher.cxx unoxml/source/events/eventdispatcher.hxx unoxml/source/events/mouseevent.cxx unoxml/source/events/mouseevent.hxx unoxml/source/events/mutationevent.cxx unoxml/source/events/mutationevent.hxx unoxml/source/events/uievent.cxx unoxml/source/events/uievent.hxx unoxml/source/xpath/nodelist.cxx unoxml/source/xpath/nodelist.hxx unoxml/source/xpath/xpathobject.cxx
Diffstat (limited to 'unoxml/source/dom/childlist.cxx')
-rw-r--r--unoxml/source/dom/childlist.cxx41
1 files changed, 31 insertions, 10 deletions
diff --git a/unoxml/source/dom/childlist.cxx b/unoxml/source/dom/childlist.cxx
index 22189c29d3eb..28731cef8c63 100644
--- a/unoxml/source/dom/childlist.cxx
+++ b/unoxml/source/dom/childlist.cxx
@@ -26,11 +26,20 @@
*
************************************************************************/
-#include "childlist.hxx"
+#include <childlist.hxx>
+
+#include <libxml/tree.h>
+
+#include <node.hxx>
+#include <document.hxx>
+
+
namespace DOM
{
- CChildList::CChildList(const CNode* base)
- : m_pNode(base->m_aNodePtr)
+ CChildList::CChildList(::rtl::Reference<CNode> const& pBase,
+ ::osl::Mutex & rMutex)
+ : m_pNode(pBase)
+ , m_rMutex(rMutex)
{
}
@@ -39,10 +48,15 @@ namespace DOM
*/
sal_Int32 SAL_CALL CChildList::getLength() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
sal_Int32 length = 0;
if (m_pNode != NULL)
{
- xmlNodePtr cur = m_pNode->children;
+ xmlNodePtr cur = m_pNode->GetNodePtr();
+ if (0 != cur) {
+ cur = cur->children;
+ }
while (cur != NULL)
{
length++;
@@ -55,20 +69,27 @@ namespace DOM
/**
Returns the indexth item in the collection.
*/
- Reference< XNode > SAL_CALL CChildList::item(sal_Int32 index) throw (RuntimeException)
+ Reference< XNode > SAL_CALL CChildList::item(sal_Int32 index)
+ throw (RuntimeException)
{
- Reference< XNode >aNode;
+ ::osl::MutexGuard const g(m_rMutex);
+
if (m_pNode != NULL)
{
- xmlNodePtr cur = m_pNode->children;
+ xmlNodePtr cur = m_pNode->GetNodePtr();
+ if (0 != cur) {
+ cur = cur->children;
+ }
while (cur != NULL)
{
- if (index-- == 0)
- aNode = Reference< XNode >(CNode::get(cur));
+ if (index-- == 0) {
+ return Reference< XNode >(
+ m_pNode->GetOwnerDocument().GetCNode(cur).get());
+ }
cur = cur->next;
}
}
- return aNode;
+ return 0;
}
}