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