xref: /trunk/main/sc/inc/queryparam.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2008 by Sun Microsystems, Inc.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * $RCSfile: interpre.hxx,v $
10  * $Revision: 1.35.44.2 $
11  *
12  * This file is part of OpenOffice.org.
13  *
14  * OpenOffice.org is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License version 3
16  * only, as published by the Free Software Foundation.
17  *
18  * OpenOffice.org is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU Lesser General Public License version 3 for more details
22  * (a copy is included in the LICENSE file that accompanied this code).
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * version 3 along with OpenOffice.org.  If not, see
26  * <http://www.openoffice.org/license.html>
27  * for a copy of the LGPLv3 License.
28  *
29  ************************************************************************/
30 
31 #ifndef SC_QUERYPARAM_HXX
32 #define SC_QUERYPARAM_HXX
33 
34 #include "global.hxx"
35 #include "scmatrix.hxx"
36 
37 #include <vector>
38 
39 struct ScDBQueryParamInternal;
40 
41 struct ScQueryParamBase
42 {
43     bool            bHasHeader;
44     bool            bByRow;
45     bool            bInplace;
46     bool            bCaseSens;
47     bool            bRegExp;
48     bool            bDuplicate;
49     bool            bMixedComparison;   // whether numbers are smaller than strings
50 
51     virtual ~ScQueryParamBase();
52 
53     SC_DLLPUBLIC SCSIZE GetEntryCount() const;
54     SC_DLLPUBLIC ScQueryEntry& GetEntry(SCSIZE n) const;
55     void Resize(SCSIZE nNew);
56     SC_DLLPUBLIC void DeleteQuery( SCSIZE nPos );
57     void FillInExcelSyntax(String& aCellStr, SCSIZE nIndex);
58 
59 protected:
60     ScQueryParamBase();
61     ScQueryParamBase(const ScQueryParamBase& r);
62 
63     mutable ::std::vector<ScQueryEntry>  maEntries;
64 };
65 
66 // ============================================================================
67 
68 struct ScQueryParamTable
69 {
70     SCCOL           nCol1;
71     SCROW           nRow1;
72     SCCOL           nCol2;
73     SCROW           nRow2;
74     SCTAB           nTab;
75 
76     ScQueryParamTable();
77     ScQueryParamTable(const ScQueryParamTable& r);
78     virtual ~ScQueryParamTable();
79 };
80 
81 // ============================================================================
82 
83 struct SC_DLLPUBLIC ScQueryParam : public ScQueryParamBase, public ScQueryParamTable
84 {
85     sal_Bool            bDestPers;          // nicht gespeichert
86     SCTAB           nDestTab;
87     SCCOL           nDestCol;
88     SCROW           nDestRow;
89 
90     ScQueryParam();
91     ScQueryParam( const ScQueryParam& r );
92     ScQueryParam( const ScDBQueryParamInternal& r );
93     virtual ~ScQueryParam();
94 
95     ScQueryParam&   operator=   ( const ScQueryParam& r );
96     sal_Bool            operator==  ( const ScQueryParam& rOther ) const;
97     void            Clear();
98     void            ClearDestParams();
99     void            MoveToDest();
100 };
101 
102 // ============================================================================
103 
104 struct ScDBQueryParamBase : public ScQueryParamBase
105 {
106     enum DataType { INTERNAL, MATRIX };
107 
108     SCCOL   mnField;    /// the field in which the values are processed during iteration.
109     bool    mbSkipString;
110 
111     DataType        GetType() const;
112 
113     virtual ~ScDBQueryParamBase();
114 
115 protected:
116     ScDBQueryParamBase(DataType eType);
117 
118 private:
119     ScDBQueryParamBase();
120 
121     DataType        meType;
122 };
123 
124 // ============================================================================
125 
126 struct ScDBQueryParamInternal : public ScDBQueryParamBase, public ScQueryParamTable
127 {
128     ScDBQueryParamInternal();
129     virtual ~ScDBQueryParamInternal();
130 };
131 
132 // ============================================================================
133 
134 struct ScDBQueryParamMatrix : public ScDBQueryParamBase
135 {
136     ScMatrixRef mpMatrix;
137 
138     ScDBQueryParamMatrix();
139     virtual ~ScDBQueryParamMatrix();
140 };
141 
142 #endif
143