tdf#119905 Infobar text overlap
Make SfxInfoBarWindow text wrap (WB_WORDBREAK) by default. Make SfxInfoBarContainerWindow stretch to fit its content (the wrapped text) Change-Id: Ib6f68011b4f2a4813dc5e0316281583b9ac641ee Reviewed-on: https://gerrit.libreoffice.org/69482 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
committed by
Samuel Mehrbrodt
parent
bb4fcc3d96
commit
c92bfbf950
@@ -174,7 +174,7 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId,
|
|||||||
m_sId(sId),
|
m_sId(sId),
|
||||||
m_eType(ibType),
|
m_eType(ibType),
|
||||||
m_pImage(VclPtr<FixedImage>::Create(this, nMessageStyle)),
|
m_pImage(VclPtr<FixedImage>::Create(this, nMessageStyle)),
|
||||||
m_pMessage(VclPtr<FixedText>::Create(this, nMessageStyle)),
|
m_pMessage(VclPtr<FixedText>::Create(this, nMessageStyle | WB_WORDBREAK)),
|
||||||
m_pCloseBtn(VclPtr<SfxCloseButton>::Create(this)),
|
m_pCloseBtn(VclPtr<SfxCloseButton>::Create(this)),
|
||||||
m_aActionBtns()
|
m_aActionBtns()
|
||||||
{
|
{
|
||||||
@@ -290,13 +290,23 @@ void SfxInfoBarWindow::Resize()
|
|||||||
nX -= nButtonGap;
|
nX -= nButtonGap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Point aMessagePosition(32 * fScaleFactor + 10 * fScaleFactor, 10 * fScaleFactor);
|
||||||
|
Size aMessageSize(nX - 35 * fScaleFactor, 20 * fScaleFactor);
|
||||||
|
Size aActualSize = m_pMessage->CalcMinimumSize(aMessageSize.getWidth());
|
||||||
|
long aMinimumHeight = m_pMessage->CalcMinimumSize().getHeight();
|
||||||
|
|
||||||
|
long aExtraHeight = aActualSize.getHeight() - aMinimumHeight;
|
||||||
|
|
||||||
|
// The message won't be legible and the window will get too high
|
||||||
|
if (aMessageSize.getWidth() < 30)
|
||||||
|
{
|
||||||
|
aExtraHeight = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pMessage->SetPosSizePixel(aMessagePosition, aActualSize);
|
||||||
m_pImage->SetPosSizePixel(Point(4, 4), Size(32 * fScaleFactor, 32 * fScaleFactor));
|
m_pImage->SetPosSizePixel(Point(4, 4), Size(32 * fScaleFactor, 32 * fScaleFactor));
|
||||||
|
|
||||||
Point aMessagePosition(32 * fScaleFactor + 10 * fScaleFactor, 10 * fScaleFactor);
|
SetPosSizePixel(Point(0, 0), Size(nWidth, INFO_BAR_BASE_HEIGHT * fScaleFactor + aExtraHeight * fScaleFactor));
|
||||||
Size aMessageSize(nX - 20 * fScaleFactor, 20 * fScaleFactor);
|
|
||||||
|
|
||||||
m_pMessage->SetPosSizePixel(aMessagePosition, aMessageSize);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SfxInfoBarWindow::Update( const OUString &sNewMessage, InfoBarType eType )
|
void SfxInfoBarWindow::Update( const OUString &sNewMessage, InfoBarType eType )
|
||||||
@@ -408,6 +418,7 @@ void SfxInfoBarContainerWindow::Resize()
|
|||||||
{
|
{
|
||||||
// Only need to change the width of the infobars
|
// Only need to change the width of the infobars
|
||||||
long nWidth = GetSizePixel().getWidth();
|
long nWidth = GetSizePixel().getWidth();
|
||||||
|
long nHeight = GetSizePixel().getHeight();
|
||||||
|
|
||||||
for (auto& rxInfoBar : m_pInfoBars)
|
for (auto& rxInfoBar : m_pInfoBars)
|
||||||
{
|
{
|
||||||
@@ -415,9 +426,17 @@ void SfxInfoBarContainerWindow::Resize()
|
|||||||
aSize.setWidth(nWidth);
|
aSize.setWidth(nWidth);
|
||||||
rxInfoBar->SetSizePixel(aSize);
|
rxInfoBar->SetSizePixel(aSize);
|
||||||
rxInfoBar->Resize();
|
rxInfoBar->Resize();
|
||||||
|
|
||||||
|
// Stretch to fit the infobar(s)
|
||||||
|
if (aSize.getHeight() > nHeight)
|
||||||
|
{
|
||||||
|
nHeight = aSize.getHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetSizePixel(Size(nWidth, nHeight));
|
||||||
|
}
|
||||||
|
|
||||||
SFX_IMPL_POS_CHILDWINDOW_WITHID(SfxInfoBarContainerChild, SID_INFOBAR, SFX_OBJECTBAR_OBJECT);
|
SFX_IMPL_POS_CHILDWINDOW_WITHID(SfxInfoBarContainerChild, SID_INFOBAR, SFX_OBJECTBAR_OBJECT);
|
||||||
|
|
||||||
SfxInfoBarContainerChild::SfxInfoBarContainerChild( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* ) :
|
SfxInfoBarContainerChild::SfxInfoBarContainerChild( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* ) :
|
||||||
|
Reference in New Issue
Block a user