summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-11-18 15:25:11 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-11-19 09:51:22 +0100
commit1562e094fc6a57cd9738109d5202497bcc043d80 (patch)
tree4886e10e140d0ef822ae20f570fa2fbad40d9697 /sfx2/source
parent7c4b5c46dd1679d93a21f015e5a09f3428eb3d2c (diff)
tdf#125359 Don't overlap multiple infobars
Change-Id: Ieda7dce84daec2e94501c69584f3df21d63d60bb Reviewed-on: https://gerrit.libreoffice.org/83101 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/dialog/infobar.cxx33
1 files changed, 7 insertions, 26 deletions
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index ea99fc6b67d3..8dd52ed32a92 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -339,7 +339,7 @@ void SfxInfoBarWindow::Resize()
m_pSecondaryMessage->SetPosSizePixel(aSecondaryMessagePosition, aSecondaryTextSize);
m_pImage->SetPosSizePixel(Point(4, 4), Size(32 * fScaleFactor, 32 * fScaleFactor));
- SetPosSizePixel(Point(0, 0), Size(nWidth, INFO_BAR_BASE_HEIGHT * fScaleFactor + aExtraHeight * fScaleFactor));
+ SetPosSizePixel(GetPosPixel(), Size(nWidth, INFO_BAR_BASE_HEIGHT * fScaleFactor + aExtraHeight * fScaleFactor));
}
void SfxInfoBarWindow::Update( const OUString& sPrimaryMessage, const OUString& sSecondaryMessage, InfobarType eType )
@@ -387,8 +387,6 @@ SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, const OUString& sP
const OUString& sSecondaryMessage, InfobarType ibType,
WinBits nMessageStyle, bool bShowCloseButton)
{
- Size aSize = GetSizePixel();
-
auto pInfoBar = VclPtr<SfxInfoBarWindow>::Create(this, sId, sPrimaryMessage, sSecondaryMessage,
ibType, nMessageStyle, bShowCloseButton);
@@ -398,14 +396,9 @@ SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, const OUString& sP
GetInfoBarColors(ibType,aBackgroundColor,aForegroundColor,aMessageColor);
pInfoBar->m_aBackgroundColor = aBackgroundColor;
pInfoBar->m_aForegroundColor = aForegroundColor;
-
- pInfoBar->SetPosPixel(Point(0, aSize.getHeight()));
- pInfoBar->Show();
m_pInfoBars.push_back(pInfoBar);
- long nHeight = pInfoBar->GetSizePixel().getHeight();
- aSize.setHeight(aSize.getHeight() + nHeight);
- SetSizePixel(aSize);
+ Resize();
return pInfoBar;
}
@@ -434,24 +427,13 @@ void SfxInfoBarContainerWindow::removeInfoBar(VclPtr<SfxInfoBarWindow> const & p
m_pInfoBars.erase(it);
}
- // Resize
- long nY = 0;
- for (auto const& infoBar : m_pInfoBars)
- {
- infoBar->SetPosPixel(Point(0, nY));
- nY += infoBar->GetSizePixel().getHeight();
- }
-
- Size aSize = GetSizePixel();
- aSize.setHeight(nY);
- SetSizePixel(aSize);
+ Resize();
m_pChildWin->Update();
}
void SfxInfoBarContainerWindow::Resize()
{
- // Only need to change the width of the infobars
long nWidth = GetSizePixel().getWidth();
long nHeight = 0;
@@ -459,14 +441,13 @@ void SfxInfoBarContainerWindow::Resize()
{
Size aSize = rxInfoBar->GetSizePixel();
aSize.setWidth(nWidth);
- rxInfoBar->SetSizePixel(aSize);
+ Point aPos(0, nHeight);
+ rxInfoBar->SetPosSizePixel(aPos, aSize);
rxInfoBar->Resize();
+ rxInfoBar->Show();
// Stretch to fit the infobar(s)
- if (aSize.getHeight() > nHeight)
- {
- nHeight = aSize.getHeight();
- }
+ nHeight += aSize.getHeight();
}
SetSizePixel(Size(nWidth, nHeight));