[Libreoffice-commits] core.git: sc/inc sc/source

Noel Grandin noel at peralex.com
Wed Jul 27 09:44:55 UTC 2016


 sc/inc/chgtrack.hxx                      |    2 
 sc/inc/dociter.hxx                       |    6 -
 sc/inc/docoptio.hxx                      |    2 
 sc/inc/tablink.hxx                       |    1 
 sc/source/core/data/dociter.cxx          |   25 -------
 sc/source/core/opencl/formulagroupcl.cxx |   97 +++++++++++++++----------------
 sc/source/core/opencl/op_statistical.hxx |    5 -
 sc/source/core/tool/chgtrack.cxx         |    4 -
 sc/source/ui/docshell/tablink.cxx        |   15 +---
 9 files changed, 55 insertions(+), 102 deletions(-)

New commits:
commit 80ee8f832f8247f9189270121fc4b3fe64a9be71
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jun 27 07:15:18 2016 +0200

    loplugin:singlevalfields in sc(part4)
    
    Change-Id: I77bcfc0103f638cd3eddb676ee88a4749bc74b1b
    Reviewed-on: https://gerrit.libreoffice.org/26687
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 7588034..e7f6e53 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -897,7 +897,6 @@ class ScChangeTrack : public utl::ConfigurationListener
     sal_uLong               nEndLastCut;
     sal_uLong               nLastMerge;
     ScChangeTrackMergeState eMergeState;
-    bool bLoadSave:1;
     bool bInDelete:1;
     bool bInDeleteUndo:1;
     bool bInDeleteTop:1;
@@ -1012,7 +1011,6 @@ public:
     ScChangeAction* GetLastSaved() const;
     ScChangeActionContent** GetContentSlots() const { return ppContentSlots; }
 
-    bool IsLoadSave() const { return bLoadSave; }
     const ScRange&      GetInDeleteRange() const
                             { return aInDeleteRange; }
     bool IsInDelete() const { return bInDelete; }
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 20775a5..16cdaf3 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -269,11 +269,9 @@ class ScQueryCellIterator           // walk through all non-empty cells in an ar
     std::unique_ptr<ScQueryParam> mpParam;
     ScDocument*     pDoc;
     const ScAttrArray*  pAttrArray;
-    sal_uLong           nNumFormat;
     SCTAB           nTab;
     SCCOL           nCol;
     SCROW           nRow;
-    SCROW           nAttrEndRow;
     sal_uInt8            nStopOnMismatch;
     sal_uInt8            nTestEqualCondition;
     bool            bAdvanceQuery;
@@ -456,16 +454,13 @@ private:
     const ScAttrArray        *pAttrArray;
     ScHorizontalCellIterator *pCellIter;
     sal_uLong                 nNumFormat;     // for CalcAsShown
-    sal_uLong                 nNumFmtIndex;
     SCTAB                     nEndTab;
     SCCOL                     nCurCol;
     SCROW                     nCurRow;
     SCTAB                     nCurTab;
     SCROW                     nAttrEndRow;
-    short                     nNumFmtType;
     bool                      bNumValid;
     bool                      bCalcAsShown;
-    bool                      bTextAsZero;
 
 public:
 
@@ -495,7 +490,6 @@ private:
     SCCOL                   nCol;
     SCROW                   nRow;
     bool                    bRowEmpty;
-    bool                    bRepeatedRow;
     SCROW                   nMinNextEnd;
 
     void InitForNextRow(bool bInitialization);
diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx
index ce2f384..5c0c28b 100644
--- a/sc/inc/docoptio.hxx
+++ b/sc/inc/docoptio.hxx
@@ -51,7 +51,7 @@ class SC_DLLPUBLIC ScDocOptions
     mutable bool bFormulaWildcardsEnabled;///< wildcards in formulas enabled, only when reading settings
     bool       bWriteCalcConfig;        ///< (subset of) Calc config will be written to user's profile
 
-    const utl::SearchParam::SearchType eSearchTypeUnknown = static_cast<utl::SearchParam::SearchType>(-1);
+    static const utl::SearchParam::SearchType eSearchTypeUnknown = static_cast<utl::SearchParam::SearchType>(-1);
 
 public:
                 ScDocOptions();
diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx
index 31f005b..ebf0018 100644
--- a/sc/inc/tablink.hxx
+++ b/sc/inc/tablink.hxx
@@ -40,7 +40,6 @@ private:
     bool bInCreate:1;
     bool bInEdit:1;
     bool bAddUndo:1;
-    bool bDoPaint:1;
 
 public:
     ScTableLink( ScDocShell* pDocSh, const OUString& rFile,
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index db67375..22f8034 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1081,9 +1081,7 @@ ScQueryCellIterator::ScQueryCellIterator(ScDocument* pDocument, SCTAB nTable,
             rItem.meType = bNumber ? ScQueryEntry::ByValue : ScQueryEntry::ByString;
         }
     }
-    nNumFormat = 0; // Initialized in GetNumberFormat
     pAttrArray = nullptr;
-    nAttrEndRow = 0;
 }
 
 void ScQueryCellIterator::InitPos()
@@ -2171,12 +2169,9 @@ void ScHorizontalCellIterator::SkipInvalid()
 ScHorizontalValueIterator::ScHorizontalValueIterator( ScDocument* pDocument,
         const ScRange& rRange ) :
     pDoc( pDocument ),
-    nNumFmtIndex(0),
     nEndTab( rRange.aEnd.Tab() ),
-    nNumFmtType( css::util::NumberFormat::UNDEFINED ),
     bNumValid( false ),
-    bCalcAsShown( pDocument->GetDocOptions().IsCalcAsShown() ),
-    bTextAsZero( false )
+    bCalcAsShown( pDocument->GetDocOptions().IsCalcAsShown() )
 {
     SCCOL nStartCol = rRange.aStart.Col();
     SCROW nStartRow = rRange.aStart.Row();
@@ -2253,27 +2248,10 @@ bool ScHorizontalValueIterator::GetNext( double& rValue, sal_uInt16& rErr )
                         bNumValid = false;
                         bFound = true;
                     }
-                    else if ( bTextAsZero )
-                    {
-                        rValue = 0.0;
-                        bNumValid = false;
-                        bFound = true;
-                    }
                 }
                 break;
             case CELLTYPE_STRING :
             case CELLTYPE_EDIT :
-                {
-                    if ( bTextAsZero )
-                    {
-                        rErr = 0;
-                        rValue = 0.0;
-                        nNumFmtType = css::util::NumberFormat::NUMBER;
-                        nNumFmtIndex = 0;
-                        bNumValid = true;
-                        bFound = true;
-                    }
-                }
                 break;
             default: ;   // nothing
         }
@@ -2297,7 +2275,6 @@ ScHorizontalAttrIterator::ScHorizontalAttrIterator( ScDocument* pDocument, SCTAB
     nRow = nStartRow;
     nCol = nStartCol;
     bRowEmpty = false;
-    bRepeatedRow = false;
 
     pIndices    = new SCSIZE[nEndCol-nStartCol+1];
     pNextEnd    = new SCROW[nEndCol-nStartCol+1];
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 55fd807..29dc9f8 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2271,7 +2271,7 @@ public:
         {
             i += (*it)->Marshal(k, argno + i, nVectorWidth, pProgram);
         }
-        if (OpGeoMean* OpSumCodeGen = dynamic_cast<OpGeoMean*>(mpCodeGen.get()))
+        if (dynamic_cast<OpGeoMean*>(mpCodeGen.get()))
         {
             // Obtain cl context
             ::opencl::KernelEnv kEnv;
@@ -2279,62 +2279,59 @@ public:
             cl_int err;
             cl_mem pClmem2;
 
-            if (OpSumCodeGen->NeedReductionKernel())
+            std::vector<cl_mem> vclmem;
+            for (SubArgumentsType::iterator it = mvSubArguments.begin(),
+                e = mvSubArguments.end(); it != e; ++it)
             {
-                std::vector<cl_mem> vclmem;
-                for (SubArgumentsType::iterator it = mvSubArguments.begin(),
-                    e = mvSubArguments.end(); it != e; ++it)
-                {
-                    if (VectorRef* VR = dynamic_cast<VectorRef*>(it->get()))
-                        vclmem.push_back(VR->GetCLBuffer());
-                    else
-                        vclmem.push_back(nullptr);
-                }
-                pClmem2 = clCreateBuffer(kEnv.mpkContext, CL_MEM_READ_WRITE,
-                    sizeof(double) * nVectorWidth, nullptr, &err);
-                if (CL_SUCCESS != err)
-                    throw OpenCLError("clCreateBuffer", err, __FILE__, __LINE__);
-                SAL_INFO("sc.opencl", "Created buffer " << pClmem2 << " size " << sizeof(double) << "*" << nVectorWidth << "=" << (sizeof(double)*nVectorWidth));
+                if (VectorRef* VR = dynamic_cast<VectorRef*>(it->get()))
+                    vclmem.push_back(VR->GetCLBuffer());
+                else
+                    vclmem.push_back(nullptr);
+            }
+            pClmem2 = clCreateBuffer(kEnv.mpkContext, CL_MEM_READ_WRITE,
+                sizeof(double) * nVectorWidth, nullptr, &err);
+            if (CL_SUCCESS != err)
+                throw OpenCLError("clCreateBuffer", err, __FILE__, __LINE__);
+            SAL_INFO("sc.opencl", "Created buffer " << pClmem2 << " size " << sizeof(double) << "*" << nVectorWidth << "=" << (sizeof(double)*nVectorWidth));
 
-                std::string kernelName = "GeoMean_reduction";
-                cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), &err);
-                if (err != CL_SUCCESS)
-                    throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
-                SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << pProgram);
+            std::string kernelName = "GeoMean_reduction";
+            cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), &err);
+            if (err != CL_SUCCESS)
+                throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
+            SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << pProgram);
 
-                // set kernel arg of reduction kernel
-                for (size_t j = 0; j < vclmem.size(); j++)
-                {
-                    SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << j << ": " << (vclmem[j] ? "cl_mem" : "double") << ": " << vclmem[j]);
-                    err = clSetKernelArg(redKernel, j,
-                        vclmem[j] ? sizeof(cl_mem) : sizeof(double),
-                        static_cast<void*>(&vclmem[j]));
-                    if (CL_SUCCESS != err)
-                        throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__);
-                }
-                SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << vclmem.size() << ": cl_mem: " << pClmem2);
-                err = clSetKernelArg(redKernel, vclmem.size(), sizeof(cl_mem), static_cast<void*>(&pClmem2));
+            // set kernel arg of reduction kernel
+            for (size_t j = 0; j < vclmem.size(); j++)
+            {
+                SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << j << ": " << (vclmem[j] ? "cl_mem" : "double") << ": " << vclmem[j]);
+                err = clSetKernelArg(redKernel, j,
+                    vclmem[j] ? sizeof(cl_mem) : sizeof(double),
+                    static_cast<void*>(&vclmem[j]));
                 if (CL_SUCCESS != err)
                     throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__);
+            }
+            SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << vclmem.size() << ": cl_mem: " << pClmem2);
+            err = clSetKernelArg(redKernel, vclmem.size(), sizeof(cl_mem), static_cast<void*>(&pClmem2));
+            if (CL_SUCCESS != err)
+                throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__);
 
-                // set work group size and execute
-                size_t global_work_size[] = { 256, (size_t)nVectorWidth };
-                size_t local_work_size[] = { 256, 1 };
-                SAL_INFO("sc.opencl", "Enqueing kernel " << redKernel);
-                err = clEnqueueNDRangeKernel(kEnv.mpkCmdQueue, redKernel, 2, nullptr,
-                    global_work_size, local_work_size, 0, nullptr, nullptr);
-                if (CL_SUCCESS != err)
-                    throw OpenCLError("clEnqueueNDRangeKernel", err, __FILE__, __LINE__);
-                err = clFinish(kEnv.mpkCmdQueue);
-                if (CL_SUCCESS != err)
-                    throw OpenCLError("clFinish", err, __FILE__, __LINE__);
+            // set work group size and execute
+            size_t global_work_size[] = { 256, (size_t)nVectorWidth };
+            size_t local_work_size[] = { 256, 1 };
+            SAL_INFO("sc.opencl", "Enqueing kernel " << redKernel);
+            err = clEnqueueNDRangeKernel(kEnv.mpkCmdQueue, redKernel, 2, nullptr,
+                global_work_size, local_work_size, 0, nullptr, nullptr);
+            if (CL_SUCCESS != err)
+                throw OpenCLError("clEnqueueNDRangeKernel", err, __FILE__, __LINE__);
+            err = clFinish(kEnv.mpkCmdQueue);
+            if (CL_SUCCESS != err)
+                throw OpenCLError("clFinish", err, __FILE__, __LINE__);
 
-                // Pass pClmem2 to the "real" kernel
-                SAL_INFO("sc.opencl", "Kernel " << k << " arg " << argno << ": cl_mem: " << pClmem2);
-                err = clSetKernelArg(k, argno, sizeof(cl_mem), static_cast<void*>(&pClmem2));
-                if (CL_SUCCESS != err)
-                    throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__);
-            }
+            // Pass pClmem2 to the "real" kernel
+            SAL_INFO("sc.opencl", "Kernel " << k << " arg " << argno << ": cl_mem: " << pClmem2);
+            err = clSetKernelArg(k, argno, sizeof(cl_mem), static_cast<void*>(&pClmem2));
+            if (CL_SUCCESS != err)
+                throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__);
         }
         if (OpSumIfs* OpSumCodeGen = dynamic_cast<OpSumIfs*>(mpCodeGen.get()))
         {
diff --git a/sc/source/core/opencl/op_statistical.hxx b/sc/source/core/opencl/op_statistical.hxx
index 970112d..14c8e54 100644
--- a/sc/source/core/opencl/op_statistical.hxx
+++ b/sc/source/core/opencl/op_statistical.hxx
@@ -201,13 +201,10 @@ public:
 class OpGeoMean: public CheckVariables
 {
 public:
-    OpGeoMean(): CheckVariables(), mNeedReductionKernel(true) {}
+    OpGeoMean(): CheckVariables() {}
     virtual void GenSlidingWindowFunction(std::stringstream &ss,
             const std::string &sSymName, SubArguments &vSubArguments) override;
     virtual std::string BinFuncName() const override { return "GeoMean"; }
-    bool NeedReductionKernel() const { return mNeedReductionKernel; }
-protected:
-    bool mNeedReductionKernel;
 };
 
 class OpHarMean: public Normal
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index d77d5f9..8325368 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2120,7 +2120,6 @@ void ScChangeTrack::Init()
     nEndLastCut = 0;
     nLastMerge = 0;
     eMergeState = SC_CTMS_NONE;
-    bLoadSave = false;
     bInDelete = false;
     bInDeleteTop = false;
     bInDeleteUndo = false;
@@ -2273,9 +2272,6 @@ void ScChangeTrack::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uI
 
 void ScChangeTrack::SetUser( const OUString& rUser )
 {
-    if ( IsLoadSave() )
-        return ; // Do not destroy the Collection
-
     maUser = rUser;
     maUserCollection.insert(maUser);
 }
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index fab2af5..c5a29f3 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -65,8 +65,7 @@ ScTableLink::ScTableLink(ScDocShell* pDocSh, const OUString& rFile,
     aOptions(rOpt),
     bInCreate( false ),
     bInEdit( false ),
-    bAddUndo( true ),
-    bDoPaint( true )
+    bAddUndo( true )
 {
     pImpl->m_pDocSh = pDocSh;
 }
@@ -82,8 +81,7 @@ ScTableLink::ScTableLink(SfxObjectShell* pShell, const OUString& rFile,
     aOptions(rOpt),
     bInCreate( false ),
     bInEdit( false ),
-    bAddUndo( true ),
-    bDoPaint( true )
+    bAddUndo( true )
 {
     pImpl->m_pDocSh = static_cast< ScDocShell* >( pShell );
     SetRefreshHandler( LINK( this, ScTableLink, RefreshHdl ) );
@@ -381,12 +379,9 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
 
     //  Paint (koennen mehrere Tabellen sein)
 
-    if (bDoPaint)
-    {
-        pImpl->m_pDocSh->PostPaint( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB),
-                                    PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS );
-        aModificator.SetDocumentModified();
-    }
+    pImpl->m_pDocSh->PostPaint( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB),
+                                PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS );
+    aModificator.SetDocumentModified();
 
     if (bNotFound)
     {


More information about the Libreoffice-commits mailing list