Commits

Anonymous committed 7dbcbad

accfixes3: tweaks after reviewing the IA2-related changes we just merged in

  • Participants
  • Parent commits 3e17b63

Comments (0)

Files changed (20)

accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx

 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
-/*
-#include <cppuhelper/compbase8.hxx>
-*/
-#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_
 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
-#endif
-#ifndef _CPPUHELPER_COMPBASE9_HXX_
 #include <cppuhelper/compbase9.hxx>
-#endif
 #include <comphelper/broadcasthelper.hxx>
 #include <comphelper/accessibletexthelper.hxx>
 #include <tools/gen.hxx>
 //........................................................................
 
 // class AccessibleListBoxEntry ------------------------------------------
-/*
-	typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible
-												, ::com::sun::star::accessibility::XAccessibleContext
-												, ::com::sun::star::accessibility::XAccessibleComponent
-												, ::com::sun::star::accessibility::XAccessibleEventBroadcaster
-												, ::com::sun::star::accessibility::XAccessibleAction
-												, ::com::sun::star::accessibility::XAccessibleSelection
-												, ::com::sun::star::accessibility::XAccessibleText
-										    	, ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE;
-*/
 	typedef ::cppu::WeakAggComponentImplHelper9< ::com::sun::star::accessibility::XAccessible
 												, ::com::sun::star::accessibility::XAccessibleContext
 												, ::com::sun::star::accessibility::XAccessibleComponent
 		sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
 		::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
 		void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+        // XAccessibleValue
 		virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue(  ) throw (::com::sun::star::uno::RuntimeException);
 		virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException);
 		virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue(  ) throw (::com::sun::star::uno::RuntimeException);
 		virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue(  ) throw (::com::sun::star::uno::RuntimeException);
+
     private:
         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > implGetParentAccessible( ) const;
 		SvLBoxEntry* GetRealChild(sal_Int32 nIndex);

accessibility/inc/accessibility/extended/textwindowaccessibility.hxx

 #include <svtools/texteng.hxx>
 #include <svtools/textview.hxx>
 #include <svtools/txtattr.hxx>
+#include <svtools/svtools.hrc>
+#include <svtools/svtdata.hxx>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/awt/FontWeight.hpp>
 #include <com/sun/star/lang/EventObject.hpp>
 #include <com/sun/star/uno/Reference.hxx>
 #include <comphelper/accessiblecontexthelper.hxx>
 #include <comphelper/accessibletexthelper.hxx>
 #include <rtl/ref.hxx>
+#include <vcl/svapp.hxx> 
+#include <unotools/accessiblerelationsethelper.hxx>
 
-// IAccessible2 implementation, 2009
-#ifndef _SVTOOLS_HRC 
-#include "svtools/svtools.hrc" 
-#endif
-#ifndef _SVTOOLS_SVTDATA_HXX 
-#include "svtools/svtdata.hxx" 
-#endif
-#ifndef _SV_SVAPP_HXX 
-#include <vcl/svapp.hxx> 
-#endif
-#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
-#include <unotools/accessiblerelationsethelper.hxx>
-#endif
-#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
-#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
-#endif
 #include <memory>
 #include <queue>
 #include <hash_map>

accessibility/inc/accessibility/helper/accessiblestrings.hrc

 #define RID_STR_ACC_ACTION_DECLINE			( RID_TK_ACC_START +    4 )
 #define RID_STR_ACC_ACTION_INCBLOCK			( RID_TK_ACC_START +    5 )
 #define RID_STR_ACC_ACTION_DECBLOCK			( RID_TK_ACC_START +    6 )
-#define RID_STR_ACC_NAME_PREVIEW            		( RID_TK_ACC_START +    7 )
 
-#define STR_SVT_ACC_ACTION_EXPAND			( RID_TK_ACC_START +    8 )
-#define STR_SVT_ACC_ACTION_COLLAPSE			( RID_TK_ACC_START +    9 )
-#define STR_SVT_ACC_LISTENTRY_SELCTED_STATE		( RID_TK_ACC_START +    10 )
+#define STR_SVT_ACC_ACTION_EXPAND               ( RID_TK_ACC_START +    7 )
+#define STR_SVT_ACC_ACTION_COLLAPSE             ( RID_TK_ACC_START +    8 )
+#define STR_SVT_ACC_LISTENTRY_SELCTED_STATE     ( RID_TK_ACC_START +    9 )
+#define RID_STR_ACC_ACTION_CHECK                ( RID_TK_ACC_START +    10 )
+#define RID_STR_ACC_ACTION_UNCHECK              ( RID_TK_ACC_START +    11 )
+#define RID_STR_ACC_SCROLLBAR_NAME_VERTICAL     ( RID_TK_ACC_START +    12 )
+#define RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL   ( RID_TK_ACC_START +    13 )
+#define RID_STR_ACC_PANEL_DESCRIPTION           ( RID_TK_ACC_START +    14 )
 
-#define	RID_STR_ACC_ACTION_CHECK			( RID_TK_ACC_START +    11 )
-#define	RID_STR_ACC_ACTION_UNCHECK			( RID_TK_ACC_START +    12 )
-#define RID_STR_ACC_ACTION_DOUBLE_CLICK			( RID_TK_ACC_START +    13 )
-#define RID_STR_ACC_SCROLLBAR_NAME_VERTICAL		( RID_TK_ACC_START +    14 )
-#define RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL		( RID_TK_ACC_START +    15 )
-#define RID_STR_ACC_PANEL_DESCRIPTION  			( RID_TK_ACC_START +    16 )
-
-#define RID_STR_ACC_NAME_BROWSEBUTTON			( RID_TK_ACC_START + 100 )
-#define RID_STR_ACC_DESC_PANELDECL_TABBAR   		( RID_TK_ACC_START + 101 )
+#define RID_STR_ACC_NAME_BROWSEBUTTON           ( RID_TK_ACC_START + 100 )
+#define RID_STR_ACC_DESC_PANELDECL_TABBAR       ( RID_TK_ACC_START + 101 )
 
 // -----------------------------------------------------------------------------
 

accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx

 #ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX
 #define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX
 
+#include <accessibility/standard/vclxaccessibleedit.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
 #include <map>
-#include <accessibility/standard/vclxaccessibleedit.hxx>
-#ifndef _COM_SUN_STAR_ACCESSIBILITY_STANDARD_ACCESSIBLEROLE_HPP_
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#endif
-#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
-#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_
-#include <com/sun/star/accessibility/XAccessibleValue.hpp>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE2_HXX
-#include <cppuhelper/implbase2.hxx>
-#endif
-
 
 typedef ::cppu::ImplHelper3<
     ::com::sun::star::accessibility::XAccessible,
 
 
 /** Base class for list- and combo boxes.  This class manages the box'
-    children.  The classed derived from this one have only to implement the
-    <member>IsValid</member> method and return the corrent implementation name.
+    children.  The classes derived from this one have only to implement the
+    <member>IsValid</member> method and return the correct implementation name.
 */
 class VCLXAccessibleBox
     : public VCLXAccessibleComponent,
 
     virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue(  ) 
         throw (::com::sun::star::uno::RuntimeException);
-	bool IsDropDownBox() {return m_bIsDropDownBox;};
-	BoxType GetBoxType() { return m_aBoxType;};
 protected:
     /** Specifies whether the box is a combo box or a list box.  List boxes
         have multi selection.

accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx

 */
 ::utl::AccessibleStateSetHelper* AccessibleBrowseBoxHeaderCell::implCreateStateSetHelper()
 {
+	BBSolarGuard aSolarGuard;
 	::osl::MutexGuard aGuard( getOslMutex() );
 	::utl::AccessibleStateSetHelper*
 		pStateSetHelper = new ::utl::AccessibleStateSetHelper;
 		if( implIsShowing() )
 			pStateSetHelper->AddState( AccessibleStateType::SHOWING );
 		mpBrowseBox->FillAccessibleStateSet( *pStateSetHelper, getType() ); //Added by yangzhh for SODC_2056
-		BBSolarGuard aSolarGuard;
 		pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
 		pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
 		pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );

accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx

 		::osl::MutexGuard aGuard( getOslMutex() );
 		ensureIsAlive();
 
-		//o is: return BBINDEX_FIRSTCONTROL + ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos();
 		return ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos();
 	}
 

accessibility/source/extended/accessibleeditbrowseboxcell.cxx

 		SolarMethodGuard aGuard( *this );
 
         // TODO: localize this!
-// IAccessible2 implementation, 2009
-        //String sName = mpBrowseBox->GetColumnDescription( getColumnPos( ) );
-		
-        //if ( 0 == sName.Len() )
-        //{
-        //    sName = String::CreateFromAscii( "Column " );
-			String  sName = String::CreateFromAscii( "Column " );
-            sName += String::CreateFromInt32( getColumnPos( ) - 1 );
-        //}
+		String  sName = String::CreateFromAscii( "Column " );
+        sName += String::CreateFromInt32( getColumnPos( ) - 1 );
         sName += String::CreateFromAscii( ", Row " );
         sName += String::CreateFromInt32( getRowPos( ) );
 

accessibility/source/extended/accessiblelistbox.cxx

 #include <toolkit/helper/convert.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 
-//#include <vcl/svdata.hxx>
-
 //........................................................................
 namespace accessibility
 {
 		if ( pEntry )
 		{
 			if( pEntry->HasChildsOnDemand() || getListBox()->GetChildCount(pEntry) > 0  )
-			//end add by duan mei hua, 2007/01/27, for sodc_6862
 			{
 				nCase = 1;
 				return nCase;
 	{
 		if(getListBox())
 		{
-			short nType = getListBox()->GetAllEntriesAccessibleRoleType();			
-			if( nType == TREEBOX_ALLITEM_ACCROLE_TYPE_TREE)
-					return AccessibleRole::TREE;
-			else if( nType == TREEBOX_ALLITEM_ACCROLE_TYPE_LIST)
-					return AccessibleRole::LIST;
+			short const nType = getListBox()->GetAllEntriesAccessibleRoleType();			
+            switch ( nType )
+            {
+            case TREEBOX_ALLITEM_ACCROLE_TYPE_TREE:
+                return AccessibleRole::TREE;
+            case TREEBOX_ALLITEM_ACCROLE_TYPE_LIST:
+                return AccessibleRole::LIST;
+            case TREEBOX_ALLITEM_ACCROLE_TYPE_NOTSET:
+                break;
+            default:
+                OSL_ENSURE( false, "AccessibleListBox::getAccessibleRole: unknown AllEntriesRoleType!" );
+                break;
+            }
 		}
 
-		//o is: return AccessibleRole::TREE;
 		sal_Bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0; 
 		if(!bHasButtons && (getListBox()->GetTreeFlags() & TREEFLAG_CHKBTN))
 			return AccessibleRole::LIST;
 			if(getRoleType() == 0)
 				return AccessibleRole::LIST;
 			else
-			return AccessibleRole::TREE;
+			    return AccessibleRole::TREE;
 	}
 	// -----------------------------------------------------------------------------
 	::rtl::OUString SAL_CALL AccessibleListBox::getAccessibleDescription(  ) throw (RuntimeException)

accessibility/source/extended/accessiblelistboxentry.cxx

 #include <comphelper/accessibleeventnotifier.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <accessibility/helper/accessiblestrings.hrc>
-#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_
 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
-#endif
 #define ACCESSIBLE_ACTION_COUNT	1
 
 namespace
 		::osl::MutexGuard aGuard( m_aMutex );
 		EnsureIsAlive();
 
-//		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
-//		SvLBoxEntry* pEntry = pParent ? getListBox()->GetEntry( pParent, i ) : NULL;
 		SvLBoxEntry* pEntry =GetRealChild(i);
 		if ( !pEntry )
 			throw IndexOutOfBoundsException();
 			else
 			{	// we have a entry as parent -> get it's accessible
 
-				// shorten our access path by one
-				::std::deque< sal_Int32 > aParentPath( m_aEntryPath );
-				aParentPath.pop_back();
+				// get our own the entry
+				SvLBoxEntry* pOwnEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+				DBG_ASSERT( pOwnEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain my own entry!" );
 
-				// get the entry for this shortened access path
-				SvLBoxEntry* pParentEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
-				DBG_ASSERT( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!" );
+                // get its parent
+                SvLBoxEntry* pParentEntry = NULL;
+				if ( pOwnEntry )
+					pParentEntry = getListBox()->GetParent( pOwnEntry );
+				OSL_ENSURE( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain the parent entry!" );
 
-				//IAccessibility2 Implementation 2009-----
-				if ( pParentEntry )
-					pParentEntry = getListBox()->GetParent(pParentEntry);
-				//-----IAccessibility2 Implementation 2009
 				if ( pParentEntry )
 					xParent = new AccessibleListBoxEntry( *getListBox(), pParentEntry, NULL );
 					// note that we pass NULL here as parent-accessible:
 		SvTreeListBox* pBox = getListBox();
 		if(pBox)
 		{
-			short nType = pBox->GetAllEntriesAccessibleRoleType();			
-			if( nType == TREEBOX_ALLITEM_ACCROLE_TYPE_TREE)
-					return AccessibleRole::TREE_ITEM;
-			else if( nType == TREEBOX_ALLITEM_ACCROLE_TYPE_LIST)
-					return AccessibleRole::LIST_ITEM;
+			short const nType = getListBox()->GetAllEntriesAccessibleRoleType();			
+            switch ( nType )
+            {
+            case TREEBOX_ALLITEM_ACCROLE_TYPE_TREE:
+                return AccessibleRole::TREE_ITEM;
+            case TREEBOX_ALLITEM_ACCROLE_TYPE_LIST:
+                return AccessibleRole::LIST_ITEM;
+            case TREEBOX_ALLITEM_ACCROLE_TYPE_NOTSET:
+                break;
+            default:
+                OSL_ENSURE( false, "AccessibleListBoxEntry::getAccessibleRole: unknown AllEntriesRoleType!" );
+                break;
+            }
 		}
 
 		sal_uInt16 treeFlag = pBox->GetTreeFlags();
 		if(getRoleType() == 0)
 			return AccessibleRole::LIST_ITEM;
 		else
-			//o is: return AccessibleRole::LABEL;
 			return AccessibleRole::TREE_ITEM;
 		}	
 	}
 	// -----------------------------------------------------------------------------
 	::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription(  ) throw (RuntimeException)
 	{
-		// no description for every item
 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
 		if( getAccessibleRole() == AccessibleRole::TREE_ITEM )
 		{
 			return getListBox()->GetEntryLongDescription( pEntry );
 		}
-		//want to cout the real column nubmer in the list box.
-		sal_uInt16 iRealItemCount = 0;
-		sal_uInt16 iCount = 0;
-		sal_uInt16 iTotleItemCount = pEntry->ItemCount();
+		// 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( iCount < iTotleItemCount )
+		while( nCount < nTotalItemCount )
 		{
-			pItem = pEntry->GetItem( iCount );
+			pItem = pEntry->GetItem( nCount );
 			if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING &&
 				 static_cast<SvLBoxString*>( pItem )->GetText().Len() > 0 )
 			{
-				iRealItemCount++;
+				++nTextItemCount;
 			}
-			iCount++;
+			++nCount;
 		}
-		if(iRealItemCount<=1  )
-		{
-			return ::rtl::OUString();
-		}
-		else
-		{
-			return getListBox()->SearchEntryTextWithHeadTitle( pEntry );
-		}
-		
+        ::rtl::OUString sDescription;
+		if ( nTextItemCount > 1 )
+			sDescription = getListBox()->SearchEntryTextWithHeadTitle( pEntry );
+        return sDescription;
 	}
+
 	// -----------------------------------------------------------------------------
 	::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName(  ) throw (RuntimeException)
 	{
 					if ( getListBox()->IsInplaceEditingEnabled() )
 				       	pStateSetHelper->AddState( AccessibleStateType::EDITABLE );
 					if ( IsShowing_Impl() )
-				        	pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+				        pStateSetHelper->AddState( AccessibleStateType::SHOWING );
 					break;
 				case AccessibleRole::CHECK_BOX:
 			       	pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
 			       	pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
 			       	pStateSetHelper->AddState( AccessibleStateType::ENABLED );
 					if ( IsShowing_Impl() )
-				        	pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+				        pStateSetHelper->AddState( AccessibleStateType::SHOWING );
 					break;
 			}			
 			getListBox()->FillAccessibleEntryStateSet(
     	ALBSolarGuard aSolarGuard;
 		::osl::MutexGuard aGuard( m_aMutex );
 		EnsureIsAlive();
-		if(aPoint.X==0 && aPoint.Y==0) return 0;
+
+        if ( aPoint.X==0 && aPoint.Y==0 )
+            return 0;
 
 		sal_Int32 nIndex = -1;
 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
 			else if ( role == AccessibleRole::LABEL )
 				return 0;
 		}
-		else
-			return ACCESSIBLE_ACTION_COUNT;
-		return 0;
+
+		return ACCESSIBLE_ACTION_COUNT;
 	}
 	// -----------------------------------------------------------------------------
     sal_Bool SAL_CALL AccessibleListBoxEntry::doAccessibleAction( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
 				//Sometimes, a List or Tree may have both checkbox and label at the same time
 				return ::rtl::OUString();
 			}
-		}else if( (nIndex == 1 && (treeFlag & TREEFLAG_CHKBTN)) || nIndex == 0 )
+		}
+        else if (   (   ( nIndex == 1 )
+                    && ( treeFlag & TREEFLAG_CHKBTN )
+                    )
+                ||  ( nIndex == 0 )
+                )
 		{
-			//IAccessibility2 Implementation 2009-----
 			if( pEntry->HasChilds() || pEntry->HasChildsOnDemand() )
-			//-----IAccessibility2 Implementation 2009
-				return getListBox()->IsExpanded( pEntry ) ? \
-				::rtl::OUString(TK_RES_STRING(STR_SVT_ACC_ACTION_COLLAPSE)) :
-				::rtl::OUString(TK_RES_STRING(STR_SVT_ACC_ACTION_EXPAND));
+            {
+				return getListBox()->IsExpanded( pEntry )
+                    ?   ::rtl::OUString( TK_RES_STRING( STR_SVT_ACC_ACTION_COLLAPSE ) )
+                    :   ::rtl::OUString( TK_RES_STRING( STR_SVT_ACC_ACTION_EXPAND ) );
+            }
 			return ::rtl::OUString();
 
 		}
 		::osl::MutexGuard aGuard( m_aMutex );
 
 		EnsureIsAlive();
-// IAccessible2 implementation, 2009
-//		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
-//		SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex );
-
 		SvLBoxEntry* pEntry =GetRealChild(nChildIndex);
 		if ( !pEntry )
 			throw IndexOutOfBoundsException();

accessibility/source/extended/accessibletablistboxtable.cxx

 #endif
 #include "accessibility/extended/AccessibleBrowseBoxTableCell.hxx"
 #include "accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx"
+#include "accessibility/extended/AccessibleBrowseBoxTableCell.hxx"
 #include <svtools/svtabbx.hxx>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
-
-#ifndef _SVTOOLS_ACCESSIBILEBROWSEBOXTABLECELL_HXX
-#include "accessibility/extended/AccessibleBrowseBoxTableCell.hxx"
-#endif
 //........................................................................
 namespace accessibility
 {

accessibility/source/extended/textwindowaccessibility.cxx

 
 namespace accessibility
 {
-    ::sal_Int32 getSelectionType(::sal_Int32 nNewFirstPara, ::sal_Int32 nNewFirstPos, ::sal_Int32 nNewLastPara, ::sal_Int32 nNewLastPos);
-    void sendEvent(::sal_Int32 start, ::sal_Int32 end, ::sal_Int16 nEventId);
-
 // Both ::osl::Mutex and ParagraphBase implement acquire and release, and thus
 // ::rtl::Reference< Paragraph > does not work.  So ParagraphImpl was factored
 // out and ::rtl::Reference< ParagraphImpl > is used instead.

accessibility/source/helper/accessiblestrings.src

 {
 	Text [ en-US ] = "(Selected)";
 };
-//===================================================
-//Added by Qu DaoGang, 07/07/2005, CR_ID:SODC_149
-//Solution: Add Resource to set AccessibleName
-//==================================================
-String RID_STR_ACC_NAME_PREVIEW
-{
-	Text [ en-US ] = "Preview";
-};
-//==================================================
-//End Added by Qu DaoGang, 07/07/2005, CR_ID:SODC_149
-//==================================================
-
 //added by duan mei hua, 2006/04/14, for refactor
 String RID_STR_ACC_ACTION_CHECK
 {
 {
 	Text [ en-US ] = "Uncheck";
 };
-String RID_STR_ACC_ACTION_DOUBLE_CLICK
-{
-	Text [ en-US ] = "Double click";
-};
 
 String RID_STR_ACC_SCROLLBAR_NAME_VERTICAL
 {

accessibility/source/standard/vclxaccessiblebox.cxx

 		}
 		case VCLEVENT_COMBOBOX_SELECT:
 		{
-	             VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
-	             if (pList != NULL)
-	             {
-		                Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
-		                if ( xText.is() )
-				{
-					::rtl::OUString sText = xText->getSelectedText();
-					if ( !sText.getLength() )
-						sText = xText->getText();
-		                    pList->UpdateSelection_Acc (sText, m_bIsDropDownBox);
-					//if(m_bIsDropDownBox && !pList->IsInDropDown())
-					if (m_bIsDropDownBox || ( !m_bIsDropDownBox && m_aBoxType==COMBOBOX))
-						NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, Any(), Any());
+             VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+             if (pList != NULL)
+             {
+                    Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
+                    if ( xText.is() )
+                    {
+                        ::rtl::OUString sText = xText->getSelectedText();
+                        if ( !sText.getLength() )
+                            sText = xText->getText();
+                        pList->UpdateSelection_Acc (sText, m_bIsDropDownBox);
+                        //if(m_bIsDropDownBox && !pList->IsInDropDown())
+                        if (m_bIsDropDownBox || ( !m_bIsDropDownBox && m_aBoxType==COMBOBOX))
+                            NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, Any(), Any());
 
-						Any aOldValue;
-						Any aNewValue;
-						aOldValue <<= AccessibleStateType::INDETERMINATE;
-						NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue);
-
-				}
-	            	}			
-			break;
-		}
-		//case VCLEVENT_DROPDOWN_OPEN:
-		//case VCLEVENT_DROPDOWN_CLOSE:
+                        Any aOldValue;
+                        Any aNewValue;
+                        aOldValue <<= AccessibleStateType::INDETERMINATE;
+                        NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue);
+                    }
+            }
+            break;
+        }
 		case VCLEVENT_LISTBOX_DOUBLECLICK:
 		case VCLEVENT_LISTBOX_SCROLLED:
-		//case VCLEVENT_LISTBOX_SELECT:
         case VCLEVENT_LISTBOX_ITEMADDED:
         case VCLEVENT_LISTBOX_ITEMREMOVED:
         case VCLEVENT_COMBOBOX_ITEMADDED:
             break;
         }
 
-		//case VCLEVENT_COMBOBOX_SELECT:
         case VCLEVENT_COMBOBOX_DESELECT:
         {
             // Selection is handled by VCLXAccessibleList which operates on
 Any VCLXAccessibleBox::getMaximumValue( ) 
     throw( RuntimeException )
 {
-    Any aAny;
-    return aAny;
+    return Any();
 }
 
 Any VCLXAccessibleBox::getMinimumValue(  ) 
     throw( RuntimeException )
 {
-    Any aAny;
-    return aAny;
+    return Any();
 }
 
 // Set the INDETERMINATE state when there is no selected item for combobox
 void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
 {
-	VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
-	if (m_aBoxType == COMBOBOX )
-	{
-		::rtl::OUString sText;
-		sal_Int32 nEntryCount = 0;
-		ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
-		if (pComboBox != NULL)
-		{
-			Edit* pSubEdit = pComboBox->GetSubEdit();
-			if ( pSubEdit)
-				sText = pSubEdit->GetText();
-			nEntryCount = pComboBox->GetEntryCount();
-		}
-		if (sText.getLength() == 0 && nEntryCount >0)
-			rStateSet.AddState(AccessibleStateType::INDETERMINATE);
-	}
-	else if (m_aBoxType == LISTBOX && m_bIsDropDownBox == true)
-	{
-		sal_Int32 nSelectedEntryCount = 0;
-		ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
-		if (pListBox != NULL && pListBox->GetEntryCount() > 0)
-		{
-	        	nSelectedEntryCount = pListBox->GetSelectEntryCount();
-			if ( nSelectedEntryCount == 0)
-				rStateSet.AddState(AccessibleStateType::INDETERMINATE);
-		}
-	}
+    VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
+    if (m_aBoxType == COMBOBOX )
+    {
+        ::rtl::OUString sText;
+        sal_Int32 nEntryCount = 0;
+        ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+        if (pComboBox != NULL)
+        {
+            Edit* pSubEdit = pComboBox->GetSubEdit();
+            if ( pSubEdit)
+                sText = pSubEdit->GetText();
+            nEntryCount = pComboBox->GetEntryCount();
+        }
+        if (sText.getLength() == 0 && nEntryCount >0)
+            rStateSet.AddState(AccessibleStateType::INDETERMINATE);
+    }
+    else if (m_aBoxType == LISTBOX && m_bIsDropDownBox == true)
+    {
+        sal_Int32 nSelectedEntryCount = 0;
+        ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
+        if (pListBox != NULL && pListBox->GetEntryCount() > 0)
+        {
+            nSelectedEntryCount = pListBox->GetSelectEntryCount();
+            if ( nSelectedEntryCount == 0)
+                rStateSet.AddState(AccessibleStateType::INDETERMINATE);
+        }
+    }
 }

accessibility/source/standard/vclxaccessiblebutton.cxx

 		if ( pButton->IsPressed() )
             rStateSet.AddState( AccessibleStateType::PRESSED );
 
-        // IA2 CWS: If the button has a poppup menu,it should has the state EXPANDABLE
+        // IA2 CWS: If the button has a poppup menu,it should have the state EXPANDABLE
         if( pButton->GetType() == WINDOW_MENUBUTTON )
         {
         	rStateSet.AddState( AccessibleStateType::EXPANDABLE );	

accessibility/source/standard/vclxaccessiblecheckbox.cxx

 	if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
         throw IndexOutOfBoundsException();
 
-	//IAccessibility2 Implementation 2009-----
-	//	return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
-	//-----IAccessibility2 Implementation 2009
-	if(IsChecked())
+	if ( IsChecked() )
 		return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_UNCHECK ) );
 	else
 		return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CHECK ) );

accessibility/source/standard/vclxaccessibledropdowncombobox.cxx

 
 void VCLXAccessibleDropDownComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
 {
-	switch ( rVclWindowEvent.GetId() )
-	{
-		case VCLEVENT_DROPDOWN_OPEN:
-		case VCLEVENT_DROPDOWN_CLOSE:
-		{
-            /*			// child count changed
-			Any aOldValue, aNewValue;
-			// get the listbox child
-			Reference< XAccessible > xChild;
-			if ( !xChild.is() )
-			{
-				try
-				{
-					// the listbox is the second child
-					xChild = getAccessibleChild(1);
-				}
-				catch ( IndexOutOfBoundsException& ) {}
-				catch ( RuntimeException& ) {}
-			}
-			if ( rVclWindowEvent.GetId() == VCLEVENT_DROPDOWN_OPEN )
-				aNewValue <<= xChild;
-			else
-				aOldValue <<= xChild;
-			NotifyAccessibleEvent(
-			AccessibleEventId::CHILD, aOldValue, aNewValue
-			);
-			break;
-            */
-		}
-
-		default:
-			VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
-	}
+	VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
 }
 
 

accessibility/source/standard/vclxaccessiblelist.cxx

         ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
         if ( pBox != NULL )
         {
-		// Find the index of the selected item inside the VCL control...
-		sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem));
-		// ...and then find the associated accessibility object.
-		if ( nIndex == LISTBOX_ENTRY_NOTFOUND )
-			nIndex = 0;
-		UpdateSelection_Impl_Acc(b_IsDropDownList);
+		    // Find the index of the selected item inside the VCL control...
+		    sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem));
+		    // ...and then find the associated accessibility object.
+		    if ( nIndex == LISTBOX_ENTRY_NOTFOUND )
+			    nIndex = 0;
+		    UpdateSelection_Impl_Acc(b_IsDropDownList);
         }
     }
 }
 	{
 		vos::OGuard aSolarGuard( Application::GetSolarMutex() );
 		::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-	    	Reference< XAccessible > xNewAcc;
+        Reference< XAccessible > xNewAcc;
 		if ( m_pListBoxHelper )
 		{
 			sal_uInt16 i=0;
 				}
 			}
 			sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
-			if ( i < nCount ) // here we have to check the if any other listbox entry is selected
-			{
-				for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i )
-					;
-			}
+			if ( i < nCount )
+            // here we have to check the if any other listbox entry is selected
+            while ( i < nCount && !checkEntrySelected( i, aNewValue, xNewAcc ) )
+                ++i;
 			if ( xNewAcc.is() && GetWindow()->HasFocus() )
 			{
 				if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
 void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent,  bool b_IsDropDownList)
 {
 	switch ( rVclWindowEvent.GetId() )
-      {
+    {
 		case VCLEVENT_LISTBOX_SELECT:
 			if ( !m_bDisableProcessEvent )
 				UpdateSelection_Impl_Acc(b_IsDropDownList);
 			if ( !m_bDisableProcessEvent )
 				UpdateFocus_Impl_Acc((sal_uInt16)reinterpret_cast<sal_uInt32>(rVclWindowEvent.GetData()),b_IsDropDownList);
 			break;
-		case VCLEVENT_WINDOW_GETFOCUS:
-			break;
 		case VCLEVENT_CONTROL_GETFOCUS:
 			{
 				VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
 				}
 			}
 			sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
-			if ( i < nCount ) // here we have to check the if any other listbox entry is selected
-			{
-				for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i )
-					;
-			}
+			// check if any other listbox entry is selected
+            while ( i < nCount && !checkEntrySelected( i, aNewValue, xNewAcc ) )
+                ++i;
 			if ( xNewAcc.is() && GetWindow()->HasFocus() )
 			{
 				if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
 			}
 		}
 	}
-	if (!m_pListBoxHelper->IsInDropDown())
-	{
-	}
-	else
+	if (m_pListBoxHelper->IsInDropDown())
 	{
 		if ( aNewValue.hasValue() || aOldValue.hasValue() )
 			NotifyAccessibleEvent(
 			ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
 			if ( pBox )
 			{
-				Size aSize = pBox->GetSubEdit()->GetSizePixel();
-				// IAccessible2 implementation, 2009
-				//aBounds.X += aSize.Height();
-				//aBounds.Y += aSize.Width();
+				Size const aSize = pBox->GetSubEdit()->GetSizePixel();
 				aBounds.Y += aSize.Height();
 				aBounds.Height -= aSize.Height();
-				//aBounds.Width  -= aSize.Width();
 			}
 		}
 	}
 			ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
 			if ( pBox )
 			{
-				//aPos.X += pBox->GetSubEdit()->GetSizePixel().Height();
-				//aPos.Y += pBox->GetSubEdit()->GetSizePixel().Width();
 				aPos.Y += pBox->GetSubEdit()->GetSizePixel().Height();
 			}
 		}

accessibility/source/standard/vclxaccessibletoolbox.cxx

 	{
 		ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
 		// returns only toolbox buttons, not windows
-		if ( aIter != m_aAccessibleChildren.end()  && aIter->second.is())
+		if ( aIter != m_aAccessibleChildren.end() )
 			pItem =	static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
 	}
 
 {
     ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
     if ( pToolBox )
-	{
-		sal_uInt16 nFocusId = pToolBox->GetItemId( (sal_uInt16)_nPos );
-		VCLXAccessibleToolBoxItem* pFocusItem = NULL;
+    {
+        sal_uInt16 nFocusId = pToolBox->GetItemId( (sal_uInt16)_nPos );
+        VCLXAccessibleToolBoxItem* pFocusItem = NULL;
 
-	    for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
-			  aIter != m_aAccessibleChildren.end(); ++aIter )
-		{
-				sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first );
+        for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
+              aIter != m_aAccessibleChildren.end(); ++aIter )
+        {
+            sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first );
 
-                VCLXAccessibleToolBoxItem* pItem =
-                    static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
-                pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) );
-                if ( nItemId == nFocusId )
-                    pFocusItem = pItem;
+            VCLXAccessibleToolBoxItem* pItem =
+                static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+            pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) );
+            if ( nItemId == nFocusId )
+                pFocusItem = pItem;
         }
-		//Solution:If the position is not a child item,the focus should not be called
-		if ( pFocusItem && (sal_uInt16)_nPos != TOOLBOX_ITEM_NOTFOUND )
-			pFocusItem->SetFocus( sal_True );
-	}
+        //Solution:If the position is not a child item,the focus should not be called
+        if ( pFocusItem && (sal_uInt16)_nPos != TOOLBOX_ITEM_NOTFOUND )
+            pFocusItem->SetFocus( sal_True );
+    }
 }
 // -----------------------------------------------------------------------------
 void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( sal_Int32 _nPos )
 		case VCLEVENT_TOOLBOX_CLICK:
 		case VCLEVENT_TOOLBOX_SELECT: 
         {
-			if ( rVclWindowEvent.GetData() )
+            sal_Int32 nAffectedItemPos = pToolBox->GetItemPos( pToolBox->GetCurItemId() );
+            if ( rVclWindowEvent.GetData() )
+                nAffectedItemPos = (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData();
+            if ( nAffectedItemPos != TOOLBOX_ITEM_NOTFOUND )
             {
-                UpdateChecked_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
-                UpdateIndeterminate_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
+                UpdateChecked_Impl( nAffectedItemPos );
+                UpdateIndeterminate_Impl( nAffectedItemPos );
             }
-			else if( pToolBox->GetItemPos(pToolBox->GetCurItemId()) != TOOLBOX_ITEM_NOTFOUND )
-			{
-				UpdateChecked_Impl( pToolBox->GetItemPos(pToolBox->GetCurItemId()) );
-		                UpdateIndeterminate_Impl( pToolBox->GetItemPos(pToolBox->GetCurItemId()) );
-			}
 			break;
         }
 		case VCLEVENT_TOOLBOX_DOUBLECLICK:
 		case VCLEVENT_TOOLBOX_ACTIVATE:
 		case VCLEVENT_TOOLBOX_DEACTIVATE:
-    	//case VCLEVENT_TOOLBOX_SELECT:
 			break;
 		// IA2 CWS. MT: Still using VCLEVENT_TOOLBOX_CLICK, see comment in vcl/source/window/toolbox2.cxx
 		/*

accessibility/source/standard/vclxaccessibletoolboxitem.cxx

 		case TOOLBOXITEM_BUTTON :
 		{
     		ToolBoxItemBits nBits = m_pToolBox->GetItemBits( m_nItemId );
-            if (( nBits & TIB_DROPDOWN ) == TIB_DROPDOWN)
+            if ( ( nBits & TIB_DROPDOWN ) == TIB_DROPDOWN )
+            {
 				m_nRole	= AccessibleRole::BUTTON_DROPDOWN;
-			else if (( ( nBits & TIB_CHECKABLE ) == TIB_CHECKABLE ) ||
-                ( ( nBits & TIB_AUTOCHECK ) == TIB_AUTOCHECK ) )
+            }
+			else if (   ( ( nBits & TIB_CHECKABLE ) == TIB_CHECKABLE )
+                    ||  ( ( nBits & TIB_AUTOCHECK ) == TIB_AUTOCHECK )
+                    )
+            {
 				m_nRole	= AccessibleRole::TOGGLE_BUTTON;
-			else if ( (nBits & TIB_DROPDOWN) == TIB_DROPDOWN )
-			{
-				m_nRole	= AccessibleRole::BUTTON_DROPDOWN;
-			}
+            }
 			else if ( m_pToolBox->GetItemWindow( m_nItemId ) )
 				m_nRole	= AccessibleRole::PANEL;
 			break;
 		if (  sRet.getLength() == 0 )
 		{
 			Window* pItemWindow = m_pToolBox->GetItemWindow( m_nItemId );
-			if ( m_nRole == AccessibleRole::PANEL && pItemWindow && pItemWindow->GetAccessible().is() &&
-				 pItemWindow->GetAccessible()->getAccessibleContext().is() )
-			{
-				::rtl::OUString sWinText = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName();
-				 if ( sWinText.getLength() > 0 ) 
-					sRet = sWinText;
-			}
+			if ( m_nRole == AccessibleRole::PANEL && pItemWindow )
+            {
+                Reference< XAccessible > const xAccessible( pItemWindow->GetAccessible() );
+                Reference< XAccessibleContext > xContext;
+                if ( xAccessible.is() )
+                    xContext = xAccessible->getAccessibleContext();
+                if ( xContext.is() )
+                    sRet = xContext->getAccessibleName();
+            }
 		}
 
 	}
 // -----------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleDescription(  ) throw (RuntimeException)
 {
-	OExternalLockGuard aGuard( this );
+    OExternalLockGuard aGuard( this );
 
-	
-	if(m_nRole	== AccessibleRole::PANEL && getAccessibleChildCount() > 0 )
-	{
-		return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_PANEL_DESCRIPTION ) );
-	}
-	else
-	{
-		::rtl::OUString sDescription;
-		if ( m_pToolBox )
-		sDescription = m_pToolBox->GetHelpText( m_nItemId );
+    ::rtl::OUString sDescription;
+    if ( m_nRole == AccessibleRole::PANEL && getAccessibleChildCount() > 0 )
+    {
+        sDescription = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_PANEL_DESCRIPTION ) );
+    }
+    else if ( m_pToolBox )
+    {
+        sDescription = m_pToolBox->GetHelpText( m_nItemId );
+    }
 
-		return sDescription;
-	}
+    return sDescription;
 }
 // -----------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleName(  ) throw (RuntimeException)

svtools/source/contnr/svtreebx.cxx

 //IAccessibility2 Implementation 2009-----
 String  SvTreeListBox::GetEntryAltText( SvLBoxEntry* ) const
 {
-	String tmp;
-	return tmp;
+    // no implementation here, needs to be implemented in derived classes
+    return String();
 }
 String SvTreeListBox::GetEntryLongDescription( SvLBoxEntry* ) const
 {
-	String tmp;
-	return tmp;
+    // no implementation here, needs to be implemented in derived classes
+    return String();
 }
 
 String SvTreeListBox::SearchEntryTextWithHeadTitle( SvLBoxEntry* pEntry ) 
 {
 	DBG_CHKTHIS(SvTreeListBox,0);
-	DBG_ASSERT( pEntry, "SvTreeListBox::SearchEntryText(): no entry" );
+	DBG_ASSERT( pEntry, "SvTreeListBox::SearchEntryTextWithHeadTitle(): no entry" );
 	String sRet;
 
 	sal_uInt16 nCount = pEntry->ItemCount();