2011-11-04 23:56:38 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License or as specified alternatively below. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* Major Contributor(s):
|
|
|
|
* Copyright (C) 2011 Kohei Yoshida <kohei.yoshida@suse.com>
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* For minor contributions see the git repository.
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
|
|
|
|
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
|
|
|
|
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
|
|
|
|
* instead of those above.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SC_QUERYENTRY_HXX__
|
|
|
|
#define __SC_QUERYENTRY_HXX__
|
|
|
|
|
|
|
|
#include "address.hxx"
|
|
|
|
#include "global.hxx"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace utl {
|
|
|
|
class SearchParam;
|
|
|
|
class TextSearch;
|
|
|
|
}
|
|
|
|
|
2011-11-05 00:12:46 -05:00
|
|
|
/**
|
|
|
|
* Each instance of this struct represents a single filtering criteria.
|
|
|
|
*/
|
2011-11-18 11:17:43 -06:00
|
|
|
struct SC_DLLPUBLIC ScQueryEntry
|
2011-11-04 23:56:38 -05:00
|
|
|
{
|
2011-11-14 15:54:44 -06:00
|
|
|
enum QueryType { ByValue, ByString, ByDate, ByEmpty };
|
2011-11-07 16:40:38 -06:00
|
|
|
|
|
|
|
struct Item
|
|
|
|
{
|
|
|
|
QueryType meType;
|
|
|
|
double mfVal;
|
|
|
|
rtl::OUString maString;
|
|
|
|
|
2011-11-20 08:12:50 -06:00
|
|
|
Item() : meType(ByValue), mfVal(0.0) {}
|
|
|
|
|
2011-11-07 21:55:53 -06:00
|
|
|
bool operator== (const Item& r) const;
|
2011-11-07 16:40:38 -06:00
|
|
|
};
|
|
|
|
typedef std::vector<Item> QueryItemsType;
|
2011-11-04 23:56:38 -05:00
|
|
|
|
|
|
|
bool bDoQuery;
|
|
|
|
SCCOLROW nField;
|
|
|
|
ScQueryOp eOp;
|
|
|
|
ScQueryConnect eConnect;
|
|
|
|
mutable utl::SearchParam* pSearchParam; // if RegExp, not saved
|
|
|
|
mutable utl::TextSearch* pSearchText; // if RegExp, not saved
|
|
|
|
|
|
|
|
ScQueryEntry();
|
|
|
|
ScQueryEntry(const ScQueryEntry& r);
|
|
|
|
~ScQueryEntry();
|
|
|
|
|
|
|
|
// creates pSearchParam and pSearchText if necessary, always RegExp!
|
|
|
|
utl::TextSearch* GetSearchTextPtr( bool bCaseSens ) const;
|
|
|
|
|
2011-11-14 16:15:31 -06:00
|
|
|
QueryItemsType& GetQueryItems();
|
2011-11-14 15:00:30 -06:00
|
|
|
const QueryItemsType& GetQueryItems() const;
|
2011-11-18 11:17:43 -06:00
|
|
|
void SetQueryByEmpty();
|
|
|
|
bool IsQueryByEmpty() const;
|
|
|
|
void SetQueryByNonEmpty();
|
|
|
|
bool IsQueryByNonEmpty() const;
|
|
|
|
const Item& GetQueryItem() const;
|
|
|
|
Item& GetQueryItem();
|
2011-11-04 23:56:38 -05:00
|
|
|
void Clear();
|
|
|
|
ScQueryEntry& operator=( const ScQueryEntry& r );
|
|
|
|
bool operator==( const ScQueryEntry& r ) const;
|
2011-11-07 16:40:38 -06:00
|
|
|
|
2011-11-04 23:56:38 -05:00
|
|
|
private:
|
2011-11-07 16:40:38 -06:00
|
|
|
/**
|
|
|
|
* Stores all query items. It must contain at least one item at all times
|
|
|
|
* (for single equality match queries or comparative queries). It may
|
|
|
|
* contain multiple items for multi-equality match queries.
|
|
|
|
*/
|
|
|
|
mutable QueryItemsType maQueryItems;
|
2011-11-04 23:56:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|