summaryrefslogtreecommitdiff
path: root/sc/source/core/data/table2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/table2.cxx')
-rw-r--r--sc/source/core/data/table2.cxx319
1 files changed, 131 insertions, 188 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 5e7d2d940282..a852f7c0c1f7 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -48,7 +48,7 @@
#include "olinetab.hxx"
#include "rechead.hxx"
#include "stlpool.hxx"
-#include "attarray.hxx" // Iterator
+#include "attarray.hxx" // Iterator
#include "markdata.hxx"
#include "progress.hxx"
#include "dociter.hxx"
@@ -89,7 +89,7 @@ BOOL ScTable::SetOutlineTable( const ScOutlineTable* pNewOutline )
else
pOutlineTable = NULL;
- return ( nNewSizeX != nOldSizeX || nNewSizeY != nOldSizeY ); // Groesse geaendert ?
+ return ( nNewSizeX != nOldSizeX || nNewSizeY != nOldSizeY ); // Groesse geaendert ?
}
@@ -293,7 +293,7 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
aCol[MAXCOL - nSize - i].MoveTo(nStartRow, nEndRow, aCol[MAXCOL - i]);
}
- if (nStartCol>0) // copy old attributes
+ if (nStartCol>0) // copy old attributes
{
USHORT nWhichArray[2];
nWhichArray[0] = ATTR_MERGE;
@@ -380,7 +380,7 @@ void ScTable::DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USH
if (nRow2 > MAXROW) nRow2 = MAXROW;
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
{
-// IncRecalcLevel();
+// IncRecalcLevel();
{ // scope for bulk broadcast
ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM());
@@ -399,7 +399,7 @@ void ScTable::DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USH
ApplyPatternArea( nCol1, nRow1, nCol2, nRow2, aPattern );
}
-// DecRecalcLevel();
+// DecRecalcLevel();
}
}
@@ -427,20 +427,20 @@ void ScTable::DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark )
}
-// pTable = Clipboard
+// pTable = Clipboard
void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
ScTable* pTable, BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions)
{
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
{
- // Inhalte kopieren
+ // Inhalte kopieren
SCCOL i;
for ( i = nCol1; i <= nCol2; i++)
aCol[i].CopyToClip(nRow1, nRow2, pTable->aCol[i], bKeepScenarioFlags, bCloneNoteCaptions);
- // copy widths/heights, and only "hidden", "filtered" and "manual" flags
- // also for all preceding columns/rows, to have valid positions for drawing objects
+ // copy widths/heights, and only "hidden", "filtered" and "manual" flags
+ // also for all preceding columns/rows, to have valid positions for drawing objects
if (pColWidth && pTable->pColWidth)
for (i=0; i<=nCol2; i++)
@@ -458,7 +458,7 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pTable->CopyRowHidden(*this, 0, nRow2);
pTable->CopyRowFiltered(*this, 0, nRow2);
- // ggf. Formeln durch Werte ersetzen
+ // ggf. Formeln durch Werte ersetzen
if ( IsProtected() )
for (i = nCol1; i <= nCol2; i++)
@@ -466,13 +466,13 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
}
-void ScTable::CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
+void ScTable::CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
bool bKeepScenarioFlags, bool bCloneNoteCaptions)
{
ScRangeList aRanges(rRanges);
for (ScRangePtr p = aRanges.First(); p; p = aRanges.Next())
{
- CopyToClip(p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(),
+ CopyToClip(p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(),
pTable, bKeepScenarioFlags, bCloneNoteCaptions);
}
}
@@ -535,7 +535,7 @@ void ScTable::MixData( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
-// Markierung von diesem Dokument
+// Markierung von diesem Dokument
void ScTable::MixMarked( const ScMarkData& rMark, USHORT nFunction,
BOOL bSkipEmpty, ScTable* pSrcTab )
{
@@ -558,18 +558,18 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if ( bAsLink && nFlags == IDF_ALL )
{
- // #68989# with IDF_ALL, also create links (formulas) for empty cells
+ // #68989# with IDF_ALL, also create links (formulas) for empty cells
for ( nRow=nRow1; nRow<=nRow2; nRow++ )
{
- // create simple formula, as in ScColumn::CreateRefCell
+ // create simple formula, as in ScColumn::CreateRefCell
ScAddress aDestPos( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab );
ScSingleRefData aRef;
aRef.nCol = nCol;
aRef.nRow = nRow;
aRef.nTab = nTab;
- aRef.InitFlags(); // -> all absolute
+ aRef.InitFlags(); // -> all absolute
aRef.SetFlag3D(TRUE);
aRef.CalcRelFromAbs( aDestPos );
ScTokenArray aArr;
@@ -586,19 +586,19 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
{
ScAddress aDestPos( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab );
ScBaseCell* pNew;
- if ( bAsLink ) // Referenz erzeugen ?
+ if ( bAsLink ) // Referenz erzeugen ?
{
pNew = aCol[nCol].CreateRefCell( pDestDoc, aDestPos, aIter.GetIndex(), nFlags );
}
- else // kopieren
+ else // kopieren
{
ScAddress aOwnPos( nCol, nRow, nTab );
if (pCell->GetCellType() == CELLTYPE_FORMULA)
{
pNew = pCell->CloneWithNote( aOwnPos, *pDestDoc, aDestPos, SC_CLONECELL_STARTLISTENING );
- // Referenzen drehen
- // bei Cut werden Referenzen spaeter per UpdateTranspose angepasst
+ // Referenzen drehen
+ // bei Cut werden Referenzen spaeter per UpdateTranspose angepasst
if (!bWasCut)
((ScFormulaCell*)pNew)->TransposeReference();
@@ -612,7 +612,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
}
- // Attribute
+ // Attribute
SCROW nAttrRow1;
SCROW nAttrRow2;
@@ -730,9 +730,9 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
aCol[i].CopyToColumn(nRow1, nRow2, nFlags, bMarked,
pDestTab->aCol[i], pMarkData, bAsLink);
- if (bColRowFlags) // Spaltenbreiten/Zeilenhoehen/Flags
+ if (bColRowFlags) // Spaltenbreiten/Zeilenhoehen/Flags
{
- // Charts muessen beim Ein-/Ausblenden angepasst werden
+ // Charts muessen beim Ein-/Ausblenden angepasst werden
ScChartListenerCollection* pCharts = pDestTab->pDocument->GetChartListenerCollection();
bool bFlagChange = false;
@@ -754,8 +754,8 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pDestTab->pColWidth[i] = pColWidth[i];
pDestTab->pColFlags[i] = pColFlags[i];
pDestTab->SetColHidden(i, i, bThisHidden);
- //! Aenderungen zusammenfassen?
- if (bHiddenChange && pCharts)
+ //! Aenderungen zusammenfassen?
+ if (bHiddenChange && pCharts)
pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, MAXROW, nTab ));
if (bChange)
@@ -775,23 +775,19 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pDestTab->pRowFlags->CopyFrom(*pRowFlags, nRow1, nRow2);
// Hidden flags.
- // #i116164# Collect information first, then apply the changes,
- // so RowHidden doesn't rebuild the tree for each row range.
- std::vector<ScShowRowsEntry> aEntries;
for (SCROW i = nRow1; i <= nRow2; ++i)
{
SCROW nThisLastRow, nDestLastRow;
bool bThisHidden = RowHidden(i, NULL, &nThisLastRow);
bool bDestHidden = pDestTab->RowHidden(i, NULL, &nDestLastRow);
-
+
// If the segment sizes differ, we take the shorter segment of the two.
SCROW nLastRow = ::std::min(nThisLastRow, nDestLastRow);
if (nLastRow >= nRow2)
// the last row shouldn't exceed the upper bound the caller specified.
nLastRow = nRow2;
-
- //pDestTab->SetRowHidden(i, nLastRow, bThisHidden);
- aEntries.push_back(ScShowRowsEntry(i, nLastRow, bThisHidden));
+
+ pDestTab->SetRowHidden(i, nLastRow, bThisHidden);
bool bThisHiddenChange = (bThisHidden != bDestHidden);
if (bThisHiddenChange && pCharts)
@@ -799,27 +795,14 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
// Hidden flags differ.
pCharts->SetRangeDirty(ScRange(0, i, nTab, MAXCOL, nLastRow, nTab));
}
-
+
if (bThisHiddenChange)
bFlagChange = true;
-
+
// Jump to the last row of the identical flag segment.
i = nLastRow;
}
- std::vector<ScShowRowsEntry>::const_iterator aEnd = aEntries.end();
- std::vector<ScShowRowsEntry>::const_iterator aIter = aEntries.begin();
- if ( aIter != aEnd )
- {
- pDestTab->mpHiddenRows->setInsertFromBack(true); // important for undo document
- while (aIter != aEnd)
- {
- pDestTab->SetRowHidden(aIter->mnRow1, aIter->mnRow2, !aIter->mbShow);
- ++aIter;
- }
- pDestTab->mpHiddenRows->setInsertFromBack(false);
- }
-
// Filtered flags.
for (SCROW i = nRow1; i <= nRow2; ++i)
{
@@ -839,7 +822,7 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (bFlagChange)
pDestTab->InvalidatePageBreaks();
- pDestTab->SetOutlineTable( pOutlineTable ); // auch nur wenn bColRowFlags
+ pDestTab->SetOutlineTable( pOutlineTable ); // auch nur wenn bColRowFlags
}
}
}
@@ -921,7 +904,7 @@ void ScTable::MarkScenarioIn( ScMarkData& rDestMark, USHORT nNeededBits ) const
{
DBG_ASSERT( bScenario, "bScenario == FALSE" );
- if ( ( nScenarioFlags & nNeededBits ) != nNeededBits ) // alle Bits gesetzt?
+ if ( ( nScenarioFlags & nNeededBits ) != nNeededBits ) // alle Bits gesetzt?
return;
for (SCCOL i=0; i<=MAXCOL; i++)
@@ -932,16 +915,16 @@ BOOL ScTable::HasScenarioRange( const ScRange& rRange ) const
{
DBG_ASSERT( bScenario, "bScenario == FALSE" );
-// ScMarkData aMark;
-// MarkScenarioIn( aMark, 0 ); //! Bits als Parameter von HasScenarioRange?
-// return aMark.IsAllMarked( rRange );
+// ScMarkData aMark;
+// MarkScenarioIn( aMark, 0 ); //! Bits als Parameter von HasScenarioRange?
+// return aMark.IsAllMarked( rRange );
ScRange aTabRange = rRange;
aTabRange.aStart.SetTab( nTab );
aTabRange.aEnd.SetTab( nTab );
const ScRangeList* pList = GetScenarioRanges();
-// return ( pList && pList->Find( aTabRange ) );
+// return ( pList && pList->Find( aTabRange ) );
if (pList)
{
@@ -971,7 +954,7 @@ const ScRangeList* ScTable::GetScenarioRanges() const
{
((ScTable*)this)->pScenarioRanges = new ScRangeList;
ScMarkData aMark;
- MarkScenarioIn( aMark, 0 ); // immer
+ MarkScenarioIn( aMark, 0 ); // immer
aMark.FillRangeListWithMarks( pScenarioRanges, FALSE );
}
return pScenarioRanges;
@@ -1023,11 +1006,11 @@ void ScTable::PutCell( const ScAddress& rPos, ScBaseCell* pCell )
}
-BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString,
+BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString,
ScSetStringParam* pParam )
{
if (ValidColRow(nCol,nRow))
- return aCol[nCol].SetString(
+ return aCol[nCol].SetString(
nRow, nTabP, rString, pDocument->GetAddressConvention(), pParam );
else
return FALSE;
@@ -1144,16 +1127,10 @@ ScBaseCell* ScTable::GetCell( SCCOL nCol, SCROW nRow ) const
void ScTable::GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const
{
rCol = 0;
- rRow = MAXROW+1;
+ rRow = 0;
while (aCol[rCol].IsEmptyData() && rCol < MAXCOL)
++rCol;
- SCCOL nCol = rCol;
- while (nCol <= MAXCOL && rRow > 0)
- {
- if (!aCol[nCol].IsEmptyData())
- rRow = ::std::min( rRow, aCol[nCol].GetFirstDataPos());
- ++nCol;
- }
+ rRow = aCol[rCol].GetFirstDataPos();
}
void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const
@@ -1163,8 +1140,11 @@ void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const
while (aCol[rCol].IsEmptyData() && (rCol > 0))
rCol--;
SCCOL nCol = rCol;
- while (nCol >= 0 && rRow < MAXROW)
- rRow = ::std::max( rRow, aCol[nCol--].GetLastDataPos());
+ while ((SCsCOL)nCol >= 0)
+ {
+ rRow = Max(rRow, aCol[nCol].GetLastDataPos());
+ nCol--;
+ }
}
@@ -1217,7 +1197,7 @@ void ScTable::SetDirtyVar()
void ScTable::SetDirty()
{
BOOL bOldAutoCalc = pDocument->GetAutoCalc();
- pDocument->SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
+ pDocument->SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
for (SCCOL i=0; i<=MAXCOL; i++)
aCol[i].SetDirty();
pDocument->SetAutoCalc( bOldAutoCalc );
@@ -1227,7 +1207,7 @@ void ScTable::SetDirty()
void ScTable::SetDirty( const ScRange& rRange )
{
BOOL bOldAutoCalc = pDocument->GetAutoCalc();
- pDocument->SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
+ pDocument->SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
SCCOL nCol2 = rRange.aEnd.Col();
for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
aCol[i].SetDirty( rRange );
@@ -1238,7 +1218,7 @@ void ScTable::SetDirty( const ScRange& rRange )
void ScTable::SetTableOpDirty( const ScRange& rRange )
{
BOOL bOldAutoCalc = pDocument->GetAutoCalc();
- pDocument->SetAutoCalc( FALSE ); // no multiple recalculation
+ pDocument->SetAutoCalc( FALSE ); // no multiple recalculation
SCCOL nCol2 = rRange.aEnd.Col();
for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
aCol[i].SetTableOpDirty( rRange );
@@ -1249,7 +1229,7 @@ void ScTable::SetTableOpDirty( const ScRange& rRange )
void ScTable::SetDirtyAfterLoad()
{
BOOL bOldAutoCalc = pDocument->GetAutoCalc();
- pDocument->SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
+ pDocument->SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
for (SCCOL i=0; i<=MAXCOL; i++)
aCol[i].SetDirtyAfterLoad();
pDocument->SetAutoCalc( bOldAutoCalc );
@@ -1259,7 +1239,7 @@ void ScTable::SetDirtyAfterLoad()
void ScTable::SetRelNameDirty()
{
BOOL bOldAutoCalc = pDocument->GetAutoCalc();
- pDocument->SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
+ pDocument->SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
for (SCCOL i=0; i<=MAXCOL; i++)
aCol[i].SetRelNameDirty();
pDocument->SetAutoCalc( bOldAutoCalc );
@@ -1314,7 +1294,7 @@ void ScTable::ResetChanged( const ScRange& rRange )
aCol[nCol].ResetChanged(nStartRow, nEndRow);
}
-// Attribute
+// Attribute
const SfxPoolItem* ScTable::GetAttr( SCCOL nCol, SCROW nRow, USHORT nWhich ) const
{
@@ -1416,16 +1396,16 @@ SCSIZE ScTable::FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCO
SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
const ScPatternAttr* pPattern, const SfxItemSet* pCondSet )
{
- // Rueckgabe = neues nArrY
+ // Rueckgabe = neues nArrY
BYTE nRotDir = pPattern->GetRotateDir( pCondSet );
if ( nRotDir != SC_ROTDIR_NONE )
{
BOOL bHit = TRUE;
- if ( nCol+1 < nX1 ) // column to the left
+ if ( nCol+1 < nX1 ) // column to the left
bHit = ( nRotDir != SC_ROTDIR_LEFT );
- else if ( nCol > nX2+1 ) // column to the right
- bHit = ( nRotDir != SC_ROTDIR_RIGHT ); // SC_ROTDIR_STANDARD may now also be extended to the left
+ else if ( nCol > nX2+1 ) // column to the right
+ bHit = ( nRotDir != SC_ROTDIR_RIGHT ); // SC_ROTDIR_STANDARD may now also be extended to the left
if ( bHit )
{
@@ -1434,14 +1414,14 @@ SCSIZE ScTable::FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCO
{
long nRotVal = ((const SfxInt32Item&) pPattern->
GetItem( ATTR_ROTATE_VALUE, pCondSet )).GetValue();
- double nRealOrient = nRotVal * F_PI18000; // 1/100 Grad
+ double nRealOrient = nRotVal * F_PI18000; // 1/100 Grad
double nCos = cos( nRealOrient );
double nSin = sin( nRealOrient );
- //! begrenzen !!!
- //! zusaetzlich Faktor fuer unterschiedliche PPT X/Y !!!
+ //! begrenzen !!!
+ //! zusaetzlich Faktor fuer unterschiedliche PPT X/Y !!!
- // bei SC_ROTDIR_LEFT kommt immer ein negativer Wert heraus,
- // wenn der Modus beruecksichtigt wird
+ // bei SC_ROTDIR_LEFT kommt immer ein negativer Wert heraus,
+ // wenn der Modus beruecksichtigt wird
nFactor = -fabs( nCos / nSin );
}
@@ -1489,7 +1469,7 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC
return;
}
- // nRotMaxCol ist auf SC_ROTMAX_NONE initialisiert, nRowNo ist schon gesetzt
+ // nRotMaxCol ist auf SC_ROTMAX_NONE initialisiert, nRowNo ist schon gesetzt
SCROW nY1 = pRowInfo[0].nRowNo;
SCROW nY2 = pRowInfo[nArrCount-1].nRowNo;
@@ -1509,8 +1489,8 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC
if ( pPattern->GetItemSet().GetItemState( ATTR_CONDITIONAL, TRUE, &pCondItem )
== SFX_ITEM_SET )
{
- // alle Formate durchgehen, damit die Zellen nicht einzeln
- // angeschaut werden muessen
+ // alle Formate durchgehen, damit die Zellen nicht einzeln
+ // angeschaut werden muessen
ULONG nIndex = ((const SfxUInt32Item*)pCondItem)->GetValue();
ScConditionalFormatList* pList = pDocument->GetCondFormList();
@@ -1533,7 +1513,7 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC
FillMaxRot( pRowInfo, nArrCount, nX1, nX2,
nCol, nAttrRow1, nAttrRow2,
nArrY, pPattern, &pStyleSheet->GetItemSet() );
- // nArrY nicht veraendern
+ // nArrY nicht veraendern
}
}
}
@@ -1557,28 +1537,28 @@ BOOL ScTable::HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR
USHORT nEdges;
if ( nCol1 == nCol2 )
- { // linke und rechte Spalte
+ { // linke und rechte Spalte
const USHORT n = 4 | 16;
nEdges = aCol[nCol1].GetBlockMatrixEdges( nRow1, nRow2, n );
// nicht (4 und 16) oder 1 oder 32
if ( nEdges && (((nEdges & n) != n) || (nEdges & 33)) )
- return TRUE; // linke oder rechte Kante fehlt oder offen
+ return TRUE; // linke oder rechte Kante fehlt oder offen
}
else
- { // linke Spalte
+ { // linke Spalte
nEdges = aCol[nCol1].GetBlockMatrixEdges( nRow1, nRow2, 4 );
// nicht 4 oder 1 oder 32
if ( nEdges && (((nEdges & 4) != 4) || (nEdges & 33)) )
- return TRUE; // linke Kante fehlt oder offen
+ return TRUE; // linke Kante fehlt oder offen
// rechte Spalte
nEdges = aCol[nCol2].GetBlockMatrixEdges( nRow1, nRow2, 16 );
// nicht 16 oder 1 oder 32
if ( nEdges && (((nEdges & 16) != 16) || (nEdges & 33)) )
- return TRUE; // rechte Kante fehlt oder offen
+ return TRUE; // rechte Kante fehlt oder offen
}
if ( nRow1 == nRow2 )
- { // obere und untere Zeile
+ { // obere und untere Zeile
BOOL bOpen = FALSE;
const USHORT n = 2 | 8;
for ( SCCOL i=nCol1; i<=nCol2; i++)
@@ -1587,17 +1567,17 @@ BOOL ScTable::HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR
if ( nEdges )
{
if ( (nEdges & n) != n )
- return TRUE; // obere oder untere Kante fehlt
+ return TRUE; // obere oder untere Kante fehlt
if ( nEdges & 4 )
- bOpen = TRUE; // linke Kante oeffnet, weitersehen
+ bOpen = TRUE; // linke Kante oeffnet, weitersehen
else if ( !bOpen )
- return TRUE; // es gibt was, was nicht geoeffnet wurde
+ return TRUE; // es gibt was, was nicht geoeffnet wurde
if ( nEdges & 16 )
- bOpen = FALSE; // rechte Kante schliesst
+ bOpen = FALSE; // rechte Kante schliesst
}
}
if ( bOpen )
- return TRUE; // es geht noch weiter
+ return TRUE; // es geht noch weiter
}
else
{
@@ -1617,15 +1597,15 @@ BOOL ScTable::HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR
if ( (nEdges & n) != n )
return TRUE;
if ( nEdges & 4 )
- bOpen = TRUE; // linke Kante oeffnet, weitersehen
+ bOpen = TRUE; // linke Kante oeffnet, weitersehen
else if ( !bOpen )
- return TRUE; // es gibt was, was nicht geoeffnet wurde
+ return TRUE; // es gibt was, was nicht geoeffnet wurde
if ( nEdges & 16 )
- bOpen = FALSE; // rechte Kante schliesst
+ bOpen = FALSE; // rechte Kante schliesst
}
}
if ( bOpen )
- return TRUE; // es geht noch weiter
+ return TRUE; // es geht noch weiter
}
}
return FALSE;
@@ -1946,8 +1926,8 @@ const ScStyleSheet* ScTable::GetSelectionStyle( const ScMarkData& rMark, BOOL& r
{
rFound = FALSE;
- BOOL bEqual = TRUE;
- BOOL bColFound;
+ BOOL bEqual = TRUE;
+ BOOL bColFound;
const ScStyleSheet* pStyle = NULL;
const ScStyleSheet* pNewStyle;
@@ -1960,7 +1940,7 @@ const ScStyleSheet* ScTable::GetSelectionStyle( const ScMarkData& rMark, BOOL& r
{
rFound = TRUE;
if ( !pNewStyle || ( pStyle && pNewStyle != pStyle ) )
- bEqual = FALSE; // unterschiedliche
+ bEqual = FALSE; // unterschiedliche
pStyle = pNewStyle;
}
}
@@ -1969,13 +1949,13 @@ const ScStyleSheet* ScTable::GetSelectionStyle( const ScMarkData& rMark, BOOL& r
}
-const ScStyleSheet* ScTable::GetAreaStyle( BOOL& rFound, SCCOL nCol1, SCROW nRow1,
+const ScStyleSheet* ScTable::GetAreaStyle( BOOL& rFound, SCCOL nCol1, SCROW nRow1,
SCCOL nCol2, SCROW nRow2 ) const
{
rFound = FALSE;
- BOOL bEqual = TRUE;
- BOOL bColFound;
+ BOOL bEqual = TRUE;
+ BOOL bColFound;
const ScStyleSheet* pStyle = NULL;
const ScStyleSheet* pNewStyle;
@@ -1987,7 +1967,7 @@ const ScStyleSheet* ScTable::GetAreaStyle( BOOL& rFound, SCCOL nCol1, SCROW nRow
{
rFound = TRUE;
if ( !pNewStyle || ( pStyle && pNewStyle != pStyle ) )
- bEqual = FALSE; // unterschiedliche
+ bEqual = FALSE; // unterschiedliche
pStyle = pNewStyle;
}
}
@@ -2098,7 +2078,7 @@ void ScTable::ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark
}
-// Spaltenbreiten / Zeilenhoehen
+// Spaltenbreiten / Zeilenhoehen
void ScTable::SetColWidth( SCCOL nCol, USHORT nNewWidth )
{
@@ -2106,7 +2086,7 @@ void ScTable::SetColWidth( SCCOL nCol, USHORT nNewWidth )
{
if (!nNewWidth)
{
-// DBG_ERROR("Spaltenbreite 0 in SetColWidth");
+// DBG_ERROR("Spaltenbreite 0 in SetColWidth");
nNewWidth = STD_COL_WIDTH;
}
@@ -2173,12 +2153,12 @@ void ScTable::SetRowHeight( SCROW nRow, USHORT nNewHeight )
namespace {
-/**
- * Check if the new pixel size is different from the old size between
- * specified ranges.
+/**
+ * Check if the new pixel size is different from the old size between
+ * specified ranges.
*/
bool lcl_pixelSizeChanged(
- ScFlatUInt16RowSegments& rRowHeights, SCROW nStartRow, SCROW nEndRow,
+ ScFlatUInt16RowSegments& rRowHeights, SCROW nStartRow, SCROW nEndRow,
sal_uInt16 nNewHeight, double nPPTY)
{
long nNewPix = static_cast<long>(nNewHeight * nPPTY);
@@ -2191,7 +2171,7 @@ bool lcl_pixelSizeChanged(
break;
if (nHeight != nNewHeight)
- {
+ {
bool bChanged = (nNewPix != static_cast<long>(nHeight * nPPTY));
if (bChanged)
return true;
@@ -2339,7 +2319,7 @@ USHORT ScTable::GetColWidth( SCCOL nCol ) const
}
-USHORT ScTable::GetOriginalWidth( SCCOL nCol ) const // immer die eingestellte
+USHORT ScTable::GetOriginalWidth( SCCOL nCol ) const // immer die eingestellte
{
DBG_ASSERT(VALIDCOL(nCol),"Falsche Spaltennummer");
@@ -2352,7 +2332,7 @@ USHORT ScTable::GetOriginalWidth( SCCOL nCol ) const // immer die eingest
USHORT ScTable::GetCommonWidth( SCCOL nEndCol )
{
- // get the width that is used in the largest continuous column range (up to nEndCol)
+ // get the width that is used in the largest continuous column range (up to nEndCol)
if ( !ValidCol(nEndCol) )
{
@@ -2365,7 +2345,7 @@ USHORT ScTable::GetCommonWidth( SCCOL nEndCol )
SCCOL nRangeStart = 0;
while ( nRangeStart <= nEndCol )
{
- // skip hidden columns
+ // skip hidden columns
while ( nRangeStart <= nEndCol && ColHidden(nRangeStart) )
++nRangeStart;
if ( nRangeStart <= nEndCol )
@@ -2378,7 +2358,7 @@ USHORT ScTable::GetCommonWidth( SCCOL nEndCol )
++nThisCount;
++nRangeEnd;
- // skip hidden columns
+ // skip hidden columns
while ( nRangeEnd <= nEndCol && ColHidden(nRangeEnd) )
++nRangeEnd;
}
@@ -2389,7 +2369,7 @@ USHORT ScTable::GetCommonWidth( SCCOL nEndCol )
nMaxWidth = nThisWidth;
}
- nRangeStart = nRangeEnd; // next range
+ nRangeStart = nRangeEnd; // next range
}
}
@@ -2418,9 +2398,9 @@ USHORT ScTable::GetRowHeight( SCROW nRow, SCROW* pStartRow, SCROW* pEndRow, bool
return 0;
}
- // If bHiddenAsZero, pStartRow and pEndRow were initialized to
- // boundaries of a non-hidden segment. Assume that the previous and
- // next segment are hidden then and limit the current height
+ // If bHiddenAsZero, pStartRow and pEndRow were initialized to
+ // boundaries of a non-hidden segment. Assume that the previous and
+ // next segment are hidden then and limit the current height
// segment.
if (pStartRow)
*pStartRow = (bHiddenAsZero ? std::max( *pStartRow, aData.mnRow1) : aData.mnRow1);
@@ -2493,7 +2473,7 @@ ULONG ScTable::GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale
}
-USHORT ScTable::GetOriginalHeight( SCROW nRow ) const // non-0 even if hidden
+USHORT ScTable::GetOriginalHeight( SCROW nRow ) const // non-0 even if hidden
{
DBG_ASSERT(VALIDROW(nRow),"wrong row number");
@@ -2504,7 +2484,7 @@ USHORT ScTable::GetOriginalHeight( SCROW nRow ) const // non-0 even if hid
}
-// Spalten-/Zeilen-Flags
+// Spalten-/Zeilen-Flags
SCROW ScTable::GetHiddenRowCount( SCROW nRow )
@@ -2520,7 +2500,7 @@ SCROW ScTable::GetHiddenRowCount( SCROW nRow )
}
-//! ShowRows / DBShowRows zusammenfassen
+//! ShowRows / DBShowRows zusammenfassen
void ScTable::ShowCol(SCCOL nCol, bool bShow)
{
@@ -2611,7 +2591,7 @@ void ScTable::DBShowRow(SCROW nRow, bool bShow)
}
}
- // Filter-Flag immer setzen, auch wenn Hidden unveraendert
+ // Filter-Flag immer setzen, auch wenn Hidden unveraendert
SetRowHidden(nRow, nRow, !bShow);
SetRowFiltered(nRow, nRow, !bShow);
DecRecalcLevel();
@@ -2635,9 +2615,8 @@ void ScTable::DBShowRow(SCROW nRow, bool bShow)
}
-void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags)
+void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
{
- // #i116164# IncRecalcLevel/DecRecalcLevel is in ScTable::Query
SCROW nStartRow = nRow1;
while (nStartRow <= nRow2)
{
@@ -2647,7 +2626,7 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags)
nEndRow = nRow2;
BOOL bChanged = ( bWasVis != bShow );
- if ( bChanged && bSetFlags )
+ if ( bChanged )
{
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
@@ -2660,13 +2639,8 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags)
}
}
- // #i116164# Directly modify the flags only if there are drawing objects within the area.
- // Otherwise, all modifications are made together in ScTable::Query, so the tree isn't constantly rebuilt.
- if ( bSetFlags )
- {
- SetRowHidden(nStartRow, nEndRow, !bShow);
- SetRowFiltered(nStartRow, nEndRow, !bShow);
- }
+ SetRowHidden(nStartRow, nEndRow, !bShow);
+ SetRowFiltered(nStartRow, nEndRow, !bShow);
if ( bChanged )
{
@@ -2678,9 +2652,9 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags)
nStartRow = nEndRow + 1;
}
- // #i12341# For Show/Hide rows, the outlines are updated separately from the outside.
- // For filtering, the changes aren't visible to the caller, so UpdateOutlineRow has
- // to be done here.
+ // #i12341# For Show/Hide rows, the outlines are updated separately from the outside.
+ // For filtering, the changes aren't visible to the caller, so UpdateOutlineRow has
+ // to be done here.
if (pOutlineTable)
UpdateOutlineRow( nRow1, nRow2, bShow );
}
@@ -2691,14 +2665,6 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
SCROW nStartRow = nRow1;
IncRecalcLevel();
InitializeNoteCaptions();
-
- // #i116164# if there are no drawing objects within the row range, a single HeightChanged call is enough
- ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
- bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, nRow1, nRow2, false );
- long nOldHeight = 0;
- if ( pDrawLayer && !bHasObjects )
- nOldHeight = static_cast<long>(GetRowHeight(nRow1, nRow2));
-
while (nStartRow <= nRow2)
{
SCROW nEndRow = -1;
@@ -2707,8 +2673,9 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
nEndRow = nRow2;
BOOL bChanged = ( bWasVis != bShow );
- if ( bChanged && bHasObjects )
+ if ( bChanged )
{
+ ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
{
long nHeight = static_cast<long>(mpRowHeights->getSumValue(nStartRow, nEndRow));
@@ -2719,14 +2686,9 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
}
}
- // #i116164# Directly modify the flags only if there are drawing objects within the area.
- // Otherwise, all rows are modified together after the loop, so the tree isn't constantly rebuilt.
- if ( bHasObjects )
- {
- SetRowHidden(nStartRow, nEndRow, !bShow);
- if (bShow)
- SetRowFiltered(nStartRow, nEndRow, false);
- }
+ SetRowHidden(nStartRow, nEndRow, !bShow);
+ if (bShow)
+ SetRowFiltered(nStartRow, nEndRow, false);
if ( bChanged )
{
@@ -2739,25 +2701,6 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
nStartRow = nEndRow + 1;
}
-
- if ( !bHasObjects )
- {
- // #i116164# set the flags for the whole range at once
- SetRowHidden(nRow1, nRow2, !bShow);
- if (bShow)
- SetRowFiltered(nRow1, nRow2, false);
-
- if ( pDrawLayer )
- {
- // if there are no objects in the range, a single HeightChanged call is enough
- long nNewHeight = 0;
- if ( bShow )
- nNewHeight = static_cast<long>(GetRowHeight(nRow1, nRow2));
- if ( nNewHeight != nOldHeight )
- pDrawLayer->HeightChanged( nTab, nRow1, nNewHeight - nOldHeight );
- }
- }
-
DecRecalcLevel();
}
@@ -2817,7 +2760,7 @@ SCROW ScTable::GetLastFlaggedRow() const
{
SCROW nLastFound = 0;
if (pRowFlags)
- {
+ {
SCROW nRow = pRowFlags->GetLastAnyBitAccess( 0, sal::static_int_cast<BYTE>(CR_ALL) );
if (ValidRow(nRow))
nLastFound = nRow;
@@ -2955,7 +2898,7 @@ void ScTable::StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 )
}
-// Auto-Outline
+// Auto-Outline
template< typename T >
short DiffSign( T a, T b )
@@ -2968,7 +2911,7 @@ short DiffSign( T a, T b )
void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow )
{
BOOL bSizeChanged = FALSE;
- BOOL bMissed = FALSE;
+ BOOL bMissed = FALSE;
SCCOL nCol;
SCROW nRow;
@@ -2977,7 +2920,7 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC
ScOutlineArray* pArray;
ScBaseCell* pCell;
ScRange aRef;
-/* ScPatternAttr aBoldPattern( pDocument->GetPool() ); //! spezielle Format-Vorlage
+/* ScPatternAttr aBoldPattern( pDocument->GetPool() ); //! spezielle Format-Vorlage
aBoldPattern.GetItemSet().Put( SvxWeightItem( WEIGHT_BOLD ) );
*/
@@ -2985,8 +2928,8 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC
// Zeilen
- SCROW nCount = nEndRow-nStartRow+1;
- BOOL* pUsed = new BOOL[nCount];
+ SCROW nCount = nEndRow-nStartRow+1;
+ BOOL* pUsed = new BOOL[nCount];
for (i=0; i<nCount; i++)
pUsed[i] = FALSE;
for (nCol=nStartCol; nCol<=nEndCol; nCol++)
@@ -3012,7 +2955,7 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC
{
if (pArray->Insert( aRef.aStart.Row(), aRef.aEnd.Row(), bSizeChanged ))
{
-// ApplyPatternArea( nStartCol, nRow, nEndCol, nRow, aBoldPattern );
+// ApplyPatternArea( nStartCol, nRow, nEndCol, nRow, aBoldPattern );
bFound = TRUE;
}
else
@@ -3043,7 +2986,7 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC
{
if (pArray->Insert( aRef.aStart.Col(), aRef.aEnd.Col(), bSizeChanged ))
{
-// ApplyPatternArea( nCol, nStartRow, nCol, nEndRow, aBoldPattern );
+// ApplyPatternArea( nCol, nStartRow, nCol, nEndRow, aBoldPattern );
bFound = TRUE;
}
else
@@ -3054,12 +2997,12 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC
}
}
- // CopyData - fuer Query in anderen Bereich
+ // CopyData - fuer Query in anderen Bereich
void ScTable::CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab )
{
- //! wenn fuer mehrere Zeilen benutzt, nach Spalten optimieren!
+ //! wenn fuer mehrere Zeilen benutzt, nach Spalten optimieren!
ScAddress aSrc( nStartCol, nStartRow, nTab );
ScAddress aDest( nDestCol, nDestRow, nDestTab );
@@ -3125,7 +3068,7 @@ BOOL ScTable::RefVisible(ScFormulaCell* pCell)
}
}
- return TRUE; // irgendwie anders
+ return TRUE; // irgendwie anders
}
@@ -3153,7 +3096,7 @@ void ScTable::SetDrawPageSize(bool bResetStreamValid, bool bUpdateNoteCaptionPos
long x = ( fValX > (double)nMax ) ? nMax : (long) fValX;
long y = ( fValY > (double)nMax ) ? nMax : (long) fValY;
- if ( IsLayoutRTL() ) // IsNegativePage
+ if ( IsLayoutRTL() ) // IsNegativePage
x = -x;
pDrawLayer->SetPageSize( static_cast<sal_uInt16>(nTab), Size( x, y ), bUpdateNoteCaptionPos );