Revert "tdf#110987: type detection, binary Office formats > templates"
[LibreOffice.git] / sc / inc / queryentry.hxx
blobdf858f08f339ecce77b37a8e480eb5c9d0c3ff91
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_QUERYENTRY_HXX
21 #define INCLUDED_SC_INC_QUERYENTRY_HXX
23 #include "global.hxx"
24 #include <svl/sharedstring.hxx>
25 #include <unotools/textsearch.hxx>
27 #include <memory>
28 #include <vector>
30 /**
31 * Each instance of this struct represents a single filtering criteria.
33 struct SC_DLLPUBLIC ScQueryEntry
35 enum QueryType { ByValue, ByString, ByDate, ByEmpty };
37 struct Item
39 QueryType meType;
40 double mfVal;
41 svl::SharedString maString;
42 bool mbMatchEmpty;
44 Item() : meType(ByValue), mfVal(0.0), mbMatchEmpty(false) {}
46 bool operator== (const Item& r) const;
48 typedef std::vector<Item> QueryItemsType;
50 bool bDoQuery;
51 SCCOLROW nField;
52 ScQueryOp eOp;
53 ScQueryConnect eConnect;
54 mutable std::unique_ptr<utl::SearchParam> pSearchParam; ///< if Wildcard or RegExp, not saved
55 mutable std::unique_ptr<utl::TextSearch> pSearchText; ///< if Wildcard or RegExp, not saved
57 ScQueryEntry();
58 ScQueryEntry(const ScQueryEntry& r);
59 ~ScQueryEntry();
61 /// creates pSearchParam and pSearchText if necessary
62 utl::TextSearch* GetSearchTextPtr( utl::SearchParam::SearchType eSearchType, bool bCaseSens,
63 bool bWildMatchSel ) const;
65 QueryItemsType& GetQueryItems() { return maQueryItems;}
66 const QueryItemsType& GetQueryItems() const { return maQueryItems;}
67 void SetQueryByEmpty();
68 bool IsQueryByEmpty() const;
69 void SetQueryByNonEmpty();
70 bool IsQueryByNonEmpty() const;
71 const Item& GetQueryItem() const;
72 Item& GetQueryItem();
73 void Clear();
74 ScQueryEntry& operator=( const ScQueryEntry& r );
75 bool operator==( const ScQueryEntry& r ) const;
77 private:
78 /**
79 * Stores all query items. It must contain at least one item at all times
80 * (for single equality match queries or comparative queries). It may
81 * contain multiple items for multi-equality match queries.
83 mutable QueryItemsType maQueryItems;
86 #endif
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */