sfx2/source/dialog/infobar.cxx |   33 +++++++--------------------------
 1 file changed, 7 insertions(+), 26 deletions(-)

New commits:
commit 3f58f94dfa64ed8733efebc5bc94e55fd9a55b31
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Mon Nov 18 15:25:11 2019 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@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.mehrbr...@cib.de>
    (cherry picked from commit 1562e094fc6a57cd9738109d5202497bcc043d80)
    Reviewed-on: https://gerrit.libreoffice.org/83162
    Tested-by: Samuel Mehrbrodt <samuel.mehrbr...@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));
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to