[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - 2 commits - sfx2/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Sat Nov 23 07:52:14 UTC 2019


 sfx2/source/dialog/infobar.cxx         |   33 +++++++--------------------------
 sfx2/source/view/sfxbasecontroller.cxx |    6 ++++++
 2 files changed, 13 insertions(+), 26 deletions(-)

New commits:
commit e275ef9db490a4dcb7d8bfbe8f3a06c7ff2ee1b1
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Nov 18 15:25:11 2019 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Sat Nov 23 08:51:35 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/83505
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

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));
commit 5d7be7fdbd1f94b2056f8b4adc7722addb9e7fc9
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Nov 20 07:49:23 2019 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Sat Nov 23 08:51:13 2019 +0100

    Add SolarMutexGuard to infobar api methods
    
    Change-Id: If7fab7df7566b1db770437090115b064b98257c6
    Reviewed-on: https://gerrit.libreoffice.org/83255
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 9c9c047f42637c274b246fb4020ed0df4ee39ded)
    Reviewed-on: https://gerrit.libreoffice.org/83506
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index f4cf6768a8b3..22ec268c9518 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1477,6 +1477,8 @@ void SAL_CALL SfxBaseController::appendInfobar(const OUString& sId, const OUStri
                                                const Sequence<StringPair>& actionButtons,
                                                sal_Bool bShowCloseButton)
 {
+    SolarMutexGuard aGuard;
+
     if (aInfobarType < static_cast<sal_Int32>(InfobarType::INFO)
         || aInfobarType > static_cast<sal_Int32>(InfobarType::DANGER))
         throw lang::IllegalArgumentException("Undefined InfobarType: "
@@ -1510,6 +1512,8 @@ void SAL_CALL SfxBaseController::updateInfobar(const OUString& sId, const OUStri
                                                const OUString& sSecondaryMessage,
                                                sal_Int32 aInfobarType)
 {
+    SolarMutexGuard aGuard;
+
     if (aInfobarType < static_cast<sal_Int32>(InfobarType::INFO)
         || aInfobarType > static_cast<sal_Int32>(InfobarType::DANGER))
         throw lang::IllegalArgumentException("Undefined InfobarType: "
@@ -1525,6 +1529,8 @@ void SAL_CALL SfxBaseController::updateInfobar(const OUString& sId, const OUStri
 
 void SAL_CALL SfxBaseController::removeInfobar(const OUString& sId)
 {
+    SolarMutexGuard aGuard;
+
     SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame();
     if (!pViewFrame->HasInfoBarWithID(sId))
         throw css::container::NoSuchElementException("Infobar with ID '" + sId + "' not found.");


More information about the Libreoffice-commits mailing list