1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_QUERYPARAM_HXX
21 #define SC_QUERYPARAM_HXX
24 #include "scmatrix.hxx"
26 #include <boost/ptr_container/ptr_vector.hpp>
28 struct ScDBQueryParamInternal
;
31 struct ScQueryParamBase
39 bool mbRangeLookup
; ///< for spreadsheet functions like MATCH, LOOKUP, HLOOKUP, VLOOKUP
41 virtual ~ScQueryParamBase();
43 virtual bool IsValidFieldIndex() const;
45 SC_DLLPUBLIC SCSIZE
GetEntryCount() const;
46 SC_DLLPUBLIC
const ScQueryEntry
& GetEntry(SCSIZE n
) const;
47 SC_DLLPUBLIC ScQueryEntry
& GetEntry(SCSIZE n
);
48 SC_DLLPUBLIC ScQueryEntry
& AppendEntry();
49 ScQueryEntry
* FindEntryByField(SCCOLROW nField
, bool bNew
);
50 SC_DLLPUBLIC
void RemoveEntryByField(SCCOLROW nField
);
51 void Resize(size_t nNew
);
52 void FillInExcelSyntax(const OUString
& aCellStr
, SCSIZE nIndex
);
55 typedef boost::ptr_vector
<ScQueryEntry
> EntriesType
;
58 typedef EntriesType::const_iterator const_iterator
;
60 const_iterator
begin() const;
61 const_iterator
end() const;
65 ScQueryParamBase(const ScQueryParamBase
& r
);
67 EntriesType maEntries
;
70 // ============================================================================
72 struct ScQueryParamTable
81 ScQueryParamTable(const ScQueryParamTable
& r
);
82 virtual ~ScQueryParamTable();
85 // ============================================================================
87 struct SC_DLLPUBLIC ScQueryParam
: public ScQueryParamBase
, public ScQueryParamTable
89 bool bDestPers
; // not saved
95 ScQueryParam( const ScQueryParam
& r
);
96 ScQueryParam( const ScDBQueryParamInternal
& r
);
97 virtual ~ScQueryParam();
99 ScQueryParam
& operator= ( const ScQueryParam
& r
);
100 bool operator== ( const ScQueryParam
& rOther
) const;
102 void ClearDestParams();
106 // ============================================================================
108 struct ScDBQueryParamBase
: public ScQueryParamBase
110 enum DataType
{ INTERNAL
, MATRIX
};
112 SCCOL mnField
; /// the field in which the values are processed during iteration.
115 DataType
GetType() const;
117 virtual ~ScDBQueryParamBase();
120 ScDBQueryParamBase(DataType eType
);
123 ScDBQueryParamBase();
128 // ============================================================================
130 struct ScDBQueryParamInternal
: public ScDBQueryParamBase
, public ScQueryParamTable
132 ScDBQueryParamInternal();
133 virtual ~ScDBQueryParamInternal();
135 virtual bool IsValidFieldIndex() const;
138 // ============================================================================
140 struct ScDBQueryParamMatrix
: public ScDBQueryParamBase
142 ScMatrixRef mpMatrix
;
144 ScDBQueryParamMatrix();
145 virtual ~ScDBQueryParamMatrix();
147 virtual bool IsValidFieldIndex() const;
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */