Kaydet (Commit) d053d40e authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Skip adjustment of row height when all rows have the same height.

Change-Id: I490ecade6b909bcf36b848c05e198d58adc90e0a
üst 832bee9a
......@@ -1572,6 +1572,8 @@ public:
SC_DLLPUBLIC bool IsManualRowHeight(SCROW nRow, SCTAB nTab) const;
bool HasUniformRowHeight( SCTAB nTab, SCROW nRow1, SCROW nRow2 ) const;
/**
* Write all column row flags to table's flag data, because not all column
* row attributes are stored in the flag data members. This is necessary
......
......@@ -815,6 +815,8 @@ public:
bool IsManualRowHeight(SCROW nRow) const;
bool HasUniformRowHeight( SCROW nRow1, SCROW nRow2 ) const;
void SyncColRowFlags();
void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
......
......@@ -279,4 +279,13 @@ void ScDocument::UpdateScriptTypes( const ScAddress& rPos, SCCOL nColSize, SCROW
pTab->UpdateScriptTypes(rPos.Col(), rPos.Row(), rPos.Col()+nColSize-1, rPos.Row()+nRowSize-1);
}
bool ScDocument::HasUniformRowHeight( SCTAB nTab, SCROW nRow1, SCROW nRow2 ) const
{
const ScTable* pTab = FetchTable(nTab);
if (!pTab)
return false;
return pTab->HasUniformRowHeight(nRow1, nRow2);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -12,6 +12,7 @@
#include <document.hxx>
#include <clipparam.hxx>
#include <bcaslot.hxx>
#include <segmenttree.hxx>
bool ScTable::IsMerged( SCCOL nCol, SCROW nRow ) const
{
......@@ -110,4 +111,17 @@ void ScTable::UpdateScriptTypes( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nR
aCol[nCol].UpdateScriptTypes(nRow1, nRow2);
}
bool ScTable::HasUniformRowHeight( SCROW nRow1, SCROW nRow2 ) const
{
if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2)
return false;
ScFlatUInt16RowSegments::RangeData aData;
if (!mpRowHeights->getRangeData(nRow1, aData))
// Search failed.
return false;
return nRow2 <= aData.mnRow2;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -490,13 +490,19 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
WaitObject aWait( rDocShell.GetActiveDialogParent() );
SCROW nStartRow = aLocalParam.nRow1 + (aLocalParam.bHasHeader ? 1 : 0);
// Calculate the script types for all cells in the sort range beforehand.
// This will speed up the row height adjustment that takes place after the
// sort.
pDoc->UpdateScriptTypes(
ScAddress(rSortParam.nCol1,rSortParam.nRow1,nTab),
rSortParam.nCol2-rSortParam.nCol1+1,
rSortParam.nRow2-rSortParam.nRow1+1);
ScAddress(aLocalParam.nCol1,nStartRow,nTab),
aLocalParam.nCol2-aLocalParam.nCol1+1,
aLocalParam.nRow2-nStartRow+1);
// No point adjusting row heights after the sort when all rows have the same height.
bool bUniformRowHeight =
pDoc->HasUniformRowHeight(nTab, nStartRow, aLocalParam.nRow2);
bool bRepeatQuery = false; // bestehenden Filter wiederholen?
ScQueryParam aQueryParam;
......@@ -632,8 +638,9 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
}
}
ScRange aDirtyRange( aLocalParam.nCol1, aLocalParam.nRow1, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab );
ScRange aDirtyRange(
aLocalParam.nCol1, nStartRow, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab);
pDoc->SetDirty( aDirtyRange );
if (bPaint)
......@@ -659,7 +666,8 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
rDocShell.PostPaint(ScRange(nStartX, nStartY, nTab, nEndX, nEndY, nTab), nPaint);
}
rDocShell.AdjustRowHeight( aLocalParam.nRow1, aLocalParam.nRow2, nTab );
if (!bUniformRowHeight)
rDocShell.AdjustRowHeight(nStartRow, aLocalParam.nRow2, nTab);
// #i59745# set collected drawing undo actions at sorting undo action
if( pUndoAction && pDrawLayer )
......
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