[Libreoffice-commits] core.git: accessibility/source include/vcl

Tamás Zolnai zolnaitamas2000 at gmail.com
Fri Dec 9 09:16:49 UTC 2016


 accessibility/source/standard/vclxaccessibleedit.cxx |   44 ++++++++++++++++++-
 include/vcl/vclmedit.hxx                             |    2 
 2 files changed, 45 insertions(+), 1 deletion(-)

New commits:
commit e0d8c3821b8fa1e7d00f7b4a7d007f9cb5c592a5
Author: Tamás Zolnai <zolnaitamas2000 at gmail.com>
Date:   Fri Dec 9 01:49:27 2016 +0000

    tdf#93430: Cannot get accessible text attributes for 'Not in dictionary' entry
    
    Change-Id: Iaa2b4fdb582025b763d43f0f24960e2ccee708e3
    Reviewed-on: https://gerrit.libreoffice.org/31778
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx
index fa3d0bc..509e59a 100644
--- a/accessibility/source/standard/vclxaccessibleedit.cxx
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -36,6 +36,10 @@
 #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>
 
@@ -304,8 +308,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 = GetAs< 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 == -1 )
+            {
+                OutputDevice* pDev = Application::GetDefaultDevice();
+                if ( pDev )
+                {
+                    aValue.Value = css::uno::makeAny(static_cast< sal_Int32 >(pDev->GetSettings().GetStyleSettings().GetFieldTextColor().GetColor()));
+                }
+            }
+            break;
+        }
+    }
+
+    return aProperties;
 }
 
 
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index 41663b4..b772aea 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -32,6 +32,8 @@ class TextView;
 
 class VCL_DLLPUBLIC VclMultiLineEdit : public Edit
 {
+    friend class VCLXAccessibleEdit;
+
 private:
     ImpVclMEdit*      pImpVclMEdit;
 


More information about the Libreoffice-commits mailing list