/* -*- 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 .
*/
// do we have this child in the cache?
AccessibleMap::const_iterator aPos = m_aChildrenMap.find( _rxKey ); if ( m_aChildrenMap.end() != aPos ) return aPos->second;
// not found in the cache, and allowed to create // -> new wrapper
rtl::Reference<OAccessibleWrapper> xValue
= new OAccessibleWrapper(m_xContext, _rxKey, m_aOwningAccessible);
// see if we do cache children if ( !m_bTransientChildren )
{
m_aChildrenMap.emplace(_rxKey, xValue);
// listen for disposals of inner children - this may happen when the inner context // is the owner for the inner children (it will dispose these children, and of course // not our wrapper for these children)
Reference< XComponent > xComp( _rxKey, UNO_QUERY ); if ( xComp.is() )
xComp->addEventListener( this );
}
void OWrappedAccessibleChildrenManager::translateAccessibleEvent( const AccessibleEventObject& _rEvent, AccessibleEventObject& _rTranslatedEvent )
{ // just in case we can't translate some of the values:
_rTranslatedEvent.NewValue = _rEvent.NewValue;
_rTranslatedEvent.OldValue = _rEvent.OldValue;
switch ( _rEvent.EventId )
{ case AccessibleEventId::CHILD: case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED: case AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED: case AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED: case AccessibleEventId::LABEL_FOR_RELATION_CHANGED: case AccessibleEventId::LABELED_BY_RELATION_CHANGED: case AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED: case AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED: // these are events where both the old and the new value contain child references
implTranslateChildEventValue( _rEvent.OldValue, _rTranslatedEvent.OldValue );
implTranslateChildEventValue( _rEvent.NewValue, _rTranslatedEvent.NewValue ); break;
case AccessibleEventId::NAME_CHANGED: case AccessibleEventId::DESCRIPTION_CHANGED: case AccessibleEventId::ACTION_CHANGED: case AccessibleEventId::STATE_CHANGED: case AccessibleEventId::BOUNDRECT_CHANGED: case AccessibleEventId::INVALIDATE_ALL_CHILDREN: case AccessibleEventId::SELECTION_CHANGED: case AccessibleEventId::VISIBLE_DATA_CHANGED: case AccessibleEventId::VALUE_CHANGED: case AccessibleEventId::MEMBER_OF_RELATION_CHANGED: case AccessibleEventId::CARET_CHANGED: case AccessibleEventId::TEXT_CHANGED: case AccessibleEventId::HYPERTEXT_CHANGED: case AccessibleEventId::TABLE_CAPTION_CHANGED: case AccessibleEventId::TABLE_COLUMN_DESCRIPTION_CHANGED: case AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED: case AccessibleEventId::TABLE_MODEL_CHANGED: case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED: case AccessibleEventId::TABLE_ROW_HEADER_CHANGED: case AccessibleEventId::TABLE_SUMMARY_CHANGED: // these Ids are also missed: SUB_WINDOW_OF_RELATION_CHANGED & TEXT_ATTRIBUTE_CHANGED case AccessibleEventId::TEXT_SELECTION_CHANGED: // nothing to translate break;
Any OAccessibleWrapper::queryInterface( const Type& _rType )
{ // #111089# instead of the inner XAccessible the proxy XAccessible must be returned
Any aReturn = OAccessibleWrapper_Base::queryInterface( _rType ); if ( !aReturn.hasValue() )
aReturn = OComponentProxyAggregation::queryInterface( _rType );
// add as event listener to the inner context, because we want to multiplex the AccessibleEvents
osl_atomic_increment( &_rRefCount );
{
Reference< XAccessibleEventBroadcaster > xBroadcaster( m_xInner, UNO_QUERY ); if ( xBroadcaster.is() )
xBroadcaster->addAccessibleEventListener( this );
}
osl_atomic_decrement( &_rRefCount );
}
OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper( )
{
OSL_ENSURE( m_rBHelper.bDisposed, "OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper: you should ensure (in your dtor) that the object is disposed!" );
}
Any SAL_CALL OAccessibleContextWrapperHelper::queryInterface( const Type& _rType )
{
Any aReturn = OComponentProxyAggregationHelper::queryInterface( _rType ); if ( !aReturn.hasValue() )
aReturn = OAccessibleContextWrapperHelper_Base::queryInterface( _rType ); return aReturn;
}
Reference< XAccessible > SAL_CALL OAccessibleContextWrapper::getAccessibleChild( sal_Int64 i )
{ // get the child of the wrapped component
Reference<XAccessible> xInnerChild = m_xInnerContext->getAccessibleChild(i); return m_xChildMapper->getAccessibleWrapperFor(xInnerChild);
}
Reference< XAccessibleRelationSet > SAL_CALL OAccessibleContextWrapper::getAccessibleRelationSet( )
{ return m_xInnerContext->getAccessibleRelationSet(); // TODO: if this relation set would contain relations to siblings, we would normally need // to wrap them, too...
}
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.