Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sc/source/ui/inc/colrowba.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public:
virtual void DrawInvert( tools::Long nDragPos ) override;

virtual OUString GetDragHelp( tools::Long nVal ) override;
virtual tools::Long GetScrollPixelOffset() const override;
};

class ScRowBar : public ScHeaderControl
Expand Down Expand Up @@ -84,6 +85,7 @@ public:
virtual void DrawInvert( tools::Long nDragPos ) override;

virtual OUString GetDragHelp( tools::Long nVal ) override;
virtual tools::Long GetScrollPixelOffset() const override;
};

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
3 changes: 3 additions & 0 deletions sc/source/ui/inc/hdrcont.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ protected:
virtual void Command( const CommandEvent& rCEvt ) override;
virtual void dispose() override;

// Sub-cell scroll pixel offset (always <= 0). Overridden by ScRowBar/ScColBar.
virtual tools::Long GetScrollPixelOffset() const { return 0; }

public:
ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelectionEngine,
SCCOLROW nNewSize, bool bNewVertical, ScTabView* pTab );
Expand Down
7 changes: 7 additions & 0 deletions sc/source/ui/inc/tabview.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ private:
tools::Long mnPendingaHScrollLeftDelta = 0;
tools::Long mnPendingaHScrollRightDelta = 0;

// Smooth scrolling: cumulative pan gesture offsets (for delta computation per Update event)
double mfPreviousPanOffsetX = 0.0;
double mfPreviousPanOffsetY = 0.0;

void SmoothScrollX( tools::Long nPixelDelta, ScHSplitPos eWhich );
void SmoothScrollY( tools::Long nPixelDelta, ScVSplitPos eWhich );

void Init();

void DoAddWin( ScGridWindow* pWin );
Expand Down
6 changes: 6 additions & 0 deletions sc/source/ui/inc/viewdata.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ private:
tools::Long nMPosY[2];
tools::Long nPixPosX[2]; // Offset in Pixels
tools::Long nPixPosY[2];
tools::Long nPixOffsetX[2]; // Sub-cell pixel offset for smooth scrolling (<=0)
tools::Long nPixOffsetY[2]; // Sub-cell pixel offset for smooth scrolling (<=0)
tools::Long nHSplitPos;
tools::Long nVSplitPos;

Expand Down Expand Up @@ -462,6 +464,10 @@ public:

void SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX );
void SetPosY( ScVSplitPos eWhich, SCROW nNewPosY );
void SetPixOffsetX( ScHSplitPos eWhich, tools::Long nOffsetPixels );
void SetPixOffsetY( ScVSplitPos eWhich, tools::Long nOffsetPixels );
tools::Long GetPixOffsetX( ScHSplitPos eWhich ) const { return pThisTab->nPixOffsetX[eWhich]; }
tools::Long GetPixOffsetY( ScVSplitPos eWhich ) const { return pThisTab->nPixOffsetY[eWhich]; }
void SetCurX( SCCOL nNewCurX ) { pThisTab->nCurX = nNewCurX; }
void SetCurY( SCROW nNewCurY ) { pThisTab->nCurY = nNewCurY; }
void SetCurXForTab( SCCOL nNewCurX, SCTAB nTabIndex );
Expand Down
10 changes: 10 additions & 0 deletions sc/source/ui/view/colrowba.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,14 @@ SCCOLROW ScRowBar::GetHiddenCount( SCCOLROW nEntryNo ) const // override only fo
return rDoc.GetHiddenRowCount( nEntryNo, nTab );
}

tools::Long ScRowBar::GetScrollPixelOffset() const
{
return pTabView->GetViewData().GetPixOffsetY(meWhich);
}

tools::Long ScColBar::GetScrollPixelOffset() const
{
return pTabView->GetViewData().GetPixOffsetX(meWhich);
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
7 changes: 5 additions & 2 deletions sc/source/ui/view/gridwin4.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@ void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::R
nScrX += ScViewData::ToPixel( rDoc.GetColWidth( nX2, nTab ), nPPTX );
}

tools::Long nScrY = 0;
// Start accumulation from the sub-cell pixel offset so AddPixelsWhile
// correctly identifies which rows cover any given clip rectangle.
// Without this, when nPixOffsetY < 0 the post-loop nScrY is too large,
// the nY2 range check fires too early, and the exposed strip is clipped short.
tools::Long nScrY = mrViewData.GetPixOffsetY(eVWhich);
ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, rDoc.MaxRow(), nPPTY, &rDoc, nTab);
SCROW nY2 = nY1;
if (nScrY <= aPixRect.Bottom() && nY2 < rDoc.MaxRow())
Expand Down Expand Up @@ -509,7 +513,6 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod

tools::Long nScrX = aScrPos.X();
tools::Long nScrY = aScrPos.Y();

SCCOL nCurX = mrViewData.GetCurX();
SCROW nCurY = mrViewData.GetCurY();
SCCOL nCurEndX = nCurX;
Expand Down
4 changes: 2 additions & 2 deletions sc/source/ui/view/hdrcont.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ tools::Long ScHeaderControl::GetScrPos( SCCOLROW nEntryNo ) const
nScrPos = nMax;
else
{
nScrPos = 0;
nScrPos = GetScrollPixelOffset();
for (SCCOLROW i=GetPos(); i<nEntryNo && nScrPos<nMax; i++)
{
sal_uInt16 nAdd = GetEntrySize(i);
Expand Down Expand Up @@ -284,7 +284,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& rRenderContext, const tools::Re
tools::Long nTransStart = nPEnd + 1;
tools::Long nTransEnd = 0;

tools::Long nInitScrPos = 0;
tools::Long nInitScrPos = GetScrollPixelOffset(); // sub-cell offset (0 when no smooth scroll)
if ( bLayoutRTL )
{
std::swap(nPStart, nPEnd);
Expand Down
Loading