From 30a997e586d717408f0fb474e5895c403198c08a Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Wed, 23 Mar 2005 11:00:32 +0000 Subject: [PATCH] INTEGRATION: CWS eforms4 (1.3.6); FILE MERGED 2004/12/13 14:54:57 dvo 1.3.6.1: #i36608# dispatch event when attribute value changes --- unoxml/source/dom/attr.cxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx index b58cfa46d988..8158f60a5ec1 100644 --- a/unoxml/source/dom/attr.cxx +++ b/unoxml/source/dom/attr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: attr.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: obo $ $Date: 2004-11-16 12:17:42 $ + * last change: $Author: vg $ $Date: 2005-03-23 12:00:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -144,6 +144,9 @@ namespace DOM void SAL_CALL CAttr::setValue(const OUString& value) throw (DOMException) { + // remember old value (for mutation event) + OUString sOldValue = getValue(); + OString o1 = OUStringToOString(value, RTL_TEXTENCODING_UTF8); xmlChar* xValue = (xmlChar*)o1.getStr(); // xmlChar* xName = OUStringToOString(m_aAttrPtr->name, RTL_TEXTENCODING_UTF8).getStr(); @@ -160,6 +163,19 @@ namespace DOM m_aNodePtr->last = tmp; tmp = tmp->next; } + + // dispatch DOM events to signal change in attribute value + // dispatch DomAttrModified + DOMSubtreeModified + OUString sEventName( RTL_CONSTASCII_USTRINGPARAM("DOMAttrModified") ); + Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); + Reference< XMutationEvent > event(docevent->createEvent(sEventName), + UNO_QUERY); + event->initMutationEvent( + sEventName, sal_True, sal_False, + Reference( static_cast( this ) ), + sOldValue, value, getName(), AttrChangeType_MODIFICATION ); + dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + xmlFree(buffer); }