1. mst
  2. ooo340

Commits

Frank Schoenheit [fs]  committed 82921df

accfixes3: fixed accessible descriptions for table cells

  • Participants
  • Parent commits 1cd1be6
  • Branches default

Comments (0)

Files changed (1)

File svtools/source/brwbox/brwbox3.cxx

View file
  • Ignore whitespace
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <toolkit/helper/vclunohelper.hxx>
+#include <rtl/ustrbuf.hxx>
 
 // Accessibility ==============================================================
 
 
 // Object data and state ------------------------------------------------------
 
-//IAccessibility2 Implementation 2009-----
 OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const
-//-----IAccessibility2 Implementation 2009
 {
-    OUString aRetText;
+    ::rtl::OUStringBuffer aNameBuffer;
     switch( eObjType )
     {
         case ::svt::BBTYPE_BROWSEBOX:
-            aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "BrowseBox" ) );
+            aNameBuffer.appendAscii( "BrowseBox" );
 			break;
         case ::svt::BBTYPE_TABLE:
-			aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) );
+            aNameBuffer.appendAscii( "Table" );
 			break;
         case ::svt::BBTYPE_ROWHEADERBAR:
-			aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) );
+            aNameBuffer.appendAscii( "RowHeaderBar" );
 			break;
         case ::svt::BBTYPE_COLUMNHEADERBAR:
-			aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
+            aNameBuffer.appendAscii( "ColumnHeaderBar" );
 			break;
         case ::svt::BBTYPE_TABLECELL:
-//IAccessibility2 Implementation 2009-----
-			if( ColCount() !=0 && GetRowCount()!=0)
-			{
-           
-				sal_Int32 columnId = _nPosition % ColCount() +1;
-				aRetText = OUString( GetColumnDescription( sal_Int16( columnId ) ) );
-				sal_Int32 rowId = _nPosition / GetRowCount() + 1;
-				aRetText += OUString::valueOf(rowId); 
-			}
-			else
-//-----IAccessibility2 Implementation 2009
-				aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "TableCell" ) );
-#if OSL_DEBUG_LEVEL > 1
-            aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
-			aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
-			aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) );
-			aRetText += OUString::valueOf(sal_Int32(GetCurColumnId()));
-			aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ) );
-#endif			
+            if ( ColCount() > 0 )
+            {
+			    sal_Int32 const columnPos = _nPosition % ColCount() +1;
+				sal_Int32 const rowPos = _nPosition / ColCount() + 1;
+
+                aNameBuffer.append( GetColumnDescription( sal_Int16( columnPos ) ) );
+                aNameBuffer.append( sal_Unicode( ' ' ) );
+                aNameBuffer.append( rowPos );
+            #if OSL_DEBUG_LEVEL > 1
+                aNameBuffer.appendAscii( " [" );
+                aNameBuffer.append( columnPos );
+                aNameBuffer.appendAscii( ", " );
+                aNameBuffer.append( rowPos );
+                aNameBuffer.appendAscii( "]" );
+            #endif
+            }
+		    else
+                aNameBuffer.appendAscii( "TableCell" );
 			break;
         case ::svt::BBTYPE_ROWHEADERCELL:
 			{
-			sal_Int32 rowId = _nPosition + 1;
-			aRetText = OUString::valueOf( rowId );
+			    sal_Int32 rowPos = _nPosition + 1;
+                aNameBuffer.append( rowPos );
 			}
-			//aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderCell" ) );
-#if OSL_DEBUG_LEVEL > 1
-            aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
-			aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
-			aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) );
-			aRetText += OUString::valueOf(sal_Int32(GetCurColumnId()));
-			aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ) );
-#endif
 			break;
         case ::svt::BBTYPE_COLUMNHEADERCELL:
-			//aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderCell" ) );
-			aRetText = OUString( GetColumnDescription( sal_Int16( _nPosition ) ) );
-#if OSL_DEBUG_LEVEL > 1
-            aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
-			aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
-			aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) );
-			aRetText += OUString::valueOf(sal_Int32(GetCurColumnId()));
-			aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ) );
-#endif
+            aNameBuffer.append( GetColumnDescription( sal_Int16( _nPosition ) ) );
 			break;
 		default:
 			OSL_ENSURE(0,"BrowseBox::GetAccessibleName: invalid enum!");
     }
-    return aRetText;
+    return aNameBuffer.makeStringAndClear();
 }
 // -----------------------------------------------------------------------------