summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2011-10-05 13:06:50 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2011-10-05 18:51:34 -0500
commit0f104e0b4ecf0431e7e9a30751104a5d256cf444 (patch)
tree9b97d8d2b63a3272c12a30d5ec868e86cbd4468b
parent86549116e2edace920a78bd8e5aa9fc1604a1b84 (diff)
accfixes2: Accessibility enhancements for svtools tree lists
-rw-r--r--svtools/inc/svtools/svtreebx.hxx55
-rw-r--r--svtools/source/contnr/imivctl1.cxx1
-rw-r--r--svtools/source/contnr/svimpbox.cxx13
-rw-r--r--svtools/source/contnr/svtabbx.cxx8
-rw-r--r--svtools/source/contnr/svtreebx.cxx139
5 files changed, 193 insertions, 23 deletions
diff --git a/svtools/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx
index b46ebe73f6b5..199802e8a280 100644
--- a/svtools/inc/svtools/svtreebx.hxx
+++ b/svtools/inc/svtools/svtreebx.hxx
@@ -49,6 +49,10 @@ class TabBar;
#define TREEFLAG_MANINS 0x0004
#define TREEFLAG_RECALCTABS 0x0008
+#define TREEBOX_ALLITEM_ACCROLE_TYPE_NOTSET 0x00
+#define TREEBOX_ALLITEM_ACCROLE_TYPE_LIST 0x01
+#define TREEBOX_ALLITEM_ACCROLE_TYPE_TREE 0x02
+
typedef sal_Int64 ExtendedWinBits;
// disable the behavior of automatically selecting a "CurEntry" upon painting the control
@@ -72,12 +76,14 @@ class SVT_DLLPUBLIC SvTreeListBox : public SvLBox
Image aCurInsertedColBmp;
short nContextBmpWidthMax;
- sal_uInt16 nFirstSelTab, nLastSelTab;
+ sal_uInt16 nFirstSelTab;
+ sal_uInt16 nLastSelTab;
short nEntryHeight;
short nEntryHeightOffs;
short nIndent;
short nFocusWidth;
- sal_uInt16 aContextBmpMode;
+ sal_uInt16 aContextBmpMode;
+ sal_Int16 m_nAllItemAccRoleType;
#ifdef _SVTREEBX_CXX
DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData * );
@@ -122,8 +128,8 @@ protected:
virtual void SetTabs();
void SetTabs_Impl();
void AddTab( long nPos,sal_uInt16 nFlags=SV_LBOXTAB_ADJUST_LEFT,
- void* pUserData = 0 );
- sal_uInt16 TabCount() const { return aTabs.Count(); }
+ void* pUserData = 0 );
+ sal_uInt16 TabCount() const { return aTabs.Count(); }
SvLBoxTab* GetFirstDynamicTab() const;
SvLBoxTab* GetFirstDynamicTab( sal_uInt16& rTabPos ) const;
SvLBoxTab* GetFirstTab( sal_uInt16 nFlagMask, sal_uInt16& rTabPos );
@@ -158,9 +164,9 @@ protected:
virtual void StateChanged( StateChangedType nStateChange );
void InitSettings(sal_Bool bFont,sal_Bool bForeground,sal_Bool bBackground);
- sal_Bool IsCellFocusEnabled() const;
+ sal_Bool IsCellFocusEnabled() const;
bool SetCurrentTabPos( sal_uInt16 _nNewPos );
- sal_uInt16 GetCurrentTabPos() const;
+ sal_uInt16 GetCurrentTabPos() const;
void CallImplEventListeners(sal_uLong nEvent, void* pData);
void ImplEditEntry( SvLBoxEntry* pEntry );
@@ -173,7 +179,7 @@ public:
SvTreeListBox( Window* pParent, const ResId& rResId );
~SvTreeListBox();
- void SetExtendedWinBits( ExtendedWinBits _nBits );
+ void SetExtendedWinBits( ExtendedWinBits _nBits );
void DisconnectFromModel();
@@ -223,7 +229,7 @@ public:
void SetCheckButtonState( SvLBoxEntry*, SvButtonState );
SvButtonState GetCheckButtonState( SvLBoxEntry* ) const;
- sal_Bool IsExpandBitmapOnCursor() const { return (sal_Bool)(aContextBmpMode & SVLISTENTRYFLAG_FOCUSED)!=0; }
+ sal_Bool IsExpandBitmapOnCursor() const { return (sal_Bool)(aContextBmpMode & SVLISTENTRYFLAG_FOCUSED)!=0; }
void SetEntryText(SvLBoxEntry*, const XubString& );
void SetExpandedEntryBmp( SvLBoxEntry* _pEntry, const Image& _rImage );
@@ -246,15 +252,15 @@ public:
void SetSublistOpenWithLeftRight( sal_Bool bMode = sal_True ); // open/close sublist with cursor left/right
void EnableInplaceEditing( sal_Bool bEnable );
- sal_Bool IsInplaceEditingEnabled() const { return SvLBox::IsInplaceEditingEnabled(); }
+ sal_Bool IsInplaceEditingEnabled() const { return SvLBox::IsInplaceEditingEnabled(); }
inline void ForbidEmptyText() { SvLBox::ForbidEmptyText(); }
// Editiert das erste StringItem des Entries, 0==Cursor
void EditEntry( SvLBoxEntry* pEntry = NULL );
- virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& );
- virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText );
- sal_Bool IsEditingActive() const { return SvLBox::IsEditingActive(); }
+ virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& );
+ virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText );
+ sal_Bool IsEditingActive() const { return SvLBox::IsEditingActive(); }
void EndEditing( sal_Bool bCancel = sal_False ) { SvLBox::EndEditing( bCancel ); }
- sal_Bool EditingCanceled() const { return SvLBox::EditingCanceled(); }
+ sal_Bool EditingCanceled() const { return SvLBox::EditingCanceled(); }
virtual void RequestingChilds( SvLBoxEntry* pParent );
@@ -274,7 +280,7 @@ public:
virtual void ModelHasInserted( SvListEntry* pEntry );
virtual void ModelHasInsertedTree( SvListEntry* pEntry );
virtual void ModelIsMoving(SvListEntry* pSource,
- SvListEntry* pTargetParent, sal_uLong nChildPos );
+ SvListEntry* pTargetParent, sal_uLong nChildPos );
virtual void ModelHasMoved(SvListEntry* pSource );
virtual void ModelIsRemoving( SvListEntry* pEntry );
virtual void ModelHasRemoved( SvListEntry* pEntry );
@@ -323,14 +329,13 @@ public:
void SetDragDropMode( DragDropMode );
void SetSelectionMode( SelectionMode );
- virtual sal_Bool Expand( SvLBoxEntry* pParent );
- virtual sal_Bool Collapse( SvLBoxEntry* pParent );
- virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True );
- virtual sal_uLong SelectChilds( SvLBoxEntry* pParent, sal_Bool bSelect );
+ virtual sal_Bool Expand( SvLBoxEntry* pParent );
+ virtual sal_Bool Collapse( SvLBoxEntry* pParent );
+ virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True );
+ virtual sal_uLong SelectChilds( SvLBoxEntry* pParent, sal_Bool bSelect );
virtual void SelectAll( sal_Bool bSelect, sal_Bool bPaint = sal_True );
virtual void SetCurEntry( SvLBoxEntry* _pEntry );
- virtual SvLBoxEntry*
- GetCurEntry() const;
+ virtual SvLBoxEntry* GetCurEntry() const;
using Window::Invalidate;
virtual void Invalidate( sal_uInt16 nFlags = 0);
@@ -345,7 +350,7 @@ public:
DECL_LINK( DefaultCompare, SvSortData* );
virtual void ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1,
- SvListEntry* pEntry2, sal_uLong nPos );
+ SvListEntry* pEntry2, sal_uLong nPos );
void EndSelection();
void RepaintScrollBars() const;
@@ -391,6 +396,14 @@ public:
/** Enables, that one cell of a tablistbox entry can be focused */
void EnableCellFocus();
+ void SetAllEntriesAccessibleRoleType( short n ) { m_nAllItemAccRoleType = n; }
+ sal_Int16 GetAllEntriesAccessibleRoleType() const { return m_nAllItemAccRoleType; }
+ sal_uInt16 GetTreeFlags() const {return nTreeFlags;}
+ XubString headString ;
+ String SearchEntryTextWithHeadTitle( SvLBoxEntry* pEntry ) ;
+ virtual String GetEntryAltText( SvLBoxEntry* pEntry) const;
+ virtual String GetEntryLongDescription( SvLBoxEntry* pEntry) const;
+
protected:
using SvListView::Expand;
using SvListView::Collapse;
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 56a15574e29b..f83fbac06e2e 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -1120,6 +1120,7 @@ void SvxIconChoiceCtrl_Impl::SetCursor_Impl( SvxIconChoiceCtrlEntry* pOldCursor,
{
SelectEntry( pCursor, sal_True, sal_True, sal_False, bPaintSync );
aCurSelectionRect = GetEntryBoundRect( pCursor );
+ CallEventListeners( VCLEVENT_LISTBOX_SELECT, pCursor );
}
}
}
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 7f8df9b9897e..464ed24aefe8 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -305,6 +305,8 @@ void SvImpLBox::Clear()
// #97680# ---------
aContextBmpWidthVector.clear();
+ CallEventListeners( VCLEVENT_LISTBOX_ITEMREMOVED, NULL );
+
}
// *********************************************************************
@@ -652,6 +654,7 @@ void SvImpLBox::SetCursor( SvLBoxEntry* pEntry, sal_Bool bForceNoSelect )
if(!bForceNoSelect && bSimpleTravel && !(nFlags & F_DESEL_ALL) && GetUpdateMode())
{
pView->Select( pCursor, sal_True );
+ CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pCursor );
}
// Mehrfachselektion: Im Cursor-Move selektieren, wenn
// nicht im Add-Mode (Ctrl-F8)
@@ -661,10 +664,15 @@ void SvImpLBox::SetCursor( SvLBoxEntry* pEntry, sal_Bool bForceNoSelect )
!bForceNoSelect )
{
pView->Select( pCursor, sal_True );
+ CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pCursor );
}
else
{
ShowCursor( sal_True );
+ if (bForceNoSelect && GetUpdateMode())
+ {
+ CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pCursor);
+ }
}
if( pAnchor )
@@ -1706,6 +1714,9 @@ void SvImpLBox::EntrySelected( SvLBoxEntry* pEntry, sal_Bool bSelect )
void SvImpLBox::RemovingEntry( SvLBoxEntry* pEntry )
{
+
+ CallEventListeners( VCLEVENT_LISTBOX_ITEMREMOVED , pEntry );
+
DestroyAnchor();
if( !pView->IsEntryVisible( pEntry ) )
@@ -2340,7 +2351,7 @@ sal_Bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
case KEY_LEFT:
{
- if ( bIsCellFocusEnabled )
+ if ( bIsCellFocusEnabled && pCursor)
{
if ( nCurTabPos > FIRST_ENTRY_TAB )
{
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index ada81843f43d..4d9328d1dc9a 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -1183,6 +1183,10 @@ void SvHeaderTabListBox::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper
sal_uInt16 nCurColumn = GetCurrColumn();
if ( IsCellVisible( nCurRow, nCurColumn ) )
_rStateSet.AddState( AccessibleStateType::VISIBLE );
+ if ( IsEnabled() )
+ {
+ _rStateSet.AddState( AccessibleStateType::ENABLED );
+ }
_rStateSet.AddState( AccessibleStateType::TRANSIENT );
break;
}
@@ -1195,6 +1199,10 @@ void SvHeaderTabListBox::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper
_rStateSet.AddState( AccessibleStateType::TRANSIENT );
break;
}
+ if ( IsEnabled() )
+ {
+ _rStateSet.AddState( AccessibleStateType::ENABLED );
+ }
default:
break;
}
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
index 329b5ded69ef..d3e49b20e64c 100644
--- a/svtools/source/contnr/svtreebx.cxx
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -92,6 +92,7 @@ void SvTreeListBox::InitTreeView()
nFirstSelTab = 0;
nLastSelTab = 0;
nFocusWidth = -1;
+ m_nAllItemAccRoleType = 0;
Link* pLink = new Link( LINK(this,SvTreeListBox, DefaultCompare) );
pLBoxImpl->m_pLink = pLink;
@@ -525,6 +526,89 @@ void SvTreeListBox::ImpEntryInserted( SvLBoxEntry* pEntry )
SetEntryHeight( (SvLBoxEntry*)pEntry );
}
+String SvTreeListBox::GetEntryAltText( SvLBoxEntry* ) const
+{
+ String tmp;
+ return tmp;
+}
+
+String SvTreeListBox::GetEntryLongDescription( SvLBoxEntry* ) const
+{
+ String tmp;
+ return tmp;
+}
+
+String SvTreeListBox::SearchEntryTextWithHeadTitle( SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT( pEntry, "SvTreeListBox::SearchEntryText(): no entry" );
+ String sRet;
+
+ sal_uInt16 nCount = pEntry->ItemCount();
+ sal_uInt16 nCur = 0;
+ sal_uInt16 nHeaderCur = 0;
+ SvLBoxItem* pItem;
+ while( nCur < nCount )
+ {
+ // MT: SV_ITEM_ID_EXTENDRLBOXSTRING / GetExtendText() was in use in IA2 cws, but only used in sc: ScSolverOptionsString. Needed?
+ pItem = pEntry->GetItem( nCur );
+ if ( (pItem->IsA() == SV_ITEM_ID_LBOXSTRING /* || pItem->IsA() == SV_ITEM_ID_EXTENDRLBOXSTRING */ ) &&
+ static_cast<SvLBoxString*>( pItem )->GetText().Len() > 0 )
+ {
+
+ //want to the column header
+ if( headString.Len() > 0)
+ {
+ xub_StrLen nEnd = headString.Search( sal_Unicode( '\t' ) );
+ if( nEnd == STRING_NOTFOUND )
+ {
+ if(sRet.Len()>0)
+ {
+ sRet += ',';
+ }
+ if(headString.Len()>0)
+ {
+ sRet += headString ;
+ sRet += ':' ;
+ }
+ }
+ else
+ {
+ String aString=headString.GetToken(nHeaderCur, sal_Unicode( '\t' ) );
+ if(sRet.Len()>0)
+ {
+ sRet += ',';
+ }
+ if( aString.Len() > 0)
+ {
+ sRet += aString ;
+ sRet += ':' ;
+ }
+ nHeaderCur++;
+ }
+ // if (pItem->IsA() == SV_ITEM_ID_LBOXSTRING)
+ sRet += static_cast<SvLBoxString*>( pItem )->GetText();
+ // else
+ // sRet += static_cast<SvLBoxString*>( pItem )->GetExtendText();
+ }
+ else
+ {
+ // if (pItem->IsA() == SV_ITEM_ID_LBOXSTRING)
+ sRet += static_cast<SvLBoxString*>( pItem )->GetText();
+ // else
+ // sRet += static_cast<SvLBoxString*>( pItem )->GetExtendText();
+ sRet += ',';
+ }
+ //end want to the column header
+ }
+ nCur++;
+ }
+
+ if (sRet.Len() > 0)
+ sRet = sRet.Erase(sRet.Len() - 1);
+ return sRet;
+}
+
void SvTreeListBox::SetCheckButtonState( SvLBoxEntry* pEntry, SvButtonState eState)
@@ -755,10 +839,27 @@ void SvTreeListBox::RequestingChilds( SvLBoxEntry* pParent )
void SvTreeListBox::GetFocus()
{
DBG_CHKTHIS(SvTreeListBox,0);
+
+ if( !SvLBox::First())
+ {
+ Invalidate();
+ }
+
pImp->GetFocus();
SvLBox::GetFocus();
SvLBoxEntry* pEntry = FirstSelected();
+ if ( !pEntry )
+ {
+ pEntry = pImp->GetCurrentEntry();
+ }
+ if (pImp->pCursor)
+ {
+ if (pEntry != pImp->pCursor)
+ {
+ pEntry = pImp->pCursor;
+ }
+ }
if ( pEntry )
{
pImp->CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pEntry );
@@ -768,6 +869,10 @@ void SvTreeListBox::GetFocus()
void SvTreeListBox::LoseFocus()
{
DBG_CHKTHIS(SvTreeListBox,0);
+ if( !SvLBox::First())
+ {
+ Invalidate();
+ }
pImp->LoseFocus();
SvLBox::LoseFocus();
}
@@ -1015,7 +1120,7 @@ sal_Bool SvTreeListBox::Select( SvLBoxEntry* pEntry, sal_Bool bSelect )
if( bSelect )
{
SelectHdl();
- pImp->CallEventListeners( VCLEVENT_LISTBOX_SELECT, pEntry );
+ CallEventListeners( VCLEVENT_LISTBOX_TREESELECT, pEntry);
}
else
DeselectHdl();
@@ -1136,6 +1241,20 @@ void SvTreeListBox::Paint( const Rectangle& rRect )
if( nTreeFlags & TREEFLAG_RECALCTABS )
SetTabs();
pImp->Paint( rRect );
+ if( !SvLBox::First() )
+ {
+ if( HasFocus() )
+ {
+ sal_Int32 tempHeight = GetTextHeight();
+ Rectangle tempRect( Point(0,0),Size(GetSizePixel().Width(),tempHeight));
+ ShowFocus(tempRect);
+ }
+ else
+ {
+ HideFocus();
+ }
+ }
+
}
void SvTreeListBox::MouseButtonDown( const MouseEvent& rMEvt )
@@ -2450,7 +2569,9 @@ void SvTreeListBox::FillAccessibleEntryStateSet( SvLBoxEntry* pEntry, ::utl::Acc
{
rStateSet.AddState( AccessibleStateType::EXPANDABLE );
if ( IsExpanded( pEntry ) )
+ {
rStateSet.AddState( (sal_Int16)AccessibleStateType::EXPANDED );
+ }
}
if ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED )
@@ -2459,6 +2580,22 @@ void SvTreeListBox::FillAccessibleEntryStateSet( SvLBoxEntry* pEntry, ::utl::Acc
rStateSet.AddState( AccessibleStateType::VISIBLE );
if ( IsSelected( pEntry ) )
rStateSet.AddState( AccessibleStateType::SELECTED );
+
+ if ( IsEnabled() )
+ {
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet.AddState( AccessibleStateType::SELECTABLE );
+ SvViewDataEntry* pViewDataNewCur = 0;
+ if( pEntry )
+ {
+ pViewDataNewCur= GetViewDataEntry(pEntry);
+ if(pViewDataNewCur->HasFocus())
+ {
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+ }
+ }
+ }
}
Rectangle SvTreeListBox::GetBoundingRect( SvLBoxEntry* pEntry )