Kaydet (Commit) d3d15d51 authored tarafından Rafael Dominguez's avatar Rafael Dominguez Kaydeden (comit) Markus Mohrhard

Refactor PaintRangeFinder to only iterate needed entries.

Added a helper function PaintRangeFinderEntry.
üst ca3865ba
...@@ -43,6 +43,7 @@ class ScRowBar; ...@@ -43,6 +43,7 @@ class ScRowBar;
class ScColBar; class ScColBar;
class ScTabControl; class ScTabControl;
class ScTabViewShell; class ScTabViewShell;
class ScRangeFindData;
class SfxPrinter; class SfxPrinter;
class ScDrawView; class ScDrawView;
class SvBorder; class SvBorder;
...@@ -200,6 +201,18 @@ private: ...@@ -200,6 +201,18 @@ private:
void SkipCursorHorizontal(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, SCsROW nMovX); void SkipCursorHorizontal(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, SCsROW nMovX);
void SkipCursorVertical(SCsCOL& rCurX, SCsROW& rCurY, SCsROW nOldY, SCsROW nMovY); void SkipCursorVertical(SCsCOL& rCurX, SCsROW& rCurY, SCsROW nOldY, SCsROW nMovY);
/**
*
* @brief Update marks for a selected Range. This is a helper function
* for PaintRangeFinder.
*
* @param pData: Range to update for painting.
* @param nTab: Current tab.
*
**/
void PaintRangeFinderEntry (ScRangeFindData* pData, SCTAB nTab);
protected: protected:
void UpdateHeaderWidth( const ScVSplitPos* pWhich = NULL, void UpdateHeaderWidth( const ScVSplitPos* pWhich = NULL,
const SCROW* pPosY = NULL ); const SCROW* pPosY = NULL );
......
...@@ -1940,6 +1940,67 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO ...@@ -1940,6 +1940,67 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
// is set (width or height changed). // is set (width or height changed).
} }
void ScTabView::PaintRangeFinderEntry (ScRangeFindData* pData, const SCTAB nTab)
{
ScRange aRef = pData->aRef;
aRef.Justify(); // Justify fuer die Abfragen unten
if ( aRef.aStart == aRef.aEnd ) //! Tab ignorieren?
aViewData.GetDocument()->ExtendMerge(aRef);
if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab )
{
SCCOL nCol1 = aRef.aStart.Col();
SCROW nRow1 = aRef.aStart.Row();
SCCOL nCol2 = aRef.aEnd.Col();
SCROW nRow2 = aRef.aEnd.Row();
// wegnehmen -> Repaint
// SC_UPDATE_MARKS: Invalidate, nicht bis zum Zeilenende
bool bHiddenEdge = false;
SCROW nTmp;
ScDocument* pDoc = aViewData.GetDocument();
while ( nCol1 > 0 && pDoc->ColHidden(nCol1, nTab) )
{
--nCol1;
bHiddenEdge = true;
}
while ( nCol2 < MAXCOL && pDoc->ColHidden(nCol2, nTab) )
{
++nCol2;
bHiddenEdge = true;
}
nTmp = pDoc->LastVisibleRow(0, nRow1, nTab);
if (!ValidRow(nTmp))
nTmp = 0;
if (nTmp < nRow1)
{
nRow1 = nTmp;
bHiddenEdge = true;
}
nTmp = pDoc->FirstVisibleRow(nRow2, MAXROW, nTab);
if (!ValidRow(nTmp))
nTmp = MAXROW;
if (nTmp > nRow2)
{
nRow2 = nTmp;
bHiddenEdge = true;
}
if ( nCol2 - nCol1 > 1 && nRow2 - nRow1 > 1 && !bHiddenEdge )
{
// nur an den Raendern entlang
PaintArea( nCol1, nRow1, nCol2, nRow1, SC_UPDATE_MARKS );
PaintArea( nCol1, nRow1+1, nCol1, nRow2-1, SC_UPDATE_MARKS );
PaintArea( nCol2, nRow1+1, nCol2, nRow2-1, SC_UPDATE_MARKS );
PaintArea( nCol1, nRow2, nCol2, nRow2, SC_UPDATE_MARKS );
}
else // alles am Stueck
PaintArea( nCol1, nRow1, nCol2, nRow2, SC_UPDATE_MARKS );
}
}
void ScTabView::PaintRangeFinder( long nNumber ) void ScTabView::PaintRangeFinder( long nNumber )
{ {
ScInputHandler* pHdl = SC_MOD()->GetInputHdl( aViewData.GetViewShell() ); ScInputHandler* pHdl = SC_MOD()->GetInputHdl( aViewData.GetViewShell() );
...@@ -1950,71 +2011,18 @@ void ScTabView::PaintRangeFinder( long nNumber ) ...@@ -1950,71 +2011,18 @@ void ScTabView::PaintRangeFinder( long nNumber )
{ {
SCTAB nTab = aViewData.GetTabNo(); SCTAB nTab = aViewData.GetTabNo();
sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count(); sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count();
for (sal_uInt16 i=0; i<nCount; i++)
if ( nNumber < 0 || nNumber == i )
{
ScRangeFindData* pData = pRangeFinder->GetObject(i);
if (pData)
{
ScRange aRef = pData->aRef;
aRef.Justify(); // Justify fuer die Abfragen unten
if ( aRef.aStart == aRef.aEnd ) //! Tab ignorieren?
aViewData.GetDocument()->ExtendMerge(aRef);
if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab )
{
SCCOL nCol1 = aRef.aStart.Col();
SCROW nRow1 = aRef.aStart.Row();
SCCOL nCol2 = aRef.aEnd.Col();
SCROW nRow2 = aRef.aEnd.Row();
// wegnehmen -> Repaint
// SC_UPDATE_MARKS: Invalidate, nicht bis zum Zeilenende
bool bHiddenEdge = false;
SCROW nTmp;
ScDocument* pDoc = aViewData.GetDocument();
while ( nCol1 > 0 && pDoc->ColHidden(nCol1, nTab) )
{
--nCol1;
bHiddenEdge = true;
}
while ( nCol2 < MAXCOL && pDoc->ColHidden(nCol2, nTab) )
{
++nCol2;
bHiddenEdge = true;
}
nTmp = pDoc->LastVisibleRow(0, nRow1, nTab);
if (!ValidRow(nTmp))
nTmp = 0;
if (nTmp < nRow1)
{
nRow1 = nTmp;
bHiddenEdge = true;
}
nTmp = pDoc->FirstVisibleRow(nRow2, MAXROW, nTab);
if (!ValidRow(nTmp))
nTmp = MAXROW;
if (nTmp > nRow2)
{
nRow2 = nTmp;
bHiddenEdge = true;
}
if ( nCol2 - nCol1 > 1 && nRow2 - nRow1 > 1 && !bHiddenEdge ) if (nNumber < 0)
{ {
// nur an den Raendern entlang for (sal_uInt16 i=0; i<nCount; i++)
PaintArea( nCol1, nRow1, nCol2, nRow1, SC_UPDATE_MARKS ); PaintRangeFinderEntry(pRangeFinder->GetObject(i),nTab);
PaintArea( nCol1, nRow1+1, nCol1, nRow2-1, SC_UPDATE_MARKS ); }
PaintArea( nCol2, nRow1+1, nCol2, nRow2-1, SC_UPDATE_MARKS ); else
PaintArea( nCol1, nRow2, nCol2, nRow2, SC_UPDATE_MARKS ); {
} sal_uInt16 idx = nNumber;
else // alles am Stueck if (idx < nCount)
PaintArea( nCol1, nRow1, nCol2, nRow2, SC_UPDATE_MARKS ); PaintRangeFinderEntry(pRangeFinder->GetObject(idx),nTab);
} }
}
}
} }
} }
} }
......
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