diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-05-23 01:14:47 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-05-24 12:38:11 +0200 |
commit | 655d61042f5b6130643d2dde3cd46e4e4d3bbb2b (patch) | |
tree | 34227fb45a7c2bf064770b4d14cdacd05a68f342 /sc/source/core/data/table2.cxx | |
parent | 99f61e9b635a7c30f28192c01a534acb1e2a6ca3 (diff) |
make color formats and conditional formats a sheet property
TODO:
- UNO needs some love to accept this change
- we need a new uno interface for conditional formats in 4.0
- copy/paste
- undo/redo
Change-Id: I2c8a233888a95c7298dfb151d1c12b6a6a58520d
Diffstat (limited to 'sc/source/core/data/table2.cxx')
-rw-r--r-- | sc/source/core/data/table2.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 09a171f03b9c..c16426f7198b 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -653,8 +653,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO std::map<sal_Int32, sal_Int32> aOldIdToNewId; std::map<sal_Int32, ScRangeList> aIdToRange; - ScConditionalFormatList* pCondFormatList = pDocument->GetCondFormList(); - ScConditionalFormatList* pOldCondFormatList = pTable->pDocument->GetCondFormList(); + ScConditionalFormatList* pOldCondFormatList = pTable->mpCondFormatList.get(); for(SCCOL i = nCol1; i <= nCol2; ++i) { ScAttrIterator* pIter = aCol[i-nDx].CreateAttrIterator( nRow1-nDy, nRow2-nDy ); @@ -667,9 +666,9 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO { ScConditionalFormat* pFormat = pOldCondFormatList->GetFormat(nId); ScConditionalFormat* pNewFormat = pFormat->Clone(pDocument); - pNewFormat->SetKey(pCondFormatList->size()+1); + pNewFormat->SetKey(mpCondFormatList->size()+1); //not in list => create entries in both maps and new format - pCondFormatList->InsertNew(pNewFormat); + mpCondFormatList->InsertNew(pNewFormat); sal_Int32 nNewId = pNewFormat->GetKey(); aOldIdToNewId.insert( std::pair<sal_Int32, sal_Int32>( nId, nNewId ) ); aIdToRange.insert( std::pair<sal_Int32, ScRangeList>( nId, ScRangeList() ) ); @@ -683,7 +682,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO itr != aIdToRange.end(); ++itr) { sal_uInt32 nNewKey = aOldIdToNewId.find(itr->first)->second; - ScConditionalFormat* pFormat = pCondFormatList->GetFormat( nNewKey ); + ScConditionalFormat* pFormat = mpCondFormatList->GetFormat( nNewKey ); pFormat->UpdateReference(URM_MOVE, ScRange(nCol1 - nDx, nRow1 - nDy, pTable->nTab, nCol2 - nDx, nRow2 - nDy, pTable->nTab), nDx, nDy, pTable->nTab - nTab); pFormat->AddRangeInfo(new ScRangeList(itr->second)); @@ -702,8 +701,8 @@ void ScTable::CopyColorScales( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow std::map<sal_Int32, sal_Int32> aOldIdToNewId; std::map<sal_Int32, ScRangeList> aIdToRange; - ScColorFormatList* pColorScaleList = pDocument->GetColorScaleList(); - ScColorFormatList* pOldColorScaleList = pTable->pDocument->GetColorScaleList(); + ScColorFormatList* pColorScaleList = mpColorFormatList.get(); + ScColorFormatList* pOldColorScaleList = pTable->mpColorFormatList.get(); for(SCCOL i = nCol1; i <= nCol2; ++i) { ScAttrIterator* pIter = aCol[i-nDx].CreateAttrIterator( nRow1-nDy, nRow2-nDy ); @@ -1542,6 +1541,9 @@ void ScTable::CalcAll() void ScTable::CompileAll() { for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].CompileAll(); + + if(mpCondFormatList) + mpCondFormatList->CompileAll(); } @@ -1554,6 +1556,9 @@ void ScTable::CompileXML( ScProgress& rProgress ) { aCol[i].CompileXML( rProgress ); } + + if(mpCondFormatList) + mpCondFormatList->CompileXML(); } void ScTable::CalcAfterLoad() @@ -1785,11 +1790,10 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC // angeschaut werden muessen sal_uLong nIndex = ((const SfxUInt32Item*)pCondItem)->GetValue(); - ScConditionalFormatList* pList = pDocument->GetCondFormList(); ScStyleSheetPool* pStylePool = pDocument->GetStyleSheetPool(); - if (pList && pStylePool && nIndex) + if (mpCondFormatList && pStylePool && nIndex) { - const ScConditionalFormat* pFormat = pList->GetFormat(nIndex); + const ScConditionalFormat* pFormat = mpCondFormatList->GetFormat(nIndex); if ( pFormat ) { sal_uInt16 nEntryCount = pFormat->Count(); |