Kaydet (Commit) 9123a2f7 authored tarafından Michael Stahl's avatar Michael Stahl

xmlfix3: #i113682#: unoxml: CEvent gets a mutex member;

 also initialize member variables in constructors.
üst 57c23f63
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
}
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment