[Libreoffice-commits] core.git: Branch 'feature/cib_contract3756' - sfx2/source
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Tue Nov 19 09:15:24 UTC 2019
sfx2/source/dialog/infobar.cxx | 33 +++++++--------------------------
1 file changed, 7 insertions(+), 26 deletions(-)
New commits:
commit 3f58f94dfa64ed8733efebc5bc94e55fd9a55b31
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Nov 18 15:25:11 2019 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Nov 19 10:14:46 2019 +0100
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 at cib.de>
(cherry picked from commit 1562e094fc6a57cd9738109d5202497bcc043d80)
Reviewed-on: https://gerrit.libreoffice.org/83162
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
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));
More information about the Libreoffice-commits
mailing list