sw/source/uibase/uiview/viewport.cxx |   42 ++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 18 deletions(-)

New commits:
commit bd4b494ac8c4a82048d6849650672445c36e1026
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Aug 3 10:19:43 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Aug 3 14:05:48 2022 +0200

    repair writer's scrollbar tooltip feature
    
    where aRect was unused from a missing Help::ShowQuickHelp etc.
    
    probably bad merge of
    
    commit 6005dd5366a86d6b7b1535233a99e24501e053a3
    Date:   Tue Dec 11 03:31:17 2012 +0000
    
        Resolves: #i25945# Allow disabling scrollbar tips by API and 
configuration
    
        (cherry picked from commit a2bbabbe141de1303ebf052e5c22b6e77387785e)
    
    Change-Id: I72d11f1cdf075a5bb67c596406f19403655f86b0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137742
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/uiview/viewport.cxx 
b/sw/source/uibase/uiview/viewport.cxx
index cee3080a755e..f249638bf7f3 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -708,25 +708,31 @@ IMPL_LINK( SwView, ScrollHdl, ScrollBar *, p, void )
                 //QuickHelp:
                 if( m_pWrtShell->GetPageCnt() > 1 )
                 {
-                    tools::Rectangle aRect;
-                    aRect.SetLeft( 
pScrollbar->GetParent()->OutputToScreenPixel(
-                                        pScrollbar->GetPosPixel() ).X() -8 );
-                    aRect.SetTop( pScrollbar->OutputToScreenPixel(
-                                    pScrollbar->GetPointerPosPixel() ).Y() );
-                    aRect.SetRight( aRect.Left() );
-                    aRect.SetBottom( aRect.Top() );
-
-                    OUString sPageStr( GetPageStr( nPhNum, nVirtNum, sDisplay 
));
-                    SwContentAtPos aCnt( IsAttrAtPos::Outline );
-                    bool bSuccess = m_pWrtShell->GetContentAtPos(aPos, aCnt);
-                    if (bSuccess && !aCnt.sStr.isEmpty())
+                    if( !nPgNum || nPgNum != nPhNum )
                     {
-                        sPageStr += "  - ";
-                        sal_Int32 nChunkLen = 
std::min<sal_Int32>(aCnt.sStr.getLength(), 80);
-                        std::u16string_view sChunk = aCnt.sStr.subView(0, 
nChunkLen);
-                        sPageStr = sChunk + sPageStr;
-                        sPageStr = sPageStr.replace('\t', ' ');
-                        sPageStr = sPageStr.replace(0x0a, ' ');
+                        tools::Rectangle aRect;
+                        aRect.SetLeft( 
pScrollbar->GetParent()->OutputToScreenPixel(
+                                            pScrollbar->GetPosPixel() ).X() -8 
);
+                        aRect.SetTop( pScrollbar->OutputToScreenPixel(
+                                        pScrollbar->GetPointerPosPixel() ).Y() 
);
+                        aRect.SetRight( aRect.Left() );
+                        aRect.SetBottom( aRect.Top() );
+
+                        OUString sPageStr( GetPageStr( nPhNum, nVirtNum, 
sDisplay ));
+                        SwContentAtPos aCnt( IsAttrAtPos::Outline );
+                        bool bSuccess = m_pWrtShell->GetContentAtPos(aPos, 
aCnt);
+                        if (bSuccess && !aCnt.sStr.isEmpty())
+                        {
+                            sPageStr += "  - ";
+                            sal_Int32 nChunkLen = 
std::min<sal_Int32>(aCnt.sStr.getLength(), 80);
+                            std::u16string_view sChunk = aCnt.sStr.subView(0, 
nChunkLen);
+                            sPageStr = sChunk + sPageStr;
+                            sPageStr = sPageStr.replace('\t', ' ');
+                            sPageStr = sPageStr.replace(0x0a, ' ');
+                        }
+
+                        Help::ShowQuickHelp( pScrollbar, aRect, sPageStr,
+                                        
QuickHelpFlags::Right|QuickHelpFlags::VCenter);
                     }
                     nPgNum = nPhNum;
                 }

Reply via email to