summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-08-03 10:19:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-08-03 14:05:48 +0200
commitbd4b494ac8c4a82048d6849650672445c36e1026 (patch)
treedb87c77a5352896f075c9d0662b7a2d31700151c /sw
parente010a57ab2489464719fb73ad0aea6e4e4c60383 (diff)
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 <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/uiview/viewport.cxx42
1 files changed, 24 insertions, 18 deletions
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;
}