[Libreoffice-commits] core.git: vcl/unx

Tamás Zolnai zolnaitamas2000 at gmail.com
Sun Dec 4 00:28:56 UTC 2016


 vcl/unx/gtk/a11y/atktext.cxx           |   18 +++++++++++++-----
 vcl/unx/gtk/a11y/atktextattributes.cxx |    6 +++++-
 2 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit 17773e1a8dd6e97f57db111819338c418f819cef
Author: Tamás Zolnai <zolnaitamas2000 at gmail.com>
Date:   Sun Dec 4 00:03:24 2016 +0000

    tdf#93430: Get run attributes of text objects
    
    .. which are not paragraphs.
    
    Note: For some reason in character attributes sequence
    we have a wrong Any value for "CharPosture" property.
    
    Change-Id: Ia45526c01cc381d3d6a1b56dbf4f03fdd38a0989
    Signed-off-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/31591

diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx
index 14cf916..fbfd0fb 100644
--- a/vcl/unx/gtk/a11y/atktext.cxx
+++ b/vcl/unx/gtk/a11y/atktext.cxx
@@ -482,12 +482,20 @@ text_wrapper_get_run_attributes( AtkText        *text,
 
         css::uno::Reference<css::accessibility::XAccessibleText> pText
             = getText( text );
-        css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
-            pTextAttributes = getTextAttributes( text );
-        if( pText.is() && pTextAttributes.is() )
+        if( pText.is())
         {
-            uno::Sequence< beans::PropertyValue > aAttributeList =
-                pTextAttributes->getRunAttributes( offset, uno::Sequence< OUString > () );
+            uno::Sequence< beans::PropertyValue > aAttributeList;
+
+            css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
+                pTextAttributes = getTextAttributes( text );
+            if(pTextAttributes.is()) // Text attributes are available for paragraphs only
+            {
+                aAttributeList = pTextAttributes->getRunAttributes( offset, uno::Sequence< OUString > () );
+            }
+            else // For other text objects use character attributes
+            {
+                aAttributeList = pText->getCharacterAttributes( offset, uno::Sequence< OUString > () );
+            }
 
             pSet = attribute_set_new_from_property_values( aAttributeList, true, text );
             //  #i100938#
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index 0620be4..c31fccd 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -298,7 +298,11 @@ FontSlant2Style(const uno::Any& rAny)
 {
     const gchar * value = nullptr;
 
-    switch( rAny.get<awt::FontSlant>() )
+    awt::FontSlant aFontSlant;
+    if(!(rAny >>= aFontSlant))
+        return nullptr;
+
+    switch( aFontSlant )
     {
         case awt::FontSlant_NONE:
             value = "normal";


More information about the Libreoffice-commits mailing list