[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-1' - include/svx svx/source sw/qa

Hossein (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 1 13:41:54 UTC 2021


 include/svx/svdopath.hxx                            |    1 
 svx/source/svdraw/svdopath.cxx                      |   13 ++++++++
 sw/qa/extras/ww8export/data/shapes-line-ellipse.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx               |   30 ++++++++++++++++++++
 4 files changed, 44 insertions(+)

New commits:
commit 23560258075567bc7dbbafb4d55ea0565bb9cb73
Author:     Hossein <hossein at libreoffice.org>
AuthorDate: Mon Jul 19 13:03:42 2021 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Sep 1 15:41:19 2021 +0200

    tdf#123321 Fix DOC/DOCX export bug which made some lines disappear
    
    * Fix the wrong calculation of SdrPathObj (line) extent while exporting
      to .doc and .docx formats. This resolves tdf#123321 which cause some
      lines to disappear after save and reload. This fix does not break
      tdf#91687
    * added tests to make sure this does not happen again, based on the
      .doc file provided in Bugzilla
    * Loading the bad exported file in MS Word is OK, but it does not work
      in LibreOffice, and some of the lines will be hidden. This needs
      additional work.
    
    The regression came from d72e0cadceb0b43928a9b4f18d75c9d5d30afdda
    
    Change-Id: Ic5a7af4d29df741204c50590728542e674ee9f91
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119116
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit bda4d7a7c3fcc259e023f568606be5dcba818db9)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119185
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit ae0c6da13c9b92757ff0f4ba360308ee50c701cf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121428
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/include/svx/svdopath.hxx b/include/svx/svdopath.hxx
index 5f56fd38e5ae..380d28cee867 100644
--- a/include/svx/svdopath.hxx
+++ b/include/svx/svdopath.hxx
@@ -86,6 +86,7 @@ public:
     virtual sal_uInt32 GetHdlCount() const override;
     virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
     virtual void AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const override;
+    virtual const tools::Rectangle& GetLogicRect() const override;
 
     // special drag methods
     virtual bool hasSpecialDrag() const override;
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index a26aaec73210..75112c28a910 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2064,6 +2064,19 @@ void SdrPathObj::AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const
     }
 }
 
+// tdf#123321: Make sure that SdrPathObj (e.g. line) has big enough extent for
+// visibility. This is realised by ensuring GetLogicRect() is the same as
+// GetSnapRect() for the SdrPathObj. Other SdrTextObj objects like
+// SdrObjCustomShape will still use a different version of this method that
+// does not consider the rotation. Otherwise, the rotated SdrObjCustomShape
+// would become mistakenly larger after save and reload (tdf#91687).
+// The invokation of the GetLogicRect() method that caused tdf#123321 was in
+// PlcDrawObj::WritePlc().
+const tools::Rectangle &SdrPathObj::GetLogicRect() const
+{
+    return GetSnapRect();
+}
+
 // dragging
 
 bool SdrPathObj::hasSpecialDrag() const
diff --git a/sw/qa/extras/ww8export/data/shapes-line-ellipse.doc b/sw/qa/extras/ww8export/data/shapes-line-ellipse.doc
new file mode 100644
index 000000000000..184881c00a6d
Binary files /dev/null and b/sw/qa/extras/ww8export/data/shapes-line-ellipse.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 004451247cdf..27d4e7e05e5f 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -422,6 +422,36 @@ DECLARE_WW8EXPORT_TEST(testTdf108072, "tdf108072.doc")
     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTableRows->getByIndex(0), "IsSplitAllowed"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf123321, "shapes-line-ellipse.doc")
+{
+    // These are the 3 lines in which 1st and 3rd one were disappearing before
+    uno::Reference<drawing::XShape> l1 = getShape(7);
+    uno::Reference<drawing::XShape> l2 = getShape(8);
+    uno::Reference<drawing::XShape> l3 = getShape(9);
+
+    // first line (smallest)
+    // Fails without the fix: Expected: 423, Actual: 2
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(423), l1->getSize().Height);
+    // Fails without the fix: Expected: 0, Actual: 2
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), l1->getSize().Width);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(7908), l1->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(37), l1->getPosition().Y);
+
+    // second line (larger)
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2542), l2->getSize().Height);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), l2->getSize().Width);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(7916), l2->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(289), l2->getPosition().Y);
+
+    // third line (largest)
+    // Fails without the fix: Expected: 7027, Actual: 2
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(7027), l3->getSize().Height);
+    // Fails without the fix: Expected: 0, Actual: 2
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), l3->getSize().Width);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(7911), l3->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(231), l3->getPosition().Y);
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf91687, "tdf91687.doc")
 {
     // Exported Watermarks were resized


More information about the Libreoffice-commits mailing list