LibreOffice Module sc (master) 1
queryparam.hxx
Go to the documentation of this file.
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#pragma once
21
23#include "address.hxx"
24#include "queryentry.hxx"
25#include "types.hxx"
26
27#include <vector>
28#include <ostream>
29
31
33struct ScQueryEntry;
34
35namespace svl {
36
37class SharedStringPool;
38
39}
40
41struct SAL_DLLPUBLIC_RTTI ScQueryParamBase
42{
45 bool bByRow;
50
51 virtual ~ScQueryParamBase();
52
53 virtual bool IsValidFieldIndex() const;
54
55 SC_DLLPUBLIC SCSIZE GetEntryCount() const;
56 SC_DLLPUBLIC const ScQueryEntry& GetEntry(SCSIZE n) const;
57 SC_DLLPUBLIC ScQueryEntry& GetEntry(SCSIZE n);
58 SC_DLLPUBLIC ScQueryEntry& AppendEntry();
59 ScQueryEntry* FindEntryByField(SCCOLROW nField, bool bNew);
60 std::vector<ScQueryEntry*> FindAllEntriesByField(SCCOLROW nField);
61 SC_DLLPUBLIC bool RemoveEntryByField(SCCOLROW nField);
62 SC_DLLPUBLIC void RemoveAllEntriesByField(SCCOLROW nField);
63 void Resize(size_t nNew);
64 void FillInExcelSyntax( svl::SharedStringPool& rPool, const OUString& aCellStr, SCSIZE nIndex,
65 SvNumberFormatter* pFormatter );
66
67protected:
68 typedef std::vector<ScQueryEntry> EntriesType;
69
70public:
71 typedef EntriesType::const_iterator const_iterator;
72
73 const_iterator begin() const;
74 const_iterator end() const;
75
76protected:
79 ScQueryParamBase& operator=(const ScQueryParamBase& r);
80
82};
83
84// For use in SAL_DEBUG etc. Output format not guaranteed to be stable.
85template<typename charT, typename traits>
86inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, traits> & stream, const ScQueryParamBase& rParam)
87{
88 stream << "{" <<
89 "searchType=" << rParam.eSearchType <<
90 ",hasHeader=" << (rParam.bHasHeader?"YES":"NO") <<
91 ",byRow=" << (rParam.bByRow?"YES":"NO") <<
92 ",inplace=" << (rParam.bInplace?"YES":"NO") <<
93 ",caseSens=" << (rParam.bCaseSens?"YES":"NO") <<
94 ",duplicate=" << (rParam.bDuplicate?"YES":"NO") <<
95 ",rangeLookup=" << (rParam.mbRangeLookup?"YES":"NO") <<
96 "}";
97
98 return stream;
99}
100
101struct SAL_DLLPUBLIC_RTTI ScQueryParamTable
102{
108
110 virtual ~ScQueryParamTable();
111
114 ScQueryParamTable & operator =(ScQueryParamTable const &) = default;
115 ScQueryParamTable & operator =(ScQueryParamTable &&) = default;
116};
117
118// For use in SAL_DEBUG etc. Output format not guaranteed to be stable.
119template<typename charT, typename traits>
120inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, traits> & stream, const ScQueryParamTable& rParam)
121{
122 stream << "{" <<
123 "col1=" << rParam.nCol1 <<
124 ",row1=" << rParam.nRow1 <<
125 ",col2=" << rParam.nCol2 <<
126 ",row2=" << rParam.nRow2 <<
127 ",tab=" << rParam.nTab <<
128 "}";
129
130 return stream;
131}
132
134{
135 bool bDestPers; // not saved
139
140 ScQueryParam();
143 virtual ~ScQueryParam() override;
144
146 bool operator== ( const ScQueryParam& rOther ) const;
147 void Clear();
148 void ClearDestParams();
149 void MoveToDest();
150};
151
152// For use in SAL_DEBUG etc. Output format not guaranteed to be stable.
153template<typename charT, typename traits>
154inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, traits> & stream, const ScQueryParam& rParam)
155{
156 stream << "{" <<
157 "base=" << *static_cast<const ScQueryParamBase*>(&rParam) <<
158 ",table=" << *static_cast<const ScQueryParamTable*>(&rParam) <<
159 ",destPers=" << (rParam.bDestPers?"YES":"NO") <<
160 ",destTab=" << rParam.nDestTab <<
161 ",destCol=" << rParam.nDestCol <<
162 ",destRow=" << rParam.nDestRow <<
163 "}";
164
165 return stream;
166}
167
169{
171
174
175 DataType GetType() const { return meType;}
176
178 virtual ~ScDBQueryParamBase() override;
179
180protected:
182
183private:
185};
186
188{
190 virtual ~ScDBQueryParamInternal() override;
191
192 virtual bool IsValidFieldIndex() const override;
193};
194
196{
198
200 virtual ~ScDBQueryParamMatrix() override;
201
202 virtual bool IsValidFieldIndex() const override;
203};
204
205/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
Reference< XOutputStream > stream
void Clear(EHistoryType eHistory)
enumrange< T >::Iterator begin(enumrange< T >)
end
These need to be in global namespace just like their respective types are.
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, const ScQueryParamBase &rParam)
Definition: queryparam.hxx:86
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
ScDBQueryParamBase()=delete
virtual ~ScDBQueryParamBase() override
Definition: queryparam.cxx:430
bool mbSkipString
the field in which the values are processed during iteration.
Definition: queryparam.hxx:173
DataType GetType() const
Definition: queryparam.hxx:175
virtual ~ScDBQueryParamInternal() override
Definition: queryparam.cxx:439
virtual bool IsValidFieldIndex() const override
Definition: queryparam.cxx:443
virtual bool IsValidFieldIndex() const override
Definition: queryparam.cxx:453
virtual ~ScDBQueryParamMatrix() override
Definition: queryparam.cxx:460
ScMatrixRef mpMatrix
Definition: queryparam.hxx:197
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:34
EntriesType m_Entries
Definition: queryparam.hxx:81
EntriesType::const_iterator const_iterator
Definition: queryparam.hxx:71
std::vector< ScQueryEntry > EntriesType
Definition: queryparam.hxx:68
ScQueryParamBase & operator=(const ScQueryParamBase &r)
Definition: queryparam.cxx:86
utl::SearchParam::SearchType eSearchType
Definition: queryparam.hxx:43
bool mbRangeLookup
for spreadsheet functions like MATCH, LOOKUP, HLOOKUP, VLOOKUP
Definition: queryparam.hxx:49
ScQueryParamTable(ScQueryParamTable &&)=default
ScQueryParamTable(ScQueryParamTable const &)=default
ScQueryParam(const ScQueryParam &)
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:25
sal_Int32 SCROW
Definition: types.hxx:17
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:518