[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - 4 commits - sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Mon Mar 25 10:52:56 PDT 2013


 sc/inc/chgtrack.hxx               |    2 
 sc/inc/dociter.hxx                |    9 +---
 sc/source/core/data/dociter.cxx   |   21 ++-------
 sc/source/core/data/global.cxx    |   21 +++++++--
 sc/source/core/tool/chgtrack.cxx  |   81 ++++++++++++++++++++++++++------------
 sc/source/core/tool/detfunc.cxx   |    6 +-
 sc/source/core/tool/interpr5.cxx  |    2 
 sc/source/filter/xml/xmlexprt.cxx |    2 
 sc/source/ui/app/transobj.cxx     |    2 
 sc/source/ui/unoobj/cellsuno.cxx  |    2 
 10 files changed, 91 insertions(+), 57 deletions(-)

New commits:
commit b0449ecb33ddf887da63f0e580c6a9468d6b9b1e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Mar 25 13:54:48 2013 -0400

    Remove a variant of constructor from ScCellIterator.
    
    It's redundant.
    
    Change-Id: I0aae329124453a5976b2a74f6290b100ce955a4e

diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index a7994a6..fabbbbe 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -231,13 +231,9 @@ private:
 
     void init();
     bool getCurrent();
+
 public:
-                    ScCellIterator(ScDocument* pDoc,
-                                   SCCOL nSCol, SCROW nSRow, SCTAB nSTab,
-                                   SCCOL nECol, SCROW nERow, SCTAB nETab,
-                                   bool bSTotal = false);
-                    ScCellIterator(ScDocument* pDoc,
-                                   const ScRange& rRange, bool bSTotal = false);
+    ScCellIterator( ScDocument* pDoc, const ScRange& rRange, bool bSTotal = false );
 
     const ScAddress& GetPos() const { return maCurPos; }
 
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 1ee51bc..2b6e568 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -936,22 +936,6 @@ bool ScDBQueryDataIterator::GetNext(Value& rValue)
     return mpData->getNext(rValue);
 }
 
-// ============================================================================
-
-ScCellIterator::ScCellIterator( ScDocument* pDoc,
-                                SCCOL nSCol, SCROW nSRow, SCTAB nSTab,
-                                SCCOL nECol, SCROW nERow, SCTAB nETab, bool bSTotal ) :
-    mpDoc(pDoc),
-    maStartPos(nSCol, nSRow, nSTab),
-    maEndPos(nECol, nERow, nETab),
-    mnIndex(0),
-    mbSubTotal(bSTotal),
-    meCurType(CELLTYPE_NONE),
-    mfCurValue(0.0)
-{
-    init();
-}
-
 ScCellIterator::ScCellIterator( ScDocument* pDoc, const ScRange& rRange, bool bSTotal ) :
     mpDoc(pDoc),
     maStartPos(rRange.aStart),
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index e7d522a..7aad0cc 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -1121,7 +1121,7 @@ sal_uInt16 ScDetectiveFunc::FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2
     sal_uInt16 nResult = nLevel;
     sal_Bool bDelete = ( nDeleteLevel && nLevel == nDeleteLevel-1 );
 
-    ScCellIterator aCellIter( pDoc, 0,0, nTab, MAXCOL,MAXROW, nTab );
+    ScCellIterator aCellIter( pDoc, ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab) );
     for (bool bHas = aCellIter.first(); bHas; bHas = aCellIter.next())
     {
         if (aCellIter.getType() != CELLTYPE_FORMULA)
@@ -1356,7 +1356,7 @@ sal_Bool ScDetectiveFunc::MarkInvalid(sal_Bool& rOverflow)
                 sal_Bool bMarkEmpty = !pData->IsIgnoreBlank();
                 SCROW nNextRow = nRow1;
                 SCROW nRow;
-                ScCellIterator aCellIter( pDoc, nCol,nRow1,nTab, nCol,nRow2,nTab );
+                ScCellIterator aCellIter( pDoc, ScRange(nCol, nRow1, nTab, nCol, nRow2, nTab) );
                 for (bool bHas = aCellIter.first(); bHas && nInsCount < SC_DET_MAXCIRCLE; bHas = aCellIter.next())
                 {
                     SCROW nCellRow = aCellIter.GetPos().Row();
@@ -1394,7 +1394,7 @@ sal_Bool ScDetectiveFunc::MarkInvalid(sal_Bool& rOverflow)
 void ScDetectiveFunc::GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                                   vector<ScTokenRef>& rRefTokens)
 {
-    ScCellIterator aIter(pDoc, nCol1, nRow1, nTab, nCol2, nRow2, nTab);
+    ScCellIterator aIter(pDoc, ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab));
     for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
     {
         if (aIter.getType() != CELLTYPE_FORMULA)
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 28e3b97..8574490 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -418,7 +418,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken
     {
         // Scan one column at a time, to pass a sequence of values to matrix in one call.
         ScCellIterator aCellIter(
-            pDok, nCol, nRow1, nTab1, nCol, nRow2, nTab2);
+            pDok, ScRange(nCol, nRow1, nTab1, nCol, nRow2, nTab2));
 
         SCROW nPrevRow = -2, nThisRow = -2;
 
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 11ba412..d0a2890 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2061,7 +2061,7 @@ void ScXMLExport::_ExportAutoStyles()
             for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
                 if (pDoc->IsStreamValid(nTab))
                 {
-                    ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab );
+                    ScCellIterator aIter( pDoc, ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab) );
                     for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
                     {
                         if (aIter.getType() != CELLTYPE_FORMULA)
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index c4c3144..bb3019e 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -778,7 +778,7 @@ void ScTransferObj::StripRefs( ScDocument* pDoc,
     SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
     ScRange aRef;
 
-    ScCellIterator aIter( pDoc, nStartX, nStartY, nSrcTab, nEndX, nEndY, nSrcTab );
+    ScCellIterator aIter( pDoc, ScRange(nStartX, nStartY, nSrcTab, nEndX, nEndY, nSrcTab) );
     for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
     {
         if (aIter.getType() != CELLTYPE_FORMULA)
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 2ff086f..aa403d7 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3908,7 +3908,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependen
 
             SCTAB nTab = lcl_FirstTab(aNewRanges);              //! alle Tabellen
 
-            ScCellIterator aCellIter( pDoc, 0,0, nTab, MAXCOL,MAXROW, nTab );
+            ScCellIterator aCellIter( pDoc, ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab) );
             for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next())
             {
                 if (aCellIter.getType() != CELLTYPE_FORMULA)
commit 0dceb9b425d1a4b06c43dcfaac0de12bdd0eb3fc
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Sun Mar 24 00:59:26 2013 +0530

    fdo#51296 Patch accounts security setting requiring ctrl+click for hyperlinks.
    
    Have used a boolean variable that acts as an entry condition to OpenURL
    methods main body/code and is set on qualification of security check.
    
    Change-Id: I1280e7cf7e8923282fda17088fd7c61fbf503b9d

diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index c4fb19f..be9b38e 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -38,6 +38,7 @@
 #include <sal/macros.h>
 #include <tools/rcid.h>
 #include <unotools/charclass.hxx>
+#include <unotools/securityoptions.hxx>
 #include <stdlib.h>
 #include <time.h>
 #include <ctype.h>
@@ -924,13 +925,25 @@ void ScGlobal::OpenURL( const String& rURL, const String& rTarget )
 {
     //  OpenURL wird immer ueber irgendwelche Umwege durch Mausklicks im GridWindow
     //  aufgerufen, darum stimmen pScActiveViewShell und nScClickMouseModifier.
+    //SvtSecurityOptions to access Libreoffice global security parameters
+    SvtSecurityOptions aSecOpt;
+    bool bProceedHyperlink = false;
+    if ( (nScClickMouseModifier & KEY_MOD1) && aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ))     // control-click -> into new window
+    {
+        //Ctrl key is pressed and ctrl+click hyperlink security control is set
+        bProceedHyperlink = true;
+    }
+    else if( !aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ) )
+    {
+        //ctrl+click hyperlink security control is disabled just click will do
+        bProceedHyperlink = true;
+    }
+    if ( !bProceedHyperlink )
+        return;
 
     SfxStringItem aUrl( SID_FILE_NAME, rURL );
     SfxStringItem aTarget( SID_TARGETNAME, rTarget );
-
-    if ( nScClickMouseModifier & KEY_MOD1 )     // control-click -> into new window
-        aTarget.SetValue(rtl::OUString("_blank"));
-
+    aTarget.SetValue(rtl::OUString("_blank"));
     SfxViewFrame* pFrame = NULL;
     String aReferName;
     if ( pScActiveViewShell )
commit ccdfe6fbd708ac937862d0ac562f94aa32fa6a7e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Mar 25 12:17:56 2013 -0400

    Reduce indentation level.
    
    Change-Id: I13ca8c4815d8a674c2e4e33741678e8bf7c7ed4d

diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 6552465..6d98741 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2681,31 +2681,32 @@ void ScChangeTrack::AppendOneDeleteRange( const ScRange& rOrgRange,
 void ScChangeTrack::LookUpContents( const ScRange& rOrgRange,
         ScDocument* pRefDoc, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
 {
-    if ( pRefDoc )
-    {
-        ScAddress aPos;
-        ScBigAddress aBigPos;
-        ScCellIterator aIter( pRefDoc, rOrgRange );
-        for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
-        {
-            if (ScChangeActionContent::GetContentCellType(aIter))
-            {
-                aBigPos.Set( aIter.GetPos().Col() + nDx, aIter.GetPos().Row() + nDy,
-                    aIter.GetPos().Tab() + nDz );
-                ScChangeActionContent* pContent = SearchContentAt( aBigPos, NULL );
-                if ( !pContent )
-                {   // nicht getrackte Contents
-                    aPos.Set( aIter.GetPos().Col() + nDx, aIter.GetPos().Row() + nDy,
-                        aIter.GetPos().Tab() + nDz );
-
-                    ScBaseCell* pCell = aIter.getHackedBaseCell();
-                    GenerateDelContent( aPos, pCell, pRefDoc );
-                    //! der Content wird hier _nicht_ per AddContent hinzugefuegt,
-                    //! sondern in UpdateReference, um z.B. auch kreuzende Deletes
-                    //! korrekt zu erfassen
-                }
-            }
-        }
+    if (!pRefDoc)
+        return;
+
+    ScAddress aPos;
+    ScBigAddress aBigPos;
+    ScCellIterator aIter( pRefDoc, rOrgRange );
+    for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
+    {
+        if (!ScChangeActionContent::GetContentCellType(aIter))
+            continue;
+
+        aBigPos.Set( aIter.GetPos().Col() + nDx, aIter.GetPos().Row() + nDy,
+            aIter.GetPos().Tab() + nDz );
+        ScChangeActionContent* pContent = SearchContentAt( aBigPos, NULL );
+        if (pContent)
+            continue;
+
+        // nicht getrackte Contents
+        aPos.Set( aIter.GetPos().Col() + nDx, aIter.GetPos().Row() + nDy,
+            aIter.GetPos().Tab() + nDz );
+
+        ScBaseCell* pCell = aIter.getHackedBaseCell();
+        GenerateDelContent( aPos, pCell, pRefDoc );
+        //! der Content wird hier _nicht_ per AddContent hinzugefuegt,
+        //! sondern in UpdateReference, um z.B. auch kreuzende Deletes
+        //! korrekt zu erfassen
     }
 }
 
commit c203f83def2140986381b2967d14b83c744f5d5c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Mar 25 12:15:59 2013 -0400

    Query content cell type directly from ScCellIterator.
    
    Change-Id: I0ab93d140f1864ca67ec42d0ac9e133dbc4b6660

diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index df5edd5..5e5c867 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -37,6 +37,7 @@
 class ScBaseCell;
 class ScDocument;
 class ScFormulaCell;
+class ScCellIterator;
 
 enum ScChangeActionType
 {
@@ -813,6 +814,7 @@ public:
         rtl::OUString& rStr, ScDocument* pDoc, bool bFlag3D = false ) const;
 
     static  ScChangeActionContentCellType   GetContentCellType( const ScBaseCell* );
+    static ScChangeActionContentCellType GetContentCellType( const ScCellIterator& rIter );
 
     // NewCell
     bool IsMatrixOrigin() const;
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 141a1ba..a7994a6 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -245,6 +245,7 @@ public:
     OUString getString();
     const EditTextObject* getEditText() const;
     ScFormulaCell* getFormulaCell();
+    const ScFormulaCell* getFormulaCell() const;
     double getValue() const;
 
     bool hasString() const;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 3a39454..1ee51bc 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1102,6 +1102,11 @@ ScFormulaCell* ScCellIterator::getFormulaCell()
     return mpCurFormula;
 }
 
+const ScFormulaCell* ScCellIterator::getFormulaCell() const
+{
+    return mpCurFormula;
+}
+
 double ScCellIterator::getValue() const
 {
     switch (meCurType)
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 7e06deb..6552465 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1753,6 +1753,37 @@ ScChangeActionContentCellType ScChangeActionContent::GetContentCellType( const S
     return SC_CACCT_NONE;
 }
 
+ScChangeActionContentCellType ScChangeActionContent::GetContentCellType( const ScCellIterator& rIter )
+{
+    switch (rIter.getType())
+    {
+        case CELLTYPE_VALUE:
+        case CELLTYPE_STRING:
+        case CELLTYPE_EDIT:
+            return SC_CACCT_NORMAL;
+        case CELLTYPE_FORMULA:
+        {
+            const ScFormulaCell* pCell = rIter.getFormulaCell();
+            switch (pCell->GetMatrixFlag())
+            {
+                case MM_NONE :
+                    return SC_CACCT_NORMAL;
+                case MM_FORMULA :
+                case MM_FAKE :
+                    return SC_CACCT_MATORG;
+                case MM_REFERENCE :
+                    return SC_CACCT_MATREF;
+                default:
+                    ;
+            }
+            return SC_CACCT_NORMAL;
+        }
+        default:
+            ;
+    }
+
+    return SC_CACCT_NONE;
+}
 
 bool ScChangeActionContent::NeedsNumberFormat( const ScBaseCell* pCell )
 {
@@ -2657,8 +2688,7 @@ void ScChangeTrack::LookUpContents( const ScRange& rOrgRange,
         ScCellIterator aIter( pRefDoc, rOrgRange );
         for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
         {
-            ScBaseCell* pCell = aIter.getHackedBaseCell();
-            if ( ScChangeActionContent::GetContentCellType( pCell ) )
+            if (ScChangeActionContent::GetContentCellType(aIter))
             {
                 aBigPos.Set( aIter.GetPos().Col() + nDx, aIter.GetPos().Row() + nDy,
                     aIter.GetPos().Tab() + nDz );
@@ -2667,6 +2697,8 @@ void ScChangeTrack::LookUpContents( const ScRange& rOrgRange,
                 {   // nicht getrackte Contents
                     aPos.Set( aIter.GetPos().Col() + nDx, aIter.GetPos().Row() + nDy,
                         aIter.GetPos().Tab() + nDz );
+
+                    ScBaseCell* pCell = aIter.getHackedBaseCell();
                     GenerateDelContent( aPos, pCell, pRefDoc );
                     //! der Content wird hier _nicht_ per AddContent hinzugefuegt,
                     //! sondern in UpdateReference, um z.B. auch kreuzende Deletes


More information about the Libreoffice-commits mailing list