[Libreoffice-commits] core.git: 2 commits - sc/source
Marco Cecchetti
marco.cecchetti at collabora.com
Sat Dec 16 13:21:22 UTC 2017
sc/source/ui/docshell/dbdocfun.cxx | 16 ++++++
sc/source/ui/docshell/olinefun.cxx | 85 +++++++++++++++++++++++++------------
sc/source/ui/inc/dbfunc.hxx | 2
sc/source/ui/inc/tabview.hxx | 9 +++
sc/source/ui/inc/tabvwsh.hxx | 8 ---
sc/source/ui/undo/undoblk2.cxx | 4 -
sc/source/ui/undo/undodat.cxx | 13 ++++-
sc/source/ui/view/dbfunc.cxx | 2
sc/source/ui/view/dbfunc3.cxx | 13 ++---
sc/source/ui/view/gridwin.cxx | 3 +
sc/source/ui/view/tabview4.cxx | 5 +-
sc/source/ui/view/tabvwshc.cxx | 25 ++++++++++
sc/source/ui/view/viewfunc.cxx | 4 -
13 files changed, 134 insertions(+), 55 deletions(-)
New commits:
commit a2cd438a34e911650acf8bbd85840eb8aa36543a
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Fri Dec 15 11:43:55 2017 +0100
lok: sc: header, cursor and selection overlays issues wrt autofilter
Change-Id: I5d797b48083c24e63f7149cf3a469ebf93213311
Reviewed-on: https://gerrit.libreoffice.org/46530
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
Tested-by: Marco Cecchetti <mrcekets at gmail.com>
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 02090556c614..a46413200225 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -616,6 +616,12 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
ScDocShellModificator aModificator( rDocShell );
ScDocument& rDoc = rDocShell.GetDocument();
+
+ if (ScTabViewShell::isAnyEditViewInRange(/*bColumns*/ false, rQueryParam.nRow1, rQueryParam.nRow2))
+ {
+ return false;
+ }
+
if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScDBData* pDBData = rDoc.GetDBAtArea( nTab, rQueryParam.nCol1, rQueryParam.nRow1,
@@ -926,6 +932,16 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
pOld, bDoSize, pAdvSource ) );
}
+ ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
+ if ( pViewSh )
+ {
+ // could there be horizontal autofilter ?
+ // maybe it would be better to set bColumns to !rQueryParam.bByRow ?
+ // anyway at the beginning the value of bByRow is 'false'
+ // then after the first sort action it becomes 'true'
+ pViewSh->OnLOKShowHideColRow(/*bColumns*/ false, rQueryParam.nRow1 - 1);
+ }
+
if (bCopy)
{
SCCOL nEndX = aLocalParam.nCol2;
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index 410c6e1bc58a..90df8eb475ba 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -79,32 +79,6 @@ static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab,
rDocShell.PostPaint( nStartCol,nStartRow,nTab, MAXCOL,MAXROW,nTab, nParts );
}
-static bool lcl_IsAnyViewEditingInEntryRange(bool bColumns, SCCOLROW nStart, SCCOLROW nEnd)
-{
- if (comphelper::LibreOfficeKit::isActive())
- {
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
- if (pTabViewShell)
- {
- ScInputHandler* pInputHandler = pTabViewShell->GetInputHandler();
- if (pInputHandler && pInputHandler->GetActiveView())
- {
- const ScViewData& rViewData = pTabViewShell->GetViewData();
- SCCOLROW nPos = bColumns ? rViewData.GetCurX() : rViewData.GetCurY();
- if (nStart <= nPos && nPos <= nEnd)
- return true;
- }
- }
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
- }
- return false;
-}
-
-
void ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool bRecord, bool bApi )
{
SCCOL nStartCol = rRange.aStart.Col();
@@ -393,7 +367,7 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
sal_uInt16 nThisLevel = aIter.LastLevel();
bool bShow = (nThisLevel < nLevel);
- if (!bShow && lcl_IsAnyViewEditingInEntryRange(bColumns, nThisStart, nThisEnd))
+ if (!bShow && ScTabViewShell::isAnyEditViewInRange(bColumns, nThisStart, nThisEnd))
continue;
if (bShow) // enable
@@ -443,7 +417,7 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
if ( pViewSh )
- pViewSh->OnLOKShowHideOutline(bColumns, nStart - 1);
+ pViewSh->OnLOKShowHideColRow(bColumns, nStart - 1);
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
@@ -554,8 +528,8 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
if ( pViewSh )
{
- pViewSh->OnLOKShowHideOutline(/*columns: */ true, nMinStartCol - 1);
- pViewSh->OnLOKShowHideOutline(/*columns: */ false, nMinStartRow - 1);
+ pViewSh->OnLOKShowHideColRow(/*columns: */ true, nMinStartCol - 1);
+ pViewSh->OnLOKShowHideColRow(/*columns: */ false, nMinStartRow - 1);
}
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top );
@@ -741,7 +715,7 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
if ( pViewSh )
- pViewSh->OnLOKShowHideOutline(bColumns, nStart - 1);
+ pViewSh->OnLOKShowHideColRow(bColumns, nStart - 1);
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
@@ -767,7 +741,7 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
SCCOLROW nEnd = pEntry->GetEnd();
- if (lcl_IsAnyViewEditingInEntryRange(bColumns, nStart, nEnd))
+ if (ScTabViewShell::isAnyEditViewInRange(bColumns, nStart, nEnd))
return false;
// TODO undo can mess things up when another view is editing a cell in the range of group entry
@@ -810,7 +784,7 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
if ( pViewSh )
- pViewSh->OnLOKShowHideOutline(bColumns, nStart - 1);
+ pViewSh->OnLOKShowHideColRow(bColumns, nStart - 1);
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx
index 793b8c65c3c8..709e1a3fd058 100644
--- a/sc/source/ui/inc/dbfunc.hxx
+++ b/sc/source/ui/inc/dbfunc.hxx
@@ -117,7 +117,7 @@ public:
static sal_uInt16 DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc, bool bAllCharts );
- void OnLOKShowHideOutline(bool bColumns, SCROW nStartRow);
+ void OnLOKShowHideColRow(bool bColumns, SCROW nStartRow);
};
#endif
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 6eddd88a5c5f..885b207cbab3 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -59,6 +59,13 @@ namespace chart2 { namespace data {
struct HighlightedRange;
}}}}}
+enum HeaderType
+{
+ COLUMN_HEADER,
+ ROW_HEADER,
+ BOTH_HEADERS
+};
+
// Help - Window
class ScCornerButton : public vcl::Window
@@ -498,7 +505,7 @@ public:
long GetGridWidth( ScHSplitPos eWhich );
long GetGridHeight( ScVSplitPos eWhich );
- void UpdateScrollBars();
+ void UpdateScrollBars( HeaderType eHeaderType = BOTH_HEADERS );
void SetNewVisArea();
void SetTabProtectionSymbol( SCTAB nTab, const bool bProtect ); // for protection icon of a tab on tabbar
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index a6435591f18b..ae283f238735 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -92,13 +92,6 @@ enum ObjectSelectionType
OST_Media
};
-enum HeaderType
-{
- COLUMN_HEADER,
- ROW_HEADER,
- BOTH_HEADERS
-};
-
class SC_DLLPUBLIC ScTabViewShell: public SfxViewShell, public ScDBFunc
{
private:
@@ -398,6 +391,7 @@ public:
/// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab is equal to nCurrentTabIndex
static void notifyAllViewsHeaderInvalidation(HeaderType eHeaderType, SCTAB nCurrentTabIndex = -1);
static void notifyAllViewsHeaderInvalidation(bool Columns, SCTAB nCurrentTabIndex = -1);
+ static bool isAnyEditViewInRange(bool bColumns, SCCOLROW nStart, SCCOLROW nEnd);
css::uno::Reference<css::drawing::XShapes> getSelectedXShapes();
};
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index 569905716f39..d8baab68c6af 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -125,13 +125,11 @@ void ScUndoWidthOrHeight::Undo()
if (pViewShell)
{
- pViewShell->UpdateScrollBars();
+ pViewShell->UpdateScrollBars(bWidth ? COLUMN_HEADER : ROW_HEADER);
SCTAB nCurrentTab = pViewShell->GetViewData().GetTabNo();
if ( nCurrentTab < nStartTab || nCurrentTab > nEndTab )
pViewShell->SetTabNo( nStartTab );
-
- ScTabViewShell::notifyAllViewsHeaderInvalidation(bWidth, pViewShell->GetViewData().GetTabNo());
}
EndUndo();
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 0fd7ee5f3b68..55fdad8188a6 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -365,8 +365,8 @@ void ScUndoOutlineBlock::Undo()
pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top);
- pViewShell->OnLOKShowHideOutline(/*columns: */ true, nStartCol - 1);
- pViewShell->OnLOKShowHideOutline(/*columns: */ false, nStartRow - 1);
+ pViewShell->OnLOKShowHideColRow(/*columns: */ true, nStartCol - 1);
+ pViewShell->OnLOKShowHideColRow(/*columns: */ false, nStartRow - 1);
EndUndo();
}
@@ -736,6 +736,9 @@ OUString ScUndoQuery::GetComment() const
void ScUndoQuery::Undo()
{
+ if (ScTabViewShell::isAnyEditViewInRange(/*bColumns*/ false, aQueryParam.nRow1, aQueryParam.nRow2))
+ return;
+
BeginUndo();
ScDocument& rDoc = pDocShell->GetDocument();
@@ -811,7 +814,11 @@ void ScUndoQuery::Undo()
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
- // Paint
+
+ // invalidate cache positions and update cursor and selection
+ pViewShell->OnLOKShowHideColRow(/*bColumns*/ false, aQueryParam.nRow1 - 1);
+
+ // Paint
if (bCopy)
{
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 7b0d640fd30d..f0ce2668aeaa 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -256,7 +256,7 @@ void ScDBFunc::Query( const ScQueryParam& rQueryParam, const ScRange* pAdvSource
if (!bCopy)
{
- UpdateScrollBars();
+ 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 6bf344eec654..9483af89e256 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -194,8 +194,7 @@ void ScDBFunc::RemoveAllOutlines( bool bRecord )
if (bOk)
{
- UpdateScrollBars();
- ScTabViewShell::notifyAllViewsHeaderInvalidation(BOTH_HEADERS, GetViewData().GetTabNo());
+ UpdateScrollBars(BOTH_HEADERS);
}
}
@@ -228,7 +227,7 @@ void ScDBFunc::SelectLevel( bool bColumns, sal_uInt16 nLevel, bool bRecord )
bool bOk = aFunc.SelectLevel( nTab, bColumns, nLevel, bRecord, true/*bPaint*/ );
if (bOk)
- UpdateScrollBars();
+ UpdateScrollBars(bColumns ? COLUMN_HEADER : ROW_HEADER);
}
// show individual outline groups
@@ -256,7 +255,7 @@ void ScDBFunc::ShowOutline( bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
bool bOk = aFunc.ShowOutline( nTab, bColumns, nLevel, nEntry, bRecord, bPaint );
if ( bOk && bPaint )
- UpdateScrollBars();
+ UpdateScrollBars(bColumns ? COLUMN_HEADER : ROW_HEADER);
}
// hide individual outline groups
@@ -270,7 +269,7 @@ void ScDBFunc::HideOutline( bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
bool bOk = aFunc.HideOutline( nTab, bColumns, nLevel, nEntry, bRecord, bPaint );
if ( bOk && bPaint )
- UpdateScrollBars();
+ UpdateScrollBars(bColumns ? COLUMN_HEADER : ROW_HEADER);
}
// menu status: show/hide marked range
@@ -2247,7 +2246,7 @@ void ScDBFunc::RepeatDB( bool bRecord )
ErrorMessage(STR_MSSG_REPEATDB_0);
}
-void ScDBFunc::OnLOKShowHideOutline(bool bColumns, SCCOLROW nStart)
+void ScDBFunc::OnLOKShowHideColRow(bool bColumns, SCCOLROW nStart)
{
if (!comphelper::LibreOfficeKit::isActive())
return;
@@ -2272,8 +2271,6 @@ void ScDBFunc::OnLOKShowHideOutline(bool bColumns, SCCOLROW nStart)
}
pViewShell = SfxViewShell::GetNext(*pViewShell);
}
-
- ScTabViewShell::notifyAllViewsHeaderInvalidation(bColumns, nCurrentTabIndex);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0e0f668adf7a..0881f006a4f0 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -795,6 +795,9 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode)
// Something went terribly wrong!
return;
+ if (ScTabViewShell::isAnyEditViewInRange(/*bColumns*/ false, aParam.nRow1, aParam.nRow2))
+ return;
+
pEntry->bDoQuery = true;
pEntry->nField = rPos.Col();
pEntry->eConnect = SC_AND;
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index d56dcbf439ef..9eb1ebd51c02 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -21,6 +21,7 @@
#include <vcl/svapp.hxx>
#include <tabview.hxx>
+#include <tabvwsh.hxx>
#include <document.hxx>
#include <docsh.hxx>
#include <scmod.hxx>
@@ -375,8 +376,10 @@ static long lcl_GetScrollRange( SCCOLROW nDocEnd, SCCOLROW nPos, SCCOLROW nVis,
return ( nEnd - nStart ); // for range starting at 0
}
-void ScTabView::UpdateScrollBars()
+void ScTabView::UpdateScrollBars( HeaderType eHeaderType )
{
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(eHeaderType, GetViewData().GetTabNo());
+
long nDiff;
bool bTop = ( aViewData.GetVSplitMode() != SC_SPLIT_NONE );
bool bRight = ( aViewData.GetHSplitMode() != SC_SPLIT_NONE );
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index aa72409f84a2..2b31c3024800 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -585,6 +585,31 @@ void ScTabViewShell::notifyAllViewsHeaderInvalidation(bool bColumns, SCTAB nCurr
ScTabViewShell::notifyAllViewsHeaderInvalidation(eHeaderType, nCurrentTabIndex);
}
+bool ScTabViewShell::isAnyEditViewInRange(bool bColumns, SCCOLROW nStart, SCCOLROW nEnd)
+{
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
+ if (pTabViewShell)
+ {
+ ScInputHandler* pInputHandler = pTabViewShell->GetInputHandler();
+ if (pInputHandler && pInputHandler->GetActiveView())
+ {
+ const ScViewData& rViewData = pTabViewShell->GetViewData();
+ SCCOLROW nPos = bColumns ? rViewData.GetCurX() : rViewData.GetCurY();
+ if (nStart <= nPos && nPos <= nEnd)
+ return true;
+ }
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
+ return false;
+}
+
bool ScTabViewShell::UseSubTotal(ScRangeList* pRangeList)
{
bool bSubTotal = false;
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 3d776a0f3301..ccbe1671932b 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2239,7 +2239,7 @@ void ScViewFunc::SetWidthOrHeight(
for (; itr != itrEnd; ++itr)
rDoc.UpdatePageBreaks( *itr );
- GetViewData().GetView()->UpdateScrollBars();
+ GetViewData().GetView()->UpdateScrollBars(bWidth ? COLUMN_HEADER : ROW_HEADER);
{
itr = aMarkData.begin();
@@ -2294,8 +2294,6 @@ void ScViewFunc::SetWidthOrHeight(
HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "column-resize");
}
}
-
- ScTabViewShell::notifyAllViewsHeaderInvalidation(bWidth, GetViewData().GetTabNo());
}
// column width/row height (via marked range)
commit b18e58d98f2f2c89d97140e9eea3094d5d238e6f
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Wed Dec 13 18:19:16 2017 +0100
lok: sc: handling conflicts btw group collapsing and cell editing
Now when a cell is edited, a group including the cell in its range
can't be collapsed.
When whole levels are collapsed all together any group entry including
an edited cell is skipped from collapsing.
Undo/redo of collapsing/expanding has been (temporarily) disabled in
the LOK case, since it could mess things up when a cell is edited and
a group is collapsed because of an undo/redo.
Change-Id: I401fa69b7a0275e3e14428b16ab48c409408a861
Reviewed-on: https://gerrit.libreoffice.org/46529
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
Tested-by: Marco Cecchetti <mrcekets at gmail.com>
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index 6e7f42cbc635..410c6e1bc58a 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -24,6 +24,7 @@
#include <docsh.hxx>
#include <olinetab.hxx>
#include <tabvwsh.hxx>
+#include <inputhdl.hxx>
#include <undodat.hxx>
#include <globstr.hrc>
#include <sc.hrc>
@@ -78,6 +79,32 @@ static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab,
rDocShell.PostPaint( nStartCol,nStartRow,nTab, MAXCOL,MAXROW,nTab, nParts );
}
+static bool lcl_IsAnyViewEditingInEntryRange(bool bColumns, SCCOLROW nStart, SCCOLROW nEnd)
+{
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
+ if (pTabViewShell)
+ {
+ ScInputHandler* pInputHandler = pTabViewShell->GetInputHandler();
+ if (pInputHandler && pInputHandler->GetActiveView())
+ {
+ const ScViewData& rViewData = pTabViewShell->GetViewData();
+ SCCOLROW nPos = bColumns ? rViewData.GetCurX() : rViewData.GetCurY();
+ if (nStart <= nPos && nPos <= nEnd)
+ return true;
+ }
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
+ return false;
+}
+
+
void ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool bRecord, bool bApi )
{
SCCOL nStartCol = rRange.aStart.Col();
@@ -330,7 +357,9 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
SCCOLROW nStart, nEnd;
rArray.GetRange( nStart, nEnd );
- if ( bRecord )
+ // TODO undo can mess things up when another view is editing a cell in the range of group entry
+ // this is a temporarily workaround
+ if (!comphelper::LibreOfficeKit::isActive() && bRecord )
{
ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
@@ -358,8 +387,15 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScOutlineEntry* pEntry;
while ((pEntry=aIter.GetNext()) != nullptr)
{
+ SCCOLROW nThisStart = pEntry->GetStart();
+ SCCOLROW nThisEnd = pEntry->GetEnd();
+
sal_uInt16 nThisLevel = aIter.LastLevel();
bool bShow = (nThisLevel < nLevel);
+
+ if (!bShow && lcl_IsAnyViewEditingInEntryRange(bColumns, nThisStart, nThisEnd))
+ continue;
+
if (bShow) // enable
{
pEntry->SetHidden( false );
@@ -372,12 +408,20 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
}
else // hidden below
{
- pEntry->SetVisible( false );
+ if (comphelper::LibreOfficeKit::isActive() && nThisLevel > 0)
+ {
+ pEntry->SetHidden( true );
+ const ScOutlineEntry* pParentEntry = rArray.GetEntryByPos(nThisLevel - 1, nThisStart);
+ if (pParentEntry && pParentEntry->IsHidden())
+ pEntry->SetVisible( false );
+ }
+ else
+ {
+ pEntry->SetVisible( false );
+ }
}
- SCCOLROW nThisStart = pEntry->GetStart();
- SCCOLROW nThisEnd = pEntry->GetEnd();
- for (SCCOLROW i=nThisStart; i<=nThisEnd; i++)
+ for (SCCOLROW i=nThisStart; i<=nThisEnd; i++)
{
if ( bColumns )
rDoc.ShowCol( static_cast<SCCOL>(i), nTab, bShow );
@@ -397,16 +441,16 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
rDoc.SetDrawPageSize(nTab);
rDoc.UpdatePageBreaks( nTab );
+ ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
+ if ( pViewSh )
+ pViewSh->OnLOKShowHideOutline(bColumns, nStart - 1);
+
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
rDocShell.SetDocumentModified();
lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
- ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
- if ( pViewSh )
- pViewSh->OnLOKShowHideOutline(bColumns, 0);
-
return true;
}
@@ -435,7 +479,9 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
SCCOLROW nMax;
SCCOLROW i;
- if ( bRecord )
+ // TODO undo can mess things up when another view is editing a cell in the range of group entry
+ // this is a temporarily workaround
+ if ( !comphelper::LibreOfficeKit::isActive() && bRecord )
{
ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
@@ -505,18 +551,18 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
rDoc.SetDrawPageSize(nTab);
rDoc.UpdatePageBreaks( nTab );
- rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top );
- rDocShell.SetDocumentModified();
- bDone = true;
-
- lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
-
ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
if ( pViewSh )
{
pViewSh->OnLOKShowHideOutline(/*columns: */ true, nMinStartCol - 1);
pViewSh->OnLOKShowHideOutline(/*columns: */ false, nMinStartRow - 1);
}
+
+ rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top );
+ rDocShell.SetDocumentModified();
+ bDone = true;
+
+ lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
}
return bDone;
@@ -559,7 +605,9 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
rRowArray.FindTouchedLevel( nStartRow, nEndRow, nRowLevel );
rRowArray.ExtendBlock( nRowLevel, nEffStartRow, nEffEndRow );
- if ( bRecord )
+ // TODO undo can mess things up when another view is editing a cell in the range of group entry
+ // this is a temporarily workaround
+ if ( !comphelper::LibreOfficeKit::isActive() && bRecord )
{
ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
@@ -628,7 +676,9 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
SCCOLROW nStart = pEntry->GetStart();
SCCOLROW nEnd = pEntry->GetEnd();
- if ( bRecord )
+ // TODO undo can mess things up when another view is editing a cell in the range of group entry
+ // this is a temporarily workaround
+ if ( !comphelper::LibreOfficeKit::isActive() && bRecord )
{
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bColumns)
@@ -689,6 +739,10 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
rDoc.InvalidatePageBreaks(nTab);
rDoc.UpdatePageBreaks( nTab );
+ ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
+ if ( pViewSh )
+ pViewSh->OnLOKShowHideOutline(bColumns, nStart - 1);
+
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
@@ -696,10 +750,6 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
- ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
- if ( pViewSh )
- pViewSh->OnLOKShowHideOutline(bColumns, nStart - 1);
-
return true; //! always ???
}
@@ -716,7 +766,13 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
SCCOLROW nStart = pEntry->GetStart();
SCCOLROW nEnd = pEntry->GetEnd();
- if ( bRecord )
+
+ if (lcl_IsAnyViewEditingInEntryRange(bColumns, nStart, nEnd))
+ return false;
+
+ // TODO undo can mess things up when another view is editing a cell in the range of group entry
+ // this is a temporarily workaround
+ if ( !comphelper::LibreOfficeKit::isActive() && bRecord )
{
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bColumns)
@@ -752,6 +808,10 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
rDoc.InvalidatePageBreaks(nTab);
rDoc.UpdatePageBreaks( nTab );
+ ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
+ if ( pViewSh )
+ pViewSh->OnLOKShowHideOutline(bColumns, nStart - 1);
+
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
@@ -759,9 +819,6 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
- ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
- if ( pViewSh )
- pViewSh->OnLOKShowHideOutline(bColumns, nStart - 1);
return true; //! always ???
}
More information about the Libreoffice-commits
mailing list