From 9da5675de3ca8a047bf45fd601522a6337efb78e Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 17 Feb 2016 15:08:48 +0100 Subject: sfx2 infobar: allow setting the message color Change-Id: I32bb73dfd8ecb78bb2eb9907b0c008e84fd2233a --- include/sfx2/infobar.hxx | 9 +++++++-- include/sfx2/viewfrm.hxx | 6 +++++- sfx2/source/dialog/infobar.cxx | 13 ++++++++++--- sfx2/source/view/viewfrm.cxx | 8 ++++++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx index 483c0f8750ca..8d0fcbce97fc 100644 --- a/include/sfx2/infobar.hxx +++ b/include/sfx2/infobar.hxx @@ -53,7 +53,8 @@ class SfxInfoBarWindow : public vcl::Window SfxInfoBarWindow( vcl::Window* parent, const OUString& sId, const OUString& sMessage, const basegfx::BColor* pBackgroundColor, - const basegfx::BColor* pForegroundColor ); + const basegfx::BColor* pForegroundColor, + const basegfx::BColor* pMessageColor ); virtual ~SfxInfoBarWindow( ); virtual void dispose() override; @@ -82,7 +83,11 @@ class SfxInfoBarContainerWindow : public vcl::Window virtual ~SfxInfoBarContainerWindow( ); virtual void dispose() override; - SfxInfoBarWindow* appendInfoBar(const OUString& sId, const OUString& sMessage, const basegfx::BColor* pBackgroundColor, const basegfx::BColor* pForegroundColor); + SfxInfoBarWindow* appendInfoBar(const OUString& sId, + const OUString& sMessage, + const basegfx::BColor* pBackgroundColor, + const basegfx::BColor* pForegroundColor, + const basegfx::BColor* pMessageColor); SfxInfoBarWindow* getInfoBar(const OUString& sId); void removeInfoBar(SfxInfoBarWindow* pInfoBar); diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index e960aec5b783..0c11c0c1f8f1 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -180,7 +180,11 @@ public: The buttons will be added from Right to Left at the right of the info bar. The parent, size and position of each button will be changed: only the width will remain unchanged. */ - SfxInfoBarWindow* AppendInfoBar(const OUString& sId, const OUString& sMessage, const basegfx::BColor* pBackgroundColor = nullptr, const basegfx::BColor* pForegroundColor = nullptr); + SfxInfoBarWindow* AppendInfoBar(const OUString& sId, + const OUString& sMessage, + const basegfx::BColor* pBackgroundColor = nullptr, + const basegfx::BColor* pForegroundColor = nullptr, + const basegfx::BColor* pMessageColor = nullptr); void RemoveInfoBar(const OUString& sId); SAL_DLLPRIVATE void SetDowning_Impl(); diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index f34f23cfcfa5..b108d3bb1444 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -131,7 +131,8 @@ void SfxCloseButton::setForegroundColor(const basegfx::BColor& rColor) SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId, const OUString& sMessage, const basegfx::BColor* pBackgroundColor, - const basegfx::BColor* pForegroundColor ) : + const basegfx::BColor* pForegroundColor, + const basegfx::BColor* pMessageColor ) : Window(pParent, 0), m_sId(sId), m_pMessage(VclPtr::Create(this, 0)), @@ -149,6 +150,8 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId, m_aForegroundColor = *pForegroundColor; static_cast(m_pCloseBtn.get())->setForegroundColor(m_aForegroundColor); } + if (pMessageColor) + m_pMessage->SetControlForeground(Color(*pMessageColor)); sal_Int32 nScaleFactor = GetDPIScaleFactor(); long nWidth = pParent->GetSizePixel().getWidth(); @@ -277,11 +280,15 @@ void SfxInfoBarContainerWindow::dispose() Window::dispose(); } -SfxInfoBarWindow* SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, const OUString& sMessage, const basegfx::BColor* pBackgroundColor, const basegfx::BColor* pForegroundColor) +SfxInfoBarWindow* SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, + const OUString& sMessage, + const basegfx::BColor* pBackgroundColor, + const basegfx::BColor* pForegroundColor, + const basegfx::BColor* pMessageColor) { Size aSize = GetSizePixel(); - VclPtrInstance pInfoBar(this, sId, sMessage, pBackgroundColor, pForegroundColor); + VclPtrInstance pInfoBar(this, sId, sMessage, pBackgroundColor, pForegroundColor, pMessageColor); pInfoBar->SetPosPixel(Point(0, aSize.getHeight())); pInfoBar->Show(); m_pInfoBars.push_back(pInfoBar); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 068bbcd891bb..65b8b0cc9fd1 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3191,7 +3191,11 @@ void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) SfxGetpApp()->SetViewFrame_Impl( pFrame ); } -SfxInfoBarWindow* SfxViewFrame::AppendInfoBar( const OUString& sId, const OUString& sMessage, const basegfx::BColor* pBackgroundColor, const basegfx::BColor* pForegroundColor ) +SfxInfoBarWindow* SfxViewFrame::AppendInfoBar( const OUString& sId, + const OUString& sMessage, + const basegfx::BColor* pBackgroundColor, + const basegfx::BColor* pForegroundColor, + const basegfx::BColor* pMessageColor ) { const sal_uInt16 nId = SfxInfoBarContainerChild::GetChildWindowId(); @@ -3203,7 +3207,7 @@ SfxInfoBarWindow* SfxViewFrame::AppendInfoBar( const OUString& sId, const OUStri if (pChild) { SfxInfoBarContainerWindow* pInfoBarContainer = static_cast(pChild->GetWindow()); - SfxInfoBarWindow* pInfoBar = pInfoBarContainer->appendInfoBar(sId, sMessage, pBackgroundColor, pForegroundColor); + SfxInfoBarWindow* pInfoBar = pInfoBarContainer->appendInfoBar(sId, sMessage, pBackgroundColor, pForegroundColor, pMessageColor); ShowChildWindow(nId); return pInfoBar; } -- cgit