[Libreoffice-commits] .: Branch 'feature/calc-matrix-rework' - 3 commits - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Dec 16 21:21:18 PST 2010


 sc/inc/scmatrix.hxx              |   53 +++++++++------------------------------
 sc/source/core/tool/scmatrix.cxx |    2 -
 2 files changed, 14 insertions(+), 41 deletions(-)

New commits:
commit 7b83f1d178994d4a6afffd0e8e1c21751d0be2b2
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Dec 17 00:20:49 2010 -0500

    Removed the eternal ref bits, as no one uses it & we don't need it.

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index e50b821..6372c3c 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -224,23 +224,19 @@ public:
         MUST be at least of the size of the original matrix. */
     ScMatrix* CloneAndExtend( SCSIZE nNewCols, SCSIZE nNewRows, DensityType eType) const;
 
-    /// Disable refcounting forever, may only be deleted via Delete() afterwards.
-    inline  void    SetEternalRef()         { nRefCnt = ULONG_MAX; }
-    inline  bool    IsEternalRef() const    { return nRefCnt == ULONG_MAX; }
     inline  void    IncRef() const
     {
-        if ( !IsEternalRef() )
-            ++nRefCnt;
+        ++nRefCnt;
     }
     inline  void    DecRef() const
     {
-        if ( nRefCnt > 0 && !IsEternalRef() )
+        if ( nRefCnt > 0 )
             if ( --nRefCnt == 0 )
                 delete this;
     }
     inline  void    Delete()
     {
-        if ( nRefCnt == 0 || IsEternalRef() )
+        if ( nRefCnt == 0 )
             delete this;
         else
             --nRefCnt;
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 9f778e6..43cd50f 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -772,7 +772,7 @@ ScMatrix* ScMatrix::Clone( DensityType eType) const
 
 ScMatrix* ScMatrix::CloneIfConst()
 {
-    return (pImpl->IsImmutable() || IsEternalRef()) ? Clone() : this;
+    return pImpl->IsImmutable() ? Clone() : this;
 }
 
 void ScMatrix::SetImmutable( bool bVal )
commit 221fb24c064579d090e57c14bedb2431b488c332
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Dec 16 23:51:25 2010 -0500

    Removed parts of the comments that are no longer true.

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 8e822bc..e50b821 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -201,9 +201,6 @@ public:
         return (nType & SC_MATVAL_NONVALUE) == SC_MATVAL_EMPTYPATH;
     }
 
-    /** If nC*nR results in more than GetElementsMax() entries, a 1x1 matrix is
-        created instead and a double error value (errStackOverflow) is set.
-        Compare nC and nR with a GetDimensions() call to check. */
     ScMatrix( SCSIZE nC, SCSIZE nR, DensityType eType = FILLED_ZERO);
 
     /** Clone the matrix. */
@@ -219,8 +216,7 @@ public:
     void SetImmutable( bool bVal );
 
     /** 
-     * Resize the matrix to specified new dimension.  Note that this operation
-     * clears all stored values. 
+     * Resize the matrix to specified new dimension.
      */
     void Resize( SCSIZE nC, SCSIZE nR);
 
commit bcc1861be3fab35f34b74c27d531bfd57eee5739
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Dec 16 23:34:38 2010 -0500

    Re-wrote header description for ScMatrix.

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 2d1de85..8e822bc 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -121,34 +121,15 @@ struct ScMatrixValue
     }
 };
 
-/** Matrix representation of double values and strings.
-
-    @ATTENTION: optimized for speed and double values.
-
-    <p> Matrix elements are NOT initialized after construction!
-
-    <p> All methods using an SCSIZE nIndex parameter and all Is...() methods do
-    NOT check the range for validity! However, the Put...() and Get...()
-    methods using nCol/nRow parameters do check the range.
-
-    <p> Methods using nCol/nRow parameters do replicate a single row vector if
-    nRow &gt; 0 and nCol &lt; nColCount, respectively a column vector if nCol
-    &gt; 0 and nRow &lt; nRowCount.
-
-    <p> GetString( SCSIZE nIndex ) does not check if there really is a string,
-    do this with IsString() first. GetString( SCSIZE nC, SCSIZE nR ) does check
-    it and returns and empty string if there is no string. Both GetDouble()
-    methods don't check for a string, do this with IsNumeric() or IsString() or
-    IsValue() first.
-
-    <p> The GetString( SvNumberFormatter&, ...) methods return the matrix
-    element's string if one is present, otherwise the numerical value is
-    formatted as a string, or in case of an error the error string is returned.
-
-    <p> PutDouble() does not reset an eventual string! Use
-    PutDoubleAndResetString() if that is wanted. Also the FillDouble...()
-    methods don't reset strings. As a consequence memory leaks may occur if
-    used wrong.
+/**
+ * Matrix data type that can store values of mixed types.  Each element can
+ * be one of the following types: numeric, string, boolean, empty, and empty
+ * path.
+ *
+ * This class also supports four different density types: filled zero,
+ * filled empty, sparse zero, and sparse empty.  The filled density type
+ * allocates memory for every single element at all times, whereas the
+ * sparse density types allocates memory only for non-default elements.
  */
 class SC_DLLPUBLIC ScMatrix
 {


More information about the Libreoffice-commits mailing list