[Libreoffice-commits] .: 11 commits - svx/inc svx/source svx/util sw/uiconfig toolkit/source vcl/inc vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 22 08:30:04 PST 2013


 svx/inc/helpid.hrc                                                         |    1 
 svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src               |    9 
 svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx |    2 
 svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx     |   46 -
 svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx     |    3 
 svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src     |  110 --
 svx/util/hidother.src                                                      |    1 
 sw/uiconfig/swriter/ui/titlepage.ui                                        |   59 -
 toolkit/source/awt/vclxaccessiblecomponent.cxx                             |    8 
 vcl/inc/vcl/builder.hxx                                                    |   14 
 vcl/inc/vcl/fixed.hxx                                                      |    6 
 vcl/inc/vcl/layout.hxx                                                     |    8 
 vcl/inc/vcl/window.hxx                                                     |   21 
 vcl/inc/window.h                                                           |    2 
 vcl/source/control/fixed.cxx                                               |   31 
 vcl/source/window/builder.cxx                                              |  149 +++
 vcl/source/window/dlgctrl.cxx                                              |   83 +-
 vcl/source/window/layout.cxx                                               |   19 
 vcl/source/window/window.cxx                                               |  385 +++++-----
 vcl/source/window/window2.cxx                                              |   33 
 20 files changed, 618 insertions(+), 372 deletions(-)

New commits:
commit 9eef4168ac57c153f5f265ac3a547e796d062a72
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 22 13:34:21 2013 +0000

    remove always false and disabled m_aCB_Use_Variants checkbox
    
    Change-Id: I770c867a2cb014fd34c5289d47ff030aa774579d

diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index 1668f71..d8ae9eb 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -189,7 +189,6 @@
 #define HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL          "SVX_HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL"
 #define HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED "SVX_HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED"
 #define HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL "SVX_HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL"
-#define HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS           "SVX_HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS"
 #define HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED "SVX_HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED"
 #define HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL "SVX_HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL"
 #define HID_SVX_MDLG_DOCRECOVERY_BROKEN                       "SVX_HID_SVX_MDLG_DOCRECOVERY_BROKEN"
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src b/svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src
index fae7ef0..288208f 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src
@@ -239,15 +239,6 @@ ModalDialog DLG_CHINESETRANSLATION
 
     DIRECTION_RADIOBUTTONS( T_COL_2, T_ROW_2, (T_FULL_WIDTH - T_COL_2 - RSC_SP_DLG_INNERBORDER_RIGHT) )
 
-    CheckBox CB_USE_VARIANTS
-    {
-        HelpID = "svx:CheckBox:DLG_CHINESETRANSLATION:CB_USE_VARIANTS";
-        Pos = MAP_APPFONT( T_COL_3, T_ROW_4 );
-        Size = MAP_APPFONT ( T_FULL_WIDTH - T_COL_3 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_CHECKBOX_HEIGHT ) ;
-
-        Text [ en-US ] = "~Use Taiwan, Hong Kong SAR, and Macao SAR character variants";
-    };
-
     FixedLine FL_COMMONTERMS
     {
         Pos = MAP_APPFONT ( T_COL_1 , T_ROW_5 ) ;
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
index 75776b7..b766059 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -230,7 +230,7 @@ uno::Any SAL_CALL ChineseTranslation_UnoDialog::getPropertyValue( const ::rtl::O
         SolarMutexGuard aSolarGuard;
         if( m_bDisposed || m_bInDispose || !m_pDialog )
             return aRet;
-        m_pDialog->getSettings( bDirectionToSimplified, bUseCharacterVariants, bTranslateCommonTerms );
+        m_pDialog->getSettings( bDirectionToSimplified, bTranslateCommonTerms );
     }
 
     if( rPropertyName.equals( C2U("IsDirectionToSimplified") ) )
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
index f04fd6d..f50679c 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
@@ -48,7 +48,6 @@ ChineseTranslationDialog::ChineseTranslationDialog( Window* pParent )
     , m_aFL_Direction( this, TextConversionDlgs_ResId( FL_DIRECTION ) )
     , m_aRB_To_Simplified( this, TextConversionDlgs_ResId( RB_TO_SIMPLIFIED ) )
     , m_aRB_To_Traditional( this, TextConversionDlgs_ResId( RB_TO_TRADITIONAL ) )
-    , m_aCB_Use_Variants( this, TextConversionDlgs_ResId( CB_USE_VARIANTS ) )
     , m_aFL_Commonterms( this, TextConversionDlgs_ResId( FL_COMMONTERMS ) )
     , m_aCB_Translate_Commonterms( this, TextConversionDlgs_ResId( CB_TRANSLATE_COMMONTERMS ) )
     , m_aPB_Editterms( this, TextConversionDlgs_ResId( PB_EDITTERMS ) )
@@ -62,7 +61,6 @@ ChineseTranslationDialog::ChineseTranslationDialog( Window* pParent )
 
     m_aRB_To_Simplified.SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED );
     m_aRB_To_Traditional.SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL );
-    m_aCB_Use_Variants.SetHelpId( HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS );
 
     SvtLinguConfig  aLngCfg;
     sal_Bool bValue = sal_Bool();
@@ -73,29 +71,12 @@ ChineseTranslationDialog::ChineseTranslationDialog( Window* pParent )
     else
         m_aRB_To_Traditional.Check();
 
-    aAny = aLngCfg.GetProperty( rtl::OUString( UPN_IS_USE_CHARACTER_VARIANTS ) );
-    if( aAny >>= bValue )
-        m_aCB_Use_Variants.Check( bValue );
-
-    // #117820# (search for other occurrences!)
-    // disable and hide that checkbox until it is decided if it is needed or not.
-    // If it is to be removed later the respective code needs to be removed as
-    // well, otherwise we just have to remove the next lines again.
-    m_aCB_Use_Variants.Check( sal_False );
-    m_aCB_Use_Variants.Enable( sal_False );
-    m_aCB_Use_Variants.Show( sal_False );
-
     aAny = aLngCfg.GetProperty( rtl::OUString( UPN_IS_TRANSLATE_COMMON_TERMS ) );
     if( aAny >>= bValue )
         m_aCB_Translate_Commonterms.Check( bValue );
 
     m_aPB_Editterms.SetClickHdl( LINK( this, ChineseTranslationDialog, DictionaryHdl ) );
-    m_aRB_To_Simplified.SetClickHdl( LINK( this, ChineseTranslationDialog, DirectionHdl ) );
-    m_aRB_To_Traditional.SetClickHdl( LINK( this, ChineseTranslationDialog, DirectionHdl ) );
-    m_aCB_Translate_Commonterms.SetClickHdl( LINK( this, ChineseTranslationDialog, CommonTermsHdl ) );
     m_aBP_OK.SetClickHdl( LINK( this, ChineseTranslationDialog, OkHdl ) );
-
-    impl_UpdateVariantsCheckBox();
 }
 
 ChineseTranslationDialog::~ChineseTranslationDialog()
@@ -109,34 +90,12 @@ ChineseTranslationDialog::~ChineseTranslationDialog()
 }
 
 void ChineseTranslationDialog::getSettings( sal_Bool& rbDirectionToSimplified
-                                          , sal_Bool& rbUseCharacterVariants
                                           , sal_Bool& rbTranslateCommonTerms ) const
 {
     rbDirectionToSimplified = m_aRB_To_Simplified.IsChecked();
-    rbUseCharacterVariants = m_aCB_Use_Variants.IsChecked();
     rbTranslateCommonTerms = m_aCB_Translate_Commonterms.IsChecked();
 }
 
-void ChineseTranslationDialog::impl_UpdateVariantsCheckBox()
-{
-// #117820# (search for other occurrences!)
-//    m_aCB_Use_Variants.Enable( m_aRB_To_Traditional.IsChecked() );
-}
-
-IMPL_LINK_NOARG(ChineseTranslationDialog, DirectionHdl)
-{
-    impl_UpdateVariantsCheckBox();
-    return 0;
-}
-
-IMPL_LINK_NOARG(ChineseTranslationDialog, CommonTermsHdl)
-{
-// #117820# (search for other occurrences!)
-//    if( m_aCB_Translate_Commonterms.IsChecked() && m_aRB_To_Traditional.IsChecked() )
-//        m_aCB_Use_Variants.Check( true );
-    return 0;
-}
-
 IMPL_LINK_NOARG(ChineseTranslationDialog, OkHdl)
 {
     //save settings to configuration
@@ -144,8 +103,6 @@ IMPL_LINK_NOARG(ChineseTranslationDialog, OkHdl)
     Any aAny;
     aAny <<= sal_Bool( !!m_aRB_To_Simplified.IsChecked() );
     aLngCfg.SetProperty( rtl::OUString( UPN_IS_DIRECTION_TO_SIMPLIFIED ), aAny );
-    aAny <<= sal_Bool( !!m_aCB_Use_Variants.IsChecked() );
-    aLngCfg.SetProperty( rtl::OUString( UPN_IS_USE_CHARACTER_VARIANTS ), aAny );
     aAny <<= sal_Bool( !!m_aCB_Translate_Commonterms.IsChecked() );
     aLngCfg.SetProperty( rtl::OUString( UPN_IS_TRANSLATE_COMMON_TERMS ), aAny );
 
@@ -174,9 +131,6 @@ IMPL_LINK_NOARG(ChineseTranslationDialog, DictionaryHdl)
             sal_Int32 nTextConversionOptions = i18n::TextConversionOption::NONE;
             if( !m_aCB_Translate_Commonterms.IsChecked() )
                 nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
-            if( m_aCB_Use_Variants.IsChecked() )
-                nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::USE_CHARACTER_VARIANTS;
-
             m_pDictionaryDialog->setDirectionAndTextConversionOptions( m_aRB_To_Simplified.IsChecked(), nTextConversionOptions );
             m_pDictionaryDialog->Execute();
         }
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
index 1dc0d25..a1b3217 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
@@ -43,12 +43,10 @@ public:
     virtual ~ChineseTranslationDialog();
 
     void getSettings( sal_Bool& rbDirectionToSimplified
-                    , sal_Bool& rbUseCharacterVariants
                     , sal_Bool& rbTranslateCommonTerms ) const;
 
 private:
     DECL_LINK( DictionaryHdl, void* );
-    DECL_LINK( DirectionHdl, void* );
     DECL_LINK( CommonTermsHdl, void* );
     DECL_LINK( OkHdl, void* );
     void impl_UpdateVariantsCheckBox();
@@ -58,7 +56,6 @@ private:
 
     RadioButton m_aRB_To_Simplified;
     RadioButton m_aRB_To_Traditional;
-    CheckBox    m_aCB_Use_Variants;
 
     FixedLine   m_aFL_Commonterms;
 
diff --git a/svx/util/hidother.src b/svx/util/hidother.src
index e6ba512..6e1eef9 100644
--- a/svx/util/hidother.src
+++ b/svx/util/hidother.src
@@ -56,7 +56,6 @@ hidspecial HID_SVX_CHINESE_DICTIONARY_LB_TO_SIMPLIFIED { HelpId = HID_SVX_CHINES
 hidspecial HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL { HelpId = HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL; };
 hidspecial HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED { HelpId = HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED; };
 hidspecial HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL { HelpId = HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL; };
-hidspecial HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS { HelpId = HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS; };
 hidspecial HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED { HelpId = HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED; };
 hidspecial HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL { HelpId = HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL; };
 hidspecial UID_FORMPROPBROWSER_FRAME            { HelpID =  UID_FORMPROPBROWSER_FRAME       ;};
commit 9770ffa271f5ba6cbb4370ea9233bf209f0a27cf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 22 12:59:50 2013 +0000

    remove unused chinese_translationdialog.src, see chinese_dialogs.src
    
    Change-Id: If32174be8ec197f83797a3e06b60c9114d4ce21f

diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
deleted file mode 100644
index 2dc1c61..0000000
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "chinese_translationdialog.hrc"
-#include "chinese_direction.hrc"
-
-#include <svtools/controldims.hrc>
-
-//-----------------------------------------------------------------------------
-//defines for positions and sizes:
-
-#define FULL_WIDTH (220)
-#define FULL_HEIGHT (120)
-#define EDITBUTTON_WIDTH (75)
-
-#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
-#define COL_2 (COL_1+RSC_SP_FLGR_SPACE_X)
-#define COL_3 (COL_2+RSC_SP_CHK_TEXTINDENT)
-#define COL_4 (FULL_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-EDITBUTTON_WIDTH)
-
-#define ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
-#define ROW_2 (ROW_1+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_GROUP_Y)
-#define ROW_3 (ROW_2+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
-#define ROW_4 (ROW_3+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
-#define ROW_5 (ROW_4+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y)
-#define ROW_6 (ROW_5+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_GROUP_Y)
-
-#define ROW_8 (FULL_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT)
-#define ROW_7 (ROW_8-RSC_CD_FIXEDLINE_HEIGHT-2)
-
-//-----------------------------------------------------------------------------
-
-ModalDialog DLG_CHINESETRANSLATION
-{
-    HelpID = "svx:ModalDialog:DLG_CHINESETRANSLATION";
-    //HelpId = ;
-    Size = MAP_APPFONT( FULL_WIDTH, FULL_HEIGHT );
-    OutputSize = TRUE;
-    Closeable = TRUE ;
-    Moveable = TRUE ;
-    SVLook = TRUE;
-
-    Text [ en-US ] = "Chinese Conversion";
-
-    FixedLine FL_DIRECTION
-    {
-        Pos = MAP_APPFONT ( COL_1 , ROW_1 ) ;
-        Size = MAP_APPFONT ( FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
-        Text [ en-US ] = "Conversion direction";
-    };
-
-    DIRECTION_RADIOBUTTONS( COL_2, ROW_2, (FULL_WIDTH - COL_2 - RSC_SP_DLG_INNERBORDER_RIGHT) )
-
-    CheckBox CB_USE_VARIANTS
-    {
-        HelpID = "svx:CheckBox:DLG_CHINESETRANSLATION:CB_USE_VARIANTS";
-        Pos = MAP_APPFONT( COL_3, ROW_4 );
-        Size = MAP_APPFONT ( FULL_WIDTH - COL_3 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_CHECKBOX_HEIGHT ) ;
-
-        Text [ en-US ] = "~Use Taiwan, Hong Kong SAR, and Macao SAR character variants";
-    };
-
-    FixedLine FL_COMMONTERMS
-    {
-        Pos = MAP_APPFONT ( COL_1 , ROW_5 ) ;
-        Size = MAP_APPFONT ( FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
-        Text [ en-US ] = "Common terms";
-    };
-
-    CheckBox CB_TRANSLATE_COMMONTERMS
-    {
-        HelpID = "svx:CheckBox:DLG_CHINESETRANSLATION:CB_TRANSLATE_COMMONTERMS";
-        Pos = MAP_APPFONT( COL_2, ROW_6 );
-        Size = MAP_APPFONT ( COL_4 - COL_2, RSC_CD_CHECKBOX_HEIGHT ) ;
-
-        Text [ en-US ] = "Translate ~common terms";
-    };
-
-    PushButton PB_EDITTERMS
-    {
-        HelpID = "svx:PushButton:DLG_CHINESETRANSLATION:PB_EDITTERMS";
-        Pos = MAP_APPFONT( COL_4, ROW_6-(RSC_CD_PUSHBUTTON_HEIGHT-RSC_CD_CHECKBOX_HEIGHT)/2 );
-        Size = MAP_APPFONT( EDITBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
-
-        Text [ en-US ] = "~Edit Terms...";
-    };
-
-    FixedLine FL_BOTTOMLINE
-    {
-        Pos = MAP_APPFONT ( 0 , ROW_7 ) ;
-        Size = MAP_APPFONT ( FULL_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ) ;
-    };
-
-    BUTTONS_OK_CANCEL_HELP_ABREAST( FULL_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT, ROW_8 )
-};
commit 4c9ca21ef827a72529ca135ccba2701a79350ed6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 22 13:35:19 2013 +0000

    remove redundant a11y/l10n-confusing pages label and set mnemonic widgets
    
    Change-Id: I1773eaa2db904e1f7cec65bb294ff38e3ce06251

diff --git a/sw/uiconfig/swriter/ui/titlepage.ui b/sw/uiconfig/swriter/ui/titlepage.ui
index 8164335..92acb22 100644
--- a/sw/uiconfig/swriter/ui/titlepage.ui
+++ b/sw/uiconfig/swriter/ui/titlepage.ui
@@ -1,6 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="lower">1</property>
+    <property name="upper">65535</property>
+    <property name="value">1</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkDialog" id="DLG_TITLEPAGE">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
@@ -96,6 +103,8 @@
                             <property name="halign">start</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">Number of title pages</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">NF_PAGE_COUNT</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
@@ -110,6 +119,10 @@
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">Place title pages at</property>
+                            <accessibility>
+                              <relation type="label-for" target="RB_DOCUMENT_START"/>
+                              <relation type="label-for" target="RB_PAGE_START"/>
+                            </accessibility>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
@@ -119,21 +132,6 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="label8">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="halign">start</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">pages</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="width">2</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
                           <object class="GtkSpinButton" id="NF_PAGE_COUNT">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -163,11 +161,14 @@
                             <property name="adjustment">adjustment1</property>
                             <property name="climb_rate">1</property>
                             <property name="numeric">True</property>
+                            <accessibility>
+                              <relation type="labelled-by" target="RB_PAGE_START"/>
+                            </accessibility>
                           </object>
                           <packing>
                             <property name="left_attach">2</property>
                             <property name="top_attach">4</property>
-                            <property name="width">2</property>
+                            <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
                         </child>
@@ -186,7 +187,7 @@
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
-                            <property name="width">4</property>
+                            <property name="width">3</property>
                             <property name="height">1</property>
                           </packing>
                         </child>
@@ -205,7 +206,7 @@
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">1</property>
-                            <property name="width">4</property>
+                            <property name="width">3</property>
                             <property name="height">1</property>
                           </packing>
                         </child>
@@ -219,11 +220,14 @@
                             <property name="active">True</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">RB_PAGE_START</property>
+                            <accessibility>
+                              <relation type="labelled-by" target="label7"/>
+                            </accessibility>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="top_attach">3</property>
-                            <property name="width">3</property>
+                            <property name="width">2</property>
                             <property name="height">1</property>
                           </packing>
                         </child>
@@ -237,6 +241,9 @@
                             <property name="active">True</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">RB_DOCUMENT_START</property>
+                            <accessibility>
+                              <relation type="labelled-by" target="label7"/>
+                            </accessibility>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -248,6 +255,9 @@
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </object>
                     </child>
                   </object>
@@ -311,6 +321,8 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">Page number</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">NF_RESTART_NUMBERING</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -366,6 +378,8 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">Page number</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">NF_SET_PAGE_NUMBER</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -493,11 +507,4 @@
       <action-widget response="0">PB_HELP</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="lower">1</property>
-    <property name="upper">65535</property>
-    <property name="value">1</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
 </interface>
commit 0769d264934210fe2bcae3024a137c3c9f19da1a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 22 16:20:08 2013 +0000

    default forward VclBuilder GetAccessibleName to its label
    
    Change-Id: I54f1761a5151067cb28b1773a1a188dd92c66bd1

diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 2e48cd8..b91534d 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -450,6 +450,7 @@ public:
 protected:
     virtual Size calculateRequisition() const;
     virtual void setAllocation(const Size &rAllocation);
+    virtual OUString getDefaultAccessibleName() const;
 };
 
 class VCL_DLLPUBLIC VclAlignment : public VclBin
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 88f39b5..ccd599a 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -581,6 +581,7 @@ protected:
     // Let Label override the code part of GetAccessibleRelationLabelFor
     virtual Window* getAccessibleRelationLabelFor() const;
     virtual sal_uInt16 getDefaultAccessibleRole() const;
+    virtual OUString getDefaultAccessibleName() const;
 public:
     // Single argument ctors shall be explicit.
     explicit            Window( Window* pParent, WinBits nStyle = 0 );
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 5ebffdc..87c87d4 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1070,6 +1070,14 @@ void VclFrame::set_label(const rtl::OUString &rLabel)
     pLabel->SetText(rLabel);
 }
 
+OUString VclFrame::getDefaultAccessibleName() const
+{
+    const Window *pLabel = get_label_widget();
+    if (pLabel)
+        return pLabel->GetAccessibleName();
+    return VclBin::getDefaultAccessibleName();
+}
+
 Size VclAlignment::calculateRequisition() const
 {
     Size aRet(m_nLeftPadding + m_nRightPadding,
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 842c94c..6767fde 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -8882,64 +8882,62 @@ void Window::SetAccessibleName( const String& rName )
 
 String Window::GetAccessibleName() const
 {
-    String aAccessibleName;
-    if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pAccessibleName )
-    {
-        aAccessibleName = *mpWindowImpl->mpAccessibleInfos->pAccessibleName;
-    }
-    else
+    if (mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pAccessibleName)
+        return *mpWindowImpl->mpAccessibleInfos->pAccessibleName;
+    return getDefaultAccessibleName();
+}
+
+OUString Window::getDefaultAccessibleName() const
+{
+    OUString aAccessibleName;
+    switch ( GetType() )
     {
-        switch ( GetType() )
-        {
-            case WINDOW_MULTILINEEDIT:
-            case WINDOW_PATTERNFIELD:
-            case WINDOW_NUMERICFIELD:
-            case WINDOW_METRICFIELD:
-            case WINDOW_CURRENCYFIELD:
-            case WINDOW_LONGCURRENCYFIELD:
-            case WINDOW_CALCINPUTLINE:
-            case WINDOW_EDIT:
-
-            case WINDOW_DATEBOX:
-            case WINDOW_TIMEBOX:
-            case WINDOW_CURRENCYBOX:
-            case WINDOW_LONGCURRENCYBOX:
-            case WINDOW_DATEFIELD:
-            case WINDOW_TIMEFIELD:
-            case WINDOW_SPINFIELD:
-
-            case WINDOW_COMBOBOX:
-            case WINDOW_LISTBOX:
-            case WINDOW_MULTILISTBOX:
-            case WINDOW_TREELISTBOX:
-            case WINDOW_METRICBOX:
-            {
-                Window *pLabel = GetAccessibleRelationLabeledBy();
-                if ( pLabel && pLabel != this )
-                    aAccessibleName = pLabel->GetText();
-            }
-            break;
+        case WINDOW_MULTILINEEDIT:
+        case WINDOW_PATTERNFIELD:
+        case WINDOW_NUMERICFIELD:
+        case WINDOW_METRICFIELD:
+        case WINDOW_CURRENCYFIELD:
+        case WINDOW_LONGCURRENCYFIELD:
+        case WINDOW_CALCINPUTLINE:
+        case WINDOW_EDIT:
 
-            case WINDOW_IMAGEBUTTON:
-            case WINDOW_PUSHBUTTON:
-                aAccessibleName = GetText();
-                if ( !aAccessibleName.Len() )
-                {
-                    aAccessibleName = GetQuickHelpText();
-                    if ( !aAccessibleName.Len() )
-                        aAccessibleName = GetHelpText();
-                }
-            break;
+        case WINDOW_DATEBOX:
+        case WINDOW_TIMEBOX:
+        case WINDOW_CURRENCYBOX:
+        case WINDOW_LONGCURRENCYBOX:
+        case WINDOW_DATEFIELD:
+        case WINDOW_TIMEFIELD:
+        case WINDOW_SPINFIELD:
 
-            default:
-                aAccessibleName = GetText();
-                break;
+        case WINDOW_COMBOBOX:
+        case WINDOW_LISTBOX:
+        case WINDOW_MULTILISTBOX:
+        case WINDOW_TREELISTBOX:
+        case WINDOW_METRICBOX:
+        {
+            Window *pLabel = GetAccessibleRelationLabeledBy();
+            if ( pLabel && pLabel != this )
+                aAccessibleName = pLabel->GetText();
         }
+        break;
 
-        aAccessibleName = GetNonMnemonicString( aAccessibleName );
+        case WINDOW_IMAGEBUTTON:
+        case WINDOW_PUSHBUTTON:
+            aAccessibleName = GetText();
+            if (aAccessibleName.isEmpty())
+            {
+                aAccessibleName = GetQuickHelpText();
+                if (aAccessibleName.isEmpty())
+                    aAccessibleName = GetHelpText();
+            }
+        break;
+
+        default:
+            aAccessibleName = GetText();
+            break;
     }
 
-    return aAccessibleName;
+    return GetNonMnemonicString( aAccessibleName );
 }
 
 void Window::SetAccessibleDescription( const String& rDescription )
commit 9f53172abd921d03bb7b1c5b0e5cf29f2cd65965
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 22 13:26:27 2013 +0000

    implement loading Mnemonic Widgets via VclBuilder
    
    Change-Id: I62677c1140e58fbf4f27750389200eca78c9ba7e

diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index ab0b1f6..220e5b1 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -98,6 +98,7 @@ private:
     typedef StringPair TextBufferMap;
     typedef StringPair WidgetAdjustmentMap;
     typedef StringPair ButtonMenuMap;
+    typedef StringPair MnemonicWidgetMap;
 
     struct ComboBoxModelMap
     {
@@ -180,6 +181,8 @@ private:
         std::vector<SizeGroup> m_aSizeGroups;
 
         AtkMap m_aAtkInfo;
+
+        std::vector<MnemonicWidgetMap> m_aMnemonicWidgetMaps;
     };
 
     void loadTranslations(const com::sun::star::lang::Locale &rLocale, const OUString &rUri);
@@ -262,6 +265,7 @@ private:
     bool extractScrollAdjustment(const OString &id, stringmap &rVec);
     bool extractButtonImage(const OString &id, stringmap &rMap, bool bRadio);
     bool extractStock(const OString &id, stringmap &rMap);
+    void extractMnemonicWidget(const OString &id, stringmap &rMap);
 
     void handleTranslations(xmlreader::XmlReader &reader);
 
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index c5cef79..e564823 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -160,6 +160,17 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
 
     handleChild(pParent, reader);
 
+    //Set Mnemonic widgets when everything has been imported
+    for (std::vector<MnemonicWidgetMap>::iterator aI = m_pParserState->m_aMnemonicWidgetMaps.begin(),
+        aEnd = m_pParserState->m_aMnemonicWidgetMaps.end(); aI != aEnd; ++aI)
+    {
+        FixedText *pOne = get<FixedText>(aI->m_sID);
+        Window *pOther = get<Window>(aI->m_sValue);
+        SAL_WARN_IF(!pOne || !pOther, "vcl", "missing member of Mnemonic Widget Mapping");
+        if (pOne && pOther)
+            pOne->set_mnemonic_widget(pOther);
+    }
+
     //Set a11y relations when everything has been imported
     for (AtkMap::iterator aI = m_pParserState->m_aAtkInfo.begin(),
          aEnd = m_pParserState->m_aAtkInfo.end(); aI != aEnd; ++aI)
@@ -781,6 +792,16 @@ bool VclBuilder::extractButtonImage(const OString &id, stringmap &rMap, bool bRa
     return false;
 }
 
+void VclBuilder::extractMnemonicWidget(const OString &id, stringmap &rMap)
+{
+    VclBuilder::stringmap::iterator aFind = rMap.find(OString("mnemonic-widget"));
+    if (aFind != rMap.end())
+    {
+        m_pParserState->m_aMnemonicWidgetMaps.push_back(MnemonicWidgetMap(id, aFind->second));
+        rMap.erase(aFind);
+    }
+}
+
 Window* VclBuilder::prepareWidgetOwnScrolling(Window *pParent, WinBits &rWinStyle)
 {
     //For Widgets that manage their own scrolling, if one appears as a child of
@@ -1011,6 +1032,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
     }
     else if (name == "GtkLabel")
     {
+        extractMnemonicWidget(id, rMap);
         if (extractSelectable(rMap))
             pWindow = new SelectableFixedText(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK);
         else
commit 9975c632c3bd142f295fc1d9b1fd6059c3a2dbcb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 22 10:20:15 2013 +0000

    rework accessibility to be layout aware
    
    Change-Id: I9f8ddfc5007dad6f090abae7e3e0a2d637da0b37

diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx
index 7e15025..efa5f92 100644
--- a/vcl/inc/vcl/fixed.hxx
+++ b/vcl/inc/vcl/fixed.hxx
@@ -38,6 +38,7 @@ class VCL_DLLPUBLIC FixedText : public Control
 private:
     sal_Int32 m_nMaxWidthChars;
     sal_Int32 m_nMinWidthChars;
+    Window *m_pMnemonicWindow;
 
     using Control::ImplInitSettings;
     using Window::ImplInit;
@@ -55,10 +56,13 @@ protected:
     virtual const Color&
                     GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
 
+    virtual Window* getAccessibleRelationLabelFor() const;
+
 public:
                     FixedText( Window* pParent, WinBits nStyle = 0 );
                     FixedText( Window* pParent, const ResId& rResId );
                     FixedText( Window* pParent, const ResId& rResId, bool bDisableAccessibleLabelForRelation );
+                    ~FixedText();
 
     virtual void    Paint( const Rectangle& rRect );
     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
@@ -75,6 +79,8 @@ public:
     Size            CalcMinimumSize(long nMaxWidth = 0x7fffffff) const;
     virtual Size    GetOptimalSize() const;
     virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue);
+    void set_mnemonic_widget(Window *pWindow);
+    Window* get_mnemonic_widget() const { return m_pMnemonicWindow; }
 };
 
 class VCL_DLLPUBLIC SelectableFixedText : public Edit
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 073433f..2e48cd8 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -44,6 +44,7 @@ public:
 protected:
     virtual Size calculateRequisition() const = 0;
     virtual void setAllocation(const Size &rAllocation) = 0;
+    virtual sal_uInt16 getDefaultAccessibleRole() const;
 private:
     bool m_bLayoutDirty;
 };
@@ -78,6 +79,7 @@ public:
     }
     virtual bool set_property(const OString &rKey, const OString &rValue);
 protected:
+    virtual sal_uInt16 getDefaultAccessibleRole() const;
     void accumulateMaxes(const Size &rChildSize, Size &rSize) const;
     Size finalizeMaxes(const Size &rSize, sal_uInt16 nVisibleChildren) const;
 
@@ -672,6 +674,11 @@ inline bool isContainerWindow(const Window &rWindow)
     return (eType == WINDOW_CONTAINER || eType == WINDOW_SCROLLWINDOW);
 }
 
+inline bool isContainerWindow(const Window *pWindow)
+{
+    return pWindow && isContainerWindow(*pWindow);
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index d9aa034..88f39b5 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -53,6 +53,7 @@ class Cursor;
 class DockingManager;
 class ScrollBar;
 class Bitmap;
+class FixedText;
 class Image;
 class MouseEvent;
 class KeyEvent;
@@ -571,6 +572,15 @@ protected:
 
     // FIXME: this is a hack to workaround missing layout functionality
     SAL_DLLPRIVATE void ImplAdjustNWFSizes();
+
+    // These eventually are supposed to go when everything is converted to .ui
+    SAL_DLLPRIVATE Window* getLegacyNonLayoutAccessibleRelationMemberOf() const;
+    SAL_DLLPRIVATE Window* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
+    SAL_DLLPRIVATE Window* getLegacyNonLayoutAccessibleRelationLabelFor() const;
+
+    // Let Label override the code part of GetAccessibleRelationLabelFor
+    virtual Window* getAccessibleRelationLabelFor() const;
+    virtual sal_uInt16 getDefaultAccessibleRole() const;
 public:
     // Single argument ctors shall be explicit.
     explicit            Window( Window* pParent, WinBits nStyle = 0 );
@@ -1223,6 +1233,13 @@ public:
     void remove_from_all_size_groups();
 
     /*
+     * add/remove mnemonic label
+     */
+    void add_mnemonic_label(FixedText *pLabel);
+    void remove_mnemonic_label(FixedText *pLabel);
+    std::vector<FixedText*> list_mnemonic_labels() const;
+
+    /*
      * Move this widget to be the nNewPosition'd child of its parent
      */
     void reorderWithinParent(sal_uInt16 nNewPosition);
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 1785be2..53c59dc 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -43,6 +43,7 @@ struct SalPaintEvent;
 struct ImplDelData;
 struct ImplAccessibleInfos;
 
+class FixedText;
 class Window;
 class VclSizeGroup;
 class VirtualDevice;
@@ -285,6 +286,7 @@ public:
     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer;
     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
     ::boost::shared_ptr< VclSizeGroup > m_xSizeGroup;
+    ::std::vector< FixedText* > m_aMnemonicLabels;
     ImplAccessibleInfos* mpAccessibleInfos;
     VCLXWindow*         mpVCLXWindow;
     Region              maWinRegion;        // region to 'shape' the VCL window (frame coordinates)
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 42b150c..ca7b2e8 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -151,6 +151,7 @@ FixedText::FixedText( Window* pParent, WinBits nStyle )
     : Control(WINDOW_FIXEDTEXT)
     , m_nMaxWidthChars(-1)
     , m_nMinWidthChars(-1)
+    , m_pMnemonicWindow(NULL)
 {
     ImplInit( pParent, nStyle );
 }
@@ -161,6 +162,7 @@ FixedText::FixedText( Window* pParent, const ResId& rResId )
     : Control(WINDOW_FIXEDTEXT)
     , m_nMaxWidthChars(-1)
     , m_nMinWidthChars(-1)
+    , m_pMnemonicWindow(NULL)
 {
     rResId.SetRT( RSC_TEXT );
     WinBits nStyle = ImplInitRes( rResId );
@@ -177,6 +179,7 @@ FixedText::FixedText( Window* pParent, const ResId& rResId, bool bDisableAccessi
     : Control( WINDOW_FIXEDTEXT )
     , m_nMaxWidthChars(-1)
     , m_nMinWidthChars(-1)
+    , m_pMnemonicWindow(NULL)
 {
     rResId.SetRT( RSC_TEXT );
     WinBits nStyle = ImplInitRes( rResId );
@@ -476,6 +479,34 @@ bool FixedText::set_property(const rtl::OString &rKey, const rtl::OString &rValu
     return true;
 }
 
+Window* FixedText::getAccessibleRelationLabelFor() const
+{
+    Window *pWindow = Control::getAccessibleRelationLabelFor();
+    if (pWindow)
+        return pWindow;
+    return get_mnemonic_widget();
+}
+
+void FixedText::set_mnemonic_widget(Window *pWindow)
+{
+    if (pWindow == m_pMnemonicWindow)
+        return;
+    if (m_pMnemonicWindow)
+    {
+        Window *pTempReEntryGuard = m_pMnemonicWindow;
+        m_pMnemonicWindow = NULL;
+        pTempReEntryGuard->remove_mnemonic_label(this);
+    }
+    m_pMnemonicWindow = pWindow;
+    if (m_pMnemonicWindow)
+        m_pMnemonicWindow->add_mnemonic_label(this);
+}
+
+FixedText::~FixedText()
+{
+    set_mnemonic_widget(NULL);
+}
+
 SelectableFixedText::SelectableFixedText(Window* pParent, WinBits nStyle)
     : Edit(pParent, nStyle)
 {
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index be3697e..15078a0 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -24,6 +24,7 @@
 #include <window.h>
 
 #include <vcl/event.hxx>
+#include <vcl/fixed.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/tabpage.hxx>
@@ -434,6 +435,16 @@ static Window* ImplFindAccelWindow( Window* pParent, sal_uInt16& rIndex, sal_Uni
             cCompareChar = xCharClass->toUpper( rtl::OUString(cCompareChar), 0, 1, rLocale )[0];
             if ( cCompareChar == cCharCode )
             {
+                if (pWindow->GetType() == WINDOW_FIXEDTEXT)
+                {
+                    FixedText *pFixedText = static_cast<FixedText*>(pWindow);
+                    Window *pMnemonicWidget = pFixedText->get_mnemonic_widget();
+                    SAL_WARN_IF(isContainerWindow(pFixedText->GetParent()) && !pMnemonicWidget,
+                        "vcl.a11y", "label missing mnemonic_widget?");
+                    if (pMnemonicWidget)
+                        return pMnemonicWidget;
+                }
+
                 // Bei Static-Controls auf das naechste Controlm weiterschalten
                 if ( (pWindow->GetType() == WINDOW_FIXEDTEXT)   ||
                      (pWindow->GetType() == WINDOW_FIXEDLINE)   ||
@@ -1207,15 +1218,8 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window
     return pWindow;
 }
 
-Window* Window::GetAccessibleRelationLabelFor() const
+Window* Window::getLegacyNonLayoutAccessibleRelationLabelFor() const
 {
-    if ( mpWindowImpl->mbDisableAccessibleLabelForRelation )
-        return NULL;
-
-    if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabelForWindow )
-        return mpWindowImpl->mpAccessibleInfos->pLabelForWindow;
-
-
     Window* pWindow = NULL;
     Window* pFrameWindow = ImplGetFrameWindow();
 
@@ -1296,14 +1300,8 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo
     return pWindow;
 }
 
-Window* Window::GetAccessibleRelationLabeledBy() const
+Window* Window::getLegacyNonLayoutAccessibleRelationLabeledBy() const
 {
-    if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation )
-        return NULL;
-
-    if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow )
-        return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow;
-
     Window* pWindow = NULL;
     Window* pFrameWindow = ImplGetFrameWindow();
 
@@ -1332,11 +1330,8 @@ Window* Window::GetAccessibleRelationLabeledBy() const
     return pWindow;
 }
 
-Window* Window::GetAccessibleRelationMemberOf() const
+Window* Window::getLegacyNonLayoutAccessibleRelationMemberOf() const
 {
-    if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pMemberOfWindow )
-        return mpWindowImpl->mpAccessibleInfos->pMemberOfWindow;
-
     Window* pWindow = NULL;
     Window* pFrameWindow = GetParent();
     if ( !pFrameWindow )
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index ddf0a5b..5ebffdc 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <vcl/dialog.hxx>
 #include <vcl/layout.hxx>
 #include "window.h"
@@ -21,6 +22,11 @@ VclContainer::VclContainer(Window *pParent, WinBits nStyle)
     SetBackground();
 }
 
+sal_uInt16 VclContainer::getDefaultAccessibleRole() const
+{
+    return com::sun::star::accessibility::AccessibleRole::PANEL;
+}
+
 Size VclContainer::GetOptimalSize() const
 {
     return calculateRequisition();
@@ -296,6 +302,11 @@ bool VclBox::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
     return true;
 }
 
+sal_uInt16 VclBox::getDefaultAccessibleRole() const
+{
+    return com::sun::star::accessibility::AccessibleRole::FILLER;
+}
+
 #define DEFAULT_CHILD_MIN_WIDTH 85
 #define DEFAULT_CHILD_MIN_HEIGHT 27
 
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 34b2d49..842c94c 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -29,6 +29,7 @@
 #include "vcl/layout.hxx"
 #include "vcl/salgtype.hxx"
 #include "vcl/event.hxx"
+#include "vcl/fixed.hxx"
 #include "vcl/help.hxx"
 #include "vcl/cursor.hxx"
 #include "vcl/svapp.hxx"
@@ -4484,6 +4485,14 @@ Window::~Window()
     // remove from size-group if necessary
     remove_from_all_size_groups();
 
+    // clear mnemonic labels
+    std::vector<FixedText*> aMnemonicLabels(list_mnemonic_labels());
+    for (std::vector<FixedText*>::iterator aI = aMnemonicLabels.begin();
+        aI != aMnemonicLabels.end(); ++aI)
+    {
+        remove_mnemonic_label(*aI);
+    }
+
     // hide window in order to trigger the Paint-Handling
     Hide();
 
@@ -8726,134 +8735,139 @@ void Window::SetAccessibleRole( sal_uInt16 nRole )
     mpWindowImpl->mpAccessibleInfos->nAccessibleRole = nRole;
 }
 
-sal_uInt16 Window::GetAccessibleRole() const
+sal_uInt16 Window::getDefaultAccessibleRole() const
 {
-    using namespace ::com::sun::star;
-
-    sal_uInt16 nRole = mpWindowImpl->mpAccessibleInfos ? mpWindowImpl->mpAccessibleInfos->nAccessibleRole : 0xFFFF;
-    if ( nRole == 0xFFFF )
+    sal_uInt16 nRole = 0xFFFF;
+    switch ( GetType() )
     {
-        switch ( GetType() )
-        {
-            case WINDOW_MESSBOX:    // MT: Would be nice to have special roles!
-            case WINDOW_INFOBOX:
-            case WINDOW_WARNINGBOX:
-            case WINDOW_ERRORBOX:
-            case WINDOW_QUERYBOX: nRole = accessibility::AccessibleRole::ALERT; break;
+        case WINDOW_MESSBOX:    // MT: Would be nice to have special roles!
+        case WINDOW_INFOBOX:
+        case WINDOW_WARNINGBOX:
+        case WINDOW_ERRORBOX:
+        case WINDOW_QUERYBOX: nRole = accessibility::AccessibleRole::ALERT; break;
 
-            case WINDOW_MODELESSDIALOG:
-            case WINDOW_MODALDIALOG:
-            case WINDOW_SYSTEMDIALOG:
-            case WINDOW_PRINTERSETUPDIALOG:
-            case WINDOW_PRINTDIALOG:
-            case WINDOW_TABDIALOG:
-            case WINDOW_BUTTONDIALOG:
-            case WINDOW_DIALOG: nRole = accessibility::AccessibleRole::DIALOG; break;
+        case WINDOW_MODELESSDIALOG:
+        case WINDOW_MODALDIALOG:
+        case WINDOW_SYSTEMDIALOG:
+        case WINDOW_PRINTERSETUPDIALOG:
+        case WINDOW_PRINTDIALOG:
+        case WINDOW_TABDIALOG:
+        case WINDOW_BUTTONDIALOG:
+        case WINDOW_DIALOG: nRole = accessibility::AccessibleRole::DIALOG; break;
 
-            case WINDOW_PUSHBUTTON:
-            case WINDOW_OKBUTTON:
-            case WINDOW_CANCELBUTTON:
-            case WINDOW_HELPBUTTON:
-            case WINDOW_IMAGEBUTTON:
-            case WINDOW_MENUBUTTON:
-            case WINDOW_MOREBUTTON:
-            case WINDOW_SPINBUTTON:
-            case WINDOW_BUTTON: nRole = accessibility::AccessibleRole::PUSH_BUTTON; break;
+        case WINDOW_PUSHBUTTON:
+        case WINDOW_OKBUTTON:
+        case WINDOW_CANCELBUTTON:
+        case WINDOW_HELPBUTTON:
+        case WINDOW_IMAGEBUTTON:
+        case WINDOW_MENUBUTTON:
+        case WINDOW_MOREBUTTON:
+        case WINDOW_SPINBUTTON:
+        case WINDOW_BUTTON: nRole = accessibility::AccessibleRole::PUSH_BUTTON; break;
 
-            case WINDOW_PATHDIALOG: nRole = accessibility::AccessibleRole::DIRECTORY_PANE; break;
-            case WINDOW_FILEDIALOG: nRole = accessibility::AccessibleRole::FILE_CHOOSER; break;
-            case WINDOW_COLORDIALOG: nRole = accessibility::AccessibleRole::COLOR_CHOOSER; break;
-            case WINDOW_FONTDIALOG: nRole = accessibility::AccessibleRole::FONT_CHOOSER; break;
+        case WINDOW_PATHDIALOG: nRole = accessibility::AccessibleRole::DIRECTORY_PANE; break;
+        case WINDOW_FILEDIALOG: nRole = accessibility::AccessibleRole::FILE_CHOOSER; break;
+        case WINDOW_COLORDIALOG: nRole = accessibility::AccessibleRole::COLOR_CHOOSER; break;
+        case WINDOW_FONTDIALOG: nRole = accessibility::AccessibleRole::FONT_CHOOSER; break;
 
-            case WINDOW_IMAGERADIOBUTTON:
-            case WINDOW_RADIOBUTTON: nRole = accessibility::AccessibleRole::RADIO_BUTTON; break;
-            case WINDOW_TRISTATEBOX:
-            case WINDOW_CHECKBOX: nRole = accessibility::AccessibleRole::CHECK_BOX; break;
+        case WINDOW_IMAGERADIOBUTTON:
+        case WINDOW_RADIOBUTTON: nRole = accessibility::AccessibleRole::RADIO_BUTTON; break;
+        case WINDOW_TRISTATEBOX:
+        case WINDOW_CHECKBOX: nRole = accessibility::AccessibleRole::CHECK_BOX; break;
 
-            case WINDOW_MULTILINEEDIT: nRole = accessibility::AccessibleRole::SCROLL_PANE; break;
+        case WINDOW_MULTILINEEDIT: nRole = accessibility::AccessibleRole::SCROLL_PANE; break;
 
-            case WINDOW_PATTERNFIELD:
-            case WINDOW_NUMERICFIELD:
-            case WINDOW_METRICFIELD:
-            case WINDOW_CURRENCYFIELD:
-            case WINDOW_LONGCURRENCYFIELD:
-            case WINDOW_CALCINPUTLINE:
-            case WINDOW_EDIT: nRole = ( GetStyle() & WB_PASSWORD ) ? (accessibility::AccessibleRole::PASSWORD_TEXT) : (accessibility::AccessibleRole::TEXT); break;
+        case WINDOW_PATTERNFIELD:
+        case WINDOW_NUMERICFIELD:
+        case WINDOW_METRICFIELD:
+        case WINDOW_CURRENCYFIELD:
+        case WINDOW_LONGCURRENCYFIELD:
+        case WINDOW_CALCINPUTLINE:
+        case WINDOW_EDIT: nRole = ( GetStyle() & WB_PASSWORD ) ? (accessibility::AccessibleRole::PASSWORD_TEXT) : (accessibility::AccessibleRole::TEXT); break;
 
-            case WINDOW_PATTERNBOX:
-            case WINDOW_NUMERICBOX:
-            case WINDOW_METRICBOX:
-            case WINDOW_CURRENCYBOX:
-            case WINDOW_LONGCURRENCYBOX:
-            case WINDOW_COMBOBOX: nRole = accessibility::AccessibleRole::COMBO_BOX; break;
+        case WINDOW_PATTERNBOX:
+        case WINDOW_NUMERICBOX:
+        case WINDOW_METRICBOX:
+        case WINDOW_CURRENCYBOX:
+        case WINDOW_LONGCURRENCYBOX:
+        case WINDOW_COMBOBOX: nRole = accessibility::AccessibleRole::COMBO_BOX; break;
 
-            case WINDOW_LISTBOX:
-            case WINDOW_MULTILISTBOX: nRole = accessibility::AccessibleRole::LIST; break;
+        case WINDOW_LISTBOX:
+        case WINDOW_MULTILISTBOX: nRole = accessibility::AccessibleRole::LIST; break;
 
-            case WINDOW_TREELISTBOX: nRole = accessibility::AccessibleRole::TREE; break;
+        case WINDOW_TREELISTBOX: nRole = accessibility::AccessibleRole::TREE; break;
 
-            case WINDOW_FIXEDTEXT: nRole = accessibility::AccessibleRole::LABEL; break;
-            case WINDOW_FIXEDLINE: nRole = accessibility::AccessibleRole::SEPARATOR; break;
-            case WINDOW_FIXEDBITMAP:
-            case WINDOW_FIXEDIMAGE: nRole = accessibility::AccessibleRole::ICON; break;
-            case WINDOW_GROUPBOX: nRole = accessibility::AccessibleRole::GROUP_BOX; break;
-            case WINDOW_SCROLLBAR: nRole = accessibility::AccessibleRole::SCROLL_BAR; break;
+        case WINDOW_FIXEDTEXT: nRole = accessibility::AccessibleRole::LABEL; break;
+        case WINDOW_FIXEDLINE: nRole = accessibility::AccessibleRole::SEPARATOR; break;
+        case WINDOW_FIXEDBITMAP:
+        case WINDOW_FIXEDIMAGE: nRole = accessibility::AccessibleRole::ICON; break;
+        case WINDOW_GROUPBOX: nRole = accessibility::AccessibleRole::GROUP_BOX; break;
+        case WINDOW_SCROLLBAR: nRole = accessibility::AccessibleRole::SCROLL_BAR; break;
 
-            case WINDOW_SLIDER:
-            case WINDOW_SPLITTER:
-            case WINDOW_SPLITWINDOW: nRole = accessibility::AccessibleRole::SPLIT_PANE; break;
+        case WINDOW_SLIDER:
+        case WINDOW_SPLITTER:
+        case WINDOW_SPLITWINDOW: nRole = accessibility::AccessibleRole::SPLIT_PANE; break;
 
-            case WINDOW_DATEBOX:
-            case WINDOW_TIMEBOX:
-            case WINDOW_DATEFIELD:
-            case WINDOW_TIMEFIELD: nRole = accessibility::AccessibleRole::DATE_EDITOR; break;
-
-            case WINDOW_SPINFIELD: nRole = accessibility::AccessibleRole::SPIN_BOX; break;
+        case WINDOW_DATEBOX:
+        case WINDOW_TIMEBOX:
+        case WINDOW_DATEFIELD:
+        case WINDOW_TIMEFIELD: nRole = accessibility::AccessibleRole::DATE_EDITOR; break;
 
-            case WINDOW_TOOLBOX: nRole = accessibility::AccessibleRole::TOOL_BAR; break;
-            case WINDOW_STATUSBAR: nRole = accessibility::AccessibleRole::STATUS_BAR; break;
+        case WINDOW_SPINFIELD: nRole = accessibility::AccessibleRole::SPIN_BOX; break;
 
-            case WINDOW_TABPAGE: nRole = accessibility::AccessibleRole::PANEL; break;
-            case WINDOW_TABCONTROL: nRole = accessibility::AccessibleRole::PAGE_TAB_LIST; break;
+        case WINDOW_TOOLBOX: nRole = accessibility::AccessibleRole::TOOL_BAR; break;
+        case WINDOW_STATUSBAR: nRole = accessibility::AccessibleRole::STATUS_BAR; break;
 
-            case WINDOW_DOCKINGWINDOW:
-            case WINDOW_SYSWINDOW:      nRole = (mpWindowImpl->mbFrame) ? accessibility::AccessibleRole::FRAME :
-                                                                          accessibility::AccessibleRole::PANEL; break;
+        case WINDOW_TABPAGE: nRole = accessibility::AccessibleRole::PANEL; break;
+        case WINDOW_TABCONTROL: nRole = accessibility::AccessibleRole::PAGE_TAB_LIST; break;
 
-            case WINDOW_FLOATINGWINDOW: nRole = ( mpWindowImpl->mbFrame ||
-                                                 (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ||
-                                                 (GetStyle() & WB_OWNERDRAWDECORATION) ) ? accessibility::AccessibleRole::FRAME :
-                                                                                           accessibility::AccessibleRole::WINDOW; break;
+        case WINDOW_DOCKINGWINDOW:
+        case WINDOW_SYSWINDOW:      nRole = (mpWindowImpl->mbFrame) ? accessibility::AccessibleRole::FRAME :
+                                                                      accessibility::AccessibleRole::PANEL; break;
 
-            case WINDOW_WORKWINDOW: nRole = accessibility::AccessibleRole::ROOT_PANE; break;
+        case WINDOW_FLOATINGWINDOW: nRole = ( mpWindowImpl->mbFrame ||
+                                             (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ||
+                                             (GetStyle() & WB_OWNERDRAWDECORATION) ) ? accessibility::AccessibleRole::FRAME :
+                                                                                       accessibility::AccessibleRole::WINDOW; break;
 
+        case WINDOW_WORKWINDOW: nRole = accessibility::AccessibleRole::ROOT_PANE; break;
 
-            case WINDOW_SCROLLBARBOX: nRole = accessibility::AccessibleRole::FILLER; break;
 
-            case WINDOW_HELPTEXTWINDOW: nRole = accessibility::AccessibleRole::TOOL_TIP; break;
+        case WINDOW_SCROLLBARBOX: nRole = accessibility::AccessibleRole::FILLER; break;
 
-            case WINDOW_RULER: nRole = accessibility::AccessibleRole::RULER; break;
+        case WINDOW_HELPTEXTWINDOW: nRole = accessibility::AccessibleRole::TOOL_TIP; break;
+
+        case WINDOW_RULER: nRole = accessibility::AccessibleRole::RULER; break;
+
+        case WINDOW_SCROLLWINDOW: nRole = accessibility::AccessibleRole::SCROLL_PANE; break;
+
+        case WINDOW_WINDOW:
+        case WINDOW_CONTROL:
+        case WINDOW_BORDERWINDOW:
+        case WINDOW_SYSTEMCHILDWINDOW:
+        default:
+            if (ImplIsAccessibleNativeFrame() )
+                nRole = accessibility::AccessibleRole::FRAME;
+            else if( IsScrollable() )
+                nRole = accessibility::AccessibleRole::SCROLL_PANE;
+            else if( ((Window*)this)->ImplGetWindow()->IsMenuFloatingWindow() )
+                nRole = accessibility::AccessibleRole::WINDOW;      // #106002#, contextmenus are windows (i.e. toplevel)
+            else
+                // #104051# WINDOW seems to be a bad default role, use LAYEREDPANE instead
+                // a WINDOW is interpreted as a top-level window, which is typically not the case
+                //nRole = accessibility::AccessibleRole::WINDOW;
+                nRole = accessibility::AccessibleRole::PANEL;
+    }
+    return nRole;
+}
 
-            case WINDOW_SCROLLWINDOW: nRole = accessibility::AccessibleRole::SCROLL_PANE; break;
+sal_uInt16 Window::GetAccessibleRole() const
+{
+    using namespace ::com::sun::star;
 
-            case WINDOW_WINDOW:
-            case WINDOW_CONTROL:
-            case WINDOW_BORDERWINDOW:
-            case WINDOW_SYSTEMCHILDWINDOW:
-            default:
-                if (ImplIsAccessibleNativeFrame() )
-                    nRole = accessibility::AccessibleRole::FRAME;
-                else if( IsScrollable() )
-                    nRole = accessibility::AccessibleRole::SCROLL_PANE;
-                else if( ((Window*)this)->ImplGetWindow()->IsMenuFloatingWindow() )
-                    nRole = accessibility::AccessibleRole::WINDOW;      // #106002#, contextmenus are windows (i.e. toplevel)
-                else
-                    // #104051# WINDOW seems to be a bad default role, use LAYEREDPANE instead
-                    // a WINDOW is interpreted as a top-level window, which is typically not the case
-                    //nRole = accessibility::AccessibleRole::WINDOW;
-                    nRole = accessibility::AccessibleRole::PANEL;
-        }
-    }
+    sal_uInt16 nRole = mpWindowImpl->mpAccessibleInfos ? mpWindowImpl->mpAccessibleInfos->nAccessibleRole : 0xFFFF;
+    if ( nRole == 0xFFFF )
+        nRole = getDefaultAccessibleRole();
     return nRole;
 }
 
@@ -8980,6 +8994,62 @@ void Window::SetAccessibleRelationMemberOf( Window* pMemberOfWin )
     mpWindowImpl->mpAccessibleInfos->pMemberOfWindow = pMemberOfWin;
 }
 
+Window* Window::GetAccessibleRelationMemberOf() const
+{
+    if (mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pMemberOfWindow)
+        return mpWindowImpl->mpAccessibleInfos->pMemberOfWindow;
+
+    if (!isContainerWindow(this) && !isContainerWindow(GetParent()))
+        return getLegacyNonLayoutAccessibleRelationMemberOf();
+
+    return NULL;
+}
+
+Window* Window::getAccessibleRelationLabelFor() const
+{
+    if (mpWindowImpl->mbDisableAccessibleLabelForRelation)
+        return NULL;
+
+    if (mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabelForWindow)
+        return mpWindowImpl->mpAccessibleInfos->pLabelForWindow;
+
+    return NULL;
+}
+
+Window* Window::GetAccessibleRelationLabelFor() const
+{
+    Window* pWindow = getAccessibleRelationLabelFor();
+
+    if (pWindow)
+        return pWindow;
+
+    if (!isContainerWindow(this) && !isContainerWindow(GetParent()))
+        return getLegacyNonLayoutAccessibleRelationLabelFor();
+
+    return NULL;
+}
+
+Window* Window::GetAccessibleRelationLabeledBy() const
+{
+    if (mpWindowImpl->mbDisableAccessibleLabeledByRelation)
+        return NULL;
+
+    if (mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow)
+        return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow;
+
+    std::vector<FixedText*> m_aMnemonicLabels(list_mnemonic_labels());
+    if (!m_aMnemonicLabels.empty())
+    {
+        SAL_WARN_IF(m_aMnemonicLabels.size() != 1, "vcl.a11y", "TODO: multiple LabeledBy not handled yet");
+        return m_aMnemonicLabels[0];
+    }
+
+    if (!isContainerWindow(this) && !isContainerWindow(GetParent()))
+        return getLegacyNonLayoutAccessibleRelationLabeledBy();
+
+    return NULL;
+}
+
 sal_Bool Window::IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath )
 {
     if( !bTraverseParentPath )
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 0dc6d17..906d65b 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -25,6 +25,7 @@
 #include <vcl/bitmap.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/event.hxx>
+#include <vcl/fixed.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/timer.hxx>
 #include <vcl/metric.hxx>
@@ -2315,4 +2316,28 @@ void Window::remove_from_all_size_groups()
     }
 }
 
+void Window::add_mnemonic_label(FixedText *pLabel)
+{
+    std::vector<FixedText*>& v = mpWindowImpl->m_aMnemonicLabels;
+    if (std::find(v.begin(), v.end(), pLabel) != v.end())
+        return;
+    v.push_back(pLabel);
+    pLabel->set_mnemonic_widget(this);
+}
+
+void Window::remove_mnemonic_label(FixedText *pLabel)
+{
+    std::vector<FixedText*>& v = mpWindowImpl->m_aMnemonicLabels;
+    std::vector<FixedText*>::iterator aFind = std::find(v.begin(), v.end(), pLabel);
+    if (aFind == v.end())
+        return;
+    v.erase(aFind);
+    pLabel->set_mnemonic_widget(NULL);
+}
+
+std::vector<FixedText*> Window::list_mnemonic_labels() const
+{
+    return mpWindowImpl->m_aMnemonicLabels;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 2a3a15fd73d119062228480c22056e9cc9e4d680
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 21 11:39:02 2013 +0000

    add a11y relations support to VclBuilder
    
    Change-Id: I5230483d653355c26db0e77afb258b802707bfee

diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index 1aa1c20..ab0b1f6 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -152,6 +152,8 @@ private:
         }
     };
 
+    typedef std::map<Window*, stringmap> AtkMap;
+
     struct ParserState
     {
         std::vector<RadioButtonGroupMap> m_aGroupMaps;
@@ -176,6 +178,8 @@ private:
         std::map<Window*, Window*> m_aRedundantParentWidgets;
 
         std::vector<SizeGroup> m_aSizeGroups;
+
+        AtkMap m_aAtkInfo;
     };
 
     void loadTranslations(const com::sun::star::lang::Locale &rLocale, const OUString &rUri);
@@ -245,7 +249,8 @@ public:
 
 private:
     Window *insertObject(Window *pParent, const OString &rClass, const OString &rID,
-        stringmap &rProps, stringmap &rPangoAttributes, std::vector<OString> &rItems);
+        stringmap &rProps, stringmap &rPangoAttributes,
+        stringmap &rAtkProps, std::vector<OString> &rItems);
 
     Window *makeObject(Window *pParent, const OString &rClass, const OString &rID,
         stringmap &rVec, const std::vector<OString> &rItems);
@@ -266,6 +271,7 @@ private:
     void applyPackingProperty(Window *pCurrent, xmlreader::XmlReader &reader);
     void collectProperty(xmlreader::XmlReader &reader, const OString &rID, stringmap &rVec);
     void collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &rMap);
+    void collectAtkAttribute(xmlreader::XmlReader &reader, stringmap &rMap);
     void collectAccelerator(xmlreader::XmlReader &reader, stringmap &rMap);
 
     void insertMenuObject(PopupMenu *pParent, const OString &rClass, const OString &rID,
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 793defc..c5cef79 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -160,6 +160,35 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
 
     handleChild(pParent, reader);
 
+    //Set a11y relations when everything has been imported
+    for (AtkMap::iterator aI = m_pParserState->m_aAtkInfo.begin(),
+         aEnd = m_pParserState->m_aAtkInfo.end(); aI != aEnd; ++aI)
+    {
+        Window *pSource = aI->first;
+        const stringmap &rMap = aI->second;
+
+        for (stringmap::const_iterator aP = rMap.begin(),
+            aEndP = rMap.end(); aP != aEndP; ++aP)
+        {
+            const OString &rTarget = aP->second;
+            Window *pTarget = get<Window>(rTarget);
+            SAL_WARN_IF(!pTarget, "vcl", "missing member of a11y relation");
+            if (!pTarget)
+                continue;
+            const OString &rType = aP->first;
+            if (rType == "labelled-by")
+                pSource->SetAccessibleRelationLabeledBy(pTarget);
+            else if (rType == "label-for")
+                pSource->SetAccessibleRelationLabelFor(pTarget);
+            else if (rType == "member-of")
+                pSource->SetAccessibleRelationMemberOf(pTarget);
+            else
+            {
+                SAL_INFO("vcl.layout", "unhandled a11y relation :" << rType.getStr());
+            }
+        }
+    }
+
     //Set radiobutton groups when everything has been imported
     for (std::vector<RadioButtonGroupMap>::iterator aI = m_pParserState->m_aGroupMaps.begin(),
          aEnd = m_pParserState->m_aGroupMaps.end(); aI != aEnd; ++aI)
@@ -1099,7 +1128,9 @@ namespace
 }
 
 Window *VclBuilder::insertObject(Window *pParent, const OString &rClass,
-    const OString &rID, stringmap &rProps, stringmap &rPango, std::vector<OString> &rItems)
+    const OString &rID, stringmap &rProps, stringmap &rPango,
+    stringmap &rAtk,
+    std::vector<OString> &rItems)
 {
     Window *pCurrentChild = NULL;
 
@@ -1147,10 +1178,13 @@ Window *VclBuilder::insertObject(Window *pParent, const OString &rClass,
             const OString &rValue = aI->second;
             pCurrentChild->set_font_attribute(rKey, rValue);
         }
+
+        m_pParserState->m_aAtkInfo[pCurrentChild] = rAtk;
     }
 
     rProps.clear();
     rPango.clear();
+    rAtk.clear();
     rItems.clear();
 
     if (!pCurrentChild)
@@ -1402,6 +1436,32 @@ void VclBuilder::collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &
         rMap[sProperty] = sValue;
 }
 
+void VclBuilder::collectAtkAttribute(xmlreader::XmlReader &reader, stringmap &rMap)
+{
+    xmlreader::Span span;
+    int nsId;
+
+    OString sProperty;
+    OString sValue;
+
+    while (reader.nextAttribute(&nsId, &span))
+    {
+        if (span.equals(RTL_CONSTASCII_STRINGPARAM("type")))
+        {
+            span = reader.getAttributeValue(false);
+            sProperty = OString(span.begin, span.length);
+        }
+        else if (span.equals(RTL_CONSTASCII_STRINGPARAM("target")))
+        {
+            span = reader.getAttributeValue(false);
+            sValue = OString(span.begin, span.length);
+        }
+    }
+
+    if (!sProperty.isEmpty())
+        rMap[sProperty] = sValue;
+}
+
 void VclBuilder::handleAdjustment(const OString &rID, stringmap &rProperties)
 {
     m_pParserState->m_aAdjustments[rID] = rProperties;
@@ -1959,7 +2019,7 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader)
 
     int nLevel = 1;
 
-    stringmap aProperties, aPangoAttributes;
+    stringmap aProperties, aPangoAttributes, aAtkAttributes;
     std::vector<OString> aItems;
 
     if (!sCustomProperty.isEmpty())
@@ -1981,7 +2041,7 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader)
                 if (!pCurrentChild)
                 {
                     pCurrentChild = insertObject(pParent, sClass, sID,
-                        aProperties, aPangoAttributes, aItems);
+                        aProperties, aPangoAttributes, aAtkAttributes, aItems);
                 }
                 handleChild(pCurrentChild, reader);
             }
@@ -1994,6 +2054,8 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader)
                     collectProperty(reader, sID, aProperties);
                 else if (name.equals(RTL_CONSTASCII_STRINGPARAM("attribute")))
                     collectPangoAttribute(reader, aPangoAttributes);
+                else if (name.equals(RTL_CONSTASCII_STRINGPARAM("relation")))
+                    collectAtkAttribute(reader, aAtkAttributes);
             }
         }
 
@@ -2018,7 +2080,10 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader)
     }
 
     if (!pCurrentChild)
-        pCurrentChild = insertObject(pParent, sClass, sID, aProperties, aPangoAttributes, aItems);
+    {
+        pCurrentChild = insertObject(pParent, sClass, sID, aProperties,
+            aPangoAttributes, aAtkAttributes, aItems);
+    }
 
     return pCurrentChild;
 }
commit f58c3774ed4a3e76f475b1def5874aa1295bc0fd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 21 11:12:49 2013 +0000

    add accessible-name and accessible-description support to VclBuilder
    
    Change-Id: Ifa85b2e2bf562786cb9d69b904a24ab1b8e0413b

diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index 3bc9642..1aa1c20 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -283,6 +283,8 @@ private:
 
     void handleSizeGroup(xmlreader::XmlReader &reader, const OString &rID);
 
+    void handleAtkObject(xmlreader::XmlReader &reader, const OString &rID, Window *pWindow);
+
     PackingData get_window_packing_data(const Window *pWindow) const;
     void set_window_packing_position(const Window *pWindow, sal_Int32 nPosition);
 
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 583d6ce..793defc 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1510,6 +1510,55 @@ void VclBuilder::handleListStore(xmlreader::XmlReader &reader, const OString &rI
     }
 }
 
+void VclBuilder::handleAtkObject(xmlreader::XmlReader &reader, const OString &rID, Window *pWindow)
+{
+    assert(pWindow);
+
+    int nLevel = 1;
+
+    stringmap aProperties;
+
+    while(1)
+    {
+        xmlreader::Span name;
+        int nsId;
+
+        xmlreader::XmlReader::Result res = reader.nextItem(
+            xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
+
+        if (res == xmlreader::XmlReader::RESULT_DONE)
+            break;
+
+        if (res == xmlreader::XmlReader::RESULT_BEGIN)
+        {
+            ++nLevel;
+            if (name.equals(RTL_CONSTASCII_STRINGPARAM("property")))
+                collectProperty(reader, rID, aProperties);
+        }
+
+        if (res == xmlreader::XmlReader::RESULT_END)
+        {
+            --nLevel;
+        }
+
+        if (!nLevel)
+            break;
+    }
+
+    for (stringmap::iterator aI = aProperties.begin(), aEnd = aProperties.end(); aI != aEnd; ++aI)
+    {
+        const OString &rKey = aI->first;
+        const OString &rValue = aI->second;
+
+        if (rKey.match("AtkObject::"))
+            pWindow->set_property(rKey.copy(RTL_CONSTASCII_LENGTH("AtkObject::")), rValue);
+        else
+            SAL_WARN("vcl.layout", "unhandled atk prop: " << rKey.getStr());
+
+        fprintf(stderr, "setting atk props on %p\n", pWindow);
+    }
+}
+
 std::vector<OString> VclBuilder::handleItems(xmlreader::XmlReader &reader, const OString &rID)
 {
     int nLevel = 1;
@@ -1902,6 +1951,11 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader)
         handleSizeGroup(reader, sID);
         return NULL;
     }
+    else if (sClass == "AtkObject")
+    {
+        handleAtkObject(reader, sID, pParent);
+        return NULL;
+    }
 
     int nLevel = 1;
 
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index acf9aad..0dc6d17 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1968,6 +1968,14 @@ bool Window::set_property(const OString &rKey, const OString &rValue)
             nBits |= WB_AUTOVSCROLL;
         SetStyle(nBits);
     }
+    else if (rKey == "accessible-name")
+    {
+        SetAccessibleName(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
+    }
+    else if (rKey == "accessible-description")
+    {
+        SetAccessibleDescription(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
+    }
     else if (rKey == "use-markup")
     {
         //https://live.gnome.org/GnomeGoals/RemoveMarkupInMessages
commit 492498b86e2f39b81da3fec895f0efdcce3a9655
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 21 10:42:24 2013 +0000

    add AccessibleRelationMemberOf to AccessibleRelationSet
    
    Change-Id: I716eb70ceb8005aa54a417d01c67bc139dc61c6f

diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index 106cb08..325b151 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -448,6 +448,14 @@ void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelation
             aSequence[0] = pLabelFor->GetAccessible();
             rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABEL_FOR, aSequence ) );
         }
+
+        Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
+        if ( pMemberOf && pMemberOf != pWindow )
+        {
+            uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+            aSequence[0] = pMemberOf->GetAccessible();
+            rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+        }
     }
 }
 
commit c9562064740baed3a9978723c5fe77b44a13a7aa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 22 08:54:33 2013 +0000

    make GetAccessibleRelationMemberOf use SetAccessibleRelationMemberOf values
    
    Change-Id: Ia413ac220c8d942576c29be6238c75c5061ec156

diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 28b0910..be3697e 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -1334,6 +1334,9 @@ Window* Window::GetAccessibleRelationLabeledBy() const
 
 Window* Window::GetAccessibleRelationMemberOf() const
 {
+    if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pMemberOfWindow )
+        return mpWindowImpl->mpAccessibleInfos->pMemberOfWindow;
+
     Window* pWindow = NULL;
     Window* pFrameWindow = GetParent();
     if ( !pFrameWindow )
commit c294a21d6644ccdda63824da525621f77f4a7eac
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 21 10:04:47 2013 +0000

    revert removal of used a11y code
    
    reverting the a11y parts of bc34a22e76775799e068cfa2617152da4c608e7d
    so that we can now make use of them
    
    Change-Id: I8090a2f9602743628d3b948338b45ed2252501eb

diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index bdb5885..d9aa034 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -1004,9 +1004,12 @@ public:
     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
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 6c481da..28b0910 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -1332,6 +1332,61 @@ Window* Window::GetAccessibleRelationLabeledBy() 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;
+}
+
 // -----------------------------------------------------------------------
 
 KeyEvent Window::GetActivationKey() const
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index baf4658..34b2d49 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -8966,6 +8966,13 @@ void Window::SetAccessibleRelationLabeledBy( Window* pLabeledBy )
     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 )


More information about the Libreoffice-commits mailing list