diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-13 13:20:20 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-14 21:31:31 +0900 |
commit | 274f497b2502db146f23eb72426ad38a70934540 (patch) | |
tree | 9853420d87e67cc26a315cfc9ae58b6a2040a098 /sfx2 | |
parent | efd013f6fc9ff5e1cb13c23c60a7e4644c2d99de (diff) |
Cleanup infobar
Change-Id: I2479b8df69da3c05021a82d269925a6374709c72
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/infobar.cxx | 133 |
1 files changed, 66 insertions, 67 deletions
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index dc8a51b50079..a2b2cd7c6f8c 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -48,12 +48,12 @@ namespace const unique_ptr<BaseProcessor2D> pProcessor( createBaseProcessor2DFromOutputDevice(*this, aNewViewInfos)); - const Rectangle aRect( Rectangle( Point( 0, 0 ), PixelToLogic( GetSizePixel() ) ) ); + const Rectangle aRect(Point(0, 0), PixelToLogic(GetSizePixel())); - Primitive2DSequence aSeq( 2 ); + Primitive2DSequence aSeq(2); - basegfx::BColor aLightColor( 1.0, 1.0, 191.0 / 255.0 ); - basegfx::BColor aDarkColor( 217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0 ); + basegfx::BColor aLightColor(1.0, 1.0, 191.0 / 255.0); + basegfx::BColor aDarkColor(217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0); const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); if ( rSettings.GetHighContrastMode() ) @@ -98,22 +98,21 @@ namespace SfxInfoBarWindow::SfxInfoBarWindow( vcl::Window* pParent, const OUString& sId, const OUString& sMessage, vector<PushButton*> aButtons ) : - Window( pParent, 0 ), - m_sId( sId ), + Window(pParent, 0), + m_sId(sId), m_pMessage(new FixedText(this, 0)), m_pCloseBtn(new SfxCloseButton(this)), m_aActionBtns() { long nWidth = pParent->GetSizePixel().getWidth(); - SetPosSizePixel( Point( 0, 0 ), Size( nWidth, 40 ) ); + SetPosSizePixel(Point(0, 0), Size(nWidth, 40)); - m_pMessage->SetText( sMessage ); - m_pMessage->SetBackground( Wallpaper( Color( 255, 255, 191 ) ) ); - m_pMessage->Show( ); + m_pMessage->SetText(sMessage); + m_pMessage->SetBackground(Wallpaper(Color(255, 255, 191))); + m_pMessage->Show(); - m_pCloseBtn->SetPosSizePixel( Point( nWidth - 25, 15 ), Size( 10, 10 ) ); - m_pCloseBtn->SetClickHdl( LINK( this, SfxInfoBarWindow, CloseHandler ) ); - m_pCloseBtn->Show( ); + m_pCloseBtn->SetClickHdl(LINK(this, SfxInfoBarWindow, CloseHandler)); + m_pCloseBtn->Show(); // Reparent the buttons and place them on the right of the bar vector<PushButton*>::iterator it; @@ -128,31 +127,31 @@ SfxInfoBarWindow::SfxInfoBarWindow( vcl::Window* pParent, const OUString& sId, Resize(); } -SfxInfoBarWindow::~SfxInfoBarWindow( ) +SfxInfoBarWindow::~SfxInfoBarWindow() {} -void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect ) +void SfxInfoBarWindow::Paint(const Rectangle& rPaintRect) { const ViewInformation2D aNewViewInfos; const unique_ptr<BaseProcessor2D> pProcessor( createBaseProcessor2DFromOutputDevice(*this, aNewViewInfos)); - const Rectangle aRect( Rectangle( Point( 0, 0 ), PixelToLogic( GetSizePixel() ) ) ); + const Rectangle aRect(Point(0, 0), PixelToLogic(GetSizePixel())); - Primitive2DSequence aSeq( 2 ); + Primitive2DSequence aSeq(2); - basegfx::BColor aLightColor( 1.0, 1.0, 191.0 / 255.0 ); - basegfx::BColor aDarkColor( 217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0 ); + basegfx::BColor aLightColor(1.0, 1.0, 191.0 / 255.0); + basegfx::BColor aDarkColor(217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0); const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - if ( rSettings.GetHighContrastMode() ) + if (rSettings.GetHighContrastMode()) { - aLightColor = rSettings.GetLightColor( ).getBColor( ); - aDarkColor = rSettings.GetDialogTextColor( ).getBColor( ); + aLightColor = rSettings.GetLightColor().getBColor(); + aDarkColor = rSettings.GetDialogTextColor().getBColor(); } // Update the label background color - m_pMessage->SetBackground( Wallpaper( Color( aLightColor ) ) ); + m_pMessage->SetBackground(Wallpaper(Color(aLightColor))); // Light background basegfx::B2DPolygon aPolygon; @@ -160,7 +159,7 @@ void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect ) aPolygon.append( basegfx::B2DPoint( aRect.Right( ), aRect.Top( ) ) ); aPolygon.append( basegfx::B2DPoint( aRect.Right( ), aRect.Bottom( ) ) ); aPolygon.append( basegfx::B2DPoint( aRect.Left( ), aRect.Bottom( ) ) ); - aPolygon.setClosed( true ); + aPolygon.setClosed(true); PolyPolygonColorPrimitive2D* pBack = new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aLightColor); @@ -178,63 +177,63 @@ void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect ) aSeq[1] = pLineBottom; - pProcessor->process( aSeq ); + pProcessor->process(aSeq); - Window::Paint( rPaintRect ); + Window::Paint(rPaintRect); } void SfxInfoBarWindow::Resize() { long nWidth = GetSizePixel().getWidth(); - m_pCloseBtn->SetPosSizePixel( Point( nWidth - 25, 15 ), Size( 10, 10 ) ); + m_pCloseBtn->SetPosSizePixel(Point( nWidth - 25, 15), Size(10, 10)); // Reparent the buttons and place them on the right of the bar - long nX = m_pCloseBtn->GetPosPixel( ).getX( ) - 15; + long nX = m_pCloseBtn->GetPosPixel().getX() - 15; long nBtnGap = 5; boost::ptr_vector<PushButton>::iterator it; for (it = m_aActionBtns.begin(); it != m_aActionBtns.end(); ++it) { - long nBtnWidth = it->GetSizePixel( ).getWidth(); + long nBtnWidth = it->GetSizePixel().getWidth(); nX -= nBtnWidth; - it->SetPosSizePixel( Point( nX, 5 ), Size( nBtnWidth, 30 ) ); + it->SetPosSizePixel(Point(nX, 5), Size(nBtnWidth, 30)); nX -= nBtnGap; } - m_pMessage->SetPosSizePixel( Point( 10, 10 ), Size( nX - 20, 20 ) ); + m_pMessage->SetPosSizePixel(Point(10, 10), Size(nX - 20, 20)); } -IMPL_LINK_NOARG( SfxInfoBarWindow, CloseHandler ) +IMPL_LINK_NOARG(SfxInfoBarWindow, CloseHandler) { - static_cast<SfxInfoBarContainerWindow*>(GetParent())->removeInfoBar( this ); + static_cast<SfxInfoBarContainerWindow*>(GetParent())->removeInfoBar(this); return 0; } -SfxInfoBarContainerWindow::SfxInfoBarContainerWindow( SfxInfoBarContainerChild* pChildWin ) : - Window( pChildWin->GetParent( ), 0 ), - m_pChildWin( pChildWin ), +SfxInfoBarContainerWindow::SfxInfoBarContainerWindow(SfxInfoBarContainerChild* pChildWin ) : + Window(pChildWin->GetParent(), 0), + m_pChildWin(pChildWin), m_pInfoBars() { } -SfxInfoBarContainerWindow::~SfxInfoBarContainerWindow( ) +SfxInfoBarContainerWindow::~SfxInfoBarContainerWindow() { } -void SfxInfoBarContainerWindow::appendInfoBar( const OUString& sId, const OUString& sMessage, vector< PushButton* > aButtons ) +void SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, const OUString& sMessage, vector<PushButton*> aButtons) { Size aSize = GetSizePixel( ); - SfxInfoBarWindow* pInfoBar = new SfxInfoBarWindow( this, sId, sMessage, aButtons ); - pInfoBar->SetPosPixel( Point( 0, aSize.getHeight( ) ) ); - pInfoBar->Show( ); - m_pInfoBars.push_back( pInfoBar ); + SfxInfoBarWindow* pInfoBar = new SfxInfoBarWindow(this, sId, sMessage, aButtons); + 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 ); + long nHeight = pInfoBar->GetSizePixel().getHeight(); + aSize.setHeight(aSize.getHeight() + nHeight); + SetSizePixel(aSize); } -SfxInfoBarWindow* SfxInfoBarContainerWindow::getInfoBar( const OUString& sId ) +SfxInfoBarWindow* SfxInfoBarContainerWindow::getInfoBar(const OUString& sId) { boost::ptr_vector<SfxInfoBarWindow>::iterator it; for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it) @@ -245,7 +244,7 @@ SfxInfoBarWindow* SfxInfoBarContainerWindow::getInfoBar( const OUString& sId ) return NULL; } -void SfxInfoBarContainerWindow::removeInfoBar( SfxInfoBarWindow* pInfoBar ) +void SfxInfoBarContainerWindow::removeInfoBar(SfxInfoBarWindow* pInfoBar) { boost::ptr_vector<SfxInfoBarWindow>::iterator it; for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it) @@ -265,56 +264,56 @@ void SfxInfoBarContainerWindow::removeInfoBar( SfxInfoBarWindow* pInfoBar ) } Size aSize = GetSizePixel( ); - aSize.setHeight( nY ); - SetSizePixel( aSize ); + aSize.setHeight(nY); + SetSizePixel(aSize); - m_pChildWin->Update( ); + m_pChildWin->Update(); } -void SfxInfoBarContainerWindow::Resize( ) +void SfxInfoBarContainerWindow::Resize() { // Only need to change the width of the infobars - long nWidth = GetSizePixel( ).getWidth( ); + long nWidth = GetSizePixel().getWidth(); boost::ptr_vector<SfxInfoBarWindow>::iterator it; for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it) { - Size aSize = it->GetSizePixel( ); - aSize.setWidth( nWidth ); - it->SetSizePixel( aSize ); - it->Resize( ); + Size aSize = it->GetSizePixel(); + aSize.setWidth(nWidth); + it->SetSizePixel(aSize); + it->Resize(); } } -SFX_IMPL_POS_CHILDWINDOW_WITHID( SfxInfoBarContainerChild, SID_INFOBAR, SFX_OBJECTBAR_OBJECT ); +SFX_IMPL_POS_CHILDWINDOW_WITHID(SfxInfoBarContainerChild, SID_INFOBAR, SFX_OBJECTBAR_OBJECT); SfxInfoBarContainerChild::SfxInfoBarContainerChild( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* ) : - SfxChildWindow( _pParent, nId ), - m_pBindings( pBindings ) + SfxChildWindow(_pParent, nId), + m_pBindings(pBindings) { - pWindow = new SfxInfoBarContainerWindow( this ); - pWindow->SetPosSizePixel( Point( 0, 0 ), Size( _pParent->GetSizePixel( ).getWidth(), 0 ) ); - pWindow->Show( ); + pWindow = new SfxInfoBarContainerWindow(this); + pWindow->SetPosSizePixel(Point(0, 0), Size(_pParent->GetSizePixel().getWidth(), 0)); + pWindow->Show(); eChildAlignment = SFX_ALIGN_LOWESTTOP; } -SfxInfoBarContainerChild::~SfxInfoBarContainerChild( ) +SfxInfoBarContainerChild::~SfxInfoBarContainerChild() { } -SfxChildWinInfo SfxInfoBarContainerChild::GetInfo( ) const +SfxChildWinInfo SfxInfoBarContainerChild::GetInfo() const { SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); return aInfo; } -void SfxInfoBarContainerChild::Update( ) +void SfxInfoBarContainerChild::Update() { // Refresh the frame to take the infobars container height change into account const sal_uInt16 nId = GetChildWindowId(); - SfxViewFrame* pVFrame = m_pBindings->GetDispatcher( )->GetFrame( ); - pVFrame->ShowChildWindow( nId ); + SfxViewFrame* pVFrame = m_pBindings->GetDispatcher()->GetFrame(); + pVFrame->ShowChildWindow(nId); // Give the focus to the document view pVFrame->GetWindow().GrabFocusToDocument(); |