tdf#132441 thumb scrolling in Start Center should be more accuracy

Change-Id: Iffee86c0046f5ec6dae0b0287ce098f9d821acaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92779
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Roman Kuznetsov <antilibreoffice@gmail.com>
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 61a7d8f..996acea 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -263,7 +263,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
    float nScrollRatio;
    if( bScrollBarUsed && mpScrBar )
        nScrollRatio = static_cast<float>(mpScrBar->GetThumbPos()) /
                        static_cast<float>(mpScrBar->GetRangeMax()-2);
                        static_cast<float>(mpScrBar->GetRangeMax() - mpScrBar->GetVisibleSize());
    else
        nScrollRatio = 0;

@@ -296,11 +296,10 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)

    mbHasVisibleItems = true;

    long nFullSteps = (mnLines > mnVisLines) ? mnLines - mnVisLines + 1 : 1;

    long nItemHeightOffset = mnItemHeight + nVItemSpace;
    long nHiddenLines = (static_cast<long>(
        ( mnLines - 1 ) * nItemHeightOffset * nScrollRatio ) -
        nVItemSpace ) /
        nItemHeightOffset;
    long nHiddenLines = static_cast<long>((nFullSteps - 1) * nScrollRatio);

    // calculate offsets
    long nStartX = nHItemSpace;
@@ -308,8 +307,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)

    // calculate and draw items
    long x = nStartX;
    long y = nStartY - ( mnLines - 1 ) * nItemHeightOffset * nScrollRatio +
        nHiddenLines * nItemHeightOffset;
    long y = nStartY - ((nFullSteps - 1) * nScrollRatio - nHiddenLines) * nItemHeightOffset;

    // draw items
    // Unless we are scrolling (via scrollbar) we just use the precalculated
@@ -387,8 +385,8 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
        Size aSize( nScrBarWidth, aWinSize.Height() );

        mpScrBar->SetPosSizePixel( aPos, aSize );
        mpScrBar->SetRangeMax( (nCurCount+mnCols-1)*gnFineness/mnCols);
        mpScrBar->SetVisibleSize( mnVisLines );
        mpScrBar->SetRangeMax(mnLines * gnFineness);
        mpScrBar->SetVisibleSize(mnVisLines * gnFineness);
        if (!bScrollBarUsed)
            mpScrBar->SetThumbPos( static_cast<long>(mnFirstLine)*gnFineness );
        long nPageSize = mnVisLines;