2002-05-16 15:12:20 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 19:16:49 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-05-16 15:12:20 +00:00
|
|
|
*
|
2005-09-08 19:16:49 +00:00
|
|
|
* $RCSfile: AccessibleParaManager.cxx,v $
|
2002-05-16 15:12:20 +00:00
|
|
|
*
|
2007-06-27 15:40:39 +00:00
|
|
|
* $Revision: 1.15 $
|
2002-05-16 15:12:20 +00:00
|
|
|
*
|
2007-06-27 15:40:39 +00:00
|
|
|
* last change: $Author: hr $ $Date: 2007-06-27 16:38:39 $
|
2002-05-16 15:12:20 +00:00
|
|
|
*
|
2005-09-08 19:16:49 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2002-05-16 15:12:20 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 19:16:49 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2002-05-16 15:12:20 +00:00
|
|
|
*
|
2005-09-08 19:16:49 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2002-05-16 15:12:20 +00:00
|
|
|
*
|
2005-09-08 19:16:49 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2002-05-16 15:12:20 +00:00
|
|
|
*
|
2005-09-08 19:16:49 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2002-05-16 15:12:20 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 03:01:37 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_svx.hxx"
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Global header
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
|
|
|
|
#include <com/sun/star/uno/Any.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
|
|
|
|
#include <com/sun/star/uno/Reference.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _CPPUHELPER_WEAKREF_HXX_
|
|
|
|
#include <cppuhelper/weakref.hxx>
|
|
|
|
#endif
|
|
|
|
|
2003-04-24 15:54:18 +00:00
|
|
|
#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
|
|
|
|
#include <com/sun/star/accessibility/XAccessible.hpp>
|
2002-05-16 15:12:20 +00:00
|
|
|
#endif
|
|
|
|
|
2003-04-24 15:54:18 +00:00
|
|
|
#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
|
|
|
|
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
|
2002-06-12 12:41:41 +00:00
|
|
|
#endif
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Project-local header
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "unoedhlp.hxx"
|
|
|
|
#include "unopracc.hxx"
|
2007-06-27 15:40:39 +00:00
|
|
|
#include <svx/unoedsrc.hxx>
|
2002-05-16 15:12:20 +00:00
|
|
|
#include "AccessibleParaManager.hxx"
|
|
|
|
#include "AccessibleEditableTextPara.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
2003-04-24 15:54:18 +00:00
|
|
|
using namespace ::com::sun::star::accessibility;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace accessibility
|
|
|
|
{
|
2002-06-12 12:41:41 +00:00
|
|
|
AccessibleParaManager::AccessibleParaManager() :
|
|
|
|
maChildren(1),
|
|
|
|
maEEOffset( 0, 0 ),
|
|
|
|
mnFocusedChild( -1 ),
|
|
|
|
mbActive( sal_False )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
AccessibleParaManager::~AccessibleParaManager()
|
|
|
|
{
|
|
|
|
// owner is responsible for possible child defuncs
|
|
|
|
}
|
|
|
|
|
2006-01-13 16:17:55 +00:00
|
|
|
void AccessibleParaManager::SetAdditionalChildStates( const VectorOfStates& rChildStates )
|
|
|
|
{
|
|
|
|
maChildStates = rChildStates;
|
|
|
|
}
|
|
|
|
|
|
|
|
const AccessibleParaManager::VectorOfStates& AccessibleParaManager::GetAdditionalChildStates() const
|
|
|
|
{
|
|
|
|
return maChildStates;
|
|
|
|
}
|
|
|
|
|
2006-06-19 13:53:25 +00:00
|
|
|
void AccessibleParaManager::SetNum( sal_Int32 nNumParas )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2006-06-19 13:53:25 +00:00
|
|
|
if( (size_t)nNumParas < maChildren.size() )
|
2002-06-12 12:41:41 +00:00
|
|
|
Release( nNumParas, maChildren.size() );
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
maChildren.resize( nNumParas );
|
2003-03-27 14:06:05 +00:00
|
|
|
|
|
|
|
if( mnFocusedChild >= nNumParas )
|
|
|
|
mnFocusedChild = -1;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2002-05-29 15:09:56 +00:00
|
|
|
sal_uInt32 AccessibleParaManager::GetNum() const
|
|
|
|
{
|
|
|
|
return maChildren.size();
|
|
|
|
}
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
AccessibleParaManager::VectorOfChildren::iterator AccessibleParaManager::begin()
|
|
|
|
{
|
|
|
|
return maChildren.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
AccessibleParaManager::VectorOfChildren::iterator AccessibleParaManager::end()
|
|
|
|
{
|
|
|
|
return maChildren.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
AccessibleParaManager::VectorOfChildren::const_iterator AccessibleParaManager::begin() const
|
|
|
|
{
|
|
|
|
return maChildren.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
AccessibleParaManager::VectorOfChildren::const_iterator AccessibleParaManager::end() const
|
|
|
|
{
|
|
|
|
return maChildren.end();
|
|
|
|
}
|
|
|
|
|
2002-05-29 15:09:56 +00:00
|
|
|
void AccessibleParaManager::Release( sal_uInt32 nPara )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2002-05-29 15:09:56 +00:00
|
|
|
DBG_ASSERT( maChildren.size() > nPara, "AccessibleParaManager::Release: invalid index" );
|
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
if( maChildren.size() > nPara )
|
|
|
|
{
|
|
|
|
ShutdownPara( GetChild( nPara ) );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
// clear reference and rect
|
|
|
|
maChildren[ nPara ] = WeakChild();
|
|
|
|
}
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2002-05-29 15:09:56 +00:00
|
|
|
void AccessibleParaManager::FireEvent( sal_uInt32 nPara,
|
2002-05-16 15:12:20 +00:00
|
|
|
const sal_Int16 nEventId,
|
|
|
|
const uno::Any& rNewValue,
|
|
|
|
const uno::Any& rOldValue ) const
|
|
|
|
{
|
2002-05-29 15:09:56 +00:00
|
|
|
DBG_ASSERT( maChildren.size() > nPara, "AccessibleParaManager::FireEvent: invalid index" );
|
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
if( maChildren.size() > nPara )
|
|
|
|
{
|
|
|
|
WeakPara::HardRefType maChild( GetChild( nPara ).first.get() );
|
|
|
|
if( maChild.is() )
|
|
|
|
maChild->FireEvent( nEventId, rNewValue, rOldValue );
|
|
|
|
}
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool AccessibleParaManager::IsReferencable( WeakPara::HardRefType aChild )
|
|
|
|
{
|
|
|
|
return aChild.is();
|
|
|
|
}
|
|
|
|
|
2002-05-29 15:09:56 +00:00
|
|
|
sal_Bool AccessibleParaManager::IsReferencable( sal_uInt32 nChild ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2002-05-29 15:09:56 +00:00
|
|
|
DBG_ASSERT( maChildren.size() > nChild, "AccessibleParaManager::IsReferencable: invalid index" );
|
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
if( maChildren.size() > nChild )
|
|
|
|
{
|
|
|
|
// retrieve hard reference from weak one
|
|
|
|
return IsReferencable( GetChild( nChild ).first.get() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return sal_False;
|
|
|
|
}
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
AccessibleParaManager::WeakChild AccessibleParaManager::GetChild( sal_uInt32 nParagraphIndex ) const
|
2002-05-23 11:46:18 +00:00
|
|
|
{
|
2002-05-29 15:09:56 +00:00
|
|
|
DBG_ASSERT( maChildren.size() > nParagraphIndex, "AccessibleParaManager::GetChild: invalid index" );
|
2002-06-12 12:41:41 +00:00
|
|
|
|
|
|
|
if( maChildren.size() > nParagraphIndex )
|
|
|
|
{
|
|
|
|
return maChildren[ nParagraphIndex ];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return WeakChild();
|
|
|
|
}
|
2002-05-23 11:46:18 +00:00
|
|
|
}
|
|
|
|
|
2002-05-29 15:09:56 +00:00
|
|
|
AccessibleParaManager::Child AccessibleParaManager::CreateChild( sal_Int32 nChild,
|
2002-05-23 11:46:18 +00:00
|
|
|
const uno::Reference< XAccessible >& xFrontEnd,
|
2002-05-29 15:09:56 +00:00
|
|
|
SvxEditSourceAdapter& rEditSource,
|
|
|
|
sal_uInt32 nParagraphIndex )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2002-05-29 15:09:56 +00:00
|
|
|
DBG_ASSERT( maChildren.size() > nParagraphIndex, "AccessibleParaManager::CreateChild: invalid index" );
|
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
if( maChildren.size() > nParagraphIndex )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2002-06-12 12:41:41 +00:00
|
|
|
// retrieve hard reference from weak one
|
|
|
|
WeakPara::HardRefType aChild( GetChild( nParagraphIndex ).first.get() );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
if( !IsReferencable( nParagraphIndex ) )
|
|
|
|
{
|
|
|
|
// there is no hard reference available, create object then
|
2006-02-01 13:35:05 +00:00
|
|
|
// --> OD 2006-01-11 #i27138#
|
|
|
|
AccessibleEditableTextPara* pChild = new AccessibleEditableTextPara( xFrontEnd, this );
|
|
|
|
// <--
|
2002-06-12 12:41:41 +00:00
|
|
|
uno::Reference< XAccessible > xChild( static_cast< ::cppu::OWeakObject* > (pChild), uno::UNO_QUERY );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
if( !xChild.is() )
|
|
|
|
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Child creation failed")), xFrontEnd);
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
aChild = WeakPara::HardRefType( xChild, pChild );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
InitChild( *aChild, rEditSource, nChild, nParagraphIndex );
|
|
|
|
|
|
|
|
maChildren[ nParagraphIndex ] = WeakChild( aChild, pChild->getBounds() );
|
|
|
|
}
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
return Child( aChild.getRef(), GetChild( nParagraphIndex ).second );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return Child();
|
|
|
|
}
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibleParaManager::SetEEOffset( const Point& rOffset )
|
|
|
|
{
|
2002-06-12 12:41:41 +00:00
|
|
|
maEEOffset = rOffset;
|
|
|
|
|
2003-04-24 15:54:18 +00:00
|
|
|
MemFunAdapter< const Point& > aAdapter( &::accessibility::AccessibleEditableTextPara::SetEEOffset, rOffset );
|
2002-05-23 11:46:18 +00:00
|
|
|
::std::for_each( begin(), end(), aAdapter );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
void AccessibleParaManager::SetActive( sal_Bool bActive )
|
|
|
|
{
|
|
|
|
mbActive = bActive;
|
|
|
|
|
|
|
|
if( bActive )
|
|
|
|
{
|
|
|
|
SetState( AccessibleStateType::ACTIVE );
|
|
|
|
SetState( AccessibleStateType::EDITABLE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UnSetState( AccessibleStateType::ACTIVE );
|
|
|
|
UnSetState( AccessibleStateType::EDITABLE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibleParaManager::SetFocus( sal_Int32 nChild )
|
|
|
|
{
|
|
|
|
if( mnFocusedChild != -1 )
|
|
|
|
UnSetState( mnFocusedChild, AccessibleStateType::FOCUSED );
|
|
|
|
|
|
|
|
mnFocusedChild = nChild;
|
|
|
|
|
|
|
|
if( mnFocusedChild != -1 )
|
|
|
|
SetState( mnFocusedChild, AccessibleStateType::FOCUSED );
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibleParaManager::InitChild( AccessibleEditableTextPara& rChild,
|
|
|
|
SvxEditSourceAdapter& rEditSource,
|
|
|
|
sal_Int32 nChild,
|
|
|
|
sal_uInt32 nParagraphIndex ) const
|
|
|
|
{
|
|
|
|
rChild.SetEditSource( &rEditSource );
|
|
|
|
rChild.SetIndexInParent( nChild );
|
|
|
|
rChild.SetParagraphIndex( nParagraphIndex );
|
|
|
|
|
|
|
|
rChild.SetEEOffset( maEEOffset );
|
|
|
|
|
|
|
|
if( mbActive )
|
|
|
|
{
|
|
|
|
rChild.SetState( AccessibleStateType::ACTIVE );
|
|
|
|
rChild.SetState( AccessibleStateType::EDITABLE );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( mnFocusedChild == static_cast<sal_Int32>(nParagraphIndex) )
|
|
|
|
rChild.SetState( AccessibleStateType::FOCUSED );
|
2006-01-13 16:17:55 +00:00
|
|
|
|
|
|
|
// add states passed from outside
|
|
|
|
for( VectorOfStates::const_iterator aIt = maChildStates.begin(), aEnd = maChildStates.end(); aIt != aEnd; ++aIt )
|
|
|
|
rChild.SetState( *aIt );
|
2002-06-12 12:41:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibleParaManager::SetState( sal_Int32 nChild, const sal_Int16 nStateId )
|
|
|
|
{
|
|
|
|
MemFunAdapter< const sal_Int16 > aFunc( &AccessibleEditableTextPara::SetState,
|
|
|
|
nStateId );
|
|
|
|
aFunc( GetChild(nChild) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibleParaManager::SetState( const sal_Int16 nStateId )
|
|
|
|
{
|
|
|
|
::std::for_each( begin(), end(),
|
|
|
|
MemFunAdapter< const sal_Int16 >( &AccessibleEditableTextPara::SetState,
|
|
|
|
nStateId ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibleParaManager::UnSetState( sal_Int32 nChild, const sal_Int16 nStateId )
|
|
|
|
{
|
|
|
|
MemFunAdapter< const sal_Int16 > aFunc( &AccessibleEditableTextPara::UnSetState,
|
|
|
|
nStateId );
|
|
|
|
aFunc( GetChild(nChild) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibleParaManager::UnSetState( const sal_Int16 nStateId )
|
|
|
|
{
|
|
|
|
::std::for_each( begin(), end(),
|
|
|
|
MemFunAdapter< const sal_Int16 >( &AccessibleEditableTextPara::UnSetState,
|
|
|
|
nStateId ) );
|
|
|
|
}
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
void AccessibleParaManager::SetEditSource( SvxEditSourceAdapter* pEditSource )
|
|
|
|
{
|
2003-04-24 15:54:18 +00:00
|
|
|
MemFunAdapter< SvxEditSourceAdapter* > aAdapter( &::accessibility::AccessibleEditableTextPara::SetEditSource, pEditSource );
|
2002-05-23 11:46:18 +00:00
|
|
|
::std::for_each( begin(), end(), aAdapter );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2002-07-24 15:19:19 +00:00
|
|
|
// not generic yet, no arguments...
|
2003-04-24 15:54:18 +00:00
|
|
|
class AccessibleParaManager_DisposeChildren : public ::std::unary_function< ::accessibility::AccessibleEditableTextPara&, void >
|
2002-07-24 15:19:19 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
AccessibleParaManager_DisposeChildren() {}
|
2003-04-24 15:54:18 +00:00
|
|
|
void operator()( ::accessibility::AccessibleEditableTextPara& rPara )
|
2002-07-24 15:19:19 +00:00
|
|
|
{
|
|
|
|
rPara.Dispose();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void AccessibleParaManager::Dispose()
|
|
|
|
{
|
|
|
|
AccessibleParaManager_DisposeChildren aFunctor;
|
|
|
|
|
|
|
|
::std::for_each( begin(), end(),
|
|
|
|
WeakChildAdapter< AccessibleParaManager_DisposeChildren > (aFunctor) );
|
|
|
|
}
|
|
|
|
|
2002-05-23 11:46:18 +00:00
|
|
|
// not generic yet, too many method arguments...
|
2003-04-24 15:54:18 +00:00
|
|
|
class StateChangeEvent : public ::std::unary_function< ::accessibility::AccessibleEditableTextPara&, void >
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef void return_type;
|
|
|
|
StateChangeEvent( const sal_Int16 nEventId,
|
|
|
|
const uno::Any& rNewValue,
|
|
|
|
const uno::Any& rOldValue ) :
|
|
|
|
mnEventId( nEventId ),
|
|
|
|
mrNewValue( rNewValue ),
|
|
|
|
mrOldValue( rOldValue ) {}
|
2003-04-24 15:54:18 +00:00
|
|
|
void operator()( ::accessibility::AccessibleEditableTextPara& rPara )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
rPara.FireEvent( mnEventId, mrNewValue, mrOldValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const sal_Int16 mnEventId;
|
|
|
|
const uno::Any& mrNewValue;
|
|
|
|
const uno::Any& mrOldValue;
|
|
|
|
};
|
|
|
|
|
2002-05-29 15:09:56 +00:00
|
|
|
void AccessibleParaManager::FireEvent( sal_uInt32 nStartPara,
|
|
|
|
sal_uInt32 nEndPara,
|
2002-05-16 15:12:20 +00:00
|
|
|
const sal_Int16 nEventId,
|
|
|
|
const uno::Any& rNewValue,
|
|
|
|
const uno::Any& rOldValue ) const
|
|
|
|
{
|
2002-05-29 15:09:56 +00:00
|
|
|
DBG_ASSERT( maChildren.size() > nStartPara &&
|
2002-05-29 16:01:52 +00:00
|
|
|
maChildren.size() >= nEndPara , "AccessibleParaManager::FireEvent: invalid index" );
|
2002-05-29 15:09:56 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
if( maChildren.size() > nStartPara &&
|
|
|
|
maChildren.size() >= nEndPara )
|
|
|
|
{
|
|
|
|
VectorOfChildren::const_iterator front = maChildren.begin();
|
|
|
|
VectorOfChildren::const_iterator back = front;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
::std::advance( front, nStartPara );
|
|
|
|
::std::advance( back, nEndPara );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
StateChangeEvent aFunctor( nEventId, rNewValue, rOldValue );
|
2002-05-21 13:58:45 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
::std::for_each( front, back, AccessibleParaManager::WeakChildAdapter< StateChangeEvent >( aFunctor ) );
|
|
|
|
}
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class ReleaseChild : public ::std::unary_function< const AccessibleParaManager::WeakChild&, AccessibleParaManager::WeakChild >
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AccessibleParaManager::WeakChild operator()( const AccessibleParaManager::WeakChild& rPara )
|
|
|
|
{
|
|
|
|
AccessibleParaManager::ShutdownPara( rPara );
|
|
|
|
|
|
|
|
// clear reference
|
|
|
|
return AccessibleParaManager::WeakChild();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2002-05-29 15:09:56 +00:00
|
|
|
void AccessibleParaManager::Release( sal_uInt32 nStartPara, sal_uInt32 nEndPara )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2002-05-29 15:09:56 +00:00
|
|
|
DBG_ASSERT( maChildren.size() > nStartPara &&
|
2002-05-29 16:01:52 +00:00
|
|
|
maChildren.size() >= nEndPara, "AccessibleParaManager::Release: invalid index" );
|
2002-05-29 15:09:56 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
if( maChildren.size() > nStartPara &&
|
|
|
|
maChildren.size() >= nEndPara )
|
|
|
|
{
|
|
|
|
VectorOfChildren::iterator front = maChildren.begin();
|
|
|
|
VectorOfChildren::iterator back = front;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
::std::advance( front, nStartPara );
|
|
|
|
::std::advance( back, nEndPara );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-06-12 12:41:41 +00:00
|
|
|
::std::transform( front, back, front, ReleaseChild() );
|
|
|
|
}
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibleParaManager::ShutdownPara( const WeakChild& rChild )
|
|
|
|
{
|
|
|
|
WeakPara::HardRefType aChild( rChild.first.get() );
|
|
|
|
|
|
|
|
if( IsReferencable( aChild ) )
|
|
|
|
aChild->SetEditSource( NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|