summaryrefslogtreecommitdiffstats
path: root/unoxml/source/dom/document.hxx
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/document.hxx
parentUse SAL_PRIuUINT32 instead of %d (diff)
parentmasterfix DEV300: #i10000# drafts removed (diff)
downloadcore-90087ebb40a6cf12c9464da4e4ea7cc8b5f24bc5.tar.gz
core-90087ebb40a6cf12c9464da4e4ea7cc8b5f24bc5.zip
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/document.hxx')
-rw-r--r--unoxml/source/dom/document.hxx85
1 files changed, 61 insertions, 24 deletions
diff --git a/unoxml/source/dom/document.hxx b/unoxml/source/dom/document.hxx
index 645a6675c7ca..7045603b06d6 100644
--- a/unoxml/source/dom/document.hxx
+++ b/unoxml/source/dom/document.hxx
@@ -26,15 +26,19 @@
*
************************************************************************/
-#ifndef _DOCUMENT_HXX
-#define _DOCUMENT_HXX
+#ifndef DOM_DOCUMENT_HXX
+#define DOM_DOCUMENT_HXX
-#include <list>
#include <set>
+#include <memory>
+
+#include <libxml/tree.h>
+
#include <sal/types.h>
+
#include <cppuhelper/implbase6.hxx>
+
#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/xml/dom/XNode.hpp>
#include <com/sun/star/xml/dom/XAttr.hpp>
@@ -53,13 +57,11 @@
#include "node.hxx"
-#include <libxml/tree.h>
using namespace std;
using ::rtl::OUString;
using namespace com::sun::star;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
using namespace com::sun::star::xml::sax;
using namespace com::sun::star::io;
using namespace com::sun::star::xml::dom;
@@ -67,32 +69,70 @@ using namespace com::sun::star::xml::dom::events;
namespace DOM
{
+ namespace events {
+ class CEventDispatcher;
+ }
+
+ class CElement;
- class CDocument : public cppu::ImplInheritanceHelper6<
- CNode, XDocument, XDocumentEvent,
- XActiveDataControl, XActiveDataSource, XSAXSerializable, XFastSAXSerializable>
+ typedef ::cppu::ImplInheritanceHelper6<
+ CNode, XDocument, XDocumentEvent,
+ XActiveDataControl, XActiveDataSource,
+ XSAXSerializable, XFastSAXSerializable>
+ CDocument_Base;
+
+ class CDocument
+ : public CDocument_Base
{
- friend class CNode;
- typedef set< Reference< XStreamListener > > listenerlist_t;
- private:
- xmlDocPtr m_aDocPtr;
+ private:
+ /// this Mutex is used for synchronization of all UNO wrapper
+ /// objects that belong to this document
+ ::osl::Mutex m_Mutex;
+ /// the libxml document: freed in destructor
+ /// => all UNO wrapper objects must keep the CDocument alive
+ xmlDocPtr const m_aDocPtr;
// datacontrol/source state
+ typedef set< Reference< XStreamListener > > listenerlist_t;
listenerlist_t m_streamListeners;
Reference< XOutputStream > m_rOutputStream;
- protected:
- CDocument(xmlDocPtr aDocPtr);
+ typedef std::map< const xmlNodePtr,
+ ::std::pair< WeakReference<XNode>, CNode* > > nodemap_t;
+ nodemap_t m_NodeMap;
+
+ ::std::auto_ptr<events::CEventDispatcher> const m_pEventDispatcher;
+
+ CDocument(xmlDocPtr const pDocPtr);
+
public:
+ /// factory: only way to create instance!
+ static ::rtl::Reference<CDocument>
+ CreateCDocument(xmlDocPtr const pDoc);
virtual ~CDocument();
- virtual void SAL_CALL saxify(
- const Reference< XDocumentHandler >& i_xHandler);
+ // needed by CXPathAPI
+ ::osl::Mutex & GetMutex() { return m_Mutex; }
+
+ events::CEventDispatcher & GetEventDispatcher();
+ ::rtl::Reference< CElement > GetDocumentElement();
+
+ /// get UNO wrapper instance for a libxml node
+ ::rtl::Reference<CNode> GetCNode(
+ xmlNodePtr const pNode, bool const bCreate = true);
+ /// remove a UNO wrapper instance
+ void RemoveCNode(xmlNodePtr const pNode, CNode const*const pCNode);
+
+ virtual CDocument & GetOwnerDocument();
- virtual void SAL_CALL fastSaxify( Context& rContext );
+ virtual void saxify(const Reference< XDocumentHandler >& i_xHandler);
+
+ virtual void fastSaxify( Context& rContext );
+
+ virtual bool IsChildTypeAllowed(NodeType const nodeType);
/**
Creates an Attr of the given name.
@@ -225,17 +265,14 @@ namespace DOM
throw (RuntimeException);
virtual OUString SAL_CALL getNodeValue()
throw (RuntimeException);
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException);
// --- delegation for XNde base.
virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
throw (RuntimeException, DOMException)
{
return CNode::appendChild(newChild);
}
- virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
- throw (RuntimeException)
- {
- return CNode::cloneNode(deep);
- }
virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
throw (RuntimeException)
{
@@ -308,7 +345,7 @@ namespace DOM
}
virtual Reference< XNode > SAL_CALL insertBefore(
const Reference< XNode >& newChild, const Reference< XNode >& refChild)
- throw (DOMException)
+ throw (RuntimeException, DOMException)
{
return CNode::insertBefore(newChild, refChild);
}