summaryrefslogtreecommitdiff
path: root/sw/source/core/access
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
commit04cbeac1177f9d1a893f56430e1e46e8c650c120 (patch)
tree1dfdf1e44ba056403edb32766ffcc9f63dbf302a /sw/source/core/access
parent05a1db9d3e14f223a2160902ce3f076bed2f7ce2 (diff)
parent91022595b4982107069d099ba61a19430023e184 (diff)
merge commit to DEV300_m57
Diffstat (limited to 'sw/source/core/access')
-rw-r--r--sw/source/core/access/acchyperlink.cxx4
-rw-r--r--sw/source/core/access/accnotextframe.cxx118
-rw-r--r--sw/source/core/access/accnotextframe.hxx12
-rw-r--r--sw/source/core/access/acctextframe.cxx112
-rw-r--r--sw/source/core/access/acctextframe.hxx11
5 files changed, 211 insertions, 46 deletions
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx
index 6a9ff9738165..ece5bbb614c5 100644
--- a/sw/source/core/access/acchyperlink.cxx
+++ b/sw/source/core/access/acchyperlink.cxx
@@ -101,8 +101,8 @@ sal_Bool SAL_CALL SwAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex )
const SwTxtINetFmt* pTxtAttr2 = rINetFmt.GetTxtINetFmt();
if( pTxtAttr2 )
{
- const_cast< SwTxtINetFmt* >( pTxtAttr2 )->SetVisited( sal_True );
- const_cast< SwTxtINetFmt* >( pTxtAttr2 )->SetValidVis( sal_True );
+ const_cast<SwTxtINetFmt*>(pTxtAttr2)->SetVisited(true);
+ const_cast<SwTxtINetFmt*>(pTxtAttr2)->SetVisitedValid(true);
}
bRet = sal_True;
}
diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx
index e89e74c9dbcf..4bb7c73362aa 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -42,6 +42,9 @@
#include <ndnotxt.hxx>
#include <flyfrm.hxx>
#include <cntfrm.hxx>
+// --> OD 2009-07-14 #i73249#
+#include <hints.hxx>
+// <--
#include "accnotextframe.hxx"
using namespace ::com::sun::star;
@@ -67,13 +70,25 @@ SwAccessibleNoTextFrame::SwAccessibleNoTextFrame(
sal_Int16 nInitRole,
const SwFlyFrm* pFlyFrm ) :
SwAccessibleFrameBase( pInitMap, nInitRole, pFlyFrm ),
- aDepend( this, const_cast < SwNoTxtNode * >( GetNoTxtNode() ) )
+ aDepend( this, const_cast < SwNoTxtNode * >( GetNoTxtNode() ) ),
+ msTitle(),
+ msDesc()
{
- const SwNoTxtNode *pNd = GetNoTxtNode();
+ const SwNoTxtNode* pNd = GetNoTxtNode();
+ // --> OD 2009-07-14 #i73249#
+ // consider new attributes Title and Description
if( pNd )
- sDesc = OUString( pNd->GetAlternateText() );
- if( !sDesc.getLength() )
- sDesc = GetName();
+ {
+ msTitle = pNd->GetTitle();
+
+ msDesc = pNd->GetDescription();
+ if ( msDesc.getLength() == 0 &&
+ msTitle != GetName() )
+ {
+ msDesc = msTitle;
+ }
+ }
+ // <--
}
SwAccessibleNoTextFrame::~SwAccessibleNoTextFrame()
@@ -82,36 +97,70 @@ SwAccessibleNoTextFrame::~SwAccessibleNoTextFrame()
void SwAccessibleNoTextFrame::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
{
- SwAccessibleFrameBase::Modify( pOld, pNew );
+ const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+ // --> OD 2009-07-14 #i73249#
+ // suppress handling of RES_NAME_CHANGED in case that attribute Title is
+ // used as the accessible name.
+ if ( nWhich != RES_NAME_CHANGED ||
+ msTitle.getLength() == 0 )
+ {
+ SwAccessibleFrameBase::Modify( pOld, pNew );
+ }
- sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
const SwNoTxtNode *pNd = GetNoTxtNode();
ASSERT( pNd == aDepend.GetRegisteredIn(), "invalid frame" );
switch( nWhich )
{
- case RES_NAME_CHANGED:
- if( pNd->GetAlternateText().Len() )
- break;
- case RES_ALT_TEXT_CHANGED:
- if( pNd && GetFrm() )
+ // --> OD 2009-07-14 #i73249#
+ case RES_TITLE_CHANGED:
{
- OUString sOldDesc( sDesc );
-
- const String& rDesc = pNd->GetAlternateText();
- sDesc = rDesc;
- if( !sDesc.getLength() )
- sDesc = GetName();
-
- if( sDesc != sOldDesc )
+ const String& sOldTitle(
+ dynamic_cast<SwStringMsgPoolItem*>(pOld)->GetString() );
+ const String& sNewTitle(
+ dynamic_cast<SwStringMsgPoolItem*>(pNew)->GetString() );
+ if ( sOldTitle == sNewTitle )
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
- aEvent.OldValue <<= sOldDesc;
- aEvent.NewValue <<= sDesc;
- FireAccessibleEvent( aEvent );
+ break;
+ }
+ msTitle = sNewTitle;
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+ aEvent.OldValue <<= OUString( sOldTitle );
+ aEvent.NewValue <<= msTitle;
+ FireAccessibleEvent( aEvent );
+
+ if ( pNd->GetDescription().Len() != 0 )
+ {
+ break;
+ }
+ }
+ // intentional no break here
+ case RES_DESCRIPTION_CHANGED:
+ {
+ if ( pNd && GetFrm() )
+ {
+ const OUString sOldDesc( msDesc );
+
+ const String& rDesc = pNd->GetDescription();
+ msDesc = rDesc;
+ if ( msDesc.getLength() == 0 &&
+ msTitle != GetName() )
+ {
+ msDesc = msTitle;
+ }
+
+ if ( msDesc != sOldDesc )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
+ aEvent.OldValue <<= sOldDesc;
+ aEvent.NewValue <<= msDesc;
+ FireAccessibleEvent( aEvent );
+ }
}
}
break;
+ // <--
/*
case RES_OBJECTDYING:
if( aDepend.GetRegisteredIn() ==
@@ -138,6 +187,23 @@ void SwAccessibleNoTextFrame::Dispose( sal_Bool bRecursive )
SwAccessibleFrameBase::Dispose( bRecursive );
}
+// --> OD 2009-07-14 #i73249#
+OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleName (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ if ( msTitle.getLength() != 0 )
+ {
+ return msTitle;
+ }
+
+ return SwAccessibleFrameBase::getAccessibleName();
+}
+// <--
+
OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleDescription (void)
throw (uno::RuntimeException)
{
@@ -145,7 +211,7 @@ OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleDescription (void)
CHECK_FOR_DEFUNC( XAccessibleContext )
- return sDesc;
+ return msDesc;
}
diff --git a/sw/source/core/access/accnotextframe.hxx b/sw/source/core/access/accnotextframe.hxx
index 25e4b402c4b2..d96c510266ae 100644
--- a/sw/source/core/access/accnotextframe.hxx
+++ b/sw/source/core/access/accnotextframe.hxx
@@ -39,7 +39,10 @@ class SwAccessibleNoTextFrame : public SwAccessibleFrameBase,
public ::com::sun::star::accessibility::XAccessibleImage
{
SwDepend aDepend;
- ::rtl::OUString sDesc;
+ // --> OD 2009-07-14 #i73249#
+ ::rtl::OUString msTitle;
+ // <--
+ ::rtl::OUString msDesc;
protected:
@@ -57,6 +60,13 @@ public:
//===== XAccessibleContext ==============================================
+ // --> OD 2009-07-14 #i73249#
+ /// Return the object's current name.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // <--
+
/// Return this object's description.
virtual ::rtl::OUString SAL_CALL
getAccessibleDescription (void)
diff --git a/sw/source/core/access/acctextframe.cxx b/sw/source/core/access/acctextframe.cxx
index 2ac42327a73e..d91a9ef514f1 100644
--- a/sw/source/core/access/acctextframe.cxx
+++ b/sw/source/core/access/acctextframe.cxx
@@ -46,6 +46,9 @@
#include <flyfrm.hxx>
#include <accmap.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
+// --> OD 2009-07-14 #i73249#
+#include <hints.hxx>
+// <--
#include "acctextframe.hxx"
using namespace ::com::sun::star;
@@ -61,8 +64,23 @@ const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleTex
SwAccessibleTextFrame::SwAccessibleTextFrame(
SwAccessibleMap* pInitMap,
const SwFlyFrm* pFlyFrm ) :
- SwAccessibleFrameBase( pInitMap, AccessibleRole::TEXT_FRAME, pFlyFrm )
+ SwAccessibleFrameBase( pInitMap, AccessibleRole::TEXT_FRAME, pFlyFrm ),
+ msTitle(),
+ msDesc()
{
+ if ( pFlyFrm )
+ {
+ const SwFlyFrmFmt* pFlyFrmFmt =
+ dynamic_cast<const SwFlyFrmFmt*>( pFlyFrm->GetFmt() );
+ msTitle = pFlyFrmFmt->GetObjTitle();
+
+ msDesc = pFlyFrmFmt->GetObjDescription();
+ if ( msDesc.getLength() == 0 &&
+ msTitle != GetName() )
+ {
+ msDesc = msTitle;
+ }
+ }
}
SwAccessibleTextFrame::~SwAccessibleTextFrame()
@@ -71,32 +89,92 @@ SwAccessibleTextFrame::~SwAccessibleTextFrame()
void SwAccessibleTextFrame::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
{
- sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+ const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+ // --> OD 2009-07-14 #i73249#
+ // suppress handling of RES_NAME_CHANGED in case that attribute Title is
+ // used as the accessible name.
+ if ( nWhich != RES_NAME_CHANGED ||
+ msTitle.getLength() == 0 )
+ {
+ SwAccessibleFrameBase::Modify( pOld, pNew );
+ }
+
const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm * >( GetFrm() );
switch( nWhich )
{
- case RES_NAME_CHANGED:
- if( pFlyFrm )
+ // --> OD 2009-07-14 #i73249#
+ case RES_TITLE_CHANGED:
{
- OUString sOldDesc( GetName() );
- SwAccessibleFrameBase::Modify( pOld, pNew );
-
- if( sOldDesc != GetName() )
+ const String& sOldTitle(
+ dynamic_cast<SwStringMsgPoolItem*>(pOld)->GetString() );
+ const String& sNewTitle(
+ dynamic_cast<SwStringMsgPoolItem*>(pNew)->GetString() );
+ if ( sOldTitle == sNewTitle )
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
- aEvent.OldValue <<= sOldDesc;
- aEvent.NewValue <<= GetName();
- FireAccessibleEvent( aEvent );
+ break;
+ }
+ msTitle = sNewTitle;
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+ aEvent.OldValue <<= OUString( sOldTitle );
+ aEvent.NewValue <<= msTitle;
+ FireAccessibleEvent( aEvent );
+
+ const SwFlyFrmFmt* pFlyFrmFmt =
+ dynamic_cast<const SwFlyFrmFmt*>( pFlyFrm->GetFmt() );
+ if ( pFlyFrmFmt->GetObjDescription().Len() != 0 )
+ {
+ break;
+ }
+ }
+ // intentional no break here
+ case RES_DESCRIPTION_CHANGED:
+ {
+ if ( pFlyFrm )
+ {
+ const OUString sOldDesc( msDesc );
+
+ const SwFlyFrmFmt* pFlyFrmFmt =
+ dynamic_cast<const SwFlyFrmFmt*>( pFlyFrm->GetFmt() );
+ const String& rDesc = pFlyFrmFmt->GetObjDescription();
+ msDesc = rDesc;
+ if ( msDesc.getLength() == 0 &&
+ msTitle != GetName() )
+ {
+ msDesc = msTitle;
+ }
+
+ if ( msDesc != sOldDesc )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
+ aEvent.OldValue <<= sOldDesc;
+ aEvent.NewValue <<= msDesc;
+ FireAccessibleEvent( aEvent );
+ }
}
}
break;
- default:
- SwAccessibleFrameBase::Modify( pOld, pNew );
- break;
+ // <--
}
}
+// --> OD 2009-07-14 #i73249#
+OUString SAL_CALL SwAccessibleTextFrame::getAccessibleName (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ if ( msTitle.getLength() != 0 )
+ {
+ return msTitle;
+ }
+
+ return SwAccessibleFrameBase::getAccessibleName();
+}
+// <--
OUString SAL_CALL SwAccessibleTextFrame::getAccessibleDescription (void)
throw (uno::RuntimeException)
{
@@ -104,7 +182,7 @@ OUString SAL_CALL SwAccessibleTextFrame::getAccessibleDescription (void)
CHECK_FOR_DEFUNC( XAccessibleContext )
- return GetName();
+ return msDesc;
}
diff --git a/sw/source/core/access/acctextframe.hxx b/sw/source/core/access/acctextframe.hxx
index 8fed22488b9b..f306b25f2478 100644
--- a/sw/source/core/access/acctextframe.hxx
+++ b/sw/source/core/access/acctextframe.hxx
@@ -39,6 +39,11 @@ namespace com { namespace star {
class SwAccessibleTextFrame : public SwAccessibleFrameBase
{
+private:
+ // --> OD 2009-07-14 #i73249#
+ ::rtl::OUString msTitle;
+ ::rtl::OUString msDesc;
+ // <--
protected:
@@ -53,6 +58,12 @@ public:
//===== XAccessibleContext ==============================================
+ // --> OD 2009-07-14 #i73249#
+ /// Return the object's current name.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // <--
/// Return this object's description.
virtual ::rtl::OUString SAL_CALL
getAccessibleDescription (void)