sc/source/ui/inc/gridwin.hxx   |    7 ---
 sc/source/ui/view/gridwin.cxx  |    6 ---
 sc/source/ui/view/gridwin4.cxx |   73 -----------------------------------------
 sc/source/ui/view/tabview5.cxx |   11 ------
 4 files changed, 97 deletions(-)

New commits:
commit 1f966bb3e38a028c82cee40f6c5a17fe9619b53c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 1 00:32:14 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 1 10:00:11 2022 +0200

    trac#34262 Revert "Do not count pages for initial page breaks, tdf#124983 
follow-up"
    
    Analyzing trac#36262 showed that the issue with WollMux mail merge
    using wrong data record count when a large amount of
    records is involved starts with this commit.
    (The issue was not reliably reproducible on all systems, though;
    I can e.g. only reproduce issue about wrong data
    record count on my LHM Win client, not on Linux or my non-LHM Win
    client.)
    
    Other tdf#124983-related commits are missing on this branch,
    which might be related.
    
    There is the initial fix
    
        commit caeb7b141280a65e60525f11a7e6514b76e12e11
        Author: Ilhan Yesil <ilhanye...@gmx.de>
        Date:   Wed Jul 10 15:41:27 2019 +0200
    
            tdf#124983 In calc make printable page borders also initially 
visible
    
    with follow-up
    
        commit 8728eddf938c9c843ab72929cfd3947735ca8da2
        Author: Miklos Vajna <vmik...@collabora.com>
        Date:   Mon Jan 6 10:31:50 2020 +0100
    
            tdf#129552 sc: avoid infinite invalidation loop when the print 
range is empty
    
    and the revert of the initial fix in
    
        commit b3e302b98dd7b992b7aa5a7f6756980d3edafc83
        Author: Xisco Fauli <xiscofa...@libreoffice.org>
        Date:   Thu Feb 13 17:06:58 2020 +0100
    
            tdf#130640: Revert "tdf#124983 In calc make printable page...
    
    and the commit reverted now in this commit
    
        commit 129c680f02564c8bee93930dec9f2ad80980cc1c
        Author: Eike Rathke <er...@redhat.com>
        Date:   Wed Aug 18 23:42:45 2021 +0200
    
            Do not count pages for initial page breaks, tdf#124983 follow-up
    
    without the second version of the fix being present at all
    (master commit
    
         commit 86e300df241312f6152da1cfa3cb2b8c668d1df5
        Author: Ilhan Yesil <ilhanye...@gmx.de>
        Date:   Fri Mar 6 13:40:59 2020 +0100
    
            tdf#124983 In calc make printable page borders initially visible
    
    ) after the revert, so maybe having the follow-up without the
    underlying fix is not a good idea.
    
    And there would be another follow-up commit on master
    that we don't have either:
    
        commit 3d7007ef8784e92bb56a91c40e7bdff812251677
        Author: Eike Rathke <er...@redhat.com>
        Date:   Tue Jun 29 14:31:19 2021 +0200
    
            maShowPageBreaksTimer.Stop() in ScGridWindow::dispose(), tdf#124983 
follow-up
    
    Revert this for now to unbreak WollMux mail merge.
    
    This reverts commit 129c680f02564c8bee93930dec9f2ad80980cc1c.
    
    Change-Id: I74c93ab7cd27eba347b78a198e3d8fbe5fdeb0e2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132370
    Tested-by: Michael Weghorn <m.wegh...@posteo.de>
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index e9363a1f96d2..5ebb26241d10 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -190,8 +190,6 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, 
public DropTargetHel
 
     RfCorner                aRFSelectedCorned;
 
-    Timer                   maShowPageBreaksTimer;
-
     bool                    bEEMouse:1;               // Edit Engine has mouse
     bool                    bDPMouse:1;               // DataPilot D&D (new 
Pivot table)
     bool                    bRFMouse:1;               // RangeFinder drag
@@ -202,7 +200,6 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, 
public DropTargetHel
     bool                    bNeedsRepaint:1;
     bool                    bAutoMarkVisible:1;
     bool                    bListValButton:1;
-    bool                    bInitialPageBreaks:1;
 
     DECL_LINK( PopupModeEndHdl, FloatingWindow*, void );
     DECL_LINK( PopupSpellingHdl, SpellCallbackInfo&, void );
@@ -291,8 +288,6 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, 
public DropTargetHel
 
     void            GetSelectionRects( ::std::vector< tools::Rectangle >& 
rPixelRects );
 
-    void            SetupInitialPageBreaks(const ScDocument& rDoc, SCTAB nTab);
-    DECL_LINK(InitiatePageBreaksTimer, Timer*, void);
 
 protected:
     virtual void    PrePaint(vcl::RenderContext& rRenderContext) override;
@@ -467,8 +462,6 @@ public:
 
     void updateLOKValListButton(bool bVisible, const ScAddress& rPos) const;
 
-    void initiatePageBreaks();
-
 protected:
     void ImpCreateOverlayObjects();
     void ImpDestroyOverlayObjects();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index aa540b5d5134..0ed015bb31da 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -482,10 +482,6 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, 
ScViewData* pData, ScSplitPos
 
     SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
     EnableRTL( false );
-
-    bInitialPageBreaks = true;
-    maShowPageBreaksTimer.SetInvokeHandler(LINK(this, ScGridWindow, 
InitiatePageBreaksTimer));
-    maShowPageBreaksTimer.SetTimeout(1);
 }
 
 ScGridWindow::~ScGridWindow()
@@ -495,8 +491,6 @@ ScGridWindow::~ScGridWindow()
 
 void ScGridWindow::dispose()
 {
-    maShowPageBreaksTimer.Stop();
-
     ImpDestroyOverlayObjects();
 
     mpFilterBox.disposeAndClear();
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index aa7ad1312acc..9426c8842bf0 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1055,28 +1055,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, 
const ScTableInfo& rTableI
 
     if (mpNoteMarker)
         mpNoteMarker->Draw(); // Above the cursor, in drawing map mode
-
-    if (bPage && bInitialPageBreaks)
-        SetupInitialPageBreaks(rDoc, nTab);
-}
-
-
-void ScGridWindow::SetupInitialPageBreaks(const ScDocument& rDoc, SCTAB nTab)
-{
-    // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page breaks
-    // is enabled, breaks should be visible. If the document is opened the 
first
-    // time, the breaks are not calculated yet, so for this initialization
-    // a timer will be triggered here.
-    std::set<SCCOL> aColBreaks;
-    std::set<SCROW> aRowBreaks;
-    rDoc.GetAllColBreaks(aColBreaks, nTab, true, false);
-    rDoc.GetAllRowBreaks(aRowBreaks, nTab, true, false);
-    if (aColBreaks.size() == 0 || aRowBreaks.size() == 0)
-    {
-        maShowPageBreaksTimer.SetPriority(TaskPriority::DEFAULT_IDLE);
-        maShowPageBreaksTimer.Start();
-    }
-    bInitialPageBreaks = false;
 }
 
 namespace
@@ -2027,55 +2005,4 @@ void ScGridWindow::DataChanged( const DataChangedEvent& 
rDCEvt )
     }
 }
 
-void ScGridWindow::initiatePageBreaks()
-{
-    bInitialPageBreaks = true;
-}
-
-IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer*, pTimer, void)
-{
-    if (pTimer == &maShowPageBreaksTimer)
-    {
-        const ScViewOptions& rOpts = pViewData->GetOptions();
-        const bool bPage = rOpts.GetOption(VOPT_PAGEBREAKS);
-        // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page
-        // breaks is enabled, breaks should be visible. If the document is
-        // opened the first time or a tab is activated the first time, the
-        // breaks are not calculated yet, so this initialization is done here.
-        if (bPage)
-        {
-            const SCTAB nCurrentTab = pViewData->GetTabNo();
-            ScDocument* pDoc = pViewData->GetDocument();
-            const Size aPageSize = pDoc->GetPageSize(nCurrentTab);
-            // Do not attempt to calculate a page size here if it is empty if
-            // that involves counting pages.
-            // An earlier implementation did
-            //   ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nCurrentTab);
-            //   rDoc.SetPageSize(nCurrentTab, rDoc.GetPageSize(nCurrentTab));
-            // which resulted in tremendous waiting times after having loaded
-            // larger documents i.e. imported from CSV, in which UI is entirely
-            // blocked. All time is spent under ScPrintFunc::CountPages() in
-            // ScTable::ExtendPrintArea() in the loop that calls
-            // MaybeAddExtraColumn() to do stuff for each text string content
-            // cell (each row in each column). Maybe that can be optimized, or
-            // obtaining page size without that overhead would be possible, but
-            // as is calling that from here is a no-no so this is a quick
-            // disable things.
-            if (aPageSize.Width()>0&&aPageSize.Height())
-            {
-                ScDocShell* pDocSh = pViewData->GetDocShell();
-                const bool bModified = pDocSh->IsModified();
-                // Even setting the same size sets page size valid, so
-                // UpdatePageBreaks() actually does something.
-                pDoc->SetPageSize( nCurrentTab, aPageSize);
-                pDoc->UpdatePageBreaks(nCurrentTab);
-                pDocSh->PostPaint(0, 0, nCurrentTab, pDoc->MaxCol(), 
pDoc->MaxRow(), nCurrentTab, PaintPartFlags::Grid);
-                pDocSh->SetModified(bModified);
-            }
-        }
-
-        Invalidate();
-    }
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 635b40e97ab5..b075b748f0e3 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -315,17 +315,6 @@ void ScTabView::TabChanged( bool bSameTabButMoved )
         }
     }
 
-    for (int i = 0; i < 4; i++)
-    {
-        if (pGridWin[i])
-        {
-            pGridWin[i]->initiatePageBreaks();
-            // Trigger calculating page breaks only once.
-            break;
-        }
-    }
-
-
     if (comphelper::LibreOfficeKit::isActive())
     {
         ScDocShell* pDocSh = GetViewData().GetDocShell();

Reply via email to