21#include <com/sun/star/script/XEventAttacherManager.hpp>
22#include <com/sun/star/beans/PropertyValue.hpp>
23#include <osl/diagnose.h>
37 ,m_rEventAttacher(_rEventAttacher)
44 ScriptEventDescriptor* pTranslated = aTranslated.getArray();
47 sal_Int32 nSeparatorPos = -1;
52 OSL_ENSURE(-1 != nSeparatorPos,
"OFormEventsImportContext::EndElement: invalid (unrecognized) event name!");
53 pTranslated->ListenerType = rEvent.first.copy(0, nSeparatorPos);
59 const PropertyValue* pEventDescription = rEvent.second.getConstArray();
60 const PropertyValue* pEventDescriptionEnd = pEventDescription + rEvent.second.getLength();
61 for (;pEventDescription != pEventDescriptionEnd; ++pEventDescription)
65 pEventDescription->Value >>= pTranslated->ScriptCode;
66 else if (pEventDescription->Name ==
EVENT_TYPE)
67 pEventDescription->Value >>= pTranslated->ScriptType;
69 pEventDescription->Value >>=
sLibrary;
100 const Sequence< ScriptEventDescriptor >& _rEvents)
103 "ODefaultEventAttacherManager::registerEvents: already have events for this object!");
110 Reference< XEventAttacherManager > xEventManager(_rxContainer, UNO_QUERY);
111 if (!xEventManager.is())
113 OSL_FAIL(
"ODefaultEventAttacherManager::setEvents: invalid argument!");
118 sal_Int32
nCount = _rxContainer->getCount();
119 Reference< XPropertySet > xCurrent;
120 MapPropertySet2ScriptSequence::const_iterator aRegisteredEventsPos;
123 xCurrent.set(_rxContainer->getByIndex(
i), css::uno::UNO_QUERY);
126 aRegisteredEventsPos =
m_aEvents.find(xCurrent);
127 if (
m_aEvents.end() != aRegisteredEventsPos)
128 xEventManager->registerScriptEvents(
i, aRegisteredEventsPos->second);
Import <script:events> element.
std::vector< EventNameValuesPair > m_aCollectEvents
virtual void registerEvents(const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rEvents)=0
MapPropertySet2ScriptSequence m_aEvents
virtual void registerEvents(const css::uno::Reference< css::beans::XPropertySet > &_rxElement, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rEvents) override
virtual ~ODefaultEventAttacherManager()
void setEvents(const css::uno::Reference< css::container::XIndexAccess > &_rxContainer)
IEventAttacher & m_rEventAttacher
OFormEventsImportContext(SvXMLImport &_rImport, IEventAttacher &_rEventAttacher)
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
constexpr OUStringLiteral EVENT_APPLICATION
constexpr OUStringLiteral EVENT_LIBRARY
constexpr OUStringLiteral EVENT_TYPE
constexpr OUStringLiteral EVENT_SCRIPTURL
constexpr OUStringLiteral EVENT_STAROFFICE
constexpr OUStringLiteral EVENT_LOCALMACRONAME
#define EVENT_NAME_SEPARATOR
constexpr OUStringLiteral sLibrary