CWS-TOOLING: integrate CWS accfixes

This commit is contained in:
Ivo Hinkelmann 2011-02-16 15:09:19 +01:00
commit ac7aee7669
20 changed files with 206 additions and 119 deletions

View file

@ -252,6 +252,10 @@
#define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4)
#define STR_SVT_ACC_DESC_FILE (STR_SVT_ACC_BEGIN+5)
#define STR_SVT_ACC_EMPTY_FIELD (STR_SVT_ACC_BEGIN+6)
//IAccessible2 implementation
#define STR_SVT_ACC_LISTENTRY_SELCTED_STATE (STR_SVT_ACC_BEGIN+7)
#define STR_SVT_ACC_RULER_VERT_NAME (STR_SVT_ACC_BEGIN+8)
#define STR_SVT_ACC_RULER_HORZ_NAME (STR_SVT_ACC_BEGIN+9)
#define STR_SVT_ACC_END (STR_SVT_ACC_EMPTY_FIELD)
#define STR_SVT_INDEXENTRY_START (STR_SVT_ACC_END + 1)
@ -390,6 +394,11 @@
#define RID_IMG_PRNDLG_COLLATE_HC (STR_SVT_PRNDLG_START + 31)
#define RID_IMG_PRNDLG_NOCOLLATE_HC (STR_SVT_PRNDLG_START + 32)
// IAccessible2 implementation in 2009
#define STR_PARAGRAPH_START (STR_SVT_PRNDLG_START + 50)
#define STR_PARAGRAPH (STR_PARAGRAPH_START + 0)
#define STR_PARAGRAPH_END (STR_PARAGRAPH)
#endif // #ifndef _SVTOOLS_HRC
// ******************************************************************* EOF

View file

@ -74,30 +74,3 @@ String STR_SVT_ACC_EMPTY_FIELD
Text [ en-US ] = "Empty Field";
};

40
svtools/source/control/filectrl.src Normal file → Executable file
View file

@ -31,28 +31,20 @@ String STR_FILECTRL_BUTTONTEXT
Text [ en-US ] = "Browse..." ;
};
String STR_TABBAR_PUSHBUTTON_MOVET0HOME
{
Text [ en-US ] = "Move To Home" ;
};
String STR_TABBAR_PUSHBUTTON_MOVELEFT
{
Text [ en-US ] = "Move Left" ;
};
String STR_TABBAR_PUSHBUTTON_MOVERIGHT
{
Text [ en-US ] = "Move Right" ;
};
String STR_TABBAR_PUSHBUTTON_MOVETOEND
{
Text [ en-US ] = "Move To End" ;
};

View file

@ -303,6 +303,7 @@ void Ruler::ImplInit( WinBits nWinBits )
else
aDefSize.Width() = nDefHeight;
SetOutputSizePixel( aDefSize );
SetType(WINDOW_RULER);
}
// -----------------------------------------------------------------------

View file

@ -38,7 +38,8 @@
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include "svtaccessiblefactory.hxx"
#include <filectrl.hrc>
#include <svtools/svtdata.hxx>
#include <limits>
// =======================================================================
@ -397,6 +398,16 @@ void TabBar::ImplInit( WinBits nWinStyle )
mnOffY++;
ImplInitControls();
if(mpFirstBtn)
mpFirstBtn->SetAccessibleName(String(SvtResId(STR_TABBAR_PUSHBUTTON_MOVET0HOME)));
if(mpPrevBtn)
mpPrevBtn->SetAccessibleName( String(SvtResId(STR_TABBAR_PUSHBUTTON_MOVELEFT)));
if(mpNextBtn)
mpNextBtn->SetAccessibleName(String(SvtResId(STR_TABBAR_PUSHBUTTON_MOVERIGHT)));
if(mpLastBtn)
mpLastBtn->SetAccessibleName( String(SvtResId(STR_TABBAR_PUSHBUTTON_MOVETOEND)));
SetSizePixel( Size( 100, CalcWindowSizePixel().Height() ) );
ImplInitSettings( sal_True, sal_True );
}

View file

@ -252,7 +252,7 @@ OUString SAL_CALL ToolbarMenuAcc::getAccessibleName() throw (RuntimeException)
if( !aRet.getLength() )
{
Window* pLabel = mpParent->mrMenu.GetLabeledBy();
Window* pLabel = mpParent->mrMenu.GetAccessibleRelationLabeledBy();
if( pLabel && pLabel != &mpParent->mrMenu )
aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
}

View file

@ -317,7 +317,7 @@ sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole()
if ( !aRet.Len() )
{
Window* pLabel = mpParent->GetLabeledBy();
Window* pLabel = mpParent->GetAccessibleRelationLabeledBy();
if ( pLabel && pLabel != mpParent )
aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
}

View file

@ -65,3 +65,5 @@
#define BTN_CANCEL 1
#define BTN_HELP 1
//IAccessibility2 Implementation 2009-----
#define STR_COLORDES 3001

View file

@ -277,45 +277,19 @@ ModalDialog DLG_COLOR
Border = TRUE ;
Pos = MAP_APPFONT ( 200 , 109 ) ;
Size = MAP_APPFONT ( 26 , 51 + DIFF ) ;
TabStop = TRUE ;
TabStop = FALSE ;
};
Control CTL_PREVIEW
{
Border = TRUE ;
Pos = MAP_APPFONT ( 229 , 109 ) ;
Size = MAP_APPFONT ( 26 , 51 + DIFF ) ;
TabStop = TRUE ;
TabStop = FALSE ;
};
};
String STR_COLORDES
{
Text [ en-US ] = "RGB(%1, %2, %3) Hue:%4 Saturation:%5 Brightness:%6";
};

View file

@ -30,5 +30,12 @@
#define STR_FILECTRL_BUTTONTEXT 333 // ID-Range?!
//IAccessibility2 Implementation 2009-----
#define STR_TABBAR_PUSHBUTTON_MOVET0HOME ( STR_FILECTRL_BUTTONTEXT+ 1)
#define STR_TABBAR_PUSHBUTTON_MOVELEFT ( STR_FILECTRL_BUTTONTEXT+ 2)
#define STR_TABBAR_PUSHBUTTON_MOVERIGHT ( STR_FILECTRL_BUTTONTEXT+ 3)
#define STR_TABBAR_PUSHBUTTON_MOVETOEND ( STR_FILECTRL_BUTTONTEXT+ 4)
//-----IAccessibility2 Implementation 2009
#endif

View file

@ -42,7 +42,7 @@
// class VCLXContainer
// ----------------------------------------------------
class VCLXContainer : public ::com::sun::star::awt::XVclContainer,
class TOOLKIT_DLLPUBLIC VCLXContainer : public ::com::sun::star::awt::XVclContainer,
public ::com::sun::star::awt::XVclContainerPeer,
public VCLXWindow
{

View file

@ -91,7 +91,7 @@ public:
// class VCLXTopWindow
// ----------------------------------------------------
class VCLXTopWindow: public VCLXTopWindow_Base,
class TOOLKIT_DLLPUBLIC VCLXTopWindow: public VCLXTopWindow_Base,
public VCLXContainer
{
protected:

View file

@ -377,7 +377,7 @@ public:
// ----------------------------------------------------
// class VCLXDialog
// ----------------------------------------------------
class VCLXDialog : public ::com::sun::star::awt::XDialog2,
class TOOLKIT_DLLPUBLIC VCLXDialog : public ::com::sun::star::awt::XDialog2,
public VCLXTopWindow
{
public:

View file

@ -445,7 +445,7 @@ void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelation
Window* pWindow = GetWindow();
if ( pWindow )
{
Window *pLabeledBy = pWindow->GetLabeledBy();
Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
if ( pLabeledBy && pLabeledBy != pWindow )
{
uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
@ -453,7 +453,7 @@ void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelation
rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
}
Window* pLabelFor = pWindow->GetLabelFor();
Window* pLabelFor = pWindow->GetAccessibleRelationLabelFor();
if ( pLabelFor && pLabelFor != pWindow )
{
uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);

View file

@ -68,7 +68,6 @@ using namespace ::com::sun::star;
// instead of only a <VCLXWindow> instance, especially regarding its
// corresponding accessibility API.
case WINDOW_METRICBOX:
// <--
case WINDOW_COMBOBOX: return new VCLXComboBox;
case WINDOW_SPINFIELD:
case WINDOW_NUMERICFIELD:

View file

@ -117,7 +117,8 @@ typedef sal_uInt16 WindowType;
#define WINDOW_INTROWINDOW (WINDOW_FIRST + 0x4f)
#define WINDOW_LISTBOXWINDOW (WINDOW_FIRST + 0x50)
#define WINDOW_DOCKINGAREA (WINDOW_FIRST + 0x51)
#define WINDOW_LAST (WINDOW_DOCKINGAREA)
#define WINDOW_RULER (WINDOW_FIRST + 0x52)
#define WINDOW_LAST (WINDOW_RULER)
// ---------------

View file

@ -210,6 +210,24 @@ struct ImplFrameData
sal_Bool mbInternalDragGestureRecognizer;
};
// -----------------------
// - ImplAccessibleInfos -
// -----------------------
struct ImplAccessibleInfos
{
sal_uInt16 nAccessibleRole;
String* pAccessibleName;
String* pAccessibleDescription;
Window* pLabeledByWindow;
Window* pLabelForWindow;
Window* pMemberOfWindow;
ImplAccessibleInfos();
~ImplAccessibleInfos();
};
// ---------------
// - WindowImpl -
// ---------------

View file

@ -1053,9 +1053,20 @@ public:
void SetAccessibleDescription( const String& rDescr );
String GetAccessibleDescription() const;
void SetAccessibleRelationLabeledBy( Window* pLabeledBy );
Window* GetAccessibleRelationLabeledBy() const;
void SetAccessibleRelationLabelFor( Window* pLabelFor );
Window* GetAccessibleRelationLabelFor() const;
void SetAccessibleRelationMemberOf( Window* pMemberOf );
Window* GetAccessibleRelationMemberOf() const;
// to avoid sending accessibility events in cases like closing dialogs
// by default checks complete parent path
sal_Bool IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath = sal_True );
void SetAccessibilityEventsSuppressed(sal_Bool bSuppressed);
/// request XCanvas render interface for this window
::com::sun::star::uno::Reference<
@ -1080,8 +1091,7 @@ public:
sal_Bool IsCreatedWithToolkit() const;
void SetCreatedWithToolkit( sal_Bool b );
Window* GetLabelFor() const;
Window* GetLabeledBy() const;
// Deprecated - can use SetAccessibleRelationLabelFor/By nowadys
virtual Window* GetParentLabelFor( const Window* pLabel ) const;
virtual Window* GetParentLabeledBy( const Window* pLabeled ) const;
KeyEvent GetActivationKey() const;

View file

@ -1120,11 +1120,15 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window
return pWindow;
}
Window* Window::GetLabelFor() const
Window* Window::GetAccessibleRelationLabelFor() const
{
if ( mpWindowImpl->mbDisableAccessibleLabelForRelation )
return NULL;
if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabelForWindow )
return mpWindowImpl->mpAccessibleInfos->pLabelForWindow;
Window* pWindow = NULL;
Window* pFrameWindow = ImplGetFrameWindow();
@ -1205,11 +1209,14 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo
return pWindow;
}
Window* Window::GetLabeledBy() const
Window* Window::GetAccessibleRelationLabeledBy() const
{
if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation )
return NULL;
if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow )
return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow;
Window* pWindow = NULL;
Window* pFrameWindow = ImplGetFrameWindow();
@ -1238,6 +1245,62 @@ Window* Window::GetLabeledBy() const
return pWindow;
}
Window* Window::GetAccessibleRelationMemberOf() const
{
Window* pWindow = NULL;
Window* pFrameWindow = GetParent();
if ( !pFrameWindow )
{
pFrameWindow = ImplGetFrameWindow();
}
// if( ! ( GetType() == WINDOW_FIXEDTEXT ||
if( !( GetType() == WINDOW_FIXEDLINE ||
GetType() == WINDOW_GROUPBOX ) )
{
// search for a control that makes member of this window
// it is considered the last fixed line or group box
// that comes before this control; with the exception of push buttons
// which are labeled only if the fixed line or group box
// is directly before the control
// get form start and form end and index of this control
sal_uInt16 nIndex, nFormStart, nFormEnd;
Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow,
const_cast<Window*>(this),
nIndex,
nFormStart,
nFormEnd );
if( pSWindow && nIndex != nFormStart )
{
if( GetType() == WINDOW_PUSHBUTTON ||
GetType() == WINDOW_HELPBUTTON ||
GetType() == WINDOW_OKBUTTON ||
GetType() == WINDOW_CANCELBUTTON )
{
nFormStart = nIndex-1;
}
for( sal_uInt16 nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- )
{
sal_uInt16 nFoundIndex = 0;
pSWindow = ::ImplGetChildWindow( pFrameWindow,
nSearchIndex,
nFoundIndex,
sal_False );
if( pSWindow && pSWindow->IsVisible() &&
( pSWindow->GetType() == WINDOW_FIXEDLINE ||
pSWindow->GetType() == WINDOW_GROUPBOX ) )
{
pWindow = pSWindow;
break;
}
if( nFoundIndex > nSearchIndex || nSearchIndex == 0 )
break;
}
}
}
return pWindow;
}
//-----IAccessibility2 Implementation 2009
// -----------------------------------------------------------------------
KeyEvent Window::GetActivationKey() const
@ -1247,7 +1310,7 @@ KeyEvent Window::GetActivationKey() const
sal_Unicode nAccel = getAccel( GetText() );
if( ! nAccel )
{
Window* pWindow = GetLabeledBy();
Window* pWindow = GetAccessibleRelationLabeledBy();
if( pWindow )
nAccel = getAccel( pWindow->GetText() );
}
@ -1260,6 +1323,10 @@ KeyEvent Window::GetActivationKey() const
nCode = KEY_A + (nAccel-'A');
else if( nAccel >= '0' && nAccel <= '9' )
nCode = KEY_0 + (nAccel-'0');
else if( nAccel == '.' )
nCode = KEY_POINT;
else if( nAccel == '-' )
nCode = KEY_SUBTRACT;
KeyCode aKeyCode( nCode, sal_False, sal_False, sal_True, sal_False );
aKeyEvent = KeyEvent( nAccel, aKeyCode );
}

View file

@ -134,25 +134,21 @@ struct ImplCalcToTopData
Region* mpInvalidateRegion;
};
struct ImplAccessibleInfos
ImplAccessibleInfos::ImplAccessibleInfos()
{
sal_uInt16 nAccessibleRole;
String* pAccessibleName;
String* pAccessibleDescription;
nAccessibleRole = 0xFFFF;
pAccessibleName = NULL;
pAccessibleDescription = NULL;
pLabeledByWindow = NULL;
pLabelForWindow = NULL;
pMemberOfWindow = NULL;
}
ImplAccessibleInfos()
{
nAccessibleRole = 0xFFFF;
pAccessibleName = NULL;
pAccessibleDescription = NULL;
}
~ImplAccessibleInfos()
{
delete pAccessibleName;
delete pAccessibleDescription;
}
};
ImplAccessibleInfos::~ImplAccessibleInfos()
{
delete pAccessibleName;
delete pAccessibleDescription;
}
// -----------------------------------------------------------------------
@ -8086,7 +8082,7 @@ void Window::SetText( const XubString& rStr )
// name change.
if ( IsReallyVisible() )
{
Window* pWindow = GetLabelFor();
Window* pWindow = GetAccessibleRelationLabelFor();
if ( pWindow && pWindow != this )
pWindow->ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle );
}
@ -9134,6 +9130,7 @@ sal_uInt16 Window::GetAccessibleRole() const
case WINDOW_HELPTEXTWINDOW: nRole = accessibility::AccessibleRole::TOOL_TIP; break;
case WINDOW_RULER: nRole = accessibility::AccessibleRole::RULER; break;
case WINDOW_WINDOW:
case WINDOW_CONTROL:
case WINDOW_BORDERWINDOW:
@ -9160,7 +9157,7 @@ void Window::SetAccessibleName( const String& rName )
if ( !mpWindowImpl->mpAccessibleInfos )
mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleName, "AccessibleName already set!" );
DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleName || !rName.Len(), "AccessibleName already set!" );
delete mpWindowImpl->mpAccessibleInfos->pAccessibleName;
mpWindowImpl->mpAccessibleInfos->pAccessibleName = new String( rName );
}
@ -9201,9 +9198,9 @@ String Window::GetAccessibleName() const
case WINDOW_LISTBOX:
case WINDOW_MULTILISTBOX:
case WINDOW_TREELISTBOX:
case WINDOW_METRICBOX:
{
Window *pLabel = GetLabeledBy();
Window *pLabel = GetAccessibleRelationLabeledBy();
if ( pLabel && pLabel != this )
aAccessibleName = pLabel->GetText();
}
@ -9262,6 +9259,27 @@ String Window::GetAccessibleDescription() const
return aAccessibleDescription;
}
void Window::SetAccessibleRelationLabeledBy( Window* pLabeledBy )
{
if ( !mpWindowImpl->mpAccessibleInfos )
mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
mpWindowImpl->mpAccessibleInfos->pLabeledByWindow = pLabeledBy;
}
void Window::SetAccessibleRelationLabelFor( Window* pLabelFor )
{
if ( !mpWindowImpl->mpAccessibleInfos )
mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
mpWindowImpl->mpAccessibleInfos->pLabelForWindow = pLabelFor;
}
void Window::SetAccessibleRelationMemberOf( Window* pMemberOfWin )
{
if ( !mpWindowImpl->mpAccessibleInfos )
mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
mpWindowImpl->mpAccessibleInfos->pMemberOfWindow = pMemberOfWin;
}
sal_Bool Window::IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath )
{
if( !bTraverseParentPath )
@ -9280,6 +9298,11 @@ sal_Bool Window::IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath )
}
}
void Window::SetAccessibilityEventsSuppressed(sal_Bool bSuppressed)
{
mpWindowImpl->mbSuppressAccessibilityEvents = bSuppressed;
}
void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect )
{
if( ! mpOutDevData )