diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-17 17:24:45 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-17 17:24:45 +0000 |
commit | d6e3a5bb1f118cbce7cc1723c6ed99d285d3c885 (patch) | |
tree | f2836522cb9fdf15a9994a3fdbf0d47819e9d799 | |
parent | d6f7c94e5c27ba02ff5c3229760c9808cc9b5bea (diff) |
CWS-TOOLING: integrate CWS a11y32
2009-09-08 11:46:26 +0200 tl r275921 : #i74816# use hi-contrast for all but for printer; namely use it for virtual devices as well
2009-08-25 10:14:46 +0200 tl r275337 : CWS-TOOLING: rebase CWS a11y32 to trunk@274622 (milestone: DEV300:m54)
2009-08-17 11:13:19 +0200 ab r275036 : #i71360# Added attribute support for misspelled
2009-07-24 14:28:11 +0200 tl r274306 : #i48354# fixed hierarchy order in SvHeaderTabListBox
2009-07-24 13:47:40 +0200 mav r274305 : #i102870# let roadmap control behave as a monolite tabstop control
2009-07-24 13:47:06 +0200 mav r274304 : #i102870# let roadmap control behave as a monolite tabstop control
2009-07-24 13:46:33 +0200 mav r274303 : #i102870# let roadmap control behave as a monolite tabstop control
2009-07-24 09:41:16 +0200 tl r274289 : #i74816# fixed evaluation of high-contrast-mode
2009-07-22 15:46:50 +0200 tl r274246 : warning-free-code fix when build with debug=t
2009-07-22 15:28:59 +0200 tl r274243 : #i74816# fixed evaluation of high-contrast-mode
-rw-r--r-- | svtools/source/control/roadmap.cxx | 19 | ||||
-rw-r--r-- | svtools/source/uno/unoiface.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/controls/roadmapcontrol.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atktext.cxx | 65 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atktextattributes.cxx | 13 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atktextattributes.hxx | 1 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkwrapper.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkwrapper.hxx | 2 |
8 files changed, 98 insertions, 7 deletions
diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index 7485efec7c7c..b0e178e631d9 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -201,6 +201,17 @@ namespace svt m_pImpl->InCompleteHyperLabel = NULL; m_pImpl->setCurItemID(-1 ); m_pImpl->setComplete( sal_True ); + + // Roadmap control should be reachable as one unit with a Tab key + // the next Tab key should spring out of the control. + // To reach it the control itself should get focus and set it + // on entries. The entries themself should not be reachable with + // the Tab key directly. So each entry should have WB_NOTABSTOP. + // + // In other words the creator should create the control with the following + // flags: + // SetStyle( ( GetStyle() | WB_TABSTOP ) & ~WB_DIALOGCONTROL ); + // TODO: if somebody sets a new font from outside (OutputDevice::SetFont), we would have to react // on this with calculating a new bold font. // Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font. @@ -725,11 +736,9 @@ namespace svt //--------------------------------------------------------------------- IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, _CurHyperLabel) { - return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); + return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); } - - void ORoadmap::DataChanged( const DataChangedEvent& rDCEvt ) { if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) || @@ -753,7 +762,7 @@ namespace svt ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, const ResId& ) { mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); - mpDescHyperLabel = new HyperLabel(_pParent, WB_TABSTOP | WB_WORDBREAK); + mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); } @@ -761,7 +770,7 @@ namespace svt { mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); - mpDescHyperLabel = new HyperLabel(_pParent, WB_TABSTOP | WB_WORDBREAK); + mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); } //--------------------------------------------------------------------- diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index e6922aa4f099..54cc448ff89e 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -133,7 +133,7 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com:: } else if (aServiceName.EqualsIgnoreCaseAscii("roadmap") ) { - pWindow = new ::svt::ORoadmap( pParent, WB_DIALOGCONTROL); + pWindow = new ::svt::ORoadmap( pParent, WB_TABSTOP ); *ppNewComp = new SVTXRoadmap; } else if ( aServiceName.EqualsIgnoreCaseAscii( "ProgressBar" ) ) diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx index 724421da5f3c..da3a265130b8 100644 --- a/toolkit/source/controls/roadmapcontrol.cxx +++ b/toolkit/source/controls/roadmapcontrol.cxx @@ -104,6 +104,7 @@ static void lcl_throwIndexOutOfBoundsException( ) ImplRegisterProperty( BASEPROPERTY_COMPLETE ); ImplRegisterProperty( BASEPROPERTY_ACTIVATED ); ImplRegisterProperty( BASEPROPERTY_CURRENTITEMID ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); ImplRegisterProperty( BASEPROPERTY_TEXT ); } diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index 8bdfe1706962..8d83ca008e4a 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -33,12 +33,15 @@ #include "atkwrapper.hxx" #include "atktextattributes.hxx" +#include <algorithm> #include <com/sun/star/accessibility/AccessibleTextType.hpp> #include <com/sun/star/accessibility/TextSegment.hpp> #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp> #include <com/sun/star/accessibility/XAccessibleText.hpp> #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> +#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp> +#include <com/sun/star/text/TextMarkupType.hpp> // #define ENABLE_TRACING @@ -175,6 +178,27 @@ static accessibility::XAccessibleText* /*****************************************************************************/ +static accessibility::XAccessibleTextMarkup* + getTextMarkup( AtkText *pText ) throw (uno::RuntimeException) +{ + AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText ); + if( pWrap ) + { + if( !pWrap->mpTextMarkup && pWrap->mpContext ) + { + uno::Any any = pWrap->mpContext->queryInterface( accessibility::XAccessibleTextMarkup::static_type(NULL) ); + pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved); + pWrap->mpTextMarkup->acquire(); + } + + return pWrap->mpTextMarkup; + } + + return NULL; +} + +/*****************************************************************************/ + static accessibility::XAccessibleTextAttributes* getTextAttributes( AtkText *pText ) throw (uno::RuntimeException) { @@ -434,6 +458,8 @@ text_wrapper_get_run_attributes( AtkText *text, AtkAttributeSet *pSet = NULL; try { + bool bOffsetsAreValid = false; + accessibility::XAccessibleText* pText = getText( text ); accessibility::XAccessibleTextAttributes* pTextAttributes = getTextAttributes( text ); if( pText && pTextAttributes ) @@ -456,10 +482,47 @@ text_wrapper_get_run_attributes( AtkText *text, // *end_offset = aTextSegment.SegmentEnd + 1; // FIXME: TESTME *end_offset = aTextSegment.SegmentEnd; // <-- + bOffsetsAreValid = true; + } + } + + // Special handling for missspelled + accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text ); + if( pTextMarkup ) + { + uno::Sequence< accessibility::TextSegment > aTextSegmentSeq = + pTextMarkup->getTextMarkupAtIndex( offset, com::sun::star::text::TextMarkupType::SPELLCHECK ); + if( aTextSegmentSeq.getLength() > 0 ) + { + accessibility::TextSegment aTextSegment = aTextSegmentSeq[0]; + gint nStartOffsetMisspelled = aTextSegment.SegmentStart; + gint nEndOffsetMisspelled = aTextSegment.SegmentEnd; + + // Get attribute run here if it hasn't been done before + if( !bOffsetsAreValid ) + { + accessibility::TextSegment aAttributeTextSegment = + pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN); + *start_offset = aAttributeTextSegment.SegmentStart; + *end_offset = aAttributeTextSegment.SegmentEnd; + } + + if( nEndOffsetMisspelled <= offset ) + *start_offset = ::std::max( *start_offset, nEndOffsetMisspelled ); + else if( nStartOffsetMisspelled <= offset ) + *start_offset = ::std::max( *start_offset, nStartOffsetMisspelled ); + + if( nStartOffsetMisspelled > offset ) + *end_offset = ::std::min( *end_offset, nStartOffsetMisspelled ); + else if( nEndOffsetMisspelled > offset ) + *end_offset = ::std::min( *end_offset, nEndOffsetMisspelled ); + + if( nStartOffsetMisspelled <= offset && nEndOffsetMisspelled > offset ) + pSet = attribute_set_prepend_misspelled( pSet ); } } } - catch(const uno::Exception& e) { + catch(const uno::Exception& e){ g_warning( "Exception in get_run_attributes()" ); diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index f6b1eccc882a..58dd5f200bbd 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -76,6 +76,7 @@ static AtkTextAttribute atk_text_attribute_tab_interval = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_tab_stops = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_writing_mode = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_vertical_align = ATK_TEXT_ATTR_INVALID; +static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID; /*****************************************************************************/ @@ -1299,6 +1300,18 @@ attribute_set_new_from_property_values( } +AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set ) +{ + if( ATK_TEXT_ATTR_INVALID == atk_text_attribute_misspelled ) + atk_text_attribute_misspelled = atk_text_attribute_register( "text-spelling" ); + + attribute_set = attribute_set_prepend( attribute_set, atk_text_attribute_misspelled, + g_strdup_printf( "misspelled" ) ); + + return attribute_set; +} + + /*****************************************************************************/ struct AtkTextAttrMapping diff --git a/vcl/unx/gtk/a11y/atktextattributes.hxx b/vcl/unx/gtk/a11y/atktextattributes.hxx index 909f09eb1522..ca67fd946a20 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.hxx +++ b/vcl/unx/gtk/a11y/atktextattributes.hxx @@ -47,5 +47,6 @@ attribute_set_map_to_property_values( AtkAttributeSet* attribute_set, com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValueList ); +AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set ); #endif diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 927b8548a77a..8854083e1509 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleText.hpp> +#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp> #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> #include <com/sun/star/accessibility/XAccessibleValue.hpp> #include <com/sun/star/accessibility/XAccessibleAction.hpp> @@ -893,6 +894,7 @@ void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper) RELEASE( wrapper->mpMultiLineText ) RELEASE( wrapper->mpTable ) RELEASE( wrapper->mpText ) + RELEASE( wrapper->mpTextMarkup ) RELEASE( wrapper->mpTextAttributes ) RELEASE( wrapper->mpValue ) } diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx index 1003d0d25cc7..95cf30096e7b 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.hxx +++ b/vcl/unx/gtk/a11y/atkwrapper.hxx @@ -49,6 +49,7 @@ namespace com { namespace sun { namespace star { namespace accessibility { class XAccessibleSelection; class XAccessibleTable; class XAccessibleText; + class XAccessibleTextMarkup; class XAccessibleTextAttributes; class XAccessibleValue; } } } } @@ -69,6 +70,7 @@ struct _AtkObjectWrapper ::com::sun::star::accessibility::XAccessibleSelection *mpSelection; ::com::sun::star::accessibility::XAccessibleTable *mpTable; ::com::sun::star::accessibility::XAccessibleText *mpText; + ::com::sun::star::accessibility::XAccessibleTextMarkup *mpTextMarkup; ::com::sun::star::accessibility::XAccessibleTextAttributes *mpTextAttributes; ::com::sun::star::accessibility::XAccessibleValue *mpValue; |