sw/qa/extras/uiwriter/uiwriter2.cxx          |   16 ++++++++++++++++
 sw/source/core/layout/anchoreddrawobject.cxx |   18 ++++++++++++------
 sw/source/filter/docx/swdocxreader.cxx       |    9 ++++++++-
 3 files changed, 36 insertions(+), 7 deletions(-)

New commits:
commit 92cd37efd22d4b80982fa87bcc336e4be5123b2c
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Feb 7 11:06:24 2019 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Jun 18 16:08:50 2019 +0200

    tdf#123032 sw, AddVerticalFrameOffsets: fix shape pos after mouse move
    
    Regression from commit 50223ea6e212b60b7d33839c2753c5601fb50f95
    (tdf#98987 sw: add AddVerticalFrameOffsets compat mode, 2016-03-31),
    the problem was that vertical position of the shape was wrong after
    mouse move, even if we attempted to take fly frames of the paragraph
    into account. (Similar situation is when saving and loading the file;
    which is much easier to test.)
    
    Fly frames are created as the
    text frames is formatted, and then SwTextFrame::CalcBaseOfstForFly() can
    calculate the vertical offset correctly. But in the "move with mouse"
    case SwToContentAnchoredObjectPosition::CalcPosition() was invoked by
    the time the old flys of the text frame were already removed, but the
    new ones were not yet added.
    
    Solve the problem by formatting the text frame from
    SwAnchoredDrawObject::MakeObjPosAnchoredAtPara() (if any of its validity
    flags are set to false) -- this is expected to be safe, as the object
    formatter is invoked by SwLayAction::FormatContent(), i.e. there is no
    recursive SwFrame::Calc() call here.
    
    (cherry picked from commit 961ba62df045473e5793d9e103be86eaad8d9575)
    
    Change-Id: I95851874e3da3f50f304421537c6743e04bdfc7b
    Reviewed-on: https://gerrit.libreoffice.org/71127
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>
    Tested-by: Aron Budea <aron.bu...@collabora.com>
    (cherry picked from commit da21956366a13b62b056d6074262f44c1559b29d)

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 01ee96f67ee6..745e2459de6c 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -640,6 +640,22 @@ void SwUiWriterTest2::testTdf122942()
     // paragraph mark, not above it.
     const SwFormatVertOrient& rVert = rFormats[1]->GetVertOrient();
     CPPUNIT_ASSERT_LESS(static_cast<SwTwips>(0), rVert.GetPos());
+
+    reload("writer8", "tdf122942.odt");
+    pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    pDoc = pWrtShell->GetDoc();
+    const SwFrameFormats& rFormats2 = *pDoc->GetSpzFrameFormats();
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFormats2.size());
+
+    SdrObject* pObject = rFormats2[1]->FindSdrObject();
+    CPPUNIT_ASSERT(pObject);
+
+    const tools::Rectangle& rOutRect = pObject->GetLastBoundRect();
+    // Without the accompanying fix in place, this test would have failed with
+    // 'Expected greater than: 5000; Actual  : 2817', i.e. the shape moved up
+    // after a reload(), while it's expected to not change its position (5773).
+    CPPUNIT_ASSERT_GREATER(static_cast<SwTwips>(5000), rOutRect.Top());
 }
 
 void SwUiWriterTest2::testDocxAttributeTableExport()
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx 
b/sw/source/core/layout/anchoreddrawobject.cxx
index 88f9969a422f..de969773d8b9 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -374,12 +374,18 @@ void SwAnchoredDrawObject::MakeObjPosAnchoredAtPara()
     // --> #i50356# - format anchor frame containing the anchor
     // position. E.g., for at-character anchored object this can be the follow
     // frame of the anchor frame, which contains the anchor character.
-    const bool bFormatAnchor =
-            !static_cast<const SwTextFrame*>( 
GetAnchorFrameContainingAnchPos() )->IsAnyJoinLocked() &&
-            !ConsiderObjWrapInfluenceOnObjPos() &&
-            !ConsiderObjWrapInfluenceOfOtherObjs();
-
-    if ( bFormatAnchor )
+    bool bJoinLocked
+        = static_cast<const 
SwTextFrame*>(GetAnchorFrameContainingAnchPos())->IsAnyJoinLocked();
+    const bool bFormatAnchor = !bJoinLocked && 
!ConsiderObjWrapInfluenceOnObjPos()
+                               && !ConsiderObjWrapInfluenceOfOtherObjs();
+
+    // Format of anchor is needed for (vertical) fly offsets, otherwise the
+    // lack of fly portions will result in an incorrect 0 offset.
+    bool bAddVerticalFlyOffsets = 
GetFrameFormat().getIDocumentSettingAccess().get(
+        DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS);
+    bool bFormatAnchorOnce = !bJoinLocked && bAddVerticalFlyOffsets;
+
+    if (bFormatAnchor || bFormatAnchorOnce)
     {
         // --> #i50356#
         
GetAnchorFrameContainingAnchPos()->Calc(GetAnchorFrameContainingAnchPos()->getRootFrame()->GetCurrShell()->GetOut());
commit 58632afd2413fcc075cad08f5b4418fb613f0ed5
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Mar 14 15:51:07 2019 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Jun 18 16:08:20 2019 +0200

    DOCX autotext import: speed up handling of large amount of blocks
    
    WW8Glossary::Load() does the same for the DOC autotext import.
    
    Old cost for a document with 2508 document parts: 843842 ms.
    
    New cost for the same document: 46572 ms (5% of baseline).
    
    Change-Id: If0ff183315cb7465dd2b32c1a4fc856b50611265
    Reviewed-on: https://gerrit.libreoffice.org/69271
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 87670fa998a26ab059e40bbe8f5e0acf0ad6ea04)

diff --git a/sw/source/filter/docx/swdocxreader.cxx 
b/sw/source/filter/docx/swdocxreader.cxx
index 09351dd0bd63..188d15856dfd 100644
--- a/sw/source/filter/docx/swdocxreader.cxx
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -137,7 +137,14 @@ bool SwDOCXReader::ReadGlossaries( SwTextBlocks& rBlocks, 
bool /* bSaveRelFiles
             }));
 
         if( xFilter->filter( aDescriptor ) )
-            return MakeEntries( static_cast<SwDocShell*>( &xDocSh )->GetDoc(), 
rBlocks );
+        {
+            if (rBlocks.StartPutMuchBlockEntries())
+            {
+                bool bRet = 
MakeEntries(static_cast<SwDocShell*>(&xDocSh)->GetDoc(), rBlocks);
+                rBlocks.EndPutMuchBlockEntries();
+                return bRet;
+            }
+        }
     }
 
     return false;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to