Kaydet (Commit) 912ecaf5 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#55546 center ellipsis tooltips that don't fit on screen

Change-Id: Ic44c9032878892fa33c839e5aaac1996e7bed943
üst fcf953b8
......@@ -94,6 +94,17 @@ static OUString lcl_GetRedlineHelp( const SwRangeRedline& rRedl, bool bBalloon )
return sBuf.makeStringAndClear();
}
OUString SwEditWin::ClipLongToolTip(const OUString& rTxt)
{
OUString sDisplayTxt(rTxt);
long nTextWidth = GetTextWidth(sDisplayTxt);
long nMaxWidth = GetDesktopRectPixel().GetWidth() * 2 / 3;
nMaxWidth = PixelToLogic(Size(nMaxWidth, 0)).Width();
if (nTextWidth > nMaxWidth)
sDisplayTxt = GetEllipsisString(sDisplayTxt, nMaxWidth, TEXT_DRAW_CENTERELLIPSIS);
return sDisplayTxt;
}
void SwEditWin::RequestHelp(const HelpEvent &rEvt)
{
SwWrtShell &rSh = m_rView.GetWrtShell();
......@@ -369,7 +380,8 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
aPt = OutputToScreenPixel( LogicToPixel( aRect.BottomRight() ));
aRect.Right() = aPt.X();
aRect.Bottom() = aPt.Y();
Help::ShowQuickHelp( this, aRect, sTxt, nStyle );
OUString sDisplayTxt(ClipLongToolTip(sTxt));
Help::ShowQuickHelp(this, aRect, sDisplayTxt, nStyle);
}
}
......@@ -410,7 +422,8 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
sTxt = SW_RESSTR(nTabRes);
Size aTxtSize( GetTextWidth(sTxt), GetTextHeight());
Rectangle aRect(rEvt.GetMousePosPixel(), aTxtSize);
Help::ShowQuickHelp(this, aRect, sTxt);
OUString sDisplayTxt(ClipLongToolTip(sTxt));
Help::ShowQuickHelp(this, aRect, sDisplayTxt);
}
bContinue = false;
}
......
......@@ -286,6 +286,11 @@ public:
void SetUseInputLanguage( bool bNew );
bool IsUseInputLanguage() const { return m_bUseInputLanguage; }
/** fdo#55546 cut very long tooltips to 2/3 of the width of the screen
via center ellipsis
*/
OUString ClipLongToolTip(const OUString& rTxt);
SwFrameControlsManager& GetFrameControlsManager() { return m_aFrameControlsManager; }
SwEditWin(vcl::Window *pParent, SwView &);
......
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