Commits

Anonymous committed 1cd1be6

accfixes3: AccessibleListBoxEntry::getAccessibleDescription: always call SvTreeListBox::GetEntryLongDescription, plus let
this method simply delegate to SearchEntryTextWithHeadTitle by default.
This way, all entries which previously did not have a description now display the item text (plus heading, if applicable),
for all others, nothing changes.

Comments (0)

Files changed (3)

accessibility/source/extended/accessiblelistboxentry.cxx

 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
 #include <vcl/svapp.hxx>
 #include <vcl/controllayout.hxx>
 #include <toolkit/awt/vclxwindow.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <accessibility/helper/accessiblestrings.hrc>
 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
 #define ACCESSIBLE_ACTION_COUNT	1
 
 namespace
 	::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription(  ) throw (RuntimeException)
 	{
 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
-		if( getAccessibleRole() == AccessibleRole::TREE_ITEM )
-		{
-			return getListBox()->GetEntryLongDescription( pEntry );
-		}
-		// want to count the real column number in the list box.
-		sal_uInt16 nTextItemCount = 0;
-		sal_uInt16 nCount = 0;
-		sal_uInt16 const nTotalItemCount = pEntry->ItemCount();
-		SvLBoxItem* pItem;
-		while( nCount < nTotalItemCount )
-		{
-			pItem = pEntry->GetItem( nCount );
-			if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING &&
-				 static_cast<SvLBoxString*>( pItem )->GetText().Len() > 0 )
-			{
-				++nTextItemCount;
-			}
-			++nCount;
-		}
-        ::rtl::OUString sDescription;
-		if ( nTextItemCount > 1 )
-			sDescription = getListBox()->SearchEntryTextWithHeadTitle( pEntry );
-        return sDescription;
+        ENSURE_OR_RETURN( pEntry != NULL, "AccessibleListBoxEntry::getAccessibleDescription: can't obtain an entry for the given path!", ::rtl::OUString() );
+		return getListBox()->GetEntryLongDescription( pEntry );
 	}
 
 	// -----------------------------------------------------------------------------

svtools/inc/svtools/svtreebx.hxx

 	
 	sal_uInt16 			GetTreeFlags() const {return nTreeFlags;}
 	
-	String				SearchEntryTextWithHeadTitle( SvLBoxEntry* pEntry ) ;
+	String				SearchEntryTextWithHeadTitle( SvLBoxEntry* pEntry ) const;
 	virtual	String		GetEntryAltText( SvLBoxEntry* pEntry) const;
 	virtual	String		GetEntryLongDescription( SvLBoxEntry* pEntry ) const;	
     virtual String      GetAccessibleItemHeading( sal_uInt16 const i_itemPos ) const;

svtools/source/contnr/svtreebx.cxx

     // no implementation here, needs to be implemented in derived classes
     return String();
 }
-String SvTreeListBox::GetEntryLongDescription( SvLBoxEntry* ) const
+String SvTreeListBox::GetEntryLongDescription( SvLBoxEntry* i_entry ) const
 {
-    // no implementation here, needs to be implemented in derived classes
-    return String();
+    return SearchEntryTextWithHeadTitle( i_entry );
 }
 
 String SvTreeListBox::GetAccessibleItemHeading( sal_uInt16 const i_itemPos ) const
     return String();
 }
 
-String SvTreeListBox::SearchEntryTextWithHeadTitle( SvLBoxEntry* pEntry ) 
+String SvTreeListBox::SearchEntryTextWithHeadTitle( SvLBoxEntry* pEntry ) const
 {
 	DBG_CHKTHIS(SvTreeListBox,0);
 	DBG_ASSERT( pEntry, "SvTreeListBox::SearchEntryTextWithHeadTitle(): no entry" );