summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/lookupcache.hxx20
-rw-r--r--sc/inc/lookupsearchmode.hxx33
-rw-r--r--sc/inc/queryiter.hxx10
3 files changed, 46 insertions, 17 deletions
diff --git a/sc/inc/lookupcache.hxx b/sc/inc/lookupcache.hxx
index bc50045f06a8..f71013dfded4 100644
--- a/sc/inc/lookupcache.hxx
+++ b/sc/inc/lookupcache.hxx
@@ -28,6 +28,7 @@
class ScDocument;
struct ScLookupCacheMap;
struct ScQueryEntry;
+enum class LookupSearchMode;
/** Lookup cache for one range used with interpreter functions such as VLOOKUP
and MATCH. Caches query for a specific row and the resulting address looked
@@ -35,7 +36,6 @@ struct ScQueryEntry;
performed, which usually occur to obtain a different offset column of the
same query.
*/
-
class ScLookupCache final : public SvtListener
{
public:
@@ -56,14 +56,6 @@ public:
GREATER_EQUAL
};
- enum SearchMode
- {
- SEARCHFWD = 1,
- SEARCHREV = -1,
- SEARCHBASC = 2,
- SEARCHDESC = -2
- };
-
class QueryCriteria
{
union
@@ -74,7 +66,7 @@ public:
bool mbAlloc;
bool mbString;
QueryOp meOp;
- SearchMode meSearchMode;
+ LookupSearchMode meSearchMode;
void deleteString()
{
@@ -86,12 +78,12 @@ public:
public:
- explicit QueryCriteria( const ScQueryEntry & rEntry, sal_Int8 nSearchMode );
+ explicit QueryCriteria( const ScQueryEntry & rEntry, LookupSearchMode nSearchMode );
QueryCriteria( const QueryCriteria & r );
~QueryCriteria();
QueryOp getQueryOp() const { return meOp; }
- SearchMode getSearchMode() const { return meSearchMode; }
+ LookupSearchMode getSearchMode() const { return meSearchMode; }
void setDouble( double fVal )
{
@@ -163,9 +155,9 @@ private:
SCROW mnRow;
SCTAB mnTab;
QueryOp meOp;
- SearchMode meSearchMode;
+ LookupSearchMode meSearchMode;
- QueryKey( const ScAddress & rAddress, const QueryOp eOp, SearchMode eSearchMode ) :
+ QueryKey( const ScAddress & rAddress, const QueryOp eOp, LookupSearchMode eSearchMode ) :
mnRow( rAddress.Row()),
mnTab( rAddress.Tab()),
meOp( eOp),
diff --git a/sc/inc/lookupsearchmode.hxx b/sc/inc/lookupsearchmode.hxx
new file mode 100644
index 000000000000..fb6b278b8179
--- /dev/null
+++ b/sc/inc/lookupsearchmode.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+/** Mode used with interpreter functions such as VLOOKUP and MATCH. */
+enum class LookupSearchMode
+{
+ Forward = 1, // Perform a search starting at the first item. This is the default.
+ Reverse = -1, // Perform a reverse search starting at the last item.
+ BinaryAscending
+ = 2, // Perform a binary search that relies on lookup_array being sorted in ascending order.
+ BinaryDescending
+ = -2 // Perform a binary search that relies on lookup_array being sorted in descending order.
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/queryiter.hxx b/sc/inc/queryiter.hxx
index 67f0e16fc0b5..6fa91b7c1347 100644
--- a/sc/inc/queryiter.hxx
+++ b/sc/inc/queryiter.hxx
@@ -22,6 +22,7 @@
#include "queryparam.hxx"
#include "mtvelements.hxx"
#include "types.hxx"
+#include "lookupsearchmode.hxx"
struct ScComplexRefData;
class ScSortedRangeCache;
@@ -269,10 +270,13 @@ public:
void AdvanceQueryParamEntryField();
void AdvanceQueryParamEntryFieldForBinarySearch();
- void SetSortedBinarySearchMode( sal_Int8 nSearchMode )
+ void SetSortedBinarySearchMode( LookupSearchMode nSearchMode )
{
- nSortedBinarySearch = sal::static_int_cast<sal_uInt8>(nSearchMode == 2 ?
- nSearchbAscd : (nSearchMode == -2 ? nSearchbDesc : nBinarySearchDisabled));
+ nSortedBinarySearch =
+ nSearchMode == LookupSearchMode::BinaryAscending
+ ? nSearchbAscd
+ : (nSearchMode == LookupSearchMode::BinaryDescending
+ ? nSearchbDesc : nBinarySearchDisabled);
}
void SetLookupMode( sal_uInt16 nVal )