Revert "tdf#124983 In calc make printable page borders initially visible"
This reverts commit ff3f749cd08851ee4eb0991eabee0327ca081a45.
Reason for revert: reportedly causes crashes and heap corruption on Windows, see discussion in https://gerrit.libreoffice.org/c/core/+/90101
Change-Id: I84429b55b5fa2b26afd21ef104606ae2f30aad5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117727
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index daf6c35..09e46d7 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -309,10 +309,6 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, public DropTargetHel
void InvalidateLOKViewCursor(const tools::Rectangle& rCursorRect,
const Fraction aScaleX, const Fraction aScaleY);
Timer maShowPageBreaksTimer;
bool bInitialPageBreaks;
void SetupInitialPageBreaks(ScDocument& rDoc, SCTAB nTab, bool bSetup);
DECL_LINK(InitiatePageBreaksTimer, Timer*, void);
protected:
virtual void PrePaint(vcl::RenderContext& rRenderContext) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
@@ -494,8 +490,6 @@ public:
void updateLOKValListButton(bool bVisible, const ScAddress& rPos) const;
void updateLOKInputHelp(const OUString& title, const OUString& content) 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 c2c115c..b6412ae 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -424,10 +424,6 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData& rData, ScSplitPos
GetOutDev()->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
EnableRTL( false );
bInitialPageBreaks = true;
maShowPageBreaksTimer.SetInvokeHandler(LINK(this, ScGridWindow, InitiatePageBreaksTimer));
maShowPageBreaksTimer.SetTimeout(1);
}
ScGridWindow::~ScGridWindow()
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index f1e53ed..9c1ff47 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -76,9 +76,6 @@
#include <vcl/virdev.hxx>
#include <svx/sdrpaintwindow.hxx>
#include <drwlayer.hxx>
#include <columnspanset.hxx>
#include <docfunc.hxx>
#include <printfun.hxx>
static void lcl_LimitRect( tools::Rectangle& rRect, const tools::Rectangle& rVisible )
{
@@ -1270,30 +1267,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
if (mpNoteMarker)
mpNoteMarker->Draw(); // Above the cursor, in drawing map mode
SetupInitialPageBreaks(rDoc, nTab, bPage&& bInitialPageBreaks);
}
void ScGridWindow::SetupInitialPageBreaks(ScDocument& rDoc, SCTAB nTab, bool bSetup)
{
// 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.
if (bSetup)
{
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
@@ -2343,39 +2316,4 @@ void ScGridWindow::DataChanged( const DataChangedEvent& rDCEvt )
Invalidate();
}
void ScGridWindow::initiatePageBreaks()
{
bInitialPageBreaks = true;
}
IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer*, pTimer, void)
{
if (pTimer == &maShowPageBreaksTimer)
{
ScDocument& rDoc = mrViewData.GetDocument();
const ScViewOptions& rOpts = mrViewData.GetOptions();
bool bPage = rOpts.GetOption(VOPT_PAGEBREAKS);
ScDocShell* pDocSh = mrViewData.GetDocShell();
bool bModified = pDocSh->IsModified();
// 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)
{
SCTAB nCurrentTab = mrViewData.GetTabNo();
Size pagesize = rDoc.GetPageSize(nCurrentTab);
if (pagesize.IsEmpty())
{
ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nCurrentTab);
rDoc.SetPageSize(nCurrentTab, rDoc.GetPageSize(nCurrentTab));
}
rDoc.UpdatePageBreaks(nCurrentTab);
pDocSh->PostPaint(0, 0, nCurrentTab, rDoc.MaxCol(), rDoc.MaxRow(), nCurrentTab, PaintPartFlags::Grid);
pDocSh->SetModified(bModified);
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index f0b6ed6..3de36af 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -320,13 +320,6 @@ void ScTabView::TabChanged( bool bSameTabButMoved )
}
}
for (int i = 0; i < 4; i++)
if (pGridWin[i])
{
pGridWin[i]->initiatePageBreaks();
}
if (!comphelper::LibreOfficeKit::isActive())
return;