[Libreoffice-commits] .: 7 commits - sc/inc sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Jan 30 10:31:02 PST 2013
sc/inc/attarray.hxx | 10 ++++++----
sc/inc/dociter.hxx | 2 +-
sc/source/core/data/attarray.cxx | 39 +++++++++++++--------------------------
sc/source/core/data/dociter.cxx | 24 +++++++++++++++---------
4 files changed, 35 insertions(+), 40 deletions(-)
New commits:
commit cd13c045846bb2af4eefc46dc8f020f6073b6054
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jan 30 05:36:02 2013 +0100
unfriend this class and the method
Change-Id: I43645409bee380ef6664109c4480ca37c5f3ecd2
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index c56207a..66db88a 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -87,9 +87,6 @@ friend class ScDocument; // for FillInfo
friend class ScDocumentIterator;
friend class ScAttrIterator;
friend class ScHorizontalAttrIterator;
-friend void ScAttrArray_IterGetNumberFormat( sal_uLong& nFormat,
- const ScAttrArray*& rpArr, SCROW& nAttrEndRow,
- const ScAttrArray* pNewArr, SCROW nRow, ScDocument* pDoc );
bool ApplyFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner,
SCROW nStartRow, SCROW nEndRow,
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index cfcc52a..9d6098d 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -222,12 +222,18 @@ void ScAttrArray_IterGetNumberFormat( sal_uLong& nFormat, const ScAttrArray*& rp
{
if ( rpArr != pNewArr || nAttrEndRow < nRow )
{
- SCSIZE nPos;
- pNewArr->Search( nRow, nPos ); // nPos 0 gueltig wenn nicht gefunden
- const ScPatternAttr* pPattern = pNewArr->pData[nPos].pPattern;
+ SCROW nRowStart = 0;
+ SCROW nRowEnd = MAXROW;
+ const ScPatternAttr* pPattern;
+ if( !(pPattern = pNewArr->GetPatternRange( nRowStart, nRowEnd, nRow ) ) )
+ {
+ pPattern = pDoc->GetDefPattern();
+ nRowEnd = MAXROW;
+ }
+
nFormat = pPattern->GetNumberFormat( pDoc->GetFormatTable() );
rpArr = pNewArr;
- nAttrEndRow = pNewArr->pData[nPos].nRow;
+ nAttrEndRow = nRowEnd;
}
}
commit 41281d375300512011113c69ddda5995463a3c88
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jan 30 05:05:31 2013 +0100
make a few more users of ScAttrArray outside of the class const
Change-Id: I76aca6b1ddb8a326eecf70a68bed2a754e462c49
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 7244921..3683111 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -141,7 +141,7 @@ public:
private:
static SCROW GetRowByColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCSIZE nColRow);
static ScBaseCell* GetCellByColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCSIZE nColRow);
- static ScAttrArray* GetAttrArrayByCol(ScDocument& rDoc, SCTAB nTab, SCCOL nCol);
+ static const ScAttrArray* GetAttrArrayByCol(ScDocument& rDoc, SCTAB nTab, SCCOL nCol);
static bool IsQueryValid(ScDocument& rDoc, const ScQueryParam& rParam, SCTAB nTab, SCROW nRow, ScBaseCell* pCell);
static SCSIZE SearchColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCROW nRow, SCCOL nCol);
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index e343680..cfcc52a 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -98,7 +98,7 @@ bool ScDocumentIterator::GetThisCol()
return false;
}
ScColumn* pCol = &pTab->aCol[nCol];
- ScAttrArray* pAtt = pCol->pAttrArray;
+ const ScAttrArray* pAtt = pCol->pAttrArray;
bool bFound = false;
do
@@ -477,7 +477,7 @@ ScBaseCell* ScDBQueryDataIterator::GetCellByColEntryIndex(ScDocument& rDoc, SCTA
return pCol->maItems[nColRow].pCell;
}
-ScAttrArray* ScDBQueryDataIterator::GetAttrArrayByCol(ScDocument& rDoc, SCTAB nTab, SCCOL nCol)
+const ScAttrArray* ScDBQueryDataIterator::GetAttrArrayByCol(ScDocument& rDoc, SCTAB nTab, SCCOL nCol)
{
if (nTab >= rDoc.GetTableCount())
OSL_FAIL("try to access index out of bounds, FIX IT");
@@ -1938,7 +1938,7 @@ ScHorizontalAttrIterator::ScHorizontalAttrIterator( ScDocument* pDocument, SCTAB
for (i=nStartCol; i<=nEndCol; i++)
{
SCCOL nPos = i - nStartCol;
- ScAttrArray* pArray = pDoc->maTabs[nTab]->aCol[i].pAttrArray;
+ const ScAttrArray* pArray = pDoc->maTabs[nTab]->aCol[i].pAttrArray;
OSL_ENSURE( pArray, "pArray == 0" );
SCSIZE nIndex;
@@ -1967,7 +1967,7 @@ ScHorizontalAttrIterator::ScHorizontalAttrIterator( ScDocument* pDocument, SCTAB
ScHorizontalAttrIterator::~ScHorizontalAttrIterator()
{
- delete[] (ScPatternAttr**)ppPatterns;
+ delete[] ppPatterns;
delete[] pNextEnd;
delete[] pIndices;
}
@@ -2012,7 +2012,7 @@ const ScPatternAttr* ScHorizontalAttrIterator::GetNext( SCCOL& rCol1, SCCOL& rCo
SCCOL nPos = i-nStartCol;
if ( pNextEnd[nPos] < nRow )
{
- ScAttrArray* pArray = pDoc->maTabs[nTab]->aCol[i].pAttrArray;
+ const ScAttrArray* pArray = pDoc->maTabs[nTab]->aCol[i].pAttrArray;
SCSIZE nIndex = ++pIndices[nPos];
if ( nIndex < pArray->nCount )
commit e8226a93aca391e9abe63edebc87aec05d3bf5bf
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jan 30 04:56:56 2013 +0100
this check always will result in true
Actually I believe that pData is non-NULL in all cases now but proving
it is quite complicated because there are a few too many friends of the
class.
Change-Id: I024605676281c0a4a46b42827b00ef98bf68ea79
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 39c87d0..50a1397 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -142,12 +142,9 @@ void ScAttrArray::Reset( const ScPatternAttr* pPattern )
nCount = nLimit = 1;
pData = new ScAttrEntry[1];
- if (pData)
- {
- ScPatternAttr* pNewPattern = (ScPatternAttr*) &pDocPool->Put(*pPattern);
- pData[0].nRow = MAXROW;
- pData[0].pPattern = pNewPattern;
- }
+ ScPatternAttr* pNewPattern = (ScPatternAttr*) &pDocPool->Put(*pPattern);
+ pData[0].nRow = MAXROW;
+ pData[0].pPattern = pNewPattern;
}
}
commit 1830e257d85481bed61774fc8febf302a35c1dea
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jan 30 04:39:36 2013 +0100
this parameter was always true
Change-Id: If78c958c11b5786f31127fc729806e1e5bc5d58a
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 9fc9677..c56207a 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -112,7 +112,7 @@ public:
#if OSL_DEBUG_LEVEL > 1
void TestData() const;
#endif
- void Reset( const ScPatternAttr* pPattern, bool bAlloc = sal_True );
+ void Reset( const ScPatternAttr* pPattern);
bool Concat(SCSIZE nPos);
const ScPatternAttr* GetPattern( SCROW nRow ) const;
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 7d5dc7b..39c87d0 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -112,7 +112,7 @@ void ScAttrArray::TestData() const
//------------------------------------------------------------------------
-void ScAttrArray::Reset( const ScPatternAttr* pPattern, bool bAlloc )
+void ScAttrArray::Reset( const ScPatternAttr* pPattern )
{
if (pData)
{
@@ -140,21 +140,13 @@ void ScAttrArray::Reset( const ScPatternAttr* pPattern, bool bAlloc )
if (pDocument->IsStreamValid(nTab))
pDocument->SetStreamValid(nTab, false);
- if (bAlloc)
+ nCount = nLimit = 1;
+ pData = new ScAttrEntry[1];
+ if (pData)
{
- nCount = nLimit = 1;
- pData = new ScAttrEntry[1];
- if (pData)
- {
- ScPatternAttr* pNewPattern = (ScPatternAttr*) &pDocPool->Put(*pPattern);
- pData[0].nRow = MAXROW;
- pData[0].pPattern = pNewPattern;
- }
- }
- else
- {
- nCount = nLimit = 0;
- pData = NULL; // should be immediately occupied again
+ ScPatternAttr* pNewPattern = (ScPatternAttr*) &pDocPool->Put(*pPattern);
+ pData[0].nRow = MAXROW;
+ pData[0].pPattern = pNewPattern;
}
}
}
commit 225e4ac6511699aba57286a7c3bff08c3c438406
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jan 30 04:05:08 2013 +0100
prevent copy c'tor and operator=
Change-Id: Ibf45ab23a2272043729e7404de89ad514735bf06
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 0f6b419..9fc9677 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -98,6 +98,11 @@ friend void ScAttrArray_IterGetNumberFormat( sal_uLong& nFormat,
void RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow,
const ScPatternAttr* pPattern, ScEditDataArray* pDataArray );
+ // prevent the copy c'tor and operator=
+ // this is just to prevent accidental use
+ ScAttrArray(const ScAttrArray&);
+ ScAttrArray& operator=(const ScAttrArray&);
+
public:
ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc );
~ScAttrArray();
commit b0255df4bd988a89d41be060c4972d37eb9e3ec8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jan 30 03:52:37 2013 +0100
prefer the c'tor initializer list
Change-Id: Ic4087959ae04b27c228abf67ef538aa8717fae4f
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index f11eefa..7d5dc7b 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -51,15 +51,13 @@ using ::editeng::SvxBorderLine;
ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc ) :
nCol( nNewCol ),
nTab( nNewTab ),
- pDocument( pDoc )
+ pDocument( pDoc ),
+ nCount(1),
+ nLimit(1),
+ pData(new ScAttrEntry[1])
{
- nCount = nLimit = 1;
- pData = new ScAttrEntry[1];
- if (pData)
- {
- pData[0].nRow = MAXROW;
- pData[0].pPattern = pDocument->GetDefPattern(); // no put
- }
+ pData[0].nRow = MAXROW;
+ pData[0].pPattern = pDocument->GetDefPattern(); // no put
}
//------------------------------------------------------------------------
commit c3669e680f8c557965945fa975ee0283706a15a8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jan 30 02:22:35 2013 +0100
adapt comment to correct code
Change-Id: I669036358773b0e9583d7d0b8130ca947d89fae9
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 8059b17..f11eefa 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1286,7 +1286,7 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const
// well it is not true that we found one
// but existing one + cell where conditional
// formatting does not remove it
- // => we have a protected cell
+ // => we should use the existing protection settting
bFoundCond = bFoundTemp;
}
}
More information about the Libreoffice-commits
mailing list