[Libreoffice-commits] .: 3 commits - sc/inc sc/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Fri May 11 22:05:03 PDT 2012
sc/inc/colorscale.hxx | 3 +++
sc/source/core/data/colorscale.cxx | 29 +++++++++++++++++++++++++++++
sc/source/core/data/conditio.cxx | 36 ++++++++++++++++++++++++++++++++++++
sc/source/core/data/documen2.cxx | 5 +++++
sc/source/core/data/table2.cxx | 5 ++---
5 files changed, 75 insertions(+), 3 deletions(-)
New commits:
commit dc6388e4f67b32783bb662b3f22f4496c547613c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 12 07:01:16 2012 +0200
ScConditionalFormat::pRanges needs to be updated correctly
ScConditionalFormat::pRanges must be updated otherwise the duplicate
value check might use the wrong range
Change-Id: I3df7d54cdcd9c8863d5fbd89eff3be83bb73f2a5
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 321edc4..5c13b90 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1536,6 +1536,8 @@ void ScConditionalFormat::CompileXML()
void ScConditionalFormat::UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
{
+ if(pRanges)
+ pRanges->UpdateReference( eUpdateRefMode, pDoc, rRange, nDx, nDy, nDz );
for (sal_uInt16 i=0; i<nEntryCount; i++)
ppEntries[i]->UpdateReference(eUpdateRefMode, rRange, nDx, nDy, nDz);
@@ -1552,6 +1554,40 @@ void ScConditionalFormat::RenameCellStyle(const String& rOld, const String& rNew
void ScConditionalFormat::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos )
{
+ if(pRanges)
+ {
+ size_t n = pRanges->size();
+ SCTAB nMinTab = std::min<SCTAB>(nOldPos, nNewPos);
+ SCTAB nMaxTab = std::max<SCTAB>(nOldPos, nNewPos);
+ for(size_t i = 0; i < n; ++i)
+ {
+ ScRange* pRange = (*pRanges)[i];
+ SCTAB nTab = pRange->aStart.Tab();
+ if(nTab < nMinTab || nTab > nMaxTab)
+ {
+ continue;
+ }
+
+ if(nTab == nOldPos)
+ {
+ pRange->aStart.SetTab(nNewPos);
+ pRange->aEnd.SetTab(nNewPos);
+ continue;
+ }
+
+ if(nNewPos < nOldPos)
+ {
+ pRange->aStart.IncTab();
+ pRange->aEnd.IncTab();
+ }
+ else
+ {
+ pRange->aStart.IncTab(-1);
+ pRange->aEnd.IncTab(-1);
+ }
+ }
+ }
+
for (sal_uInt16 i=0; i<nEntryCount; i++)
ppEntries[i]->UpdateMoveTab( nOldPos, nNewPos );
commit 7db060e12f61a33a344006cf8dfcb4a2527495f0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 12 06:45:19 2012 +0200
reduce scope of this variable
Change-Id: I I98b7d83aee9f74574a4884f6066e769930e1803a
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index c6fed2b..d13fa9f 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -650,14 +650,13 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
SCsCOL nDx, SCsROW nDy, sal_uInt16 nInsFlag,
bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable)
{
- SCCOL i;
if (nCol2 > MAXCOL) nCol2 = MAXCOL;
if (nRow2 > MAXROW) nRow2 = MAXROW;
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
{
IncRecalcLevel();
- for ( i = nCol1; i <= nCol2; i++)
+ for ( SCCOL i = nCol1; i <= nCol2; i++)
aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]);
//remove old notes
@@ -675,7 +674,7 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if ((nInsFlag & IDF_ATTRIB) != 0)
{
if (nRow1==0 && nRow2==MAXROW && pColWidth && pTable->pColWidth)
- for (i=nCol1; i<=nCol2; i++)
+ for (SCCOL i=nCol1; i<=nCol2; i++)
pColWidth[i] = pTable->pColWidth[i-nDx];
if (nCol1==0 && nCol2==MAXCOL && mpRowHeights && pTable->mpRowHeights &&
commit 5ff6482b51105aa9645dbf2990cba2c1dfdd63ac
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 12 05:59:29 2012 +0200
add color scales to copy document
Change-Id: I03e141746920c7794e18267cf01799d03c7cafb3
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 54f0c59..e7d0944 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -50,6 +50,7 @@ private:
public:
ScColorScaleEntry(double nVal, const Color& rCol);
ScColorScaleEntry(const ScColorScaleEntry& rEntry);
+ ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry& rEntry);
~ScColorScaleEntry();
const Color& GetColor() const;
@@ -83,6 +84,7 @@ private:
bool CheckEntriesForRel(const ScRange& rRange) const;
public:
ScColorScaleFormat(ScDocument* pDoc);
+ ScColorScaleFormat(ScDocument* pDoc, const ScColorScaleFormat& rFormat);
Color* GetColor(const ScAddress& rAddr) const;
void AddEntry(ScColorScaleEntry* pEntry);
@@ -108,6 +110,7 @@ private:
boost::ptr_vector<ScColorScaleFormat> maColorScaleFormats;
public:
ScColorScaleFormatList() {};
+ ScColorScaleFormatList(ScDocument* pDoc, const ScColorScaleFormatList& rList);
typedef ColorScaleFormatContainer::iterator iterator;
typedef ColorScaleFormatContainer::const_iterator const_iterator;
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 6a249ff..21df634 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -50,6 +50,16 @@ ScColorScaleEntry::ScColorScaleEntry(const ScColorScaleEntry& rEntry):
{
}
+ScColorScaleEntry::ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry& rEntry):
+ mnVal(rEntry.mnVal),
+ maColor(rEntry.maColor),
+ mpCell(static_cast<ScFormulaCell*>(rEntry.mpCell->Clone(*pDoc))),
+ mbMin(rEntry.mbMin),
+ mbMax(rEntry.mbMax),
+ mbPercent(rEntry.mbPercent)
+{
+}
+
ScColorScaleEntry::~ScColorScaleEntry()
{
}
@@ -101,6 +111,17 @@ ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc):
{
}
+ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc, const ScColorScaleFormat& rFormat):
+ maRanges(rFormat.maRanges),
+ mpDoc(pDoc)
+{
+ for(const_iterator itr = rFormat.begin(); itr != rFormat.end(); ++itr)
+ {
+ maColorScales.push_back(new ScColorScaleEntry(pDoc, *itr));
+ }
+}
+
+
void ScColorScaleFormat::AddEntry( ScColorScaleEntry* pEntry )
{
maColorScales.push_back( pEntry );
@@ -465,6 +486,14 @@ ScColorScaleFormat::const_iterator ScColorScaleFormat::end() const
return maColorScales.end();
}
+ScColorScaleFormatList::ScColorScaleFormatList(ScDocument* pDoc, const ScColorScaleFormatList& rList)
+{
+ for(const_iterator itr = rList.begin(); itr != rList.end(); ++itr)
+ {
+ maColorScaleFormats.push_back(new ScColorScaleFormat(pDoc, *itr));
+ }
+}
+
void ScColorScaleFormatList::AddFormat( ScColorScaleFormat* pFormat )
{
maColorScaleFormats.push_back( pFormat );
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 1120f05..87ad7d4 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -475,6 +475,11 @@ void ScDocument::InitClipPtrs( ScDocument* pSourceDoc )
const ScConditionalFormatList* pSourceCond = pSourceDoc->pCondFormList;
if ( pSourceCond )
pCondFormList = new ScConditionalFormatList(this, *pSourceCond);
+
+ const ScColorScaleFormatList* pSourceColorScaleList = pSourceDoc->mpColorScaleList.get();
+ if ( pSourceColorScaleList )
+ mpColorScaleList.reset(new ScColorScaleFormatList(this, *pSourceColorScaleList));
+
const ScValidationDataList* pSourceValid = pSourceDoc->pValidationList;
if ( pSourceValid )
pValidationList = new ScValidationDataList(this, *pSourceValid);
More information about the Libreoffice-commits
mailing list