diff options
author | Tamás Zolnai <zolnaitamas2000@gmail.com> | 2016-12-04 00:03:24 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-12-11 20:54:03 +0000 |
commit | c5b71538e9cd7854f502d20c36396176a49bef2b (patch) | |
tree | 167ece5a17220ab08505b6036227aa7df6f531d5 /vcl | |
parent | a2d66138ffa6a5e886bdbb5fe05ee13a0618d27e (diff) |
tdf#93430: Cannot get accessible text attributes for 'Not in dictionary' entry
Squashed from two commits:
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.
Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/31591
(cherry picked from commit 17773e1a8dd6e97f57db111819338c418f819cef)
tdf#93430: Cannot get accessible text attributes for 'Not in dictionary' entry
Reviewed-on: https://gerrit.libreoffice.org/31778
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit e0d8c3821b8fa1e7d00f7b4a7d007f9cb5c592a5)
Reviewed-on: https://gerrit.libreoffice.org/31792
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
tdf#93430: Return the right offsets for runs
MultiLineEdit is a special control which can have
more text portions with different text attributes.
Reviewed-on: https://gerrit.libreoffice.org/31813
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 8d52045853cecb716138d51b8b6ad0272a86af86)
Change-Id: Ia45526c01cc381d3d6a1b56dbf4f03fdd38a0989
Reviewed-on: https://gerrit.libreoffice.org/31804
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/edit/texteng.cxx | 20 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atktext.cxx | 18 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atktextattributes.cxx | 6 |
3 files changed, 38 insertions, 6 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index df1de5bf900a..1a91f99ec2b7 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -1223,6 +1223,26 @@ long TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_I return nWidth; } +void TextEngine::GetTextPortionRange(const TextPaM& rPaM, sal_Int32& nStart, sal_Int32& nEnd) +{ + nStart = 0; + nEnd = 0; + TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( rPaM.GetPara() ); + for ( size_t i = 0; i < pParaPortion->GetTextPortions().size(); ++i ) + { + TETextPortion* pTextPortion = pParaPortion->GetTextPortions()[ i ]; + if (nStart + pTextPortion->GetLen() > rPaM.GetIndex()) + { + nEnd = nStart + pTextPortion->GetLen(); + return; + } + else + { + nStart += pTextPortion->GetLen(); + } + } +} + sal_uInt16 TextEngine::GetLineCount( sal_uInt32 nParagraph ) const { DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" ); diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index 5c662a711131..425b3358f1b7 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -494,12 +494,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 b7857d079b66..43d6d9c535d4 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -301,7 +301,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"; |