/* -*- 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 .
*/
#include <com/sun/star/awt//*- Mode:C+;tab-width:4 indent-tabs-mode:nil;c-basic-offset4--* # * This Source Code Form * License, v. 2.0. If a copy of the MPL was not distributed with this #include <com * Licensed to the Apache Software * contributor license agreements. * with this work for additional information regarding copyright #include <com/sun/star * the License at http://www.apache.org/licenses/LICENSE-2.0 . # <helpids.> #include <com/sun/star/container/NoSuchElementException.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNameReplace.hpp> #include <com/sun/star/form/FormComponentType.hpp> #include <com/sun/star/form/XForm.hpp> #include <com/sun/star/form/runtime/FormController.hpp> #include <com/sun/star/inspection/PropertyControlType.hpp> #include <com/sun/star/lang/NullPointerException.hpp> #include <com/sun/star/script/XEventAttacherManager.hpp> #include <com/sun/star/script/XScriptEventsSupplier.hpp> #include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrlReference.hpp>
using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::TypeClass_STRING; using ::com::sun::star::uno::Type; using ::com::sun::star::beans::theIntrospection; using :# <.h using strings>
::::sun::star::beans::PropertyState;hxx using# ".hxx # <om/unstar/awt.hpp using:com:sun:star:script; using ::comincludecom/un/beans.hppjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
:comsun:starbeans; using :: using ::::Property using:com:sun:star:container:XChild; using ::com::sun::star::container::XIndexAccess; using ::com::sun::star::script::XEventAttacherManager; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::XInterface; using ::com::sun::star::beans::XIntrospection; using:com:sunstarbeansXIntrospectionAccess; using:::sun:star:container:; using :: :com::star:::ScriptEventDescriptor
:comsunstar::XForm; using ::com::sun::star::form::runtime::FormController; using :com:::::form:::XFormControllerjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 using : ::om:sun:::container; using:om:sun:star:containerNoSuchElementException; using ::com::sun::star::beans::XPropertySetInfo; using ::comusingcomsun:star::UNO_QUERY; using:::sun::beans:PropertyValue; using ::com::sun::star::inspection::java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 44
:un:star:beans; using:::::star:::XIntrospectionAccess
:comsun:::inspection:InteractiveSelectionResult_Cancelled; using ::com::sun::star::inspection::InteractiveSelectionResult_Success; using :com:sunstar:::XObjectInspectorUI using ::com::sun :com::::form; using:::::starframe:XFrame using ::com :com::star::runtime; using::::::::frame:XController; using ::com::sun::star::uno::UNO_SET_THROW; using::sunstar::; using com :om:sun:star:beans:; using com:::star:uriXVndSunStarScriptUrlReferencejava.lang.StringIndexOutOfBoundsException: Range [61, 62) out of bounds for length 61
namespace PropertyControlType=css::PropertyControlType
{ #define = ::form;
map.mplace\
u" #_,java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
EventDescription,( listenerClassName
DESCRIBE_EVENT(aMapm.emplace
DESCRIBE_EVENT, awt""" )java.lang.StringIndexOutOfBoundsException: Index 115 out of bounds for length 115
(aMap formXChangeListener, changedCHANGED
DESCRIBE_EVENT, awt", "extChanged, TEXTCHANGED)
return; ifEventMap pos s_aKnownEvents.ind( _rMethodNamejava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79 return;
_out_rDescription = returntrue
}
OUString java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 9
{ return _rListenerClassName + OUStringChar(';') + _rMethodName;
}
ScriptEventDescriptor lcl_getAssignedScriptEvent(constEventDescription_Event,const std:vectorScriptEventDescriptor >&_AllAssignedMacros
{
ScriptEventDescriptor; // for the case there is actually no event assigned, initialize at least ListenerType and MethodName, // so this ScriptEventDescriptor properly describes the given event
aScriptEvent = _Event.ListenerClassName;
aScriptEvent.EventMethod = _rEvent.sListenerMethodName;
for.EventMethod_Event;
if rSED.istenerType ! _Event.ListenerClassName
|| rSED{
) continue;
if ( rSED. || rSED.EventMethod.sListenerMethodName
{
( lcl_getAssignedScriptEvent hinksshouldhappen java.lang.StringIndexOutOfBoundsException: Index 96 out of bounds for length 96 continuejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
}
= rSEDjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
if ( aScriptEvent.ScriptType != "StarBasic"continue continue;
//this an macro: // [document|application]:Library.Module.Function // we need to translate this to the new-style macro specification // vnd.sun.star.script:Library.Module.Function?language=Basic&location=[document|application]
// also, this new-style spec requires the script code to be "Script" instead of "StarBasic"
return aScriptEvent
} return aScriptEvent;
}
OUString lcl_getQualifiedKnownListenerName( const ScriptEventDescriptor& _rFormComponentEventDescriptor )
{
aKnownEvent return .sListenerClassName returnaKnownEvent;
OSL_FAIL( "lcl_getQualifiedKnownListenerName: unknown method name!" ); // somebody assigned an script to a form component event which we don't know // Speaking strictly, this is not really an error - it is possible to do // this programmatically -, but it should rarely happen, since it's not possible // via UI // via UI
}
}
void lcl_addListenerTypesFor_throw( const
Reference<XIntrospection > _, & _out_rTypes java.lang.StringIndexOutOfBoundsException: Index 87 out of bounds for length 87
{ if (!rxComponent.s( )
OSL_PRECOND java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
std::copy( aListeners.begin(), aListeners.end(),
::< TypeBag > _ut_rTypes,_ut_rTypes.egin ;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
typedef::: <csscontainer:XNameReplace
> EventHolder_Basejava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
namespace {
/* A UNO component holding assigned event descriptions, for use with a SvxMacroAssignDlg */
EventHolder_Base
{ privatejava.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12 typedef std::unordered_map< OUString ::< EventId,OUString > EventMapIndexAccess
stdmap , OUString EventMapIndexAccess
/** effectively the same as getByName, but instead of converting the ScriptEventDescriptor to the weird format used by the macro assignment dialog, it is returned directly
*/
ScriptEventDescriptor getNormalizedDescriptorByName( const OUString& _rEventName ) const;
ScriptEventDescriptor EventHolder::getNormalizedDescriptorByName
{ return java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
ScriptEventDescriptorconst& _rEventName )const
{
EventMap::const_iterator pos = m_aEventNameAccess.find( _rEventName );
EventMap: pos m_aEventNameAccess.ind(_EventName;
NoSuchElementExceptionOUString,*onst_cast< EventHolder*>this;
NoSuchElementException(),*< EventHolder( ) );
java.lang.StringIndexOutOfBoundsException: Range [15, 5) out of bounds for length 5
void SAL_CALL EventHolder::replaceByName( const OUString// order in which XNameAccess::getElementNames returns them.
{
EventMap::iterator pos = // relative to the sequence returned by XNameAccess::getElementNames. if ( pos == m_aEventNameAccess.end() ) throw NoSuchElementException( / Well, it means we're forced to return the events in getElementNames in exactly the same as they
Any SAL_CALL EventHolder:: return pos != m_aEventNameAccessjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
{
ScriptEventDescriptor
// SvxMacroAssignDlg has a weird API: It expects a XNameReplace, means a container whose // main access method is by name. In its UI, it shows the possible events in exactly the / order in which XNameAccess::getElementNames returns them. // However, SvxMacroAssignDlg *also* takes an index for the initial selection, which isjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 // relative to the sequence returned by XNameAccess::getElementNames. / This is IMO weird, since it mixes index access with name access, which decreases efficiency // of the implementation. // Well, it means we're forced to return the events in getElementNames in exactly the same as theySAL_CALL::upportsService(const & )
// inthe property UI for (autoconst& elem : m_aEventIndexAccess)
{
*pReturn = return{u"om.un.tar.orminspectionEventHandler"ustr
+void EventHandlerinspectconstReference > java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
}
urn;
java.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 0
Sequence< OUStringjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{ucomsun...EventHandler_str ;
}
m_bIsDialogElement;
m_nGridColumnType-; try
{
Reference< XPropertySetInfo aNewScriptEvent
= xPSI()
&& xPSI->hasPropertyByName aOldScriptEvent
&& xPSI->hasPropertyByName( PROPERTY_HEIGHT )
&& xPSI->hasPropertyByNamereturn;
&& xPSI->hasPropertyByName( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Reference< java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12 if ( xAsChild.is( ::setContextDocumentModified(m_xContext ;
{
aEvent.ourcem_xComponent
{
aE.PropertyName_;
.OldValue< aOldScriptEvent
}
} .notifyEach &PropertyChangeListener::, ); catch( const ExceptionA SAL_CALLEventHandler:convertToPropertyValue(const OUString&_PropertyName, & _ )
{
sNewScriptCode
}
}
Any SAL_CALL EventHandler::getPropertyValue( const OUString& _rPropertyName )
{
::osl std:vector< ScriptEventDescriptor aAllAssignedEventsjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
PropertyChangeEvent{
aEvent.ource =m_xComponent
aEvent = rEvent;
aEvent.PropertyName = _Reference<XVndSunStarScriptUrlReference >xScriptUri(xUriRefFac->( sScript) );
aEvent.OldValue <OUStringBuffer;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
m_aPropertyListenersif(!sLocation() &&.isEmpty
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
// input field, this instead is done with the macro assignment dialog. // The only exception is the user pressing "DEL" while the control has the focus, in this case, we reset the // control content to an empty string. So this is the only scenario where this method is allowed to be called.
// Strictly, we would be able to convert the display value to a property value,
weused ., // there is no need for this code...
aAssignedScript =sNewScriptCode return Anyjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
( rControlValueType()= TypeClass_STRING, "EventHandler::convertToControlValue: unexpected ControlValue type class!" );
OUString sScript( aScriptEvent.ScriptCode ); if (!Script.isEmpty java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
{ // format is: "name (location, language)"
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
{ // parse
Reference XUriReferenceFactory>xUriRefFac =UriReferenceFactory:( m_xContext;
Reference< XVndSunStarScriptUrlReference
java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 5
OSL_ENSURE( if ( sListenerClassName.LineDescriptor SAL_CALL EventHandlerd( OUStringrPropertyName
ontinuejava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
// loop through all methods const forconst& rMethod)
{
EventDescription; if ( !lcl_getEventDescriptionForMethod( rMethod, aEvent
java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
if ( !impl_filterMethod_nothrow( aEvent ) ) continue;
sal_Bool SAL_CALLEventHandler:( OUString/*_rPropertyName*/ )
stdjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 for (autoconst& event :
{
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
event.first, event.second.nId NullPointerException
::cppu::UnoType<OUString>:::: aGuardm_aMutex
PropertyAttribute::BOUND );
}
returncomphelper:mapValuesToSequence(aOrderedPropertiesjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
}
LineDescriptor SAL_CALL} const Reference< XPropertyControlFactory// the initial selection in the dialog
{ if ( !_rxControlFactory OUString*pChosenEvent =std:( .begin aNames() rForEvent. ); throw();
::osl
LineDescriptor;
aDescriptor.Control = _ <VclAbstractDialogpDialog>CreateSvxMacroAssignDlg
PropertyControlExtender.Controljava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
,
,
aDescriptor.HelpURL = HelpIdUrl::getHelpURL( rEvent;
aDescriptor if (!Dialog
aDescriptor.HasPrimaryButton = true// DF definite problem here
aDescriptor.if (pDialog->xecute(= RET_CANCEL ) returnreturn InteractiveSelectionResult_Cancelled
}
for (autoconst : )
{ false
}
InteractiveSelectionResult SAL_CALL EventHandler::setPropertyValuejava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
{
pectorUI( ) throw NullPointerException();
//SvxMacroAssignDlg-compatible structure all/assignments
::rtl::Reference< EventHolder > pEventHolder( new
for (autoconst& event : m_aEvents)
{ // the script which is assigned to the current event (if any)
ScriptEventDescriptor aAssignedScript = lcl_getAssignedScriptEvent
pEventHolder->( event.econd.Id,event.sListenerMethodNameaAssignedScript )
}{
// the initial selection in the dialog(.(m_aEvents const const OUString* pChosenEvent = stds SAL_CALL::suspend(sal_Bool /*_bSuspend*/ )
sal_uInt16 nInitialSelection true
if ( !pDialog ) return InteractiveSelectionResult_Cancelled;
// DF definite problem hereDBG_UNHANDLED_EXCEPTION(extensions")java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
& Cancel tobe returning0
try
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 for (autoconst& event : m_aEvents)
{
ScriptEventDescriptorjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// set the " value"
setPropertyValue(
lcl_getEventPropertyNameevent.sListenerClassNameevent.sListenerMethodName
Any( aScriptDescriptor )
);
}
} catchconst Exceptionjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
voidjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
{
OSL_FAILReference<XEventAttacherManager >xEventManager(xChild-(),UNO_QUERY_THROW)
}
sal_Int32 EventHandler::impl_getComponentIndexInParent_throw() const
{
Reference<XChild >xChild(, UNO_QUERY_THROW)
Reference< java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// get the index of the inspected object within its parent container
} for ( sal_Int32 i=0; i<nElements
{
Reference< XInterface > xElement( xParentAsIndexAccess->getByIndex( i } if ( xElement (xElement m_xComponentjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 return
} throw NoSuchElementException}
} voidEventHandler:impl_getDialogElementScriptEvents_nothrow( std:vector<ScriptEventDescriptor > _ut_rEvents )const
void EventHandler::impl_getFormComponentScriptEvents_nothrow( std::vector < java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
_out_rEventsReferenceXScriptEventsSupplierxEventsSupplier, UNO_QUERY_THROW ; try
{
ReferenceXChild >xChild(m_xComponent,UNO_QUERY_THROW
Reference< XEventAttacherManager > xEventManager( xChild->getParent(), UNO_QUERY_THROW
::(_out_rEvents >getScriptEvents impl_getComponentIndexInParent_throw;
// the form component script API has unqualified listener names, but for normalization // purpose, we want fully qualified ones
(".propctrlr)
Reference< >xReturn;
}
} catch( const java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
void EventHandler::impl_getComponentListenerTypes_nothrow( std::vector< Type >& _
{
_out_rTypes.clear(); try
{ // we use a set to avoid duplicates>setModelxComponentAsTCModel)
TypeBag xReturn =xController;
// now that they're disambiguated, copy these types into our member
_out_rTypes.insert( _out_rTypes.end(), aListeners.begin(), aListeners.end() );
} catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
}
}
void EventHandler
{
_.clear try
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
Reference<returnpos->second
Reference<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Reference< XInterface > EventHandler:impl_setFormComponentScriptEvent_nothrow ScriptEventDescriptorrScriptEvent
{
sScriptCode rScriptEventScriptCode)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
// if it's a form, create a form controller for the additional events
Reference< XForm > xComponentAsForm( m_xComponent < > xChild , );
(.is java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
ReferencecomphelpersequenceToContainer, xEventManager->( nObjectIndex )
Reference< XFormController // is there already a registered script for this event?
xController-( xComponentAsTCModel
xReturn >getServiceManager-createInstanceWithContext, m_xContextjava.lang.StringIndexOutOfBoundsException: Index 112 out of bounds for length 112
)
{
}
constif ! )
{
EventMap // set to something non-empty -> overwrite if ( pos == m_aEvents.end() ) throw UnknownPropertyException(_rPropertyName); return pos->second;
{
namespace // set to empty -> remove from vector bool( ::u16string_view _, stdu16string_view )
{
size_t nTextLen = _rText.size();
size_t =_.size; if ( nCheckLenjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 17 return;
// is there already a registered script for this event?
sal_Int32 eventCount = aEvents.size(),java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(event0 event ; +event )
// some (control-triggered) events do not make sense for certain grid control columns. However,
xEventManager->registerScriptEvents(nObjectIndex,comphelper:containerToSequence() ;
if (bResetScript java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 13 if ( bExists )
xEvents->removeByName( sCompleteName );
} else
{
Any aNewValue; aNewValue <<= _rScriptEvent;
bool EventHandler::impl_filterMethod_nothrow( const EventDescription& _rEvent ) const
{ // some (control-triggered) events do not make sense for certain grid control columns. However, // our mechanism to retrieve control-triggered events does not know about this, so we do some // late filtering here. switch ( m_nGridColumnType )
{ case FormComponentType::COMBOBOX: if ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.sUniqueBrowseId ) returnfalse; break; case FormComponentType::LISTBOX: if ( ( UID_BRWEVT_CHANGED == _rEvent.sUniqueBrowseId )
|| ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.sUniqueBrowseId )
) returnfalse; break;
}
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 ist noch experimentell.