sw/source/core/access/accframebase.cxx |    8 ++++++++
 sw/source/core/access/accmap.cxx       |   17 ++++++++++++++++-
 sw/source/core/layout/trvlfrm.cxx      |   16 +++++++++++++---
 3 files changed, 37 insertions(+), 4 deletions(-)

New commits:
commit be55b1915fd0374f8f25c2c1be2b39744666d052
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Thu Jul 18 18:27:18 2019 +0200
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Mon Jul 22 08:32:29 2019 +0200

    (related: tdf#110442) sw: fix a11y/UI selection of at-char flys
    
    SwAccessibleFrameBase::GetSelectedState() and SwAccessibleMap ignored
    FLY_AT_CHAR flys for no apparent reason.
    
    SwRootFrame::CalcFrameRects() is the function that determines the
    selection overlay painted in the view.
    
    Change-Id: I60aae2e401d2e811ed1aa8eb95cfd093c65c1de4
    Reviewed-on: https://gerrit.libreoffice.org/75961
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/sw/source/core/access/accframebase.cxx 
b/sw/source/core/access/accframebase.cxx
index 609ca2e5b4d5..9b344b5a2b35 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -38,6 +38,7 @@
 #include <txtfrm.hxx>
 #include <notxtfrm.hxx>
 #include <ndtxt.hxx>
+#include <undobj.hxx>
 #include <dcontact.hxx>
 #include <fmtanchr.hxx>
 
@@ -342,6 +343,13 @@ bool SwAccessibleFrameBase::GetSelectedState( )
                                 && (nHere < nEndIndex ) )
                                 return true;
                         }
+                        else if (rAnchor.GetAnchorId() == 
RndStdIds::FLY_AT_CHAR)
+                        {
+                            if (IsDestroyFrameAnchoredAtChar(*pPos, *pStart, 
*pEnd))
+                            {
+                                return true;
+                            }
+                        }
                         break;
                     }
                     // else: this PaM doesn't point to this paragraph
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index fedd41e68fae..5d60c0020804 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -76,6 +76,7 @@
 #include <dflyobj.hxx>
 #include <prevwpage.hxx>
 #include <calbck.hxx>
+#include <undobj.hxx>
 #include <tools/diagnose_ex.h>
 #include <tools/debug.hxx>
 
@@ -1203,7 +1204,6 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
                                 sal_uLong nEndIndex = pEnd->nNode.GetIndex();
                                 if ((nStartIndex <= nLastNode) && (nFirstNode 
<= nEndIndex))
                                 {
-                                    // FIXME: what about missing FLY_AT_CHAR?
                                     if( rAnchor.GetAnchorId() == 
RndStdIds::FLY_AS_CHAR )
                                     {
                                         if( ( ((nHere == nStartIndex) && 
(nIndex >= pStart->nContent.GetIndex())) || (nHere > nStartIndex) )
@@ -1237,6 +1237,21 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
                                                 static_cast < 
::accessibility::AccessibleShape* >(xAcc.get())->ResetState( 
AccessibleStateType::SELECTED );
                                         }
                                     }
+                                    else if (rAnchor.GetAnchorId() == 
RndStdIds::FLY_AT_CHAR)
+                                    {
+                                        uno::Reference<XAccessible> const 
xAcc((*aIter).second);
+                                        if (xAcc.is())
+                                        {
+                                            if 
(IsDestroyFrameAnchoredAtChar(*pPos, *pStart, *pEnd))
+                                            {
+                                                
static_cast<::accessibility::AccessibleShape*>(xAcc.get())->SetState( 
AccessibleStateType::SELECTED );
+                                            }
+                                            else
+                                            {
+                                                
static_cast<::accessibility::AccessibleShape*>(xAcc.get())->ResetState( 
AccessibleStateType::SELECTED );
+                                            }
+                                        }
+                                    }
                                 }
                             }
                         }
diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index 5606210afb20..a0c99131f416 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -48,6 +48,7 @@
 #include <frmatr.hxx>
 #include <frmtool.hxx>
 #include <ndtxt.hxx>
+#include <undobj.hxx>
 
 #include <cfloat>
 #include <swselectionlist.hxx>
@@ -2573,9 +2574,18 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
                 const SwFlyFrame* pFly = static_cast<const 
SwFlyFrame*>(pAnchoredObj);
                 const SwVirtFlyDrawObj* pObj = pFly->GetVirtDrawObj();
                 const SwFormatSurround &rSur = 
pFly->GetFormat()->GetSurround();
-                const SwPosition* anchoredAt = 
pAnchoredObj->GetFrameFormat().GetAnchor().GetContentAnchor();
-                bool inSelection = ( anchoredAt != nullptr && *pStartPos <= 
*anchoredAt && *anchoredAt < *pEndPos );
-                if( anchoredAt != nullptr && *anchoredAt == *pEndPos )
+                SwFormatAnchor const& 
rAnchor(pAnchoredObj->GetFrameFormat().GetAnchor());
+                const SwPosition* anchoredAt = rAnchor.GetContentAnchor();
+                bool inSelection = (
+                            anchoredAt != nullptr
+                        && (   (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR
+                                && IsDestroyFrameAnchoredAtChar(*anchoredAt, 
*pStartPos, *pEndPos))
+                            || (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA
+                                && *pStartPos <= *anchoredAt
+                                && *anchoredAt < *pEndPos)));
+                if (anchoredAt != nullptr
+                    && rAnchor.GetAnchorId() != RndStdIds::FLY_AT_CHAR
+                    && *anchoredAt == *pEndPos)
                 {
                     const SwNodes& nodes = anchoredAt->GetDoc()->GetNodes();
                     if( *pEndPos == SwPosition( nodes.GetEndOfContent()))
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to