[Libreoffice-commits] .: Branch 'feature/new-autofilter-popup' - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Nov 4 09:31:02 PDT 2011


 sc/inc/queryparam.hxx              |    4 +++-
 sc/source/core/tool/interpr1.cxx   |    4 ----
 sc/source/core/tool/queryparam.cxx |   18 +++++++++---------
 3 files changed, 12 insertions(+), 14 deletions(-)

New commits:
commit 98f6ce69a9ad65d23f251afff533249b79f29da3
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Nov 4 12:30:41 2011 -0400

    Set pStr private and discovered several more direct access to this member.

diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index dd09aa3..79330ae 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -52,13 +52,15 @@ namespace utl {
 
 struct ScQueryEntry
 {
+private:
+    String*         pStr;
+public:
     bool            bDoQuery;
     bool            bQueryByString;
     bool            bQueryByDate;
     SCCOLROW        nField;
     ScQueryOp       eOp;
     ScQueryConnect  eConnect;
-    String*         pStr;
     double          nVal;
     mutable utl::SearchParam* pSearchParam;       // if RegExp, not saved
     mutable utl::TextSearch*  pSearchText;        // if RegExp, not saved
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 6c42369..d8c2f5d 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4317,10 +4317,6 @@ static sal_Int32 lcl_CompareMatrix2Query(
     if (!rEntry.bQueryByString)
         return 1;       // string always greater than numeric
 
-    if (!rEntry.pStr)
-        // this should not happen!
-        return 1;
-
     const rtl::OUString rStr1 = rMat.GetString(i);
     const rtl::OUString rStr2 = rEntry.GetQueryString();
 
diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx
index ffa9b94..bfb31d2 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -43,13 +43,13 @@ const SCSIZE MAXQUERY = 8;
 }
 
 ScQueryEntry::ScQueryEntry() :
+    pStr(new String),
     bDoQuery(false),
     bQueryByString(false),
     bQueryByDate(false),
     nField(0),
     eOp(SC_EQUAL),
     eConnect(SC_AND),
-    pStr(new String),
     nVal(0.0),
     pSearchParam(NULL),
     pSearchText(NULL)
@@ -57,13 +57,13 @@ ScQueryEntry::ScQueryEntry() :
 }
 
 ScQueryEntry::ScQueryEntry(const ScQueryEntry& r) :
+    pStr(new String(*r.pStr)),
     bDoQuery(r.bDoQuery),
     bQueryByString(r.bQueryByString),
     bQueryByDate(r.bQueryByDate),
     nField(r.nField),
     eOp(r.eOp),
     eConnect(r.eConnect),
-    pStr(new String(*r.pStr)),
     nVal(r.nVal),
     pSearchParam(NULL),
     pSearchText(NULL)
@@ -237,17 +237,17 @@ void ScQueryParamBase::FillInExcelSyntax(String& aCellStr, SCSIZE nIndex)
         {
             if (aCellStr.GetChar(1) == '>')
             {
-                *rEntry.pStr = aCellStr.Copy(2);
+                rEntry.SetQueryString(aCellStr.Copy(2));
                 rEntry.eOp   = SC_NOT_EQUAL;
             }
             else if (aCellStr.GetChar(1) == '=')
             {
-                *rEntry.pStr = aCellStr.Copy(2);
+                rEntry.SetQueryString(aCellStr.Copy(2));
                 rEntry.eOp   = SC_LESS_EQUAL;
             }
             else
             {
-                *rEntry.pStr = aCellStr.Copy(1);
+                rEntry.SetQueryString(aCellStr.Copy(1));
                 rEntry.eOp   = SC_LESS;
             }
         }
@@ -255,21 +255,21 @@ void ScQueryParamBase::FillInExcelSyntax(String& aCellStr, SCSIZE nIndex)
         {
             if (aCellStr.GetChar(1) == '=')
             {
-                *rEntry.pStr = aCellStr.Copy(2);
+                rEntry.SetQueryString(aCellStr.Copy(2));
                 rEntry.eOp   = SC_GREATER_EQUAL;
             }
             else
             {
-                *rEntry.pStr = aCellStr.Copy(1);
+                rEntry.SetQueryString(aCellStr.Copy(1));
                 rEntry.eOp   = SC_GREATER;
             }
         }
         else
         {
             if (aCellStr.GetChar(0) == '=')
-                *rEntry.pStr = aCellStr.Copy(1);
+                rEntry.SetQueryString(aCellStr.Copy(1));
             else
-                *rEntry.pStr = aCellStr;
+                rEntry.SetQueryString(aCellStr);
             rEntry.eOp = SC_EQUAL;
         }
     }


More information about the Libreoffice-commits mailing list