Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SC_INC_QUERYPARAM_HXX
21 : #define INCLUDED_SC_INC_QUERYPARAM_HXX
22 :
23 : #include "global.hxx"
24 : #include "types.hxx"
25 :
26 : #include <boost/ptr_container/ptr_vector.hpp>
27 :
28 : struct ScDBQueryParamInternal;
29 : struct ScQueryEntry;
30 :
31 : namespace svl {
32 :
33 : class SharedStringPool;
34 :
35 : }
36 :
37 : struct ScQueryParamBase
38 : {
39 : bool bHasHeader;
40 : bool bByRow;
41 : bool bInplace;
42 : bool bCaseSens;
43 : bool bRegExp;
44 : bool bDuplicate;
45 : bool mbRangeLookup; ///< for spreadsheet functions like MATCH, LOOKUP, HLOOKUP, VLOOKUP
46 :
47 : virtual ~ScQueryParamBase();
48 :
49 : virtual bool IsValidFieldIndex() const;
50 :
51 : SC_DLLPUBLIC SCSIZE GetEntryCount() const;
52 : SC_DLLPUBLIC const ScQueryEntry& GetEntry(SCSIZE n) const;
53 : SC_DLLPUBLIC ScQueryEntry& GetEntry(SCSIZE n);
54 : SC_DLLPUBLIC ScQueryEntry& AppendEntry();
55 : ScQueryEntry* FindEntryByField(SCCOLROW nField, bool bNew);
56 : SC_DLLPUBLIC void RemoveEntryByField(SCCOLROW nField);
57 : void Resize(size_t nNew);
58 : void FillInExcelSyntax(svl::SharedStringPool& rPool, const OUString& aCellStr, SCSIZE nIndex);
59 :
60 : protected:
61 : typedef boost::ptr_vector<ScQueryEntry> EntriesType;
62 :
63 : public:
64 : typedef EntriesType::const_iterator const_iterator;
65 :
66 : const_iterator begin() const;
67 : const_iterator end() const;
68 :
69 : protected:
70 : ScQueryParamBase();
71 : ScQueryParamBase(const ScQueryParamBase& r);
72 :
73 : EntriesType maEntries;
74 : };
75 :
76 : struct ScQueryParamTable
77 : {
78 : SCCOL nCol1;
79 : SCROW nRow1;
80 : SCCOL nCol2;
81 : SCROW nRow2;
82 : SCTAB nTab;
83 :
84 : ScQueryParamTable();
85 : ScQueryParamTable(const ScQueryParamTable& r);
86 : virtual ~ScQueryParamTable();
87 : };
88 :
89 : struct SC_DLLPUBLIC ScQueryParam : public ScQueryParamBase, public ScQueryParamTable
90 : {
91 : bool bDestPers; // not saved
92 : SCTAB nDestTab;
93 : SCCOL nDestCol;
94 : SCROW nDestRow;
95 :
96 : ScQueryParam();
97 : ScQueryParam( const ScQueryParam& r );
98 : ScQueryParam( const ScDBQueryParamInternal& r );
99 : virtual ~ScQueryParam();
100 :
101 : ScQueryParam& operator= ( const ScQueryParam& r );
102 : bool operator== ( const ScQueryParam& rOther ) const;
103 : void Clear();
104 : void ClearDestParams();
105 : void MoveToDest();
106 : };
107 :
108 : struct ScDBQueryParamBase : public ScQueryParamBase
109 : {
110 : enum DataType { INTERNAL, MATRIX };
111 :
112 : SCCOL mnField; /// the field in which the values are processed during iteration.
113 : bool mbSkipString;
114 :
115 40 : DataType GetType() const { return meType;}
116 :
117 : virtual ~ScDBQueryParamBase();
118 :
119 : protected:
120 : ScDBQueryParamBase(DataType eType);
121 :
122 : private:
123 : ScDBQueryParamBase();
124 :
125 : DataType meType;
126 : };
127 :
128 : struct ScDBQueryParamInternal : public ScDBQueryParamBase, public ScQueryParamTable
129 : {
130 : ScDBQueryParamInternal();
131 : virtual ~ScDBQueryParamInternal();
132 :
133 : virtual bool IsValidFieldIndex() const SAL_OVERRIDE;
134 : };
135 :
136 : struct ScDBQueryParamMatrix : public ScDBQueryParamBase
137 : {
138 : ScMatrixRef mpMatrix;
139 :
140 : ScDBQueryParamMatrix();
141 : virtual ~ScDBQueryParamMatrix();
142 :
143 : virtual bool IsValidFieldIndex() const SAL_OVERRIDE;
144 : };
145 :
146 : #endif
147 :
148 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|