LibreOffice Module sc (master)  1
typedstrdata.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
10 #include <typedstrdata.hxx>
11 #include <global.hxx>
12 
14 
16 {
17  if (left.meStrType != right.meStrType)
18  return left.meStrType < right.meStrType;
19 
20  if (left.meStrType == Value)
21  return left.mfValue < right.mfValue;
22 
23  if (left.mbIsDate != right.mbIsDate)
24  return left.mbIsDate < right.mbIsDate;
25 
27  left.maStrValue, right.maStrValue) < 0;
28 }
29 
31 {
32  if (left.meStrType != right.meStrType)
33  return left.meStrType < right.meStrType;
34 
35  if (left.meStrType == Value)
36  return left.mfValue < right.mfValue;
37 
38  if (left.mbIsDate != right.mbIsDate)
39  return left.mbIsDate < right.mbIsDate;
40 
42  left.maStrValue, right.maStrValue) < 0;
43 }
44 
46 {
47  if (left.meStrType != right.meStrType)
48  return false;
49 
50  if (left.meStrType == Value && left.mfValue != right.mfValue &&
51  !left.mbIsFormatted)
52  return false;
53 
54  if (left.mbIsDate != right.mbIsDate )
55  return false;
56 
57  if (ScGlobal::GetCaseCollator()->compareString(
58  left.maStrValue, right.maStrValue) == 0)
59  {
60  // hack: it's possible, because we only compare values of the same filter range
61  const_cast<bool&>(left.mbIsDuplicated) = true;
62  return true;
63  }
64  else
65  return false;
66 }
67 
69 {
70  if (left.meStrType != right.meStrType)
71  return false;
72 
73  if (left.meStrType == Value && left.mfValue != right.mfValue &&
74  !left.mbIsFormatted)
75  return false;
76 
77  if (left.mbIsDate != right.mbIsDate )
78  return false;
79 
80  if (ScGlobal::GetCollator()->compareString(
81  left.maStrValue, right.maStrValue) == 0)
82  {
83  // hack: it's possible, because we only compare values of the same filter range
84  const_cast<bool&>(left.mbIsDuplicated) = true;
85  return true;
86  }
87  else
88  return false;
89 }
90 
92 {
93  // Case insensitive comparison by default.
94  return LessCaseInsensitive()(*this, r);
95 }
96 
98  const OUString& rStr, double nVal, StringType nType, bool bDate, bool bFormatted, bool bDuplicated ) :
99  maStrValue(rStr),
100  mfValue(nVal),
101  meStrType(nType),
102  mbIsDate( bDate ),
103  mbIsFormatted( bFormatted ),
104  mbIsDuplicated( bDuplicated ) {}
105 
107  maVal(rVal), mbCaseSens(bCaseSens) {}
108 
110 {
111  if (mbCaseSens)
112  {
114  }
115  else
116  {
118  }
119 }
120 
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
ScTypedStrData(const OUString &rStr, double nVal=0.0, StringType eType=Standard, bool bDate=false, bool mbIsFormatted=false, bool bDuplicated=false)
static SC_DLLPUBLIC CollatorWrapper * GetCollator()
Definition: global.cxx:1028
FindTypedStrData(const ScTypedStrData &rVal, bool bCaseSens)
bool operator()(const ScTypedStrData &left, const ScTypedStrData &right) const
OUString maStrValue
ScTypedStrData maVal
bool operator<(const ScTypedStrData &r) const
static CollatorWrapper * GetCaseCollator()
Definition: global.cxx:1038
StringType meStrType
bool operator()(const ScTypedStrData &left, const ScTypedStrData &right) const
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:400
bool operator()(const ScTypedStrData &r) const
bool operator()(const ScTypedStrData &left, const ScTypedStrData &right) const
bool operator()(const ScTypedStrData &left, const ScTypedStrData &right) const