Kaydet (Commit) 290a851b authored tarafından Markus Mohrhard's avatar Markus Mohrhard

ScTable::FillAuto should work with hidden rows/columsn now too

üst a6a0ea2f
...@@ -536,7 +536,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ...@@ -536,7 +536,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
sal_uLong nIMin = nIStart; sal_uLong nIMin = nIStart;
sal_uLong nIMax = nIEnd; sal_uLong nIMax = nIEnd;
PutInOrder(nIMin,nIMax); PutInOrder(nIMin,nIMax);
bool bHasFiltered = IsDataFiltered(aFillRange.aStart.Col(), aFillRange.aStart.Row(), aFillRange.aEnd.Col(), aFillRange.aEnd.Row()); bool bHasFiltered = IsDataFiltered(aFillRange);
if (!bHasFiltered) if (!bHasFiltered)
{ {
...@@ -569,52 +569,52 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ...@@ -569,52 +569,52 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
rInner = nIStart; rInner = nIStart;
while (true) // #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes while (true) // #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes
{ {
if ( bGetPattern ) if (!ColHidden(nCol) && !RowHidden(nRow))
{ {
delete pNewPattern; if ( bGetPattern )
if (bVertical) // rInner&:=nRow, rOuter&:=nCol
pSrcPattern = aCol[nCol].GetPattern(static_cast<SCROW>(nAtSrc));
else // rInner&:=nCol, rOuter&:=nRow
pSrcPattern = aCol[nAtSrc].GetPattern(static_cast<SCROW>(nRow));
bGetPattern = false;
pStyleSheet = pSrcPattern->GetStyleSheet();
// Merge/Mergeflag nicht uebernehmen,
const SfxItemSet& rSet = pSrcPattern->GetItemSet();
if ( rSet.GetItemState(ATTR_MERGE, false) == SFX_ITEM_SET
|| rSet.GetItemState(ATTR_MERGE_FLAG, false) == SFX_ITEM_SET )
{ {
pNewPattern = new ScPatternAttr( *pSrcPattern ); delete pNewPattern;
SfxItemSet& rNewSet = pNewPattern->GetItemSet(); if (bVertical) // rInner&:=nRow, rOuter&:=nCol
rNewSet.ClearItem(ATTR_MERGE); pSrcPattern = aCol[nCol].GetPattern(static_cast<SCROW>(nAtSrc));
rNewSet.ClearItem(ATTR_MERGE_FLAG); else // rInner&:=nCol, rOuter&:=nRow
pSrcPattern = aCol[nAtSrc].GetPattern(static_cast<SCROW>(nRow));
bGetPattern = false;
pStyleSheet = pSrcPattern->GetStyleSheet();
// Merge/Mergeflag nicht uebernehmen,
const SfxItemSet& rSet = pSrcPattern->GetItemSet();
if ( rSet.GetItemState(ATTR_MERGE, false) == SFX_ITEM_SET
|| rSet.GetItemState(ATTR_MERGE_FLAG, false) == SFX_ITEM_SET )
{
pNewPattern = new ScPatternAttr( *pSrcPattern );
SfxItemSet& rNewSet = pNewPattern->GetItemSet();
rNewSet.ClearItem(ATTR_MERGE);
rNewSet.ClearItem(ATTR_MERGE_FLAG);
}
else
pNewPattern = NULL;
} }
else
pNewPattern = NULL;
}
if ( bVertical && nISrcStart == nISrcEnd && !bHasFiltered ) if ( bVertical && nISrcStart == nISrcEnd && !bHasFiltered )
{
// Attribute komplett am Stueck setzen
if (pNewPattern || pSrcPattern != pDocument->GetDefPattern())
{ {
// Default steht schon da (DeleteArea) // Attribute komplett am Stueck setzen
SCROW nY1 = static_cast<SCROW>(Min( nIStart, nIEnd )); if (pNewPattern || pSrcPattern != pDocument->GetDefPattern())
SCROW nY2 = static_cast<SCROW>(Max( nIStart, nIEnd )); {
if ( pStyleSheet ) // Default steht schon da (DeleteArea)
aCol[nCol].ApplyStyleArea( nY1, nY2, *pStyleSheet ); SCROW nY1 = static_cast<SCROW>(Min( nIStart, nIEnd ));
if ( pNewPattern ) SCROW nY2 = static_cast<SCROW>(Max( nIStart, nIEnd ));
aCol[nCol].ApplyPatternArea( nY1, nY2, *pNewPattern ); if ( pStyleSheet )
else aCol[nCol].ApplyStyleArea( nY1, nY2, *pStyleSheet );
aCol[nCol].ApplyPatternArea( nY1, nY2, *pSrcPattern ); if ( pNewPattern )
aCol[nCol].ApplyPatternArea( nY1, nY2, *pNewPattern );
else
aCol[nCol].ApplyPatternArea( nY1, nY2, *pSrcPattern );
}
break; // Schleife abbrechen
} }
break; // Schleife abbrechen
}
if (!RowFiltered( nRow ))
{
if ( bHasFiltered ) if ( bHasFiltered )
DeleteArea(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), DeleteArea(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow),
static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), IDF_AUTOFILL); static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), IDF_AUTOFILL);
if ( pSrcPattern != aCol[nCol].GetPattern( static_cast<SCROW>(nRow) ) ) if ( pSrcPattern != aCol[nCol].GetPattern( static_cast<SCROW>(nRow) ) )
{ {
...@@ -693,17 +693,20 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ...@@ -693,17 +693,20 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
rInner = nIStart; rInner = nIStart;
while (true) // #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes while (true) // #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes
{ {
if (bPositive) if(!ColHidden(nCol) && !RowHidden(nRow))
{ {
++nListIndex; if (bPositive)
if (nListIndex >= nListCount) nListIndex = 0; {
} ++nListIndex;
else if (nListIndex >= nListCount) nListIndex = 0;
{ }
if (nListIndex == 0) nListIndex = nListCount; else
--nListIndex; {
if (nListIndex == 0) nListIndex = nListCount;
--nListIndex;
}
aCol[nCol].Insert(static_cast<SCROW>(nRow), new ScStringCell(pListData->GetSubStr(nListIndex)));
} }
aCol[nCol].Insert(static_cast<SCROW>(nRow), new ScStringCell(pListData->GetSubStr(nListIndex)));
if (rInner == nIEnd) break; if (rInner == nIEnd) break;
if (bPositive) ++rInner; else --rInner; if (bPositive) ++rInner; else --rInner;
...@@ -718,7 +721,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ...@@ -718,7 +721,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
{ {
sal_uLong nSource = nISrcStart; sal_uLong nSource = nISrcStart;
double nDelta; double nDelta;
if ( (nScFillModeMouseModifier & KEY_MOD1) || bHasFiltered ) if ( (nScFillModeMouseModifier & KEY_MOD1) )
nDelta = 0.0; nDelta = 0.0;
else if ( bPositive ) else if ( bPositive )
nDelta = 1.0; nDelta = 1.0;
...@@ -735,56 +738,53 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ...@@ -735,56 +738,53 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
ScBaseCell* pSrcCell = NULL; ScBaseCell* pSrcCell = NULL;
CellType eCellType = CELLTYPE_NONE; CellType eCellType = CELLTYPE_NONE;
bool bIsOrdinalSuffix = false; bool bIsOrdinalSuffix = false;
bool bRowFiltered = false;
rInner = nIStart; rInner = nIStart;
while (true) // #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes while (true) // #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes
{ {
if ( bGetCell ) if(!ColHidden(nCol) && !RowHidden(nRow))
{ {
if (bVertical) // rInner&:=nRow, rOuter&:=nCol if ( bGetCell )
pSrcCell = aCol[nCol].GetCell( static_cast<SCROW>(nSource) );
else // rInner&:=nCol, rOuter&:=nRow
pSrcCell = aCol[nSource].GetCell( static_cast<SCROW>(nRow) );
bGetCell = false;
if ( pSrcCell )
{ {
eCellType = pSrcCell->GetCellType(); if (bVertical) // rInner&:=nRow, rOuter&:=nCol
switch ( eCellType ) pSrcCell = aCol[nCol].GetCell( static_cast<SCROW>(nSource) );
else // rInner&:=nCol, rOuter&:=nRow
pSrcCell = aCol[nSource].GetCell( static_cast<SCROW>(nRow) );
bGetCell = false;
if ( pSrcCell )
{ {
case CELLTYPE_VALUE: eCellType = pSrcCell->GetCellType();
nVal = ((ScValueCell*)pSrcCell)->GetValue(); switch ( eCellType )
break;
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
if ( eCellType == CELLTYPE_STRING )
aValue = ((ScStringCell*)pSrcCell)->GetString();
else
aValue = ((ScEditCell*)pSrcCell)->GetString();
if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered )
{
nCellDigits = 0; // look at each source cell individually
nHeadNoneTail = lcl_DecompValueString(
aValue, nStringValue, &nCellDigits );
bIsOrdinalSuffix = aValue.Equals(
ScGlobal::GetOrdinalSuffix( nStringValue));
}
break;
default:
{ {
// added to avoid warnings case CELLTYPE_VALUE:
nVal = ((ScValueCell*)pSrcCell)->GetValue();
break;
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
if ( eCellType == CELLTYPE_STRING )
aValue = ((ScStringCell*)pSrcCell)->GetString();
else
aValue = ((ScEditCell*)pSrcCell)->GetString();
if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered )
{
nCellDigits = 0; // look at each source cell individually
nHeadNoneTail = lcl_DecompValueString(
aValue, nStringValue, &nCellDigits );
bIsOrdinalSuffix = aValue.Equals(
ScGlobal::GetOrdinalSuffix( nStringValue));
}
break;
default:
{
// added to avoid warnings
}
} }
} }
else
eCellType = CELLTYPE_NONE;
} }
else
eCellType = CELLTYPE_NONE;
}
bRowFiltered = RowHidden(nRow);
if (!bRowFiltered)
{
switch (eCellType) switch (eCellType)
{ {
case CELLTYPE_VALUE: case CELLTYPE_VALUE:
...@@ -823,11 +823,11 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ...@@ -823,11 +823,11 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
case CELLTYPE_STRING: case CELLTYPE_STRING:
case CELLTYPE_EDIT: case CELLTYPE_EDIT:
aCol[nCol].Insert( aDestPos.Row(), pSrcCell->Clone( *pDocument ) ); aCol[nCol].Insert( aDestPos.Row(), pSrcCell->Clone( *pDocument ) );
break; break;
default: default:
{ {
// added to avoid warnings // added to avoid warnings
} }
} }
} }
break; break;
...@@ -840,9 +840,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ...@@ -840,9 +840,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
nMaxFormCnt = nFormulaCounter - nActFormCnt; nMaxFormCnt = nFormulaCounter - nActFormCnt;
break; break;
default: default:
{ {
// added to avoid warnings // added to avoid warnings
} }
} }
if (nSource==nISrcEnd) if (nSource==nISrcEnd)
...@@ -852,7 +852,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ...@@ -852,7 +852,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
nSource = nISrcStart; nSource = nISrcStart;
bGetCell = true; bGetCell = true;
} }
if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered ) if ( !(nScFillModeMouseModifier & KEY_MOD1) )
{ {
if ( bPositive ) if ( bPositive )
nDelta += 1.0; nDelta += 1.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment