summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <zolnaitamas2000@gmail.com>2016-12-04 00:03:24 +0000
committerTamás Zolnai <tamas.zolnai@collabora.com>2016-12-04 00:28:25 +0000
commit17773e1a8dd6e97f57db111819338c418f819cef (patch)
treeb60677fe6d17d71eaa856968e76ab2042891e661
parent94de45ec211ec0acead9ec11a22c3cd72336dbc7 (diff)
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@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/31591
-rw-r--r--vcl/unx/gtk/a11y/atktext.cxx18
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.cxx6
2 files changed, 18 insertions, 6 deletions
diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx
index 14cf91606d87..fbfd0fb41e11 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 0620be4af6af..c31fccdbeebf 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";