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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 23 09:41:29 UTC 2019


 sw/qa/extras/uiwriter/uiwriter.cxx |    4 +++-
 sw/source/core/draw/dflyobj.cxx    |    7 +++++++
 sw/source/core/inc/dflyobj.hxx     |    1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 47ec4fb42cae7e51e45c6361a6e6773462b7b8ca
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Oct 21 21:33:36 2019 +0200
Commit:     Xisco FaulĂ­ <xiscofauli at libreoffice.org>
CommitDate: Wed Oct 23 11:40:34 2019 +0200

    tdf#127412 sw: fix reported ZOrder of shape+textbox pairs
    
    Writer documents may have shape+textbox pairs, in which case internally
    they have individual ZOrders, but the textbox ZOrder is always just 1
    larger than their shape, and externally this is not visible (UNO API,
    UI).
    
    This is implemented by e.g. SwXDrawPage::getCount(), which ignores those
    textboxes. This worked in general for SwVirtFlyDrawObj, but in case the
    textbox is a SwFlyDrawObj, then these were not filtered out. Fix this,
    so the scenario when the shapes are added to the draw page following
    ZOrder (0, 1, etc) works (internally producing 0, 1, 2, 3, etc ZOrders).
    
    (cherry picked from commit 9a29a4df545d7f88cd14bb99ce54f149032eb7f0)
    
    Change-Id: I2a04fb76029d83390d418c764fdfbe7a1ee0f208
    Reviewed-on: https://gerrit.libreoffice.org/81302
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index e403adb33e96..0a646fd730e7 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -1358,10 +1358,12 @@ void SwUiWriterTest::testShapeTextboxAutosize()
 {
     SwDoc* pDoc = createDoc("shape-textbox-autosize.odt");
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+    // 0-1 is the first UI-visible shape+textbox.
     SdrObject* pFirst = pPage->GetObj(0);
     CPPUNIT_ASSERT_EQUAL(OUString("1st"), pFirst->GetName());
 
-    SdrObject* pSecond = pPage->GetObj(1);
+    // 2-3 is the second UI-visible shape+textbox.
+    SdrObject* pSecond = pPage->GetObj(2);
     CPPUNIT_ASSERT_EQUAL(OUString("2nd"), pSecond->GetName());
 
     // Shape -> textbox synchronization was missing, the second shape had the
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 890ee455a28a..a24be565cf68 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -67,6 +67,7 @@
 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <notxtfrm.hxx>
+#include <dcontact.hxx>
 
 using namespace ::com::sun::star;
 
@@ -144,6 +145,12 @@ sal_uInt16 SwFlyDrawObj::GetObjIdentifier() const
     return SwFlyDrawObjIdentifier;
 }
 
+bool SwFlyDrawObj::IsTextBox() const
+{
+    const SwFrameFormat* pFrameFormat = FindFrameFormat(this);
+    return SwTextBoxHelper::isTextBox(pFrameFormat, RES_FLYFRMFMT);
+}
+
 // TODO: Need own primitive to get the FlyFrame paint working
 namespace drawinglayer
 {
diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx
index 5ede9007ec24..93823bd1b2dc 100644
--- a/sw/source/core/inc/dflyobj.hxx
+++ b/sw/source/core/inc/dflyobj.hxx
@@ -50,6 +50,7 @@ public:
     // for instantiation of this class while loading (via factory)
     virtual SdrInventor GetObjInventor()     const override;
     virtual sal_uInt16  GetObjIdentifier()   const override;
+    bool IsTextBox() const override;
 };
 
 // virtual objects for Flys


More information about the Libreoffice-commits mailing list