Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef __SC_QUERYENTRY_HXX__
30 : : #define __SC_QUERYENTRY_HXX__
31 : :
32 : : #include "address.hxx"
33 : : #include "global.hxx"
34 : :
35 : : #include <vector>
36 : :
37 : : namespace utl {
38 : : class SearchParam;
39 : : class TextSearch;
40 : : }
41 : :
42 : : /**
43 : : * Each instance of this struct represents a single filtering criteria.
44 : : */
45 : : struct SC_DLLPUBLIC ScQueryEntry
46 : : {
47 : : enum QueryType { ByValue, ByString, ByDate, ByEmpty };
48 : :
49 : 54344 : struct Item
50 : : {
51 : : QueryType meType;
52 : : double mfVal;
53 : : rtl::OUString maString;
54 : :
55 : 10872 : Item() : meType(ByValue), mfVal(0.0) {}
56 : :
57 : : bool operator== (const Item& r) const;
58 : : };
59 : : typedef std::vector<Item> QueryItemsType;
60 : :
61 : : bool bDoQuery;
62 : : SCCOLROW nField;
63 : : ScQueryOp eOp;
64 : : ScQueryConnect eConnect;
65 : : mutable utl::SearchParam* pSearchParam; // if RegExp, not saved
66 : : mutable utl::TextSearch* pSearchText; // if RegExp, not saved
67 : :
68 : : ScQueryEntry();
69 : : ScQueryEntry(const ScQueryEntry& r);
70 : : ~ScQueryEntry();
71 : :
72 : : // creates pSearchParam and pSearchText if necessary, always RegExp!
73 : : utl::TextSearch* GetSearchTextPtr( bool bCaseSens ) const;
74 : :
75 : : QueryItemsType& GetQueryItems();
76 : : const QueryItemsType& GetQueryItems() const;
77 : : void SetQueryByEmpty();
78 : : bool IsQueryByEmpty() const;
79 : : void SetQueryByNonEmpty();
80 : : bool IsQueryByNonEmpty() const;
81 : : const Item& GetQueryItem() const;
82 : : Item& GetQueryItem();
83 : : void Clear();
84 : : ScQueryEntry& operator=( const ScQueryEntry& r );
85 : : bool operator==( const ScQueryEntry& r ) const;
86 : :
87 : : private:
88 : : /**
89 : : * Stores all query items. It must contain at least one item at all times
90 : : * (for single equality match queries or comparative queries). It may
91 : : * contain multiple items for multi-equality match queries.
92 : : */
93 : : mutable QueryItemsType maQueryItems;
94 : : };
95 : :
96 : : #endif
97 : :
98 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|