summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svx/source/accessibility/AccessibleEditableTextPara.cxx207
-rw-r--r--svx/source/accessibility/AccessibleEditableTextPara.hxx12
-rw-r--r--svx/source/accessibility/AccessibleImageBullet.cxx97
-rw-r--r--svx/source/accessibility/AccessibleImageBullet.hxx20
-rw-r--r--svx/source/accessibility/AccessibleParaManager.cxx71
-rw-r--r--svx/source/accessibility/AccessibleParaManager.hxx69
-rwxr-xr-xsvx/source/accessibility/AccessibleShape.cxx6
-rw-r--r--svx/source/accessibility/AccessibleTextHelper.cxx251
-rw-r--r--svx/source/unoedit/unoedprx.cxx29
9 files changed, 494 insertions, 268 deletions
diff --git a/svx/source/accessibility/AccessibleEditableTextPara.cxx b/svx/source/accessibility/AccessibleEditableTextPara.cxx
index bfdac753c0..439d7e6b4c 100644
--- a/svx/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/svx/source/accessibility/AccessibleEditableTextPara.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AccessibleEditableTextPara.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: thb $ $Date: 2002-05-17 17:34:57 $
+ * last change: $Author: thb $ $Date: 2002-05-23 12:44:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -163,6 +163,13 @@ namespace accessibility
mxParent( rParent ),
maStateListeners( maMutex )
{
+ // Create the state set.
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper ();
+ mxStateSet = pStateSet;
+
+ // these are always on
+ pStateSet->AddState( AccessibleStateType::MULTILINE );
+ pStateSet->AddState( AccessibleStateType::FOCUSABLE );
}
AccessibleEditableTextPara::~AccessibleEditableTextPara()
@@ -181,35 +188,34 @@ namespace accessibility
void AccessibleEditableTextPara::SetParagraphIndex( sal_Int32 nIndex )
{
- sal_Int32 nOldIndex = mnParagraphIndex;
+ uno::Any aOldDesc;
+ uno::Any aOldName;
- if( nOldIndex != nIndex )
+ try
{
- // index and therefore description changed
- LostPropertyEvent( uno::makeAny( getAccessibleDescription() ), AccessibleEventId::ACCESSIBLE_DESCRIPTION_EVENT );
- LostPropertyEvent( uno::makeAny( getAccessibleName() ), AccessibleEventId::ACCESSIBLE_NAME_EVENT );
+ aOldDesc <<= getAccessibleDescription();
+ aOldName <<= getAccessibleName();
}
+ catch( const uno::Exception& ) {} // optional behaviour
+
+ sal_Int32 nOldIndex = mnParagraphIndex;
mnParagraphIndex = nIndex;
+ WeakBullet::HardRefType aChild( maImageBullet.get() );
+ if( aChild.is() )
+ aChild->SetParagraphIndex(mnParagraphIndex);
+
try
{
- if( HaveChildren() )
+ if( nOldIndex != nIndex )
{
- WeakBullet::HardRefType aChild( maImageBullet.get() );
-
- if( aChild.is() )
- aChild->SetParagraphIndex(mnParagraphIndex);
+ // index and therefore description changed
+ FireEvent( AccessibleEventId::ACCESSIBLE_DESCRIPTION_EVENT, uno::makeAny( getAccessibleDescription() ), aOldDesc );
+ FireEvent( AccessibleEventId::ACCESSIBLE_NAME_EVENT, uno::makeAny( getAccessibleName() ), aOldName );
}
}
- catch( const uno::RuntimeException& ) {}
-
- if( nOldIndex != nIndex )
- {
- // index and therefore description changed
- GotPropertyEvent( uno::makeAny( getAccessibleDescription() ), AccessibleEventId::ACCESSIBLE_DESCRIPTION_EVENT );
- GotPropertyEvent( uno::makeAny( getAccessibleName() ), AccessibleEventId::ACCESSIBLE_NAME_EVENT );
- }
+ catch( const uno::Exception& ) {} // optional behaviour
}
sal_Int32 AccessibleEditableTextPara::GetParagraphIndex() const throw (uno::RuntimeException)
@@ -219,24 +225,21 @@ namespace accessibility
void AccessibleEditableTextPara::SetEditSource( SvxEditSourceAdapter* pEditSource )
{
+ SvxEditSource* pOldEditSource = mpEditSource;
+
mpEditSource = pEditSource;
- try
- {
- if( HaveChildren() )
- {
- WeakBullet::HardRefType aChild( maImageBullet.get() );
-
- if( aChild.is() )
- aChild->SetEditSource(pEditSource);
- }
- }
- catch( const uno::RuntimeException& ) {}
+ WeakBullet::HardRefType aChild( maImageBullet.get() );
+ if( aChild.is() )
+ aChild->SetEditSource(pEditSource);
if( !mpEditSource )
{
// going defunc
- FireEvent( AccessibleEventId::ACCESSIBLE_STATE_EVENT );
+ UnSetState( AccessibleStateType::SHOWING );
+ UnSetState( AccessibleStateType::VISIBLE );
+ SetState( AccessibleStateType::INVALID );
+ SetState( AccessibleStateType::DEFUNC );
try
{
@@ -245,7 +248,15 @@ namespace accessibility
lang::EventObject aEvent (xThis);
maStateListeners.disposeAndClear( aEvent );
}
- catch( const uno::RuntimeException& ) {}
+ catch( const uno::Exception& ) {}
+ }
+ else if( !pOldEditSource )
+ {
+ // going alive
+ UnSetState( AccessibleStateType::DEFUNC );
+ UnSetState( AccessibleStateType::INVALID );
+ SetState( AccessibleStateType::VISIBLE );
+ SetState( AccessibleStateType::SHOWING );
}
}
@@ -464,13 +475,9 @@ namespace accessibility
void AccessibleEditableTextPara::SetEEOffset( const Point& rOffset )
{
- if( HaveChildren() )
- {
- WeakBullet::HardRefType aChild( maImageBullet.get() );
-
- if( aChild.is() )
- aChild->SetEEOffset(rOffset);
- }
+ WeakBullet::HardRefType aChild( maImageBullet.get() );
+ if( aChild.is() )
+ aChild->SetEEOffset(rOffset);
maEEOffset = rOffset;
}
@@ -493,7 +500,7 @@ namespace accessibility
{
xListener->notifyEvent( aEvent );
}
- catch( const uno::RuntimeException& )
+ catch( const uno::Exception& )
{
#ifdef DBG_UTIL
DBG_ERROR("AccessibleEditableTextPara::FireEvent: Caught runtime exception from listener, removing object (bridge/listener dead?)");
@@ -513,6 +520,28 @@ namespace accessibility
FireEvent( nEventId, uno::Any(), rOldValue );
}
+ void AccessibleEditableTextPara::SetState( const sal_Int16 nStateId )
+ {
+ ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+ if( pStateSet != NULL &&
+ !pStateSet->contains(nStateId) )
+ {
+ pStateSet->AddState( nStateId );
+ GotPropertyEvent( uno::makeAny( nStateId), AccessibleEventId::ACCESSIBLE_STATE_EVENT );
+ }
+ }
+
+ void AccessibleEditableTextPara::UnSetState( const sal_Int16 nStateId )
+ {
+ ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+ if( pStateSet != NULL &&
+ pStateSet->contains(nStateId) )
+ {
+ pStateSet->RemoveState( nStateId );
+ LostPropertyEvent( uno::makeAny( nStateId), AccessibleEventId::ACCESSIBLE_STATE_EVENT );
+ }
+ }
+
uno::Any SAL_CALL AccessibleEditableTextPara::queryInterface (const uno::Type & rType) throw (uno::RuntimeException)
{
uno::Any aRet;
@@ -664,45 +693,13 @@ namespace accessibility
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
- utl::AccessibleStateSetHelper* aStateSet = new utl::AccessibleStateSetHelper();
- uno::Reference< XAccessibleStateSet > xStateSet( static_cast< cppu::OWeakObject* > (aStateSet), uno::UNO_QUERY );
-
- // are we defunc?
- if( !mpEditSource )
- {
- aStateSet->AddState( AccessibleStateType::DEFUNC );
- aStateSet->AddState( AccessibleStateType::INVALID );
- }
-
- // are we editable?
- if( IsActive() )
- {
- aStateSet->AddState( AccessibleStateType::ACTIVE );
- aStateSet->AddState( AccessibleStateType::SELECTED );
- aStateSet->AddState( AccessibleStateType::EDITABLE );
- }
+ // Create a copy of the state set and return it.
+ ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if( isFocusTraversable() )
- {
- aStateSet->AddState( AccessibleStateType::FOCUSABLE );
- }
-
- // TODO: handle focus state
- // AccessibleStateType::FOCUSED
-
- // these are always on
- aStateSet->AddState( AccessibleStateType::MULTILINE );
- // meaningful only for XAccessibleSelection interface
- // aStateSet->AddState( AccessibleStateType::SELECTABLE );
+ if( !pStateSet )
+ return uno::Reference<XAccessibleStateSet>();
- // are we visible?
- if( IsVisible() )
- {
- aStateSet->AddState( AccessibleStateType::SHOWING );
- aStateSet->AddState( AccessibleStateType::VISIBLE );
- }
-
- return xStateSet;
+ return uno::Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet) );
}
lang::Locale SAL_CALL AccessibleEditableTextPara::getLocale() throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
@@ -743,21 +740,39 @@ namespace accessibility
return aRect.IsInside( aPoint );
}
- uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessibleAt( const awt::Point& aPoint ) throw (uno::RuntimeException)
+ uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessibleAt( const awt::Point& _aPoint ) throw (uno::RuntimeException)
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
if( HaveChildren() )
{
- // create accessible object for bitmap bullet
- // TODO
- return uno::Reference< XAccessible >();
- }
- else
- {
- // as we have no children, empty reference
- return uno::Reference< XAccessible >();
+ // make given position relative
+ Point aPoint( _aPoint.X, _aPoint.Y );
+ awt::Point aRefPoint = getLocationOnScreen();
+ aPoint -= Point( aRefPoint.X, aRefPoint.Y );
+
+ // respect EditEngine offset to surrounding shape/cell
+ aPoint -= GetEEOffset();
+
+ // convert to EditEngine coordinate system
+ SvxTextForwarder& rCacheTF = GetTextForwarder();
+ Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) );
+
+ EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< USHORT > (GetParagraphIndex()) );
+
+ if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
+ aBulletInfo.bVisible &&
+ aBulletInfo.nType == SVX_NUM_BITMAP )
+ {
+ Rectangle aRect = aBulletInfo.aBounds;
+
+ if( aRect.IsInside( aLogPoint ) )
+ return getAccessibleChild(0);
+ }
}
+
+ // no children at all, or none at given position
+ return uno::Reference< XAccessible >();
}
awt::Rectangle SAL_CALL AccessibleEditableTextPara::getBounds() throw (uno::RuntimeException)
@@ -1162,16 +1177,14 @@ namespace accessibility
switch( aTextType )
{
- case AccessibleTextType::GLYPH:
- // TODO
- break;
-
case AccessibleTextType::ATTRIBUTE_RUN:
// GetCharAttribs( USHORT nPara, EECharAttribArray& rLst ) const;
// beware: array is sorted in start positions, the end positions can overlap!
// TODO
break;
+ case AccessibleTextType::GLYPH:
+ // TODO: CTL?
case AccessibleTextType::CHARACTER:
aRetVal = String( getCharacter( nIndex ) );
break;
@@ -1233,14 +1246,12 @@ namespace accessibility
switch( aTextType )
{
- case AccessibleTextType::GLYPH:
- // TODO
- break;
-
case AccessibleTextType::ATTRIBUTE_RUN:
// TODO
break;
+ case AccessibleTextType::GLYPH:
+ // TODO: CTL?
case AccessibleTextType::CHARACTER:
aRetVal = nIndex > 0 ? String(getCharacter( nIndex-1 )) : String();
break;
@@ -1326,14 +1337,12 @@ namespace accessibility
switch( aTextType )
{
- case AccessibleTextType::GLYPH:
- // TODO
- break;
-
case AccessibleTextType::ATTRIBUTE_RUN:
// TODO
break;
+ case AccessibleTextType::GLYPH:
+ // TODO: CTL?
case AccessibleTextType::CHARACTER:
aRetVal = nIndex < nTextLen-1 ? String(getCharacter( nIndex+1 )) : String();
break;
diff --git a/svx/source/accessibility/AccessibleEditableTextPara.hxx b/svx/source/accessibility/AccessibleEditableTextPara.hxx
index 18cc335118..c48642572a 100644
--- a/svx/source/accessibility/AccessibleEditableTextPara.hxx
+++ b/svx/source/accessibility/AccessibleEditableTextPara.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AccessibleEditableTextPara.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: thb $ $Date: 2002-05-16 16:10:17 $
+ * last change: $Author: thb $ $Date: 2002-05-23 12:44:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -274,6 +274,11 @@ namespace accessibility
/// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+ /// Sets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
+ void SetState( const sal_Int16 nStateId );
+ /// Unsets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
+ void UnSetState( const sal_Int16 nStateId );
+
static Rectangle LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder );
private:
@@ -388,6 +393,9 @@ namespace accessibility
// the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
Point maEEOffset;
+ // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
+ ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
+
mutable osl::Mutex maMutex;
/// The shape we're the accessible for (unguarded)
diff --git a/svx/source/accessibility/AccessibleImageBullet.cxx b/svx/source/accessibility/AccessibleImageBullet.cxx
index 4359f37559..8ba6d30766 100644
--- a/svx/source/accessibility/AccessibleImageBullet.cxx
+++ b/svx/source/accessibility/AccessibleImageBullet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AccessibleImageBullet.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: thb $ $Date: 2002-05-17 17:35:10 $
+ * last change: $Author: thb $ $Date: 2002-05-23 12:44:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -205,24 +205,13 @@ namespace accessibility
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
- utl::AccessibleStateSetHelper* aStateSet = new utl::AccessibleStateSetHelper();
- uno::Reference< XAccessibleStateSet > xStateSet( static_cast< cppu::OWeakObject* > (aStateSet), uno::UNO_QUERY );
+ // Create a copy of the state set and return it.
+ ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- // are we defunc?
- if( !mpEditSource )
- {
- aStateSet->AddState( AccessibleStateType::DEFUNC );
- aStateSet->AddState( AccessibleStateType::INVALID );
- }
+ if( !pStateSet )
+ return uno::Reference<XAccessibleStateSet>();
- // are we visible?
- if( IsVisible() )
- {
- aStateSet->AddState( AccessibleStateType::SHOWING );
- aStateSet->AddState( AccessibleStateType::VISIBLE );
- }
-
- return xStateSet;
+ return uno::Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet) );
}
lang::Locale SAL_CALL AccessibleImageBullet::getLocale() throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
@@ -350,16 +339,19 @@ namespace accessibility
sal_Bool SAL_CALL AccessibleImageBullet::isShowing( ) throw (uno::RuntimeException)
{
- return IsVisible();
+ // TODO: remove
+ return sal_False;
}
sal_Bool SAL_CALL AccessibleImageBullet::isVisible( ) throw (uno::RuntimeException)
{
- return IsVisible();
+ // TODO: remove
+ return sal_False;
}
sal_Bool SAL_CALL AccessibleImageBullet::isFocusTraversable( ) throw (uno::RuntimeException)
{
+ // TODO: remove
return sal_False;
}
@@ -437,12 +429,17 @@ namespace accessibility
void AccessibleImageBullet::SetEditSource( SvxEditSource* pEditSource )
{
+ SvxEditSource* pOldEditSource = mpEditSource;
+
mpEditSource = pEditSource;
if( !mpEditSource )
{
// going defunc
- FireEvent( AccessibleEventId::ACCESSIBLE_STATE_EVENT );
+ UnSetState( AccessibleStateType::SHOWING );
+ UnSetState( AccessibleStateType::VISIBLE );
+ SetState( AccessibleStateType::INVALID );
+ SetState( AccessibleStateType::DEFUNC );
try
{
@@ -451,7 +448,15 @@ namespace accessibility
lang::EventObject aEvent (xThis);
maStateListeners.disposeAndClear( aEvent );
}
- catch( const uno::RuntimeException& ) {}
+ catch( const uno::Exception& ) {}
+ }
+ else if( !pOldEditSource )
+ {
+ // going alive
+ UnSetState( AccessibleStateType::DEFUNC );
+ UnSetState( AccessibleStateType::INVALID );
+ SetState( AccessibleStateType::VISIBLE );
+ SetState( AccessibleStateType::SHOWING );
}
}
@@ -473,7 +478,7 @@ namespace accessibility
{
xListener->notifyEvent( aEvent );
}
- catch( const uno::RuntimeException& )
+ catch( const uno::Exception& )
{
#ifdef DBG_UTIL
DBG_ERROR("AccessibleImageBullet::FireEvent: Caught runtime exception from listener, removing object (bridge/listener dead?)");
@@ -493,30 +498,54 @@ namespace accessibility
FireEvent( nEventId, uno::Any(), rOldValue );
}
- sal_Bool AccessibleImageBullet::IsVisible() const
+ void AccessibleImageBullet::SetState( const sal_Int16 nStateId )
{
- return mpEditSource ? sal_True : sal_False ;
+ ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+ if( pStateSet != NULL &&
+ !pStateSet->contains(nStateId) )
+ {
+ pStateSet->AddState( nStateId );
+ GotPropertyEvent( uno::makeAny( nStateId), AccessibleEventId::ACCESSIBLE_STATE_EVENT );
+ }
+ }
+
+ void AccessibleImageBullet::UnSetState( const sal_Int16 nStateId )
+ {
+ ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+ if( pStateSet != NULL &&
+ pStateSet->contains(nStateId) )
+ {
+ pStateSet->RemoveState( nStateId );
+ LostPropertyEvent( uno::makeAny( nStateId), AccessibleEventId::ACCESSIBLE_STATE_EVENT );
+ }
}
void AccessibleImageBullet::SetParagraphIndex( sal_Int32 nIndex )
{
- sal_Int32 nOldIndex = mnParagraphIndex;
+ uno::Any aOldDesc;
+ uno::Any aOldName;
- if( nOldIndex != nIndex )
+ try
{
- // index and therefore description changed
- LostPropertyEvent( uno::makeAny( getAccessibleDescription() ), AccessibleEventId::ACCESSIBLE_DESCRIPTION_EVENT );
- LostPropertyEvent( uno::makeAny( getAccessibleName() ), AccessibleEventId::ACCESSIBLE_NAME_EVENT );
+ aOldDesc <<= getAccessibleDescription();
+ aOldName <<= getAccessibleName();
}
+ catch( const uno::Exception& ) {} // optional behaviour
+
+ sal_Int32 nOldIndex = mnParagraphIndex;
mnParagraphIndex = nIndex;
- if( nOldIndex != nIndex )
+ try
{
- // index and therefore description changed
- GotPropertyEvent( uno::makeAny( getAccessibleDescription() ), AccessibleEventId::ACCESSIBLE_DESCRIPTION_EVENT );
- GotPropertyEvent( uno::makeAny( getAccessibleName() ), AccessibleEventId::ACCESSIBLE_NAME_EVENT );
+ if( nOldIndex != nIndex )
+ {
+ // index and therefore description changed
+ FireEvent( AccessibleEventId::ACCESSIBLE_DESCRIPTION_EVENT, uno::makeAny( getAccessibleDescription() ), aOldDesc );
+ FireEvent( AccessibleEventId::ACCESSIBLE_NAME_EVENT, uno::makeAny( getAccessibleName() ), aOldName );
+ }
}
+ catch( const uno::Exception& ) {} // optional behaviour
}
sal_Int32 AccessibleImageBullet::GetParagraphIndex() const throw (uno::RuntimeException)
diff --git a/svx/source/accessibility/AccessibleImageBullet.hxx b/svx/source/accessibility/AccessibleImageBullet.hxx
index 12b54e95fb..86adec7325 100644
--- a/svx/source/accessibility/AccessibleImageBullet.hxx
+++ b/svx/source/accessibility/AccessibleImageBullet.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AccessibleImageBullet.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: vg $ $Date: 2002-05-23 10:04:33 $
+ * last change: $Author: thb $ $Date: 2002-05-23 12:44:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -246,16 +246,9 @@ namespace accessibility
void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
- /** Query the visibility state
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
-
- @return the visibility state. Per definition, a defunc object is no longer visible
- */
- sal_Bool IsVisible() const;
+ // maintain state set and send STATE_CHANGE events
+ void SetState( const sal_Int16 nStateId );
+ void UnSetState( const sal_Int16 nStateId );
SvxEditSource& GetEditSource() const throw (::com::sun::star::uno::RuntimeException);
@@ -291,6 +284,9 @@ namespace accessibility
// the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
Point maEEOffset;
+ // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
+ ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
+
mutable osl::Mutex maMutex;
/// The shape we're the accessible for (unguarded)
diff --git a/svx/source/accessibility/AccessibleParaManager.cxx b/svx/source/accessibility/AccessibleParaManager.cxx
index 6a14e8c29b..30664a502e 100644
--- a/svx/source/accessibility/AccessibleParaManager.cxx
+++ b/svx/source/accessibility/AccessibleParaManager.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AccessibleParaManager.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: thb $ $Date: 2002-05-21 14:58:45 $
+ * last change: $Author: thb $ $Date: 2002-05-23 12:44:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -166,15 +166,20 @@ namespace accessibility
return IsReferencable( maChildren[ nChild ].first.get() );
}
- AccessibleParaManager::Child AccessibleParaManager::GetChild( sal_Int32 nChild,
- const uno::Reference< XAccessible >& xFrontEnd,
- SvxEditSourceAdapter& rEditSource,
- sal_Int32 nParagraphIndex )
+ AccessibleParaManager::WeakChild AccessibleParaManager::GetChild( sal_Int32 nParagraphIndex )
+ {
+ return maChildren[ nParagraphIndex ];
+ }
+
+ AccessibleParaManager::Child AccessibleParaManager::CreateChild( sal_Int32 nChild,
+ const uno::Reference< XAccessible >& xFrontEnd,
+ SvxEditSourceAdapter& rEditSource,
+ sal_Int32 nParagraphIndex )
{
// retrieve hard reference from weak one
- WeakPara::HardRefType aChild( maChildren[ nChild ].first.get() );
+ WeakPara::HardRefType aChild( maChildren[ nParagraphIndex ].first.get() );
- if( !IsReferencable( nChild ) )
+ if( !IsReferencable( nParagraphIndex ) )
{
// there is no hard reference available, create object then
AccessibleEditableTextPara* pChild = new AccessibleEditableTextPara( xFrontEnd );
@@ -189,53 +194,25 @@ namespace accessibility
aChild->SetIndexInParent( nChild );
aChild->SetParagraphIndex( nParagraphIndex );
- maChildren[ nChild ] = WeakChild( aChild, pChild->getBounds() );
+ maChildren[ nParagraphIndex ] = WeakChild( aChild, pChild->getBounds() );
}
- return Child( aChild.getRef(), maChildren[ nChild ].second );
+ return Child( aChild.getRef(), maChildren[ nParagraphIndex ].second );
}
- // TODO: refactor these functors to a single template
- class SetChildrenEEOffset : public ::std::unary_function< accessibility::AccessibleEditableTextPara&, void >
- {
- public:
- SetChildrenEEOffset( const Point& rOffset ) : mrOffset( rOffset ) {}
- void operator()( accessibility::AccessibleEditableTextPara& rPara )
- {
- rPara.SetEEOffset( mrOffset );
- }
-
- private:
- const Point& mrOffset;
- };
-
void AccessibleParaManager::SetEEOffset( const Point& rOffset )
{
- SetChildrenEEOffset aFunctor( rOffset );
- ForEach( aFunctor );
+ MemFunAdapter< const Point& > aAdapter( &accessibility::AccessibleEditableTextPara::SetEEOffset, rOffset );
+ ::std::for_each( begin(), end(), aAdapter );
}
- // TODO: refactor these functors to a single template
- class SetChildrenEditSource : public ::std::unary_function< accessibility::AccessibleEditableTextPara&, void >
- {
- public:
- SetChildrenEditSource( SvxEditSourceAdapter* pEditSource ) : mpEditSource( pEditSource ) {}
- void operator()( accessibility::AccessibleEditableTextPara& rPara )
- {
- rPara.SetEditSource( mpEditSource );
- }
-
- private:
- SvxEditSourceAdapter* mpEditSource;
- };
-
void AccessibleParaManager::SetEditSource( SvxEditSourceAdapter* pEditSource )
{
- SetChildrenEditSource aFunctor( pEditSource );
- ForEach( aFunctor );
+ MemFunAdapter< SvxEditSourceAdapter* > aAdapter( &accessibility::AccessibleEditableTextPara::SetEditSource, pEditSource );
+ ::std::for_each( begin(), end(), aAdapter );
}
- // TODO: refactor these functors to a single template (EffSTL or MExC++)
+ // not generic yet, too many method arguments...
class StateChangeEvent : public ::std::unary_function< accessibility::AccessibleEditableTextPara&, void >
{
public:
@@ -269,9 +246,9 @@ namespace accessibility
::std::advance( front, nStartPara );
::std::advance( back, nEndPara );
- StateChangeEvent aFunctor( nEventId, rNewValue, rOldValue );
+ StateChangeEvent aFunctor( nEventId, rNewValue, rOldValue );
- ::std::for_each( front, back, AccessibleParaManager::WeakChildAdapter< StateChangeEvent > ( aFunctor ) );
+ ::std::for_each( front, back, AccessibleParaManager::WeakChildAdapter< StateChangeEvent >( aFunctor ) );
}
class ReleaseChild : public ::std::unary_function< const AccessibleParaManager::WeakChild&, AccessibleParaManager::WeakChild >
@@ -291,8 +268,8 @@ namespace accessibility
VectorOfChildren::iterator front = maChildren.begin();
VectorOfChildren::iterator back = front;
- ::std::advance< VectorOfChildren::iterator, sal_Int32 >( front, nStartPara );
- ::std::advance< VectorOfChildren::iterator, sal_Int32 >( back, nEndPara );
+ ::std::advance( front, nStartPara );
+ ::std::advance( back, nEndPara );
::std::transform( front, back, front, ReleaseChild() );
}
diff --git a/svx/source/accessibility/AccessibleParaManager.hxx b/svx/source/accessibility/AccessibleParaManager.hxx
index cbf3f4a6f0..59a556d645 100644
--- a/svx/source/accessibility/AccessibleParaManager.hxx
+++ b/svx/source/accessibility/AccessibleParaManager.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AccessibleParaManager.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: thb $ $Date: 2002-05-21 14:58:45 $
+ * last change: $Author: thb $ $Date: 2002-05-23 12:44:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -201,7 +201,12 @@ namespace accessibility
AccessibleParaManager();
~AccessibleParaManager();
- // changing the state of the AccessibleParaManager itself
+ /** Set the number of paragraphs
+
+ @param nNumPara
+ The total number of paragraphs the EditEngine currently
+ has (_not_ the number of currently visible children)
+ */
void SetNum( sal_Int32 nNumParas );
// iterators
@@ -221,10 +226,12 @@ namespace accessibility
sal_Bool IsReferencable( sal_Int32 nChild ) const;
static void ShutdownPara( const WeakChild& rChild );
- Child GetChild( sal_Int32 nChild,
- const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible >& xFrontEnd,
- SvxEditSourceAdapter& rEditSource,
- sal_Int32 nParagraphIndex );
+ Child CreateChild( sal_Int32 nChild,
+ const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible >& xFrontEnd,
+ SvxEditSourceAdapter& rEditSource,
+ sal_Int32 nParagraphIndex );
+
+ WeakChild GetChild( sal_Int32 nParagraphIndex );
// forwarder to all paragraphs
void SetEEOffset ( const Point& rOffset );
@@ -238,9 +245,16 @@ namespace accessibility
const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(),
const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
- // functor adapter for ForEach template, accessing only the
- // paragraph object and hiding the fact that our children are
- // held weakly
+ /** Functor adapter for ForEach template
+
+ Adapts giving functor such that only the paragraph objects
+ are accessed and the fact that our children are held
+ weakly is hidden
+
+ The functor must provide the following method:
+ void operator() ( AccessibleEditablePara& )
+
+ */
template < typename Functor > class WeakChildAdapter : public ::std::unary_function< const WeakChild&, void >
{
public:
@@ -258,8 +272,39 @@ namespace accessibility
Functor& mrFunctor;
};
- // generic algorithm on given paragraphs (non-mutating, i.e. the
- // original vector is unchanged). convenience.
+ /** Adapter for unary member functions
+
+ Since STL's binder don't work with const& arguments (and
+ BOOST's neither, at least on MSVC), have to provide our
+ own adapter for unary member functions.
+
+ Create with pointer to member function of
+ AccessibleEditableTextPara and the corresponding argument.
+ */
+ template < typename Argument > class MemFunAdapter : public ::std::unary_function< const WeakChild&, void >
+ {
+ public:
+ typedef void (accessibility::AccessibleEditableTextPara::*FunctionPointer)( Argument );
+
+ MemFunAdapter( FunctionPointer aFunPtr, Argument aArg ) : maFunPtr(aFunPtr), maArg(aArg) {}
+ void operator()( const WeakChild& rPara )
+ {
+ // retrieve hard reference from weak one
+ WeakPara::HardRefType aHardRef( rPara.first.get() );
+
+ if( aHardRef.is() )
+ (*aHardRef.*maFunPtr)( maArg );
+ }
+
+ private:
+ FunctionPointer maFunPtr;
+ Argument maArg;
+ };
+
+ /** Generic algorithm on given paragraphs
+
+ Convenience method, that already adapts the given functor with WeakChildAdapter
+ */
template < typename Functor > void ForEach( Functor& rFunctor )
{
::std::for_each( begin(), end(), WeakChildAdapter< Functor >(rFunctor) );
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index c8169cda99..f2972c3cab 100755
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AccessibleShape.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: thb $ $Date: 2002-05-17 19:10:58 $
+ * last change: $Author: thb $ $Date: 2002-05-23 12:44:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -196,7 +196,6 @@ void AccessibleShape::Init (void)
// Beware! Here we leave the paths of the UNO API and descend into the
// depths of the core. Necessary for makeing the edit engine
// accessible.
-#if 0
SdrView* pView = maShapeTreeInfo.GetSdrView ();
const Window* pWindow = maShapeTreeInfo.GetWindow ();
if (pView != NULL && pWindow != NULL)
@@ -207,7 +206,6 @@ void AccessibleShape::Init (void)
this,
::std::auto_ptr<SvxEditSource>(pEditSource));
}
-#endif
}
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index f1c042eb4c..a3b2c32c3e 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AccessibleTextHelper.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: thb $ $Date: 2002-05-21 14:58:45 $
+ * last change: $Author: thb $ $Date: 2002-05-23 12:44:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -206,11 +206,17 @@ namespace accessibility
void SetOffset( const Point& );
const Point& GetOffset() const { return maOffset; } // Strictly correct only with locked solar mutex!
+ void SetChildrenOffset( sal_Int32 nOffset );
+ sal_Int32 GetChildrenOffset() const { return mnStartIndex; }
+
sal_Bool IsSelected() const;
// do NOT hold object mutex when calling this! Danger of deadlock
void FireEvent( const sal_Int16 nEventId, const uno::Any& rNewValue = uno::Any(), const uno::Any& rOldValue = uno::Any() ) const;
+ void SetFocus( sal_Bool bHaveFocus ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool HaveFocus() throw (::com::sun::star::uno::RuntimeException);
+
#ifdef DBG_UTIL
void CheckInvariants() const;
#endif
@@ -227,6 +233,9 @@ namespace accessibility
// shutdown usage of current edit source on myself and the children.
void ShutdownEditSource() throw (uno::RuntimeException);
+ void SetChildrenState( const sal_Int16 nStateId );
+ void UnSetChildrenState( const sal_Int16 nStateId );
+
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
// lock solar mutex before
@@ -264,12 +273,18 @@ namespace accessibility
sal_Int32 mnFirstVisibleChild;
sal_Int32 mnLastVisibleChild;
+ // offset to add to all our children
+ sal_Int32 mnStartIndex;
+
// the object handling our children (guarded by solar mutex)
accessibility::AccessibleParaManager maParaManager;
- // spin lock to prevent notify in notify
+ // spin lock to prevent notify in notify (guarded by solar mutex)
sal_Bool mbInNotify;
+ // whether we have the focus set (guarded by solar mutex)
+ sal_Bool mbHaveFocus;
+
// must be before maStateListeners, has to live longer
mutable ::osl::Mutex maMutex;
@@ -290,7 +305,9 @@ namespace accessibility
maLastSelection( 0,0,0,0 ),
mnFirstVisibleChild( -1 ),
mnLastVisibleChild( -2 ),
+ mnStartIndex( 0 ),
mbInNotify( sal_False ),
+ mbHaveFocus( sal_False ),
maStateListeners( maMutex )
{
}
@@ -304,7 +321,7 @@ namespace accessibility
// shutdown and release edit source
SetEditSource( ::std::auto_ptr< SvxEditSource >() );
}
- catch( const uno::RuntimeException& ) {}
+ catch( const uno::Exception& ) {}
// owner is responsible for dispose and clear on listeners
}
@@ -384,11 +401,86 @@ namespace accessibility
ESelection aSelection;
bRet = GetEditViewForwarder().GetSelection( aSelection );
}
- catch( const uno::RuntimeException& ) {}
+ catch( const uno::Exception& ) {}
return bRet;
}
+ // functor for sending child events (no stand-alone function, they are maybe not inlined)
+ class AccessibleTextHelper_OffsetChildIndex : public ::std::unary_function< accessibility::AccessibleEditableTextPara&, void >
+ {
+ public:
+ AccessibleTextHelper_OffsetChildIndex( sal_Int32 nDifference ) : mnDifference(nDifference) {}
+ void operator()( accessibility::AccessibleEditableTextPara& rPara )
+ {
+ rPara.SetIndexInParent( rPara.GetIndexInParent() + mnDifference );
+ }
+
+ private:
+ const sal_Int32 mnDifference;
+ };
+
+ void AccessibleTextHelper_Impl::SetChildrenOffset( sal_Int32 nOffset )
+ {
+ sal_Int32 nOldOffset( mnStartIndex );
+
+ mnStartIndex = nOffset;
+
+ if( nOldOffset != nOffset )
+ {
+ // update children
+ AccessibleTextHelper_OffsetChildIndex aFunctor( nOffset - nOldOffset );
+
+ ::std::for_each( maParaManager.begin(), maParaManager.end(),
+ AccessibleParaManager::WeakChildAdapter< AccessibleTextHelper_OffsetChildIndex > (aFunctor) );
+ }
+ }
+
+ void AccessibleTextHelper_Impl::SetFocus( sal_Bool bHaveFocus ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ sal_Bool bOldFocus( mbHaveFocus );
+
+ mbHaveFocus = bHaveFocus;
+
+ if( IsActive() )
+ {
+ try
+ {
+ // find the one with the cursor and get/set focus accordingly
+ ESelection aSelection;
+ if( GetEditViewForwarder().GetSelection( aSelection ) )
+ {
+ AccessibleParaManager::WeakPara::HardRefType aChild( maParaManager.GetChild(aSelection.nEndPara).first.get() );
+ if( maParaManager.IsReferencable(aSelection.nEndPara) )
+ {
+ if( mbHaveFocus )
+ aChild->SetState( AccessibleStateType::FOCUSED );
+ else
+ aChild->UnSetState( AccessibleStateType::FOCUSED );
+ }
+ }
+ }
+ catch( const uno::Exception& ) {}
+ }
+ else if( bOldFocus != bHaveFocus )
+ {
+ if( mbHaveFocus )
+ GotPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::ACCESSIBLE_STATE_EVENT );
+ else
+ LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::ACCESSIBLE_STATE_EVENT );
+ }
+ }
+
+ sal_Bool AccessibleTextHelper_Impl::HaveFocus() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mbHaveFocus && !IsActive() )
+ return sal_True;
+ else
+ return sal_False;
+ }
+
sal_Bool AccessibleTextHelper_Impl::IsActive() const throw (uno::RuntimeException)
{
SvxEditSource& rEditSource = GetEditSource();
@@ -430,15 +522,18 @@ namespace accessibility
}
}
- // functor for sending child events
- class AccessibleTextHelper_SendAccessibleChildEvent : public ::std::unary_function< accessibility::AccessibleEditableTextPara&, void >
+ // functor for sending child events (no stand-alone function, they are maybe not inlined)
+ class AccessibleTextHelper_LostChildEvent : public ::std::unary_function< const accessibility::AccessibleParaManager::WeakChild&, void >
{
public:
- AccessibleTextHelper_SendAccessibleChildEvent( AccessibleTextHelper_Impl& rImpl ) : mrImpl(rImpl) {}
- void operator()( accessibility::AccessibleEditableTextPara& rPara )
+ AccessibleTextHelper_LostChildEvent( AccessibleTextHelper_Impl& rImpl ) : mrImpl(rImpl) {}
+ void operator()( const accessibility::AccessibleParaManager::WeakChild& rPara )
{
- uno::Reference< XAccessible > xChild( static_cast< ::cppu::OWeakObject* > ( &rPara ), uno::UNO_QUERY );
- mrImpl.FireEvent(AccessibleEventId::ACCESSIBLE_CHILD_EVENT, uno::Any(), uno::makeAny( xChild ) );
+ // retrieve hard reference from weak one
+ accessibility::AccessibleParaManager::WeakPara::HardRefType aHardRef( rPara.first.get() );
+
+ if( aHardRef.is() )
+ mrImpl.FireEvent(AccessibleEventId::ACCESSIBLE_CHILD_EVENT, uno::Any(), uno::makeAny( aHardRef.getRef() ) );
}
private:
@@ -453,8 +548,8 @@ namespace accessibility
maParaManager.SetEditSource( NULL );
// loosing all children
- AccessibleTextHelper_SendAccessibleChildEvent aFunctor( *this );
- maParaManager.ForEach( aFunctor );
+ AccessibleTextHelper_LostChildEvent aFunctor( *this );
+ ::std::for_each( maParaManager.begin(), maParaManager.end(), aFunctor );
maParaManager.SetNum(0);
// quit listen on stale edit source
@@ -558,7 +653,7 @@ namespace accessibility
}
}
}
- catch( const uno::RuntimeException& )
+ catch( const uno::Exception& )
{
DBG_ERROR("AccessibleTextHelper_Impl::UpdateVisibleChildren error while determining visible children");
@@ -566,13 +661,13 @@ namespace accessibility
mnFirstVisibleChild = -1;
mnLastVisibleChild = -2;
- AccessibleTextHelper_SendAccessibleChildEvent aFunctor( *this );
- maParaManager.ForEach( aFunctor );
+ AccessibleTextHelper_LostChildEvent aFunctor( *this );
+ ::std::for_each( maParaManager.begin(), maParaManager.end(), aFunctor );
maParaManager.SetNum(0);
}
}
- // functor for checking changes in paragraph bounding boxes
+ // functor for checking changes in paragraph bounding boxes (no stand-alone function, maybe not inlined)
class AccessibleTextHelper_UpdateChildBounds : public ::std::unary_function< const accessibility::AccessibleParaManager::WeakChild&,
accessibility::AccessibleParaManager::WeakChild >
{
@@ -638,6 +733,20 @@ namespace accessibility
}
#endif
+ void AccessibleTextHelper_Impl::SetChildrenState( const sal_Int16 nStateId )
+ {
+ ::std::for_each( maParaManager.begin(), maParaManager.end(),
+ AccessibleParaManager::MemFunAdapter< const sal_Int16 >( &AccessibleEditableTextPara::SetState,
+ nStateId ) );
+ }
+
+ void AccessibleTextHelper_Impl::UnSetChildrenState( const sal_Int16 nStateId )
+ {
+ ::std::for_each( maParaManager.begin(), maParaManager.end(),
+ AccessibleParaManager::MemFunAdapter< const sal_Int16 >( &AccessibleEditableTextPara::UnSetState,
+ nStateId ) );
+ }
+
void AccessibleTextHelper_Impl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
// do not recurse
@@ -646,6 +755,7 @@ namespace accessibility
mbInNotify = sal_True;
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
const SfxSimpleHint* pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint );
const TextHint* pTextHint = PTR_CAST( TextHint, &rHint );
const SvxViewHint* pViewHint = PTR_CAST( SvxViewHint, &rHint );
@@ -737,11 +847,9 @@ namespace accessibility
::std::advance( begin, nFirst );
::std::advance( end, nLast );
- AccessibleTextHelper_SendAccessibleChildEvent aFunctor( *this );
+ AccessibleTextHelper_LostChildEvent aFunctor( *this );
- ::std::for_each( begin, end,
- ::accessibility::AccessibleParaManager::WeakChildAdapter< AccessibleTextHelper_SendAccessibleChildEvent >
- ( aFunctor ) );
+ ::std::for_each( begin, end, aFunctor );
}
#ifdef DBG_UTIL
else
@@ -763,7 +871,7 @@ namespace accessibility
UpdateSelection( ESelection() );
}
// maybe we're not in edit mode (this is not an error)
- catch( const uno::RuntimeException& ) {}
+ catch( const uno::Exception& ) {}
break;
}
@@ -815,10 +923,8 @@ namespace accessibility
::std::advance( begin, pTextHint->GetValue() );
::std::advance( end, nParas );
- AccessibleTextHelper_SendAccessibleChildEvent aFunctor( *this );
- ::std::for_each( begin, end,
- ::accessibility::AccessibleParaManager::WeakChildAdapter< AccessibleTextHelper_SendAccessibleChildEvent >
- ( aFunctor ) );
+ AccessibleTextHelper_LostChildEvent aFunctor( *this );
+ ::std::for_each( begin, end, aFunctor );
break;
}
@@ -844,10 +950,8 @@ namespace accessibility
::std::advance( begin, pTextHint->GetValue() );
::std::advance( end, nParas );
- AccessibleTextHelper_SendAccessibleChildEvent aFunctor( *this );
- ::std::for_each( begin, end,
- ::accessibility::AccessibleParaManager::WeakChildAdapter< AccessibleTextHelper_SendAccessibleChildEvent >
- ( aFunctor ) );
+ AccessibleTextHelper_LostChildEvent aFunctor( *this );
+ ::std::for_each( begin, end, aFunctor );
// resize child vector to the current child count
maParaManager.SetNum( nParas );
@@ -888,6 +992,37 @@ namespace accessibility
break;
}
}
+ else if( pSdrHint )
+ {
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_BEGEDIT:
+ {
+ // change children state
+ SetChildrenState( AccessibleStateType::ACTIVE );
+ SetChildrenState( AccessibleStateType::EDITABLE );
+
+ // find the one selected
+ ESelection aSelection;
+ if( GetEditViewForwarder().GetSelection( aSelection ) )
+ {
+ AccessibleParaManager::WeakPara::HardRefType aChild( maParaManager.GetChild(aSelection.nEndPara).first.get() );
+ if( maParaManager.IsReferencable(aSelection.nEndPara) )
+ {
+ aChild->SetState( AccessibleStateType::SELECTED );
+ }
+ }
+ break;
+ }
+
+ case HINT_ENDEDIT:
+ // change children state
+ UnSetChildrenState( AccessibleStateType::EDITABLE );
+ UnSetChildrenState( AccessibleStateType::ACTIVE );
+ UnSetChildrenState( AccessibleStateType::SELECTED );
+ break;
+ }
+ }
// it's VITAL to keep the SfxSimpleHint last! It's the base of some classes above!
else if( pSimpleHint )
{
@@ -901,13 +1036,13 @@ namespace accessibility
// Note: cannot destroy it here, since we're called from there!
ShutdownEditSource();
}
- catch( const uno::RuntimeException& ) {}
+ catch( const uno::Exception& ) {}
break;
}
}
}
- catch( const uno::RuntimeException& )
+ catch( const uno::Exception& )
{
#ifdef DBG_UTIL
DBG_ERROR("AccessibleTextHelper_Impl::Notify: Unhandled exception.");
@@ -941,7 +1076,7 @@ namespace accessibility
{
xListener->notifyEvent( aEvent );
}
- catch( const uno::RuntimeException& )
+ catch( const uno::Exception& )
{
#ifdef DBG_UTIL
DBG_ERROR("AccessibleTextHelper_Impl::StateChangeEvent: Caught runtime exception from listener (bridge/listener dead?).");
@@ -963,13 +1098,15 @@ namespace accessibility
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
+ i -= GetChildrenOffset();
+
if( 0 > i || i > getAccessibleChildCount() ||
GetTextForwarder().GetParagraphCount() <= i )
{
throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid child index")), mxFrontEnd);
}
- return maParaManager.GetChild( i, mxFrontEnd, GetEditSource(), mnFirstVisibleChild + i ).first;
+ return maParaManager.CreateChild( i, mxFrontEnd, GetEditSource(), mnFirstVisibleChild + i ).first;
}
void SAL_CALL AccessibleTextHelper_Impl::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
@@ -1081,13 +1218,30 @@ namespace accessibility
void AccessibleTextHelper::SetFocus( sal_Bool bHaveFocus ) throw (::com::sun::star::uno::RuntimeException)
{
- // TODO
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ mpImpl->SetFocus( bHaveFocus );
+
+ mpImpl->CheckInvariants();
+#else
+ mpImpl->SetFocus( bHaveFocus );
+#endif
}
sal_Bool AccessibleTextHelper::HaveFocus() throw (::com::sun::star::uno::RuntimeException)
{
- // TODO
- return sal_False;
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ sal_Bool bRet( mpImpl->HaveFocus() );
+
+ mpImpl->CheckInvariants();
+
+ return bRet;
+#else
+ return mpImpl->HaveFocus();
+#endif
}
void AccessibleTextHelper::FireEvent( const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue ) const
@@ -1133,13 +1287,30 @@ namespace accessibility
void AccessibleTextHelper::SetChildrenOffset( sal_Int32 nOffset )
{
- // TODO
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ mpImpl->SetChildrenOffset( nOffset );
+
+ mpImpl->CheckInvariants();
+#else
+ mpImpl->SetChildrenOffset( nOffset );
+#endif
}
sal_Int32 AccessibleTextHelper::GetChildrenOffset() const
{
- // TODO
- return 0;
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ sal_Int32 nOffset = mpImpl->GetChildrenOffset();
+
+ mpImpl->CheckInvariants();
+
+ return nOffset;
+#else
+ return mpImpl->GetChildrenOffset();
+#endif
}
void AccessibleTextHelper::UpdateChildren() throw (::com::sun::star::uno::RuntimeException)
diff --git a/svx/source/unoedit/unoedprx.cxx b/svx/source/unoedit/unoedprx.cxx
index d23173a685..4b929ca45d 100644
--- a/svx/source/unoedit/unoedprx.cxx
+++ b/svx/source/unoedit/unoedprx.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unoedprx.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: thb $ $Date: 2002-05-17 17:35:51 $
+ * last change: $Author: thb $ $Date: 2002-05-23 12:46:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -123,11 +123,11 @@ public:
mnIndex(0),
mnEEIndex(0),
mnFieldOffset(0),
- mbInField(sal_False),
mnFieldLen(0),
+ mbInField(sal_False),
mnBulletOffset(0),
- mbInBullet(sal_False),
- mnBulletLen(0) {};
+ mnBulletLen(0),
+ mbInBullet(sal_False) {};
~SvxAccessibleTextIndex() {};
// Get/Set current paragraph
@@ -196,13 +196,6 @@ private:
ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAccessibleTextIndex& rEnd )
{
- // check overflow
- DBG_ASSERT(rStart.GetParagraph() >= 0 && rStart.GetParagraph() <= USHRT_MAX &&
- rStart.GetEEIndex() >= 0 && rStart.GetEEIndex() <= USHRT_MAX &&
- rEnd.GetParagraph() >= 0 && rEnd.GetParagraph() <= USHRT_MAX &&
- rEnd.GetEEIndex() >= 0 && rEnd.GetEEIndex() <= USHRT_MAX,
- "MakeEESelection: index value overflow");
-
// deal with field special case: to really get a field contained
// within a selection, the start index must be before or on the
// field, the end index after it.
@@ -236,11 +229,6 @@ ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAcces
ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex )
{
- // check overflow
- DBG_ASSERT(rIndex.GetParagraph() >= 0 && rIndex.GetParagraph() <= USHRT_MAX &&
- rIndex.GetEEIndex() >= 0 && rIndex.GetEEIndex() <= USHRT_MAX,
- "MakeEESelection: index value overflow");
-
return ESelection( rIndex.GetParagraph(), rIndex.GetEEIndex(),
rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 );
}
@@ -1246,7 +1234,12 @@ sal_Bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) cons
aStartIndex.SetEEIndex( aSelection.nStartPara, aSelection.nStartPos, *mrTextForwarder );
aEndIndex.SetEEIndex( aSelection.nEndPara, aSelection.nEndPos, *mrTextForwarder );
- rSel = MakeEESelection( aStartIndex, aEndIndex );
+ DBG_ASSERT(aStartIndex.GetIndex() >= 0 && aStartIndex.GetIndex() <= USHRT_MAX &&
+ aEndIndex.GetIndex() >= 0 && aEndIndex.GetIndex() <= USHRT_MAX,
+ "SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow");
+
+ rSel = ESelection( aStartIndex.GetParagraph(), static_cast< USHORT > (aStartIndex.GetIndex()),
+ aEndIndex.GetParagraph(), static_cast< USHORT > (aEndIndex.GetIndex()) );
return sal_True;
}