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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 17 16:57:57 UTC 2019


 sw/inc/crsrsh.hxx                          |    1 +
 sw/inc/viscrs.hxx                          |    4 +++-
 sw/qa/extras/layout/layout.cxx             |    8 ++++++++
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |    2 +-
 sw/qa/extras/uiwriter/data2/tdf105330.odt  |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx        |   25 +++++++++++++++++++++++++
 sw/qa/extras/ww8import/ww8import.cxx       |    8 ++++++++
 sw/source/core/crsr/callnk.cxx             |   15 ++-------------
 sw/source/core/crsr/crsrsh.cxx             |    5 +++++
 sw/source/core/crsr/viscrs.cxx             |    5 +++++
 10 files changed, 58 insertions(+), 15 deletions(-)

New commits:
commit d5b50e74ee822e1c8402e3044e14799e47907ff8
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Sep 16 21:15:28 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Sep 17 18:57:09 2019 +0200

    tdf#105330 sw: fix lost cursor on undoing nested table insert
    
    This is a regression from commit
    e4509eea8fc7c07ddff48edf0d4c015c2663d896 (n#751313 SwCallLink: avoid
    redrawing complete rows without nested tables, 2012-04-20), though
    manual testing shows that the underlying problem has been addressed in
    the meantime, so this can be reverted.
    
    Over time, some poor tests started to depend on the new behavior so
    adapt them as necessary:
    
    1) Change back test added in commit
    075fc0c0a34875adf2833e5933b4982b9443a373 (testcase for fdo#38414,
    2014-03-18) to its original form, that was changed to an export test in
    commit 086550313260d9fa45b91dc705b21bb9b51ce0b8 (move round-tripables to
    ooxmlexport, 2016-10-07), as the export of that document still results
    in data loss of cell content, just happened to pass so far.
    
    2) Explicitly calculate content of text frames in two more tests, which
    just hoped that by the time they assert, the layout is ready already
    (but now that the missing notification is restored, it happens that the
    first pass of the layout doesn't create them; only a later pass, invoked
    by Idle, which doesn't run during cppunit tests).
    
    (cherry picked from commit c56bf1479cc71d1a2b0639f6383e90c1f7e3655b)
    
    Conflicts:
            sw/qa/extras/uiwriter/uiwriter2.cxx
    
    Change-Id: Ie13d17266cd552f3850848ae980bcfe8776997ac
    Reviewed-on: https://gerrit.libreoffice.org/79043
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index fb105b00e524..70eadace19ec 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -688,6 +688,7 @@ public:
     // (This is needed for displaying the Drag&Drop/Copy-Cursor.)
     bool SetVisibleCursor( const Point &rPt );
     inline void UnSetVisibleCursor();
+    SwVisibleCursor* GetVisibleCursor() const;
 
     // jump to the next or previous field of the corresponding type
     bool MoveFieldType(
diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
index 49a9cc9035bb..2361bed32ecc 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -25,6 +25,7 @@
 #include "swcrsr.hxx"
 #include "swrect.hxx"
 #include "swregion.hxx"
+#include "swdllapi.h"
 
 namespace sdr { namespace overlay { class OverlayObject; } }
 
@@ -33,7 +34,7 @@ class SfxViewShell;
 
 // From here classes/methods for non-text cursor.
 
-class SwVisibleCursor
+class SW_DLLPUBLIC SwVisibleCursor
 {
     friend void InitCore();
     friend void FinitCore();
@@ -57,6 +58,7 @@ public:
     bool IsVisible() const { return m_bIsVisible; }
     void SetDragCursor( bool bFlag = true ) { m_bIsDragCursor = bFlag; }
     void SetPosAndShow(SfxViewShell const * pViewShell);
+    const vcl::Cursor& GetTextCursor() const;
 };
 
 // From here classes/methods for selections.
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index e235cab6af45..dc63fc66302e 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2611,6 +2611,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118672)
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117923)
 {
     createDoc("tdf117923.doc");
+    // Ensure that all text portions are calculated before testing.
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwViewShell* pViewShell
+        = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+    CPPUNIT_ASSERT(pViewShell);
+    pViewShell->Reformat();
+
     xmlDocPtr pXmlDoc = parseLayoutDump();
 
     // Check that we actually test the line we need
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 089e6cd666d3..826cfe1eec11 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -522,7 +522,7 @@ DECLARE_OOXMLEXPORT_TEST(testNegativeCellMarginTwips, "negative-cell-margin-twip
     CPPUNIT_ASSERT( width.toInt32() > 0 );
 }
 
-DECLARE_OOXMLEXPORT_TEST(testFdo38414, "fdo38414.docx" )
+DECLARE_OOXMLIMPORT_TEST(testFdo38414, "fdo38414.docx" )
 {
     // The cells in the last (4th) column were merged properly and so the result didn't have the same height.
     // (Since w:gridBefore is worked around by faking another cell in the row, so column count is thus 5
diff --git a/sw/qa/extras/uiwriter/data2/tdf105330.odt b/sw/qa/extras/uiwriter/data2/tdf105330.odt
new file mode 100644
index 000000000000..bb1a088c38cc
Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf105330.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 13e1d305a2e3..765c65dfa1da 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -28,6 +28,7 @@
 #include <itabenum.hxx>
 #include <fmtfsize.hxx>
 #include <xmloff/odffields.hxx>
+#include <comphelper/propertyvalue.hxx>
 #include <txtfrm.hxx>
 #include <redline.hxx>
 #include <com/sun/star/style/BreakType.hpp>
@@ -1386,4 +1387,28 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125310b)
     CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105330)
+{
+    load(DATA_DIRECTORY, "tdf105330.odt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->Down(/*bSelect=*/false);
+    uno::Sequence<beans::PropertyValue> aTableArgs = {
+        comphelper::makePropertyValue("Rows", static_cast<sal_uInt16>(1)),
+        comphelper::makePropertyValue("Columns", static_cast<sal_uInt16>(1)),
+    };
+    lcl_dispatchCommand(mxComponent, ".uno:InsertTable", aTableArgs);
+
+    SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+    sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+    rUndoManager.Undo();
+
+    //  Without the accompanying fix in place, height was only 1 twips (practically invisible).
+    CPPUNIT_ASSERT_EQUAL(static_cast<long>(276),
+                         pWrtShell->GetVisibleCursor()->GetTextCursor().GetSize().getHeight());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index bd29b496fea4..41b97b098951 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -164,6 +164,14 @@ DECLARE_OOXMLIMPORT_TEST(testImageLazyRead, "image-lazy-read.doc")
 
 DECLARE_WW8IMPORT_TEST(testTdf106799, "tdf106799.doc")
 {
+    // Ensure that all text portions are calculated before testing.
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwViewShell* pViewShell
+        = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+    CPPUNIT_ASSERT(pViewShell);
+    pViewShell->Reformat();
+
     sal_Int32 const nCellWidths[3][4] = { { 9530, 0, 0, 0 },{ 2382, 2382, 2382, 2384 },{ 2382, 2382, 2382, 2384 } };
     sal_Int32 const nCellTxtLns[3][4] = { { 1, 0, 0, 0 },{ 1, 0, 0, 0},{ 1, 1, 1, 1 } };
     // Table was distorted because of missing sprmPFInnerTableCell at paragraph marks (0x0D) with sprmPFInnerTtp
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index 358d0895ed67..0754ca48e48e 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -80,19 +80,8 @@ static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell const & rShe
         return;
 
     const SwTableLine* pLine = pRow->GetTabLine( );
-    // Avoid redrawing the complete row if there are no nested tables
-    for (SwFrame *pCell = pRow->GetLower(); pCell; pCell = pCell->GetNext())
-    {
-        for (SwFrame *pContent = pCell->GetLower(); pContent; pContent = pContent->GetNext())
-        {
-            if (pContent->GetType() == SwFrameType::Tab)
-            {
-                SwFormatFrameSize aSize = pLine->GetFrameFormat()->GetFrameSize();
-                pRow->ModifyNotification(nullptr, &aSize);
-                return;
-            }
-        }
-    }
+    SwFormatFrameSize aSize = pLine->GetFrameFormat()->GetFrameSize();
+    pRow->ModifyNotification(nullptr, &aSize);
 }
 
 SwCallLink::~SwCallLink() COVERITY_NOEXCEPT_FALSE
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 22a84c6b4f75..be873c7e532e 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2601,6 +2601,11 @@ bool SwCursorShell::SetVisibleCursor( const Point &rPt )
     return bRet;
 }
 
+SwVisibleCursor* SwCursorShell::GetVisibleCursor() const
+{
+    return m_pVisibleCursor;
+}
+
 bool SwCursorShell::IsOverReadOnlyPos( const Point& rPt ) const
 {
     Point aPt( rPt );
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index f4272cacd354..be760d57f77e 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -244,6 +244,11 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell)
     }
 }
 
+const vcl::Cursor& SwVisibleCursor::GetTextCursor() const
+{
+    return m_aTextCursor;
+}
+
 SwSelPaintRects::SwSelPaintRects( const SwCursorShell& rCSh )
     : SwRects()
     , m_pCursorShell( &rCSh )


More information about the Libreoffice-commits mailing list