sw/source/core/layout/trvlfrm.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 0b9d6406a40fe890ea003f8e503c4aca6f65c2e6
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Jan 18 18:21:30 2024 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Jan 22 11:29:42 2024 +0100

    tdf#137839 sw: add drawing shapes anchored in selection to overlay
    
    This is mostly a UI problem: if text is selected, then any objects
    anchored in the selection are implicitly selected as well.
    
    Unfortunately only fly frames are painted with the selection overlay,
    but there doesn't seem to be a reason not to paint the SdrObjects as
    well.
    
    Change-Id: I0d9e35fdd1e1bdcc73a4c71b069993e670b5468d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162262
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index 423c5137fb78..fb8deceb774b 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2630,10 +2630,8 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& 
rCursor, SwRects & rRects,
             for (SwAnchoredObject* pAnchoredObj : rObjs)
             {
                 const SwFlyFrame* pFly = pAnchoredObj->DynCastFlyFrame();
-                if ( !pFly )
-                    continue;
-                const SwVirtFlyDrawObj* pObj = pFly->GetVirtDrawObj();
-                const SwFormatSurround &rSur = 
pFly->GetFormat()->GetSurround();
+                SdrObject const*const pObj(pAnchoredObj->GetDrawObj());
+                SwFormatSurround const& 
rSur(pAnchoredObj->GetFrameFormat()->GetSurround());
                 SwFormatAnchor const& 
rAnchor(pAnchoredObj->GetFrameFormat()->GetAnchor());
                 const SwPosition* anchoredAt = rAnchor.GetContentAnchor();
                 bool inSelection = (
@@ -2643,8 +2641,10 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& 
rCursor, SwRects & rRects,
                             || (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA
                                 && IsSelectFrameAnchoredAtPara(*anchoredAt, 
*pStartPos, *pEndPos))));
                 if (eMode != RectsMode::NoAnchoredFlys && inSelection)
-                        Add( aRegion, pFly->getFrameArea() );
-                else if ( !pFly->IsAnLower( pStartFrame ) &&
+                {
+                    Add(aRegion, pAnchoredObj->GetObjRect());
+                }
+                else if (pFly && !pFly->IsAnLower(pStartFrame) &&
                     (rSur.GetSurround() != css::text::WrapTextMode_THROUGH &&
                     !rSur.IsContour()) )
                 {

Reply via email to