summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2011-01-19 20:27:26 +0100
committerMichael Stahl <mst@openoffice.org>2011-01-19 20:27:26 +0100
commit9123a2f7c219f93f0db63d359c1d0f362d32b59a (patch)
tree51fb6d83967c8d5579586f8ba75a6459607f7f21 /unoxml
parent57c23f6329f58cd359200413c55e7988ab1e32db (diff)
xmlfix3: #i113682#: unoxml: CEvent gets a mutex member;
also initialize member variables in constructors.
Diffstat (limited to 'unoxml')
-rw-r--r--unoxml/source/events/event.cxx34
-rw-r--r--unoxml/source/events/event.hxx11
-rw-r--r--unoxml/source/events/mouseevent.cxx27
-rw-r--r--unoxml/source/events/mouseevent.hxx7
-rw-r--r--unoxml/source/events/mutationevent.cxx17
-rw-r--r--unoxml/source/events/mutationevent.hxx7
-rw-r--r--unoxml/source/events/uievent.cxx16
-rw-r--r--unoxml/source/events/uievent.hxx7
8 files changed, 104 insertions, 22 deletions
diff --git a/unoxml/source/events/event.cxx b/unoxml/source/events/event.cxx
index 8a9af5cc692e..87201d7eece7 100644
--- a/unoxml/source/events/event.cxx
+++ b/unoxml/source/events/event.cxx
@@ -25,62 +25,84 @@
*
************************************************************************/
-#include "event.hxx"
+#include <event.hxx>
namespace DOM { namespace events
{
+ CEvent::CEvent()
+ : m_canceled(sal_False)
+ , m_phase(PhaseType_CAPTURING_PHASE)
+ , m_bubbles(sal_False)
+ , m_cancelable(sal_True)
+ {
+ }
+
CEvent::~CEvent()
{
}
OUString SAL_CALL CEvent::getType() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_eventType;
}
- Reference< XEventTarget > SAL_CALL CEvent::getTarget() throw (RuntimeException)
+ Reference< XEventTarget > SAL_CALL
+ CEvent::getTarget() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_target;
}
- Reference< XEventTarget > SAL_CALL CEvent::getCurrentTarget() throw (RuntimeException)
+ Reference< XEventTarget > SAL_CALL
+ CEvent::getCurrentTarget() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_currentTarget;
}
PhaseType SAL_CALL CEvent::getEventPhase() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_phase;
}
sal_Bool SAL_CALL CEvent::getBubbles() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_bubbles;
}
sal_Bool SAL_CALL CEvent::getCancelable() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_cancelable;
}
- com::sun::star::util::Time SAL_CALL CEvent::getTimeStamp() throw (RuntimeException)
+ com::sun::star::util::Time SAL_CALL
+ CEvent::getTimeStamp() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_time;
}
void SAL_CALL CEvent::stopPropagation() throw (RuntimeException)
{
- if (m_cancelable) m_canceled = sal_True;
+ ::osl::MutexGuard const g(m_Mutex);
+ if (m_cancelable) { m_canceled = sal_True; }
}
void SAL_CALL CEvent::preventDefault() throw (RuntimeException)
{
}
- void SAL_CALL CEvent::initEvent(const OUString& eventTypeArg, sal_Bool canBubbleArg,
+ void SAL_CALL
+ CEvent::initEvent(OUString const& eventTypeArg, sal_Bool canBubbleArg,
sal_Bool cancelableArg) throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
+
m_eventType = eventTypeArg;
m_bubbles = canBubbleArg;
m_cancelable = cancelableArg;
diff --git a/unoxml/source/events/event.hxx b/unoxml/source/events/event.hxx
index 34ab0ad2508f..dd6619542feb 100644
--- a/unoxml/source/events/event.hxx
+++ b/unoxml/source/events/event.hxx
@@ -31,6 +31,7 @@
#include <sal/types.h>
#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/xml/dom/events/XEvent.hpp>
#include <com/sun/star/xml/dom/events/XEventTarget.hpp>
#include <com/sun/star/util/Time.hpp>
@@ -56,16 +57,12 @@ friend class CText;
friend class CCharacterData;
friend class CAttr;
-
-private:
- sal_Bool m_canceled;
-
protected:
+ ::osl::Mutex m_Mutex;
+ sal_Bool m_canceled;
OUString m_eventType;
Reference< XEventTarget > m_target;
Reference< XEventTarget > m_currentTarget;
- //xmlNodePtr m_target;
- //xmlNodePtr m_currentTarget;
PhaseType m_phase;
sal_Bool m_bubbles;
sal_Bool m_cancelable;
@@ -73,7 +70,7 @@ protected:
public:
- CEvent() : m_canceled(sal_False){}
+ explicit CEvent();
virtual ~CEvent();
virtual OUString SAL_CALL getType() throw (RuntimeException);
diff --git a/unoxml/source/events/mouseevent.cxx b/unoxml/source/events/mouseevent.cxx
index 645ffc3305a9..02d1ea619c84 100644
--- a/unoxml/source/events/mouseevent.cxx
+++ b/unoxml/source/events/mouseevent.cxx
@@ -25,49 +25,72 @@
*
************************************************************************/
-#include "mouseevent.hxx"
+#include <mouseevent.hxx>
namespace DOM { namespace events
{
+ CMouseEvent::CMouseEvent()
+ : CMouseEvent_Base()
+ , m_screenX(0)
+ , m_screenY(0)
+ , m_clientX(0)
+ , m_clientY(0)
+ , m_ctrlKey(sal_False)
+ , m_shiftKey(sal_False)
+ , m_altKey(sal_False)
+ , m_metaKey(sal_False)
+ , m_button(0)
+ {
+ }
sal_Int32 SAL_CALL CMouseEvent::getScreenX() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_screenX;
}
sal_Int32 SAL_CALL CMouseEvent::getScreenY() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_screenY;
}
sal_Int32 SAL_CALL CMouseEvent::getClientX() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_clientX;
}
sal_Int32 SAL_CALL CMouseEvent::getClientY() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_clientY;
}
sal_Bool SAL_CALL CMouseEvent::getCtrlKey() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_ctrlKey;
}
sal_Bool SAL_CALL CMouseEvent::getShiftKey() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_shiftKey;
}
sal_Bool SAL_CALL CMouseEvent::getAltKey() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_altKey;
}
sal_Bool SAL_CALL CMouseEvent::getMetaKey() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_metaKey;
}
sal_Int16 SAL_CALL CMouseEvent::getButton() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_button;
}
Reference< XEventTarget > SAL_CALL CMouseEvent::getRelatedTarget() throw(RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_relatedTarget;
}
@@ -89,6 +112,8 @@ namespace DOM { namespace events
const Reference< XEventTarget >& /*relatedTargetArg*/)
throw(RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
+
CUIEvent::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
m_screenX = screenXArg;
m_screenY = screenYArg;
diff --git a/unoxml/source/events/mouseevent.hxx b/unoxml/source/events/mouseevent.hxx
index ad6deae086de..483ea3a6650c 100644
--- a/unoxml/source/events/mouseevent.hxx
+++ b/unoxml/source/events/mouseevent.hxx
@@ -40,7 +40,11 @@ using ::rtl::OUString;
namespace DOM { namespace events {
-class CMouseEvent : public cppu::ImplInheritanceHelper1< CUIEvent, XMouseEvent >
+typedef ::cppu::ImplInheritanceHelper1< CUIEvent, XMouseEvent >
+ CMouseEvent_Base;
+
+class CMouseEvent
+ : public CMouseEvent_Base
{
friend class CEventDispatcher;
protected:
@@ -56,6 +60,7 @@ protected:
Reference< XEventTarget > m_relatedTarget;
public:
+ explicit CMouseEvent();
virtual sal_Int32 SAL_CALL getScreenX() throw (RuntimeException);
virtual sal_Int32 SAL_CALL getScreenY() throw (RuntimeException);
diff --git a/unoxml/source/events/mutationevent.cxx b/unoxml/source/events/mutationevent.cxx
index d9645ae9a8a0..201fbe9e07da 100644
--- a/unoxml/source/events/mutationevent.cxx
+++ b/unoxml/source/events/mutationevent.cxx
@@ -25,36 +25,47 @@
*
************************************************************************/
-#include "mutationevent.hxx"
+#include <mutationevent.hxx>
namespace DOM { namespace events
{
+ CMutationEvent::CMutationEvent()
+ : CMutationEvent_Base()
+ , m_attrChangeType(AttrChangeType_MODIFICATION)
+ {
+ }
+
CMutationEvent::~CMutationEvent()
{
}
Reference< XNode > SAL_CALL CMutationEvent::getRelatedNode() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_relatedNode;
}
OUString SAL_CALL CMutationEvent::getPrevValue() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_prevValue;
}
OUString SAL_CALL CMutationEvent::getNewValue() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_newValue;
}
OUString SAL_CALL CMutationEvent::getAttrName() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_attrName;
}
AttrChangeType SAL_CALL CMutationEvent::getAttrChange() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_attrChangeType;
}
@@ -64,7 +75,9 @@ namespace DOM { namespace events
const OUString& newValueArg, const OUString& attrNameArg,
AttrChangeType attrChangeArg) throw (RuntimeException)
{
- initEvent(typeArg, canBubbleArg, cancelableArg);
+ ::osl::MutexGuard const g(m_Mutex);
+
+ CEvent::initEvent(typeArg, canBubbleArg, cancelableArg);
m_relatedNode = relatedNodeArg;
m_prevValue = prevValueArg;
m_newValue = newValueArg;
diff --git a/unoxml/source/events/mutationevent.hxx b/unoxml/source/events/mutationevent.hxx
index e725a63b1a21..89c484a57e85 100644
--- a/unoxml/source/events/mutationevent.hxx
+++ b/unoxml/source/events/mutationevent.hxx
@@ -45,7 +45,11 @@ using ::rtl::OUString;
namespace DOM { namespace events {
-class CMutationEvent : public cppu::ImplInheritanceHelper1< CEvent, XMutationEvent >
+typedef ::cppu::ImplInheritanceHelper1< CEvent, XMutationEvent >
+ CMutationEvent_Base;
+
+class CMutationEvent
+ : public CMutationEvent_Base
{
friend class CEventDispatcher;
protected:
@@ -56,6 +60,7 @@ protected:
AttrChangeType m_attrChangeType;
public:
+ explicit CMutationEvent();
virtual ~CMutationEvent();
diff --git a/unoxml/source/events/uievent.cxx b/unoxml/source/events/uievent.cxx
index 5ec8548abe0e..68e5dbbc6862 100644
--- a/unoxml/source/events/uievent.cxx
+++ b/unoxml/source/events/uievent.cxx
@@ -25,18 +25,26 @@
*
************************************************************************/
-#include "uievent.hxx"
+#include <uievent.hxx>
namespace DOM { namespace events
{
+ CUIEvent::CUIEvent()
+ : CUIEvent_Base()
+ , m_detail(0)
+ {
+ }
- Reference< XAbstractView > SAL_CALL CUIEvent::getView() throw(RuntimeException)
+ Reference< XAbstractView > SAL_CALL
+ CUIEvent::getView() throw(RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_view;
}
sal_Int32 SAL_CALL CUIEvent::getDetail() throw(RuntimeException)
{
+ ::osl::MutexGuard const g(m_Mutex);
return m_detail;
}
@@ -46,7 +54,9 @@ namespace DOM { namespace events
const Reference< XAbstractView >& viewArg,
sal_Int32 detailArg) throw(RuntimeException)
{
- initEvent(typeArg, canBubbleArg, cancelableArg);
+ ::osl::MutexGuard const g(m_Mutex);
+
+ CEvent::initEvent(typeArg, canBubbleArg, cancelableArg);
m_view = viewArg;
m_detail = detailArg;
}
diff --git a/unoxml/source/events/uievent.hxx b/unoxml/source/events/uievent.hxx
index eeed60b1641e..2a33c5d696c5 100644
--- a/unoxml/source/events/uievent.hxx
+++ b/unoxml/source/events/uievent.hxx
@@ -44,7 +44,10 @@ using namespace com::sun::star::xml::dom::views;
namespace DOM { namespace events {
-class CUIEvent : public cppu::ImplInheritanceHelper1< CEvent, XUIEvent >
+typedef ::cppu::ImplInheritanceHelper1< CEvent, XUIEvent > CUIEvent_Base;
+
+class CUIEvent
+ : public CUIEvent_Base
{
friend class CEventDispatcher;
protected:
@@ -52,6 +55,8 @@ protected:
Reference< XAbstractView > m_view;
public:
+ explicit CUIEvent();
+
virtual Reference< XAbstractView > SAL_CALL getView() throw(RuntimeException);
virtual sal_Int32 SAL_CALL getDetail() throw(RuntimeException);
virtual void SAL_CALL initUIEvent(const OUString& typeArg,