/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// find the event in the list and replace the data auto nIndex = comphelper::findValue(maEventNames, aName); if (nIndex == -1) throw container::NoSuchElementException();
// check for correct type of the element if ( !::comphelper::NamedValueCollection::canExtractFrom( rElement ) ) throw lang::IllegalArgumentException();
::comphelper::NamedValueCollection const aEventDescriptor( rElement );
// create Configuration at first, creation might call this method also and that would overwrite everything // we might have stored before! if ( mpObjShell && !mpObjShell->IsLoading() )
{ // SetModified will end up calling into our documentEventOccured method
aGuard.unlock();
mpObjShell->SetModified();
aGuard.lock();
}
OUString sType; if ( ( aNormalizedDescriptor.size() == 1 )
&& !aNormalizedDescriptor.has( PROP_EVENT_TYPE ) //TODO
&& ( aNormalizedDescriptor.get( PROP_EVENT_TYPE ) >>= sType )
&& ( sType.isEmpty() )
)
{ // An empty event type means no binding. Therefore reset data // to reflect that state. // (that's for compatibility only. Nowadays, the Tools/Customize dialog should // set an empty sequence to indicate the request for resetting the assignment.)
OSL_ENSURE( false, "legacy event assignment format detected" );
aNormalizedDescriptor.clear();
}
bool SfxEvents_Impl::isScriptURLAllowed(const OUString& aScriptURL)
{
std::optional<css::uno::Sequence<OUString>> allowedEvents(
officecfg::Office::Common::Security::Scripting::AllowedDocumentEventURLs::get()); // When AllowedDocumentEventURLs is empty, all event URLs are allowed if (!allowedEvents) returntrue;
if ( mxBroadcaster.is() )
{
mxBroadcaster->removeDocumentEventListener( this );
mxBroadcaster = nullptr;
}
}
SfxEvents_Impl::SfxEvents_Impl( SfxObjectShell* pShell,
uno::Reference< document::XDocumentEventBroadcaster > const & xBroadcaster )
{ // get the list of supported events and store it if ( pShell )
maEventNames = pShell->GetEventNames(); else
maEventNames = rtl::Reference<GlobalEventConfig>(new GlobalEventConfig)->getElementNames();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.