[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/inc sc/source
Eike Rathke
erack at redhat.com
Sat Feb 17 22:23:45 UTC 2018
sc/inc/dbdata.hxx | 1 +
sc/source/ui/docshell/docsh5.cxx | 21 ++++++++++++++++++---
2 files changed, 19 insertions(+), 3 deletions(-)
New commits:
commit 54fac33e16550c1dd95c89362130229ba2b54270
Author: Eike Rathke <erack at redhat.com>
Date: Thu Feb 15 12:50:40 2018 +0100
Resolves: tdf#115046 don't restore a sheet-local DBData from temporary
And don't clear AutoFilter button flags in the new temporary range.
Change-Id: I273de1e04632ac99c267523b2843665d257fd361
(cherry picked from commit 74d30155c5067271fb98bacbcb895c215e61678d)
Reviewed-on: https://gerrit.libreoffice.org/49810
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 9412f23b7c65..ca1a19f10263 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -122,6 +122,7 @@ public:
const OUString& GetName() const { return aName; }
const OUString& GetUpperName() const { return aUpper; }
+ SCTAB GetTab() const { return nTable; }
void GetArea(SCTAB& rTab, SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2) const;
SC_DLLPUBLIC void GetArea(ScRange& rRange) const;
void SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index d247d39ab25d..4599c2da6065 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -222,8 +222,10 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe
// other ranges, use the document global temporary anonymous range
// instead. But, if AutoFilter is to be toggled then do use the
// sheet-local DB range.
+ bool bSheetLocal = true;
if (eMode != SC_DB_AUTOFILTER && pNoNameData->HasAutoFilter())
{
+ bSheetLocal = false;
pNoNameData = aDocument.GetAnonymousDBData();
if (!pNoNameData)
{
@@ -231,14 +233,24 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe
nTab, nStartCol, nStartRow, nEndCol, nEndRow, true, bHasHeader);
aDocument.SetAnonymousDBData( pNoNameData);
}
+ // ScDocShell::CancelAutoDBRange() would restore the
+ // sheet-local anonymous DBData from pOldAutoDBRange, unset so
+ // that won't happen with data of a previous sheet-local
+ // DBData.
+ delete pOldAutoDBRange;
+ pOldAutoDBRange = nullptr;
}
-
- if ( !pOldAutoDBRange )
+ else if (!pOldAutoDBRange)
{
// store the old unnamed database range with its settings for undo
// (store at the first change, get the state before all changes)
pOldAutoDBRange = new ScDBData( *pNoNameData );
}
+ else if (pOldAutoDBRange->GetTab() != pNoNameData->GetTab())
+ {
+ // Different sheet-local unnamed DB range than the previous one.
+ *pOldAutoDBRange = *pNoNameData;
+ }
SCCOL nOldX1; // take old range away cleanly
SCROW nOldY1; //! (UNDO ???)
@@ -255,7 +267,10 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe
nStartCol <= nOldY2 && nOldY1 <= nEndCol)
bHasHeader = true;
- DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2 );
+ // Remove AutoFilter button flags only for sheet-local DB range,
+ // not if a temporary is used.
+ if (bSheetLocal)
+ DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2 );
pNoNameData->SetSortParam( ScSortParam() ); // reset parameter
pNoNameData->SetQueryParam( ScQueryParam() );
More information about the Libreoffice-commits
mailing list