[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed May 13 20:13:24 UTC 2020


 sw/qa/uitest/writer_tests2/tdf116474.py |    4 +-
 sw/source/core/frmedt/fews.cxx          |   43 --------------------------------
 2 files changed, 2 insertions(+), 45 deletions(-)

New commits:
commit 90cc23eabdbc9248192a584c3dc41444cdab3bfd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 6 11:06:45 2020 +0100
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Wed May 13 22:12:51 2020 +0200

    Resolves: tdf#123801 captioning issues
    
    revert attempt to by default create a msword roundtrip friendly caption.
    
    commit 2333786aa0eaf70c45c80e546239fb3565b1b4e7
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Tue Mar 20 11:48:28 2018 +0000
    
        Resolves: tdf#116474 bring hidden text property under undo control
    
    commit ebd43aee5b9cf98ed96ce28985267ad0bc980b7a
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Fri Apr 7 13:41:38 2017 +0100
    
        rework setting hidden property on line break
    
    commit feedd45ba2dd308af2d3a1b2f64681b9467535b6
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Thu Oct 27 14:37:03 2016 +0100
    
        in msword the hard-break between image and caption has a width
    
    commit ba401ee10be2fb051bc961680f35b04e4e77a32d
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Thu Sep 1 09:39:37 2016 +0100
    
        coverity#1372378 Dereference null return value
    
    commit 93ab0ff24cb71c36c9e7958046e96d7472b5af90
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Thu Sep 10 15:46:57 2015 +0100
    
        Related: tdf#93676 default to as-char inside captions
    
    Change-Id: I460046a10f36bed13e2f4651b4c0a9b9b0662015
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93530
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py
index e85943d77043..e5bb89209835 100644
--- a/sw/qa/uitest/writer_tests2/tdf116474.py
+++ b/sw/qa/uitest/writer_tests2/tdf116474.py
@@ -41,13 +41,13 @@ class tdf116474(UITestCase):
         xOkBtn.executeAction("CLICK", tuple())
 
         xFrame = document.TextFrames[0]
-        self.assertEqual(document.TextFrames[0].Text.String, "\nFigure 1: Caption")
+        self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
         self.assertEqual(document.GraphicObjects.getCount(), 1)  #nr. of images
         #Undo, redo
         self.xUITest.executeCommand(".uno:Undo")
         self.xUITest.executeCommand(".uno:Redo")
         #Verify
-        self.assertEqual(document.TextFrames[0].Text.String, "\nFigure 1: Caption")
+        self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
         self.assertEqual(document.GraphicObjects.getCount(), 1)  #nr. of images
 
         self.ui_test.close_doc()
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 2f874fd34e24..2ad7ec20a86f 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -19,7 +19,6 @@
 
 #include <svx/svdobj.hxx>
 #include <comphelper/lok.hxx>
-#include <editeng/charhiddenitem.hxx>
 #include <init.hxx>
 #include <fesh.hxx>
 #include <tabcol.hxx>
@@ -502,48 +501,6 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, con
         pFlyFormat = GetDoc()->InsertLabel(eType, rText, rSeparator,
                                            rNumberSeparator, bBefore, nId,
                                            nIdx, rCharacterStyle, bCpyBrd);
-
-        //if we succeeded in putting a caption on the content, and the
-        //content was a frame/graphic, then set the contained element
-        //to as-char anchoring because that's all msword is able to
-        //do when inside a frame, and in writer for freshly captioned
-        //elements it's largely irrelevant what the anchor of the contained
-        //type is but making it as-char by default results in very
-        //good roundtripping
-        if (pFlyFormat && bInnerCntIsFly)
-        {
-            SwNodeIndex aAnchIdx(*pFlyFormat->GetContent().GetContentIdx(), 1);
-            SwTextNode *pTextNode = aAnchIdx.GetNode().GetTextNode();
-
-            SwFormatAnchor aAnc(RndStdIds::FLY_AS_CHAR);
-            sal_Int32 nInsertPos = bBefore ? pTextNode->Len() : 0;
-            SwPosition aPos(*pTextNode, nInsertPos);
-
-            aAnc.SetAnchor(&aPos);
-
-            SwFlyFrame *pFly = GetSelectedOrCurrFlyFrame();
-            OSL_ENSURE(pFly, "SetFlyFrameAttr, no Fly selected.");
-            if (pFly)
-            {
-                SfxItemSet aSet(makeItemSetFromFormatAnchor(GetDoc()->GetAttrPool(), aAnc));
-                SwFlyFrameFormat* pInnerFlyFormat = pFly->GetFormat();
-                GetDoc()->SetFlyFrameAttr(*pInnerFlyFormat, aSet);
-            }
-            //put a hard-break after the graphic to keep it separated
-            //from the caption text if the outer frame is resized
-            const sal_Int32 nIndex = bBefore ? nInsertPos : 1;
-            SwIndex aIdx(pTextNode, nIndex);
-            pTextNode->InsertText("\n", aIdx);
-            //set the hard-break to be hidden, otherwise it has
-            //non-zero width in word and so hard-break flows on
-            //the next line, pushing the caption text out of
-            //the frame making the caption apparently disappear
-            SvxCharHiddenItem aHidden(true, RES_CHRATR_HIDDEN);
-            SfxItemSet aSet(GetDoc()->GetAttrPool(), {{aHidden.Which(), aHidden.Which()}});
-            aSet.Put(aHidden);
-            SwPaM aPam(*pTextNode, nIndex, *pTextNode, nIndex + 1);
-            SetAttrSet(aSet, SetAttrMode::DEFAULT, &aPam);
-        }
     }
 
     if (pFlyFormat)


More information about the Libreoffice-commits mailing list