[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sc/source

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 4 10:34:23 UTC 2020


 sc/source/ui/view/tabview.cxx |   81 +-----------------------------------------
 1 file changed, 2 insertions(+), 79 deletions(-)

New commits:
commit 3c6c039685870ed23d2f25cbfd984d3b54c4b60d
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Sat May 23 11:00:19 2020 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Sat Jul 4 12:33:50 2020 +0200

    use lcl_ExtendTiledDimension() in getRowColumnHeaders()
    
    to avoid code repetitions.
    
    Change-Id: If83b42175fb53132174fa33d169806e17a4a5cbe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96973
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Dennis Francis <dennis.francis at collabora.com>

diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 834bc01b9af6..3b11b23d7cf0 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2669,45 +2669,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
 
     /// 2) if we are approaching current max tiled row, signal a size changed event
     ///    and invalidate the involved area
-
-    if (nEndRow > aViewData.GetMaxTiledRow() - nVisibleRows)
-    {
-        ScDocShell* pDocSh = aViewData.GetDocShell();
-        ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel() ) : nullptr;
-        Size aOldSize(0, 0);
-        if (pModelObj)
-            aOldSize = pModelObj->getDocumentSize();
-
-        aViewData.SetMaxTiledRow(std::min(std::max(nEndRow, aViewData.GetMaxTiledRow()) + nVisibleRows, long(MAXTILEDROW)));
-
-        Size aNewSize(0, 0);
-        if (pModelObj)
-            aNewSize = pModelObj->getDocumentSize();
-
-        SAL_INFO("sc.lok.header", "Row Header: a new height: " << aNewSize.Height());
-        if (pDocSh)
-        {
-            // New area extended to the bottom of the sheet after last row
-            // excluding overlapping area with aNewColArea
-            tools::Rectangle aNewRowArea(0, aOldSize.getHeight(), aOldSize.getWidth(), aNewSize.getHeight());
-
-            // Only invalidate if spreadsheet extended to the bottom
-            if (aNewRowArea.getHeight())
-            {
-                UpdateSelectionOverlay();
-                SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewRowArea.toString());
-            }
-
-            // Provide size in the payload, so clients don't have to
-            // call lok::Document::getDocumentSize().
-            std::stringstream ss;
-            ss << aNewSize.Width() << ", " << aNewSize.Height();
-            OString sSize = ss.str().c_str();
-            ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
-            SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false);
-        }
-    }
-
+    lcl_ExtendTiledDimension(/* bColumn */ false, nEndRow, nVisibleRows, *this, aViewData);
 
     /// 3) create string data for rows
 
@@ -2803,46 +2765,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
 
     /// 2) if we are approaching current max tiled column, signal a size changed event
     ///    and invalidate the involved area
-
-    if (nEndCol > aViewData.GetMaxTiledCol() - nVisibleCols)
-    {
-        ScDocShell* pDocSh = aViewData.GetDocShell();
-        ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel() ) : nullptr;
-        Size aOldSize(0, 0);
-        if (pModelObj)
-            aOldSize = pModelObj->getDocumentSize();
-
-        aViewData.SetMaxTiledCol(std::min(std::max(nEndCol, aViewData.GetMaxTiledCol()) + nVisibleCols, long(pDoc->MaxCol())));
-
-        Size aNewSize(0, 0);
-        if (pModelObj)
-            aNewSize = pModelObj->getDocumentSize();
-
-        if (pDocSh)
-        {
-            // New area extended to the right of the sheet after last column
-            // including overlapping area with aNewRowArea
-            tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), aNewSize.getHeight());
-
-            // Only invalidate if spreadsheet extended to the bottom
-            if (aNewColArea.getWidth())
-            {
-                UpdateSelectionOverlay();
-                SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewColArea.toString());
-            }
-
-            if (aOldSize != aNewSize)
-            {
-                // Provide size in the payload, so clients don't have to
-                // call lok::Document::getDocumentSize().
-                std::stringstream ss;
-                ss << aNewSize.Width() << ", " << aNewSize.Height();
-                OString sSize = ss.str().c_str();
-                ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
-                SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false);
-            }
-        }
-    }
+    lcl_ExtendTiledDimension(/* bColumn */ true, nEndCol, nVisibleCols, *this, aViewData);
 
     /// 3) create string data for columns
 


More information about the Libreoffice-commits mailing list