26#include <com/sun/star/uno/Any.hxx>
27#include <com/sun/star/uno/Sequence.hxx>
28#include <com/sun/star/beans/PropertyValue.hpp>
37#include <unordered_map>
44#define PATHDELIMITER "/"
45#define SETNODE_BINDINGS "Bindings"
46#define PROPERTYNAME_BINDINGURL "BindingURL"
71"OnPrepareViewClosing",
103 void Notify(
const css::uno::Sequence<OUString>& aPropertyNames)
override;
109 void replaceByName(
const OUString& aName,
const css::uno::Any& aElement );
113 css::uno::Sequence < css::beans::PropertyValue >
getByName(
const OUString& aName );
138 Sequence<OUString> aNotifySeq {
"Events" };
168 SAL_INFO(
"unotools",
"In GlobalEventConfig_Impl::ImplCommit");
176 if(rEntry.second.isEmpty() )
181 SAL_INFO(
"unotools",
"writing binding for: " << sNode);
199 auto plMacros = lMacros.getArray();
200 for (
const auto& rEventName : lEventNames )
202 plMacros[0] = aSetNode + rEventName + aCommandKey;
203 SAL_INFO(
"unotools",
"reading binding for: " << lMacros[0]);
205 if( lValues.hasElements() )
208 lValues[0] >>= sMacroURL;
209 sal_Int32 startIndex = rEventName.indexOf(
'\'');
210 sal_Int32 endIndex = rEventName.lastIndexOf(
'\'');
211 if( startIndex >=0 && endIndex > 0 )
214 OUString eventName = rEventName.copy(startIndex,endIndex-startIndex);
223 Sequence< beans::PropertyValue >
props;
225 if( !( aElement >>=
props ) )
227 throw lang::IllegalArgumentException( OUString(),
228 Reference< XInterface > (), 2);
231 for(
const auto& rProp : std::as_const(
props) )
233 if ( rProp.Name ==
"Script" )
234 rProp.Value >>= macroURL;
242 static constexpr OUStringLiteral
sEventType =
u"EventType";
243 static constexpr OUStringLiteral
sScript =
u"Script";
244 Sequence< beans::PropertyValue >
props(2);
245 auto pProps =
props.getArray();
247 pProps[0].Value <<= OUString(
sScript);
252 pProps[1].Value <<= it->second;
260 throw container::NoSuchElementException(
aName );
262 pProps[1].Value <<= OUString();
333 Reference< container::XNameReplace > ret(
this);
EventBindingHash m_eventBindingHash
virtual ~GlobalEventConfig_Impl() override
void replaceByName(const OUString &aName, const css::uno::Any &aElement)
static css::uno::Type const & getElementType()
void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
is called from the ConfigManager before application ends of from the PropertyChangeListener if the su...
SupportedEventsVector m_supportedEvents
css::uno::Sequence< css::beans::PropertyValue > getByName(const OUString &aName)
bool hasByName(const OUString &aName)
virtual void ImplCommit() override
writes the changed values into the sub tree.
css::uno::Sequence< OUString > getElementNames()
OUString const & GetEventName(GlobalEventId nID) const
sal_Bool SAL_CALL hasElements() override
void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
css::uno::Sequence< OUString > SAL_CALL getElementNames() override
css::uno::Any SAL_CALL getByName(const OUString &aName) override
css::uno::Sequence< css::beans::PropertyValue > getByName2(const OUString &aName)
static OUString GetEventName(GlobalEventId nID)
virtual ~GlobalEventConfig() override
sal_Bool SAL_CALL hasByName(const OUString &aName) override
static GlobalEventConfig_Impl * m_pImpl
static sal_Int32 m_nRefCount
css::uno::Type SAL_CALL getElementType() override
static void holdConfigItem(EItem eItem)
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
bool SetSetProperties(const OUString &rNode, const css::uno::Sequence< css::beans::PropertyValue > &rValues)
css::uno::Sequence< OUString > GetNodeNames(const OUString &rNode)
bool EnableNotification(const css::uno::Sequence< OUString > &rNames, bool bEnableInternalNotification=false)
enables notifications about changes on selected sub nodes/values
bool ClearNodeSet(const OUString &rNode)
o3tl::enumarray< GlobalEventId, OUString > SupportedEventsVector
#define PROPERTYNAME_BINDINGURL
std::unordered_map< OUString, OUString > EventBindingHash
static o3tl::enumarray< GlobalEventId, const char * > pEventAsciiNames
static std::mutex & GetOwnStaticMutex()
#define SAL_INFO(area, stream)
OUString get(TranslateId sContextAndId, const std::locale &loc)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
constexpr OUStringLiteral sScript
constexpr OUStringLiteral sEventType