summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorTamás Zolnai <zolnaitamas2000@gmail.com>2016-12-04 00:03:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-12-11 20:54:03 +0000
commitc5b71538e9cd7854f502d20c36396176a49bef2b (patch)
tree167ece5a17220ab08505b6036227aa7df6f531d5 /accessibility
parenta2d66138ffa6a5e886bdbb5fe05ee13a0618d27e (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 'accessibility')
-rw-r--r--accessibility/source/standard/vclxaccessibleedit.cxx59
1 files changed, 58 insertions, 1 deletions
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx
index 9ef00251c6ad..f36ee0b85b95 100644
--- a/accessibility/source/standard/vclxaccessibleedit.cxx
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -30,12 +30,17 @@
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/accessibility/AccessibleTextType.hpp>
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/string.hxx>
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <vcl/edit.hxx>
+#include <vcl/vclmedit.hxx>
+#include <vcl/textdata.hxx>
+#include <vcl/txtattr.hxx>
+#include <vcl/xtextedt.hxx>
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
@@ -305,8 +310,46 @@ sal_Unicode VCLXAccessibleEdit::getCharacter( sal_Int32 nIndex ) throw (IndexOut
Sequence< PropertyValue > VCLXAccessibleEdit::getCharacterAttributes( sal_Int32 nIndex, const Sequence< OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
{
OExternalLockGuard aGuard( this );
+ Sequence< PropertyValue > aProperties = VCLXAccessibleTextComponent::getCharacterAttributes( nIndex, aRequestedAttributes );
- return VCLXAccessibleTextComponent::getCharacterAttributes( nIndex, aRequestedAttributes );
+ // Handle multiline edit character properties
+ VclPtr<VclMultiLineEdit> pMulitLineEdit = GetAsDynamic< VclMultiLineEdit >();
+ if ( pMulitLineEdit )
+ {
+ ExtTextEngine* pTextEngine = pMulitLineEdit->GetTextEngine();
+ TextPaM aCursor( 0, nIndex );
+ const TextAttribFontColor* pFontColor = static_cast<const TextAttribFontColor* >(pTextEngine->FindAttrib( aCursor, TEXTATTR_FONTCOLOR ));
+ if ( pFontColor )
+ {
+ for (PropertyValue& aValue : aProperties )
+ {
+ if (aValue.Name == "CharColor")
+ {
+ aValue.Value = css::uno::makeAny(static_cast< sal_Int32 >(COLORDATA_RGB(pFontColor->GetColor().GetColor())));
+ break;
+ }
+ }
+ }
+ }
+
+ // Set default character color if it is not set yet to a valid value
+ for (PropertyValue& aValue : aProperties )
+ {
+ if (aValue.Name == "CharColor")
+ {
+ if ( aValue.Value == sal_Int32(-1) )
+ {
+ OutputDevice* pDev = Application::GetDefaultDevice();
+ if ( pDev )
+ {
+ aValue.Value = css::uno::makeAny(static_cast< sal_Int32 >(pDev->GetSettings().GetStyleSettings().GetFieldTextColor().GetColor()));
+ }
+ }
+ break;
+ }
+ }
+
+ return aProperties;
}
@@ -434,6 +477,20 @@ css::accessibility::TextSegment VCLXAccessibleEdit::getTextAtIndex( sal_Int32 nI
{
OExternalLockGuard aGuard( this );
+ // Override general text component behavior: MultiLineEdit can have more text portions
+ if ( aTextType == AccessibleTextType::ATTRIBUTE_RUN )
+ {
+ VclPtr<VclMultiLineEdit> pMulitLineEdit = GetAsDynamic< VclMultiLineEdit >();
+ if ( pMulitLineEdit )
+ {
+ ExtTextEngine* pTextEngine = pMulitLineEdit->GetTextEngine();
+ TextPaM aCursor( 0, nIndex );
+ TextSegment aResult;
+ pTextEngine->GetTextPortionRange( aCursor, aResult.SegmentStart, aResult.SegmentEnd );
+ return aResult;
+ }
+ }
+
return VCLXAccessibleTextComponent::getTextAtIndex( nIndex, aTextType );
}