Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / typedstrdata.hxx
blobb6bed2dfc249b8d7ae7b6d594da4739fb2c0e3a0
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/.
8 */
10 #pragma once
12 #include <rtl/ustring.hxx>
14 #include <set>
16 class ScTypedStrData
18 public:
19 enum StringType {
20 Value,
21 MRU,
22 Standard,
23 Name,
24 DbName,
25 Header
28 ScTypedStrData(
29 OUString&& rStr, double fVal = 0.0, double fRVal = 0.0, StringType nType = Standard, bool bDate = false, bool bIsHiddenByFilter = false ) :
30 maStrValue(std::move(rStr)),
31 mfValue(fVal),
32 mfRoundedValue(fRVal),
33 meStrType(nType),
34 mbIsDate( bDate ),
35 mbIsHiddenByFilter(bIsHiddenByFilter) {}
37 ScTypedStrData( const OUString& rStr, double fVal = 0.0, double fRVal = 0.0, StringType eType = Standard,
38 bool bDate = false, bool bIsHiddenByFilter = false );
40 bool IsDate() const { return mbIsDate;}
41 bool IsHiddenByFilter() const { return mbIsHiddenByFilter;}
42 const OUString& GetString() const { return maStrValue;}
43 StringType GetStringType() const { return meStrType;}
44 double GetValue() const { return mfValue; }
45 double GetRoundedValue() const { return mfRoundedValue; }
47 struct LessHiddenRows
49 bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
52 struct LessCaseSensitive
54 bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
57 struct LessSortCaseSensitive
59 bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
62 struct LessCaseInsensitive
64 bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
67 struct LessSortCaseInsensitive
69 bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
72 struct EqualCaseSensitive
74 bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
77 struct EqualCaseInsensitive
79 bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
82 bool operator< (const ScTypedStrData& r) const;
84 private:
85 OUString maStrValue;
86 double mfValue;
87 double mfRoundedValue; // rounded value by format code
88 StringType meStrType;
89 bool mbIsDate;
90 bool mbIsHiddenByFilter;
93 class FindTypedStrData
95 ScTypedStrData maVal;
96 bool mbCaseSens;
97 public:
98 FindTypedStrData(ScTypedStrData aVal, bool bCaseSens);
99 bool operator() (const ScTypedStrData& r) const;
102 typedef std::set<ScTypedStrData, ScTypedStrData::LessCaseSensitive> ScTypedCaseStrSet;
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */