summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2020-05-21 01:48:03 +0530
committerDennis Francis <dennis.francis@collabora.com>2020-05-25 00:39:56 +0530
commit3389d07341097be5b10df6cb91a6fdf48bfc2c86 (patch)
tree1e7fa2467776abd1cf544cb7ddede343f332b726
parentf6685707441770e7141b7b31fed1c2ddf550e297 (diff)
lokit: notify clients of various sheet geometry invalidations
if the new feature flag scPrintTwipsMsgs is set. Change-Id: Ia36b9f3835115fb6f30e4e8f57d5d7a1b57df609
-rw-r--r--sc/source/ui/undo/undoblk.cxx35
-rw-r--r--sc/source/ui/undo/undoblk2.cxx7
-rw-r--r--sc/source/ui/undo/undodat.cxx25
-rw-r--r--sc/source/ui/view/dbfunc.cxx4
-rw-r--r--sc/source/ui/view/dbfunc3.cxx34
-rw-r--r--sc/source/ui/view/tabvwshc.cxx37
-rw-r--r--sc/source/ui/view/viewfun2.cxx17
-rw-r--r--sc/source/ui/view/viewfunc.cxx18
8 files changed, 163 insertions, 14 deletions
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index d9f89078e6e6..6da29b7d0860 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -273,11 +273,19 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
if (comphelper::LibreOfficeKit::isActive())
{
- if (eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER || eCmd == INS_CELLSRIGHT)
- ScTabViewShell::notifyAllViewsHeaderInvalidation(COLUMN_HEADER, pViewShell->GetViewData().GetTabNo());
-
- if (eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER || eCmd == INS_CELLSDOWN)
- ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, pViewShell->GetViewData().GetTabNo());
+ bool bColumns = (eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER || eCmd == INS_CELLSRIGHT);
+ bool bRows = (eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER || eCmd == INS_CELLSDOWN);
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
+ if (bColumns)
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(COLUMN_HEADER, nTab);
+
+ if (bRows)
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, nTab);
+
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ bColumns, bRows,
+ true /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
}
}
}
@@ -534,11 +542,20 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
{
if (comphelper::LibreOfficeKit::isActive())
{
- if (eCmd == DelCellCmd::Cols || eCmd == DelCellCmd::CellsLeft)
- ScTabViewShell::notifyAllViewsHeaderInvalidation(COLUMN_HEADER, pViewShell->GetViewData().GetTabNo());
+ bool bColumns = (eCmd == DelCellCmd::Cols || eCmd == DelCellCmd::CellsLeft);
+ bool bRows = (eCmd == DelCellCmd::Rows || eCmd == DelCellCmd::CellsUp);
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
+
+ if (bColumns)
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(COLUMN_HEADER, nTab);
+
+ if (bRows)
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, nTab);
- if (eCmd == DelCellCmd::Rows || eCmd == DelCellCmd::CellsUp)
- ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, pViewShell->GetViewData().GetTabNo());
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ bColumns, bRows,
+ true /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
}
}
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index 9b4de7f89f62..584d610e3315 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -125,9 +125,14 @@ void ScUndoWidthOrHeight::Undo()
if (pViewShell)
{
+ SCTAB nCurrentTab = pViewShell->GetViewData().GetTabNo();
+ bool bAffectsVisibility = (eMode != SC_SIZE_ORIGINAL && eMode != SC_SIZE_VISOPT);
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ bWidth /* bColumns */, !bWidth /* bRows */,
+ true /* bSizes*/, bAffectsVisibility /* bHidden */, bAffectsVisibility /* bFiltered */,
+ false /* bGroups */, nCurrentTab);
pViewShell->UpdateScrollBars(bWidth ? COLUMN_HEADER : ROW_HEADER);
- SCTAB nCurrentTab = pViewShell->GetViewData().GetTabNo();
if ( nCurrentTab < nStartTab || nCurrentTab > nEndTab )
pViewShell->SetTabNo( nStartTab );
}
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 373908540f7c..159a6be32c13 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -100,6 +100,9 @@ void ScUndoDoOutline::Undo()
else
pUndoDoc->CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, rDoc);
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bColumns, !bColumns,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
pViewShell->UpdateScrollBars();
pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top);
@@ -179,6 +182,10 @@ void ScUndoMakeOutline::Undo()
pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size);
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ bColumns /* bColumns */, !bColumns /* bRows */,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
ScTabViewShell::notifyAllViewsHeaderInvalidation( bColumns, nTab );
EndUndo();
@@ -262,6 +269,9 @@ void ScUndoOutlineLevel::Undo()
rDoc.UpdatePageBreaks( nTab );
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bColumns, !bColumns,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
pViewShell->UpdateScrollBars();
SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
@@ -354,6 +364,9 @@ void ScUndoOutlineBlock::Undo()
rDoc.UpdatePageBreaks( nTab );
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(true /* bColumns */, true /* bRows */,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
pViewShell->UpdateScrollBars();
SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
@@ -449,6 +462,10 @@ void ScUndoRemoveAllOutlines::Undo()
pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size);
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ true /* bColumns */, true /* bRows */,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
ScTabViewShell::notifyAllViewsHeaderInvalidation(BOTH_HEADERS, nTab);
EndUndo();
@@ -814,6 +831,10 @@ void ScUndoQuery::Undo()
// invalidate cache positions and update cursor and selection
pViewShell->OnLOKShowHideColRow(/*bColumns*/ false, aQueryParam.nRow1 - 1);
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ false /* bColumns */, true /* bRows */,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ false /* bGroups */, nTab);
ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, nTab);
// Paint
@@ -1333,6 +1354,10 @@ void ScUndoRepeatDB::Undo()
if (xUndoDB)
rDoc.SetDBCollection(std::unique_ptr<ScDBCollection>(new ScDBCollection(*xUndoDB)), true);
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(false /* bColumns */, true /* bRows */,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ false /* bGroups */, nTab);
+
SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 74d211d02683..d76b5ce37b9f 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -257,6 +257,10 @@ void ScDBFunc::Query( const ScQueryParam& rQueryParam, const ScRange* pAdvSource
if (!bCopy)
{
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ false /* bColumns */, true /* bRows */,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ false /* bGroups */, nTab);
UpdateScrollBars(ROW_HEADER);
SelectionChanged(); // for attribute states (filtered rows are ignored)
}
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index d7faee139d0c..cdc0324ee408 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -94,6 +94,9 @@ void ScDBFunc::MakeOutline( bool bColumns, bool bRecord )
aFunc.MakeOutline( aRange, bColumns, bRecord, false );
ScTabViewShell::notifyAllViewsHeaderInvalidation(bColumns, GetViewData().GetTabNo());
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bColumns, !bColumns, false /* bSizes*/,
+ false /* bHidden */, false /* bFiltered */,
+ true /* bGroups */, GetViewData().GetTabNo());
}
else
ErrorMessage(STR_NOMULTISELECT);
@@ -111,6 +114,9 @@ void ScDBFunc::RemoveOutline( bool bColumns, bool bRecord )
aFunc.RemoveOutline( aRange, bColumns, bRecord, false );
ScTabViewShell::notifyAllViewsHeaderInvalidation(bColumns, GetViewData().GetTabNo());
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bColumns, !bColumns, false /* bSizes*/,
+ true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, GetViewData().GetTabNo());
}
else
ErrorMessage(STR_NOMULTISELECT);
@@ -191,6 +197,9 @@ void ScDBFunc::RemoveAllOutlines( bool bRecord )
if (bOk)
{
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(true /* bColumns */, true /* bRows */, false /* bSizes*/,
+ true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
UpdateScrollBars(BOTH_HEADERS);
}
}
@@ -225,7 +234,12 @@ void ScDBFunc::SelectLevel( bool bColumns, sal_uInt16 nLevel, bool bRecord )
bool bOk = aFunc.SelectLevel( nTab, bColumns, nLevel, bRecord, true/*bPaint*/ );
if (bOk)
+ {
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bColumns, !bColumns, false /* bSizes*/,
+ true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
UpdateScrollBars(bColumns ? COLUMN_HEADER : ROW_HEADER);
+ }
}
// show individual outline groups
@@ -253,7 +267,12 @@ void ScDBFunc::ShowOutline( bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
aFunc.ShowOutline( nTab, bColumns, nLevel, nEntry, bRecord, bPaint );
if ( bPaint )
+ {
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bColumns, !bColumns, false /* bSizes*/,
+ true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
UpdateScrollBars(bColumns ? COLUMN_HEADER : ROW_HEADER);
+ }
}
// hide individual outline groups
@@ -267,7 +286,12 @@ void ScDBFunc::HideOutline( bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
bool bOk = aFunc.HideOutline( nTab, bColumns, nLevel, nEntry, bRecord, bPaint );
if ( bOk && bPaint )
+ {
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bColumns, !bColumns, false /* bSizes*/,
+ true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, nTab);
UpdateScrollBars(bColumns ? COLUMN_HEADER : ROW_HEADER);
+ }
}
// menu status: show/hide marked range
@@ -359,7 +383,12 @@ void ScDBFunc::ShowMarkedOutlines( bool bRecord )
ScOutlineDocFunc aFunc(*pDocSh);
bool bDone = aFunc.ShowMarkedOutlines( aRange, bRecord );
if (bDone)
+ {
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(true, true,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, GetViewData().GetTabNo());
UpdateScrollBars();
+ }
}
else
ErrorMessage(STR_NOMULTISELECT);
@@ -376,7 +405,12 @@ void ScDBFunc::HideMarkedOutlines( bool bRecord )
ScOutlineDocFunc aFunc(*pDocSh);
bool bDone = aFunc.HideMarkedOutlines( aRange, bRecord );
if (bDone)
+ {
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(true, true,
+ false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, GetViewData().GetTabNo());
UpdateScrollBars();
+ }
}
else
ErrorMessage(STR_NOMULTISELECT);
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index d26874ea47f4..e2e1d73d4794 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -537,6 +537,43 @@ void ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bool bColumns, bool bRo
bool bHidden, bool bFiltered, bool bGroups,
SCTAB nCurrentTabIndex)
{
+ if (!comphelper::LibreOfficeKit::isActive() ||
+ !comphelper::LibreOfficeKit::isCompatFlagSet(
+ comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
+ return;
+
+ if (!bColumns && !bRows)
+ return;
+
+ bool bAllTypes = bSizes && bHidden && bFiltered && bGroups;
+ bool bAllDims = bColumns && bRows;
+ OString aPayload = bAllDims ? "all" : bColumns ? "columns" : "rows";
+
+ if (!bAllTypes)
+ {
+ if (bSizes)
+ aPayload += " sizes";
+
+ if (bHidden)
+ aPayload += " hidden";
+
+ if (bFiltered)
+ aPayload += " filtered";
+
+ if (bGroups)
+ aPayload += " groups";
+ }
+
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
+ if (pTabViewShell && (nCurrentTabIndex == -1 || pTabViewShell->getPart() == nCurrentTabIndex))
+ {
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY, aPayload.getStr());
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
}
bool ScTabViewShell::isAnyEditViewInRange(bool bColumns, SCCOLROW nStart, SCCOLROW nEnd)
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 09e5b87526cb..916cebd3cb43 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -175,7 +175,14 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
pDocSh->UpdateOle(&GetViewData());
if (comphelper::LibreOfficeKit::isActive())
- ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, GetViewData().GetTabNo());
+ {
+ SCTAB nTab = GetViewData().GetTabNo();
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ false /* bColumns */, true /* bRows */,
+ true /* bSizes*/, false /* bHidden */, false /* bFiltered */,
+ false /* bGroups */, nTab);
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, nTab);
+ }
return bAnyChanged;
}
@@ -224,7 +231,13 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow )
PaintPartFlags::Grid | PaintPartFlags::Left );
if (comphelper::LibreOfficeKit::isActive())
- ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, GetViewData().GetTabNo());
+ {
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ false /* bColumns */, true /* bRows */,
+ true /* bSizes*/, false /* bHidden */, false /* bFiltered */,
+ false /* bGroups */, nTab);
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, nTab);
+ }
return bChanged;
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index d70b2742b6f6..30e2b021461d 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1627,6 +1627,10 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste )
if (bInsertRows)
ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, GetViewData().GetTabNo());
+
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bInsertCols, bInsertRows, true /* bSizes*/,
+ true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, GetViewData().GetTabNo());
}
}
OUString aStartAddress = aRange.aStart.GetColRowString();
@@ -1700,11 +1704,17 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd )
if (comphelper::LibreOfficeKit::isActive())
{
- if (eCmd == DelCellCmd::Cols)
+ bool bColsDeleted = (eCmd == DelCellCmd::Cols);
+ bool bRowsDeleted = (eCmd == DelCellCmd::Rows);
+ if (bColsDeleted)
ScTabViewShell::notifyAllViewsHeaderInvalidation(COLUMN_HEADER, GetViewData().GetTabNo());
- if (eCmd == DelCellCmd::Rows)
+ if (bRowsDeleted)
ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, GetViewData().GetTabNo());
+
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bColsDeleted, bRowsDeleted, true /* bSizes*/,
+ true /* bHidden */, true /* bFiltered */,
+ true /* bGroups */, GetViewData().GetTabNo());
}
}
else
@@ -2250,6 +2260,10 @@ void ScViewFunc::SetWidthOrHeight(
for (const SCTAB& nTab : aMarkData)
rDoc.UpdatePageBreaks( nTab );
+ bool bAffectsVisibility = (eMode != SC_SIZE_ORIGINAL && eMode != SC_SIZE_VISOPT);
+ ScTabViewShell::notifyAllViewsSheetGeomInvalidation(bWidth /* bColumns */, !bWidth /* bRows */,
+ true /* bSizes*/, bAffectsVisibility /* bHidden */, bAffectsVisibility /* bFiltered */,
+ false /* bGroups */, nCurTab);
GetViewData().GetView()->UpdateScrollBars(bWidth ? COLUMN_HEADER : ROW_HEADER);
{