[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sc/source

Mike Kaganski mike.kaganski at collabora.com
Fri Dec 1 01:19:41 UTC 2017


 sc/source/ui/docshell/docfunc.cxx |    3 +++
 sc/source/ui/docshell/docsh5.cxx  |    5 +++++
 sc/source/ui/undo/undobase.cxx    |   11 ++++++++++-
 sc/source/ui/undo/undoblk.cxx     |    2 ++
 sc/source/ui/undo/undoblk3.cxx    |    6 +++++-
 sc/source/ui/view/viewfun2.cxx    |    7 +++++++
 6 files changed, 32 insertions(+), 2 deletions(-)

New commits:
commit 264b5dfc3cf90b904229c75dce7e2a9105552ead
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Sun Feb 12 01:58:23 2017 +0300

    tdf#76183: refresh objects' positions on optimal height recalc
    
    Since commit b10833d4db6046f2d32ea44a60cb19a626d80447, it's required
    to detect when objects' placement should be adjusted, and call
    SetDrawPageSize manually.
    Unit test included [not in this backport, though]
    
    Change-Id: I933ba4802b212400cc47ed0fb7e1f8f44049bb81
    Reviewed-on: https://gerrit.libreoffice.org/34165
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/45570
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index e314e3b35273..c42f04e1bb31 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -151,6 +151,9 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
 
     sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
     bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
+    // tdf#76183: recalculate objects' positions
+    if (bChanged)
+        rDoc.SetDrawPageSize(nTab);
 
     if ( bPaint && bChanged )
         rDocShell.PostPaint(ScRange(0, nStartRow, nTab, MAXCOL, MAXROW, nTab),
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 32857f2b3dee..427dd9ab3525 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -394,7 +394,12 @@ bool ScDocShell::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab )
     bool bChange = aDocument.SetOptimalHeight(aCxt, nStartRow,nEndRow, nTab);
 
     if (bChange)
+    {
+        // tdf#76183: recalculate objects' positions
+        aDocument.SetDrawPageSize(nTab);
+
         PostPaint( 0,nStartRow,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID|PAINT_LEFT );
+    }
 
     return bChange;
 }
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 0133f9afd41a..9aa01565096b 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -308,10 +308,14 @@ bool ScBlockUndo::AdjustHeight()
         aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab());
 
     if (bRet)
+    {
+        // tdf#76183: recalculate objects' positions
+        rDoc.SetDrawPageSize(aBlockRange.aStart.Tab());
+
         pDocShell->PostPaint( 0,      aBlockRange.aStart.Row(), aBlockRange.aStart.Tab(),
                               MAXCOL, MAXROW,                   aBlockRange.aEnd.Tab(),
                               PAINT_GRID | PAINT_LEFT );
-
+    }
     return bRet;
 }
 
@@ -408,9 +412,14 @@ void ScMultiBlockUndo::AdjustHeight()
         bool bRet = rDoc.SetOptimalHeight(aCxt, r.aStart.Row(), r.aEnd.Row(), r.aStart.Tab());
 
         if (bRet)
+        {
+            // tdf#76183: recalculate objects' positions
+            rDoc.SetDrawPageSize(r.aStart.Tab());
+
             pDocShell->PostPaint(
                 0, r.aStart.Row(), r.aStart.Tab(), MAXCOL, MAXROW, r.aEnd.Tab(),
                 PAINT_GRID | PAINT_LEFT);
+        }
     }
 }
 
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 157540535667..ca234549ab83 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1177,6 +1177,8 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
 
         if (rDoc.SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab()))
         {
+            // tdf#76183: recalculate objects' positions
+            rDoc.SetDrawPageSize(aRange.aStart.Tab());
             aRange.aStart.SetCol(0);
             aRange.aEnd.SetCol(MAXCOL);
             aRange.aEnd.SetRow(MAXROW);
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index ff43c28e0934..5de441787b0e 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -884,7 +884,7 @@ void ScUndoAutoFormat::Redo()
                     rDoc.SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
             }
 
-            rDoc.SetOptimalHeight(aCxt, nStartY, nEndY, nTab);
+            bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartY, nEndY, nTab);
 
             for (SCCOL nCol=nStartX; nCol<=nEndX; nCol++)
                 if (!rDoc.ColHidden(nCol, nTab))
@@ -895,6 +895,10 @@ void ScUndoAutoFormat::Redo()
                     rDoc.SetColWidth( nCol, nTab, nThisSize );
                     rDoc.ShowCol( nCol, nTab, true );
                 }
+
+            // tdf#76183: recalculate objects' positions
+            if (bChanged)
+                rDoc.SetDrawPageSize(nTab);
         }
 
         pDocShell->PostPaint( 0,      0,      nStartZ,
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 7e2e8b316708..6b2b17ae7f61 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -147,6 +147,9 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
                 bAnyChanged = bChanged = true;
             }
         }
+        // tdf#76183: recalculate objects' positions
+        if (bChanged)
+            rDoc.SetDrawPageSize(nTab);
         if ( bPaint && bChanged )
             pDocSh->PostPaint( 0, nPaintY, nTab, MAXCOL, MAXROW, nTab,
                                                 PAINT_GRID | PAINT_LEFT );
@@ -181,6 +184,10 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow )
     sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
     bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
 
+    // tdf#76183: recalculate objects' positions
+    if (bChanged)
+        rDoc.SetDrawPageSize(nTab);
+
     if (bChanged && ( nStartRow == nEndRow ))
     {
         sal_uInt16 nNewPixel = (sal_uInt16) (rDoc.GetRowHeight(nStartRow,nTab) * nPPTY);


More information about the Libreoffice-commits mailing list