sw/source/core/layout/paintfrm.cxx |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

New commits:
commit f53df0c693d8e73e86ddd986e5b861a0af28e62b
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Mon Mar 25 16:01:44 2024 -0400
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Apr 2 09:08:25 2024 +0200

    tdf#131253 sw: draw frame text boundary only if show formatting marks
    
    This squashed backport includes c51f9f15b8c308e62b4839cc13d623fdab0486c2
    
    It is infuriating to see a border around your image
    when there is no border defined. View - Text boundaries
    does NOT sound like something that would apply to images,
    and it is NOT nice to turn that off because then you also
    lose the body text markers as well as the header/footer indicators.
    
    Instead, do the same thing as the page boundaries - only show
    the (full) boundary when show formatting marks is turned on
    (and there are no partial boundaries for frames...)
    
    These text boundaries around AT-anchored flies
    only became visible in LO 6.0.
    
    Change-Id: I7954effc46d977e1761cba71758f7a7af2072807
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165294
    Reviewed-by: Justin Luth <jl...@mail.com>
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165428
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 92d8f087ec36..5ca89df04ba8 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7331,6 +7331,28 @@ void SwLayoutFrame::PaintSubsidiaryLines( const 
SwPageFrame *pPage,
     const bool bFlys = pPage->GetSortedObjs() != nullptr;
 
     const bool bCell = IsCellFrame();
+
+    if (!bCell && IsFlyFrame())
+    {
+        // particularly with images (but also plausible for any kind of frame),
+        // it is very disconcerting to see a fake border,
+        // so (just like the page boundary) only show fly "text boundaries"
+        // when "Show Formatting Marks" is turned on
+        if (!gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars())
+            return;
+
+        // if the frame is wrap none or wrap through, then text boundary lines 
have no meaning
+        // (unless the frame itself contains text)
+        const text::WrapTextMode aSurround = 
GetFormat()->GetSurround().GetSurround();
+        if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR
+            && (!Lower() || !Lower()->IsTextFrame())
+            && (aSurround == text::WrapTextMode::WrapTextMode_THROUGH
+                || aSurround == text::WrapTextMode::WrapTextMode_NONE))
+        {
+            return;
+        }
+    }
+
     //  #i3662# - use frame area for cells for section use also frame area
     const bool bUseFrameArea = bCell || IsSctFrame();
     SwRect aOriginal( bUseFrameArea ? getFrameArea() : getFramePrintArea() );

Reply via email to