summaryrefslogtreecommitdiffstats
path: root/sc/inc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-08 19:06:41 +0200
committerEike Rathke <erack@redhat.com>2017-09-08 21:53:46 +0200
commit9c1826d98065c30411cbf2e731560165ca2b7668 (patch)
tree06de32ee651e03fce5f9e5497ed4af7218caeced /sc/inc
parentsvl: assert calls of SfxPoolItem::Create/Store (diff)
downloadcore-9c1826d98065c30411cbf2e731560165ca2b7668.tar.gz
core-9c1826d98065c30411cbf2e731560165ca2b7668.zip
sc-perf: do not add a million empty filter entries just to sort and discard
Which can happen if an (anonymous) database range as filter range was selected to span an entire column of which most (the tail) is empty cells. The entries are processed to be unique anyway. This significantly shortens the time to display the filter dialog. Happened with attachment http://bugs.documentfoundation.org/attachment.cgi?id=136074 of bug https://bugs.documentfoundation.org/show_bug.cgi?id=112258 Change-Id: Ia169911d6f23611a3b3ecbf291757465f1998210 Reviewed-on: https://gerrit.libreoffice.org/42118 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/column.hxx3
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/inc/filterentries.hxx39
-rw-r--r--sc/inc/table.hxx4
4 files changed, 46 insertions, 6 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index b9b5b01f3fe2..6d2ac9e44cf1 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -105,6 +105,7 @@ struct ScCellValue;
class ScDocumentImport;
class ScHint;
enum class ScMF;
+struct ScFilterEntries;
struct ScNeededSizeOptions
{
@@ -522,7 +523,7 @@ public:
void GetFilterEntries(
sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow,
- std::vector<ScTypedStrData>& rStrings, bool& rHasDates );
+ ScFilterEntries& rFilterEntries );
bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index e08378e2242c..a7b9fcdc4d17 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -199,6 +199,7 @@ enum class ScDBDataPortion;
enum class ScSheetEventId;
class BitmapEx;
class ScColumnsRange;
+struct ScFilterEntries;
namespace sc {
@@ -1900,12 +1901,11 @@ public:
* database range that contains the specified cell position.
*/
void GetFilterEntries( SCCOL nCol, SCROW nRow,
- SCTAB nTab, std::vector<ScTypedStrData>& rStrings,
- bool& rHasDates);
+ SCTAB nTab, ScFilterEntries& rFilterEntries );
SC_DLLPUBLIC void GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow,
SCTAB nTab, bool bCaseSens,
- std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
+ ScFilterEntries& rFilterEntries );
void GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
std::vector<ScTypedStrData>& rStrings, bool bLimit = false );
diff --git a/sc/inc/filterentries.hxx b/sc/inc/filterentries.hxx
new file mode 100644
index 000000000000..2a8dccd99cb3
--- /dev/null
+++ b/sc/inc/filterentries.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SC_INC_FILTERENTRIES_HXX
+#define SC_INC_FILTERENTRIES_HXX
+
+#include <sal/config.h>
+#include "typedstrdata.hxx"
+#include <vector>
+
+struct ScFilterEntries
+{
+ std::vector<ScTypedStrData> maStrData;
+ bool mbHasDates;
+ bool mbHasEmpties;
+
+ ScFilterEntries() : mbHasDates(false), mbHasEmpties(false) {}
+
+ std::vector<ScTypedStrData>::iterator begin() { return maStrData.begin(); }
+ std::vector<ScTypedStrData>::iterator end() { return maStrData.end(); }
+ std::vector<ScTypedStrData>::const_iterator begin() const { return maStrData.begin(); }
+ std::vector<ScTypedStrData>::const_iterator end() const { return maStrData.end(); }
+ std::vector<ScTypedStrData>::size_type size() const { return maStrData.size(); }
+ ScTypedStrData& front() { return maStrData.front(); }
+ const ScTypedStrData& front() const { return maStrData.front(); }
+ bool empty() const { return maStrData.empty(); }
+ void push_back( const ScTypedStrData& r ) { maStrData.push_back(r); }
+ void push_back( ScTypedStrData&& r ) { maStrData.push_back(r); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 4c734c7d7823..10974065d571 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -928,8 +928,8 @@ public:
SCSIZE Query(const ScQueryParam& rQueryParam, bool bKeepSub);
bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
- void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
- void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, std::vector<ScTypedStrData>& rStrings, bool& rHasDates );
+ void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries );
+ void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, ScFilterEntries& rFilterEntries );
bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit);
bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;