24#include <com/sun/star/uno/Any.hxx>
33#include <com/sun/star/beans/PropertyValue.hpp>
34#include <com/sun/star/container/XNameReplace.hpp>
35#include <com/sun/star/document/XEventsSupplier.hpp>
36#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp>
37#include <com/sun/star/uno/Sequence.hxx>
38#include <com/sun/star/uno/Reference.hxx>
51 assert(SfxPoolItem::operator==(rAttr));
59 for (
size_t nNo = 0, nCnt = rOwn.
size(); nNo < nCnt; ++nNo )
63 if ( rOwnEvent.
mnId != rOtherEvent.
mnId ||
112 uno::Sequence < beans::PropertyValue >
aProperties(3);
116 pValues[ 0 ].Value <<= OUString(
"STAR_BASIC");
128 uno::Sequence < beans::PropertyValue >
aProperties(2);
141 uno::Sequence < beans::PropertyValue >
aProperties(2);
154 SAL_WARN(
"sfx.config",
"CreateEventData_Impl(): ScriptType not supported!");
159 uno::Sequence < beans::PropertyValue >
aProperties;
169 uno::Reference < document::XEventsSupplier > xSupplier;
172 xSupplier.set( pDoc->
GetModel(), uno::UNO_QUERY );
176 xSupplier = frame::theGlobalEventBroadcaster::get(::comphelper::getProcessComponentContext());
179 if ( !xSupplier.is() )
182 uno::Reference < container::XNameReplace > xEvents = xSupplier->getEvents();
183 if ( !aEventName.isEmpty() )
189 xEvents->replaceByName( aEventName, aEventData );
191 catch(
const css::lang::IllegalArgumentException& )
195 catch(
const css::container::NoSuchElementException& )
201 SAL_INFO(
"sfx.config",
"PropagateEvents_Impl: Got unknown event" );
208 std::optional<SvxMacro> pMacro;
const PropertyValue * pValues
PropertiesInfo aProperties
static void ConfigureEvent(const OUString &aName, const SvxMacro &, SfxObjectShell const *pObjSh)
static std::unique_ptr< SvxMacro > ConvertToMacro(const css::uno::Any &rElement, SfxObjectShell *pDoc)
virtual SfxEventNamesItem * Clone(SfxItemPool *pPool=nullptr) const override
SfxEventNamesList aEventsList
void AddEvent(const OUString &, const OUString &, SvMacroItemId)
SfxEventNamesItem(const sal_uInt16 nId)
virtual bool operator==(const SfxPoolItem &) const override
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
SfxEventNamesList & operator=(const SfxEventNamesList &rCpy)
void push_back(SfxEventName Item)
SfxEventName & at(size_t Index)
static std::unique_ptr< SvxMacro > ConvertToMacro(const css::uno::Any &rElement, SfxObjectShell *pDoc)
css::uno::Reference< css::frame::XModel3 > GetModel() const
const OUString & GetMacName() const
ScriptType GetScriptType() const
const OUString & GetLibName() const
#define TOOLS_WARN_EXCEPTION(area, stream)
SvMacroItemId
these values get stored in streams in a 16-bit value
static uno::Any CreateEventData_Impl(const SvxMacro *pMacro)
static void PropagateEvent_Impl(SfxObjectShell const *pDoc, const OUString &aEventName, const SvxMacro *pMacro)
constexpr OUStringLiteral PROP_MACRO_NAME
constexpr OUStringLiteral PROP_SCRIPT
constexpr OUStringLiteral PROP_EVENT_TYPE
constexpr OUStringLiteral PROP_LIBRARY
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
constexpr OUStringLiteral SVX_MACRO_LANGUAGE_JAVASCRIPT