xref: /aoo4110/main/sc/inc/queryparam.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_QUERYPARAM_HXX
25 #define SC_QUERYPARAM_HXX
26 
27 #include "global.hxx"
28 #include "scmatrix.hxx"
29 
30 #include <vector>
31 
32 struct ScDBQueryParamInternal;
33 
34 struct ScQueryParamBase
35 {
36     bool            bHasHeader;
37     bool            bByRow;
38     bool            bInplace;
39     bool            bCaseSens;
40     bool            bRegExp;
41     bool            bDuplicate;
42     bool            bMixedComparison;   // whether numbers are smaller than strings
43 
44     virtual ~ScQueryParamBase();
45 
46     SC_DLLPUBLIC SCSIZE GetEntryCount() const;
47     SC_DLLPUBLIC ScQueryEntry& GetEntry(SCSIZE n) const;
48     void Resize(SCSIZE nNew);
49     SC_DLLPUBLIC void DeleteQuery( SCSIZE nPos );
50     void FillInExcelSyntax(String& aCellStr, SCSIZE nIndex);
51 
52 protected:
53     ScQueryParamBase();
54     ScQueryParamBase(const ScQueryParamBase& r);
55 
56     mutable ::std::vector<ScQueryEntry>  maEntries;
57 };
58 
59 // ============================================================================
60 
61 struct ScQueryParamTable
62 {
63     SCCOL           nCol1;
64     SCROW           nRow1;
65     SCCOL           nCol2;
66     SCROW           nRow2;
67     SCTAB           nTab;
68 
69     ScQueryParamTable();
70     ScQueryParamTable(const ScQueryParamTable& r);
71     virtual ~ScQueryParamTable();
72 };
73 
74 // ============================================================================
75 
76 struct SC_DLLPUBLIC ScQueryParam : public ScQueryParamBase, public ScQueryParamTable
77 {
78     sal_Bool            bDestPers;          // nicht gespeichert
79     SCTAB           nDestTab;
80     SCCOL           nDestCol;
81     SCROW           nDestRow;
82 
83     ScQueryParam();
84     ScQueryParam( const ScQueryParam& r );
85     ScQueryParam( const ScDBQueryParamInternal& r );
86     virtual ~ScQueryParam();
87 
88     ScQueryParam&   operator=   ( const ScQueryParam& r );
89     sal_Bool            operator==  ( const ScQueryParam& rOther ) const;
90     void            Clear();
91     void            ClearDestParams();
92     void            MoveToDest();
93 };
94 
95 // ============================================================================
96 
97 struct ScDBQueryParamBase : public ScQueryParamBase
98 {
99     enum DataType { INTERNAL, MATRIX };
100 
101     SCCOL   mnField;    /// the field in which the values are processed during iteration.
102     bool    mbSkipString;
103 
104     DataType        GetType() const;
105 
106     virtual ~ScDBQueryParamBase();
107 
108 protected:
109     ScDBQueryParamBase(DataType eType);
110 
111 private:
112     ScDBQueryParamBase();
113 
114     DataType        meType;
115 };
116 
117 // ============================================================================
118 
119 struct ScDBQueryParamInternal : public ScDBQueryParamBase, public ScQueryParamTable
120 {
121     ScDBQueryParamInternal();
122     virtual ~ScDBQueryParamInternal();
123 };
124 
125 // ============================================================================
126 
127 struct ScDBQueryParamMatrix : public ScDBQueryParamBase
128 {
129     ScMatrixRef mpMatrix;
130 
131     ScDBQueryParamMatrix();
132     virtual ~ScDBQueryParamMatrix();
133 };
134 
135 #endif
136