Kaydet (Commit) 6eb05dff authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS onlineupdate6b (1.13.6); FILE MERGED

2007/12/12 12:48:20 dv 1.13.6.1: #152451# Tried to make the code more bullet proof
üst cc24b5b0
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: updatecheckui.cxx,v $ * $RCSfile: updatecheckui.cxx,v $
* *
* $Revision: 1.14 $ * $Revision: 1.15 $
* *
* last change: $Author: ihi $ $Date: 2008-01-14 15:05:57 $ * last change: $Author: vg $ $Date: 2008-01-28 15:31:41 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -188,7 +188,7 @@ private: ...@@ -188,7 +188,7 @@ private:
BubbleWindow* GetBubbleWindow(); BubbleWindow* GetBubbleWindow();
void RemoveBubbleWindow( bool bRemoveIcon ); void RemoveBubbleWindow( bool bRemoveIcon );
Image GetMenuBarIcon( MenuBar* pMBar ); Image GetMenuBarIcon( MenuBar* pMBar );
void AddMenuBarIcon( SystemWindow* pSysWin ); void AddMenuBarIcon( SystemWindow* pSysWin, bool bAddEventHdl );
Image GetBubbleImage( ::rtl::OUString &rURL ); Image GetBubbleImage( ::rtl::OUString &rURL );
uno::Reference< document::XEventBroadcaster > getGlobalEventBroadcaster() const uno::Reference< document::XEventBroadcaster > getGlobalEventBroadcaster() const
...@@ -393,7 +393,7 @@ Image UpdateCheckUI::GetBubbleImage( ::rtl::OUString &rURL ) ...@@ -393,7 +393,7 @@ Image UpdateCheckUI::GetBubbleImage( ::rtl::OUString &rURL )
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UpdateCheckUI::AddMenuBarIcon( SystemWindow *pSysWin ) void UpdateCheckUI::AddMenuBarIcon( SystemWindow *pSysWin, bool bAddEventHdl )
{ {
if ( ! mbShowMenuIcon ) if ( ! mbShowMenuIcon )
return; return;
...@@ -403,6 +403,9 @@ void UpdateCheckUI::AddMenuBarIcon( SystemWindow *pSysWin ) ...@@ -403,6 +403,9 @@ void UpdateCheckUI::AddMenuBarIcon( SystemWindow *pSysWin )
MenuBar *pActiveMBar = pSysWin->GetMenuBar(); MenuBar *pActiveMBar = pSysWin->GetMenuBar();
if ( ( pSysWin != mpIconSysWin ) || ( pActiveMBar != mpIconMBar ) ) if ( ( pSysWin != mpIconSysWin ) || ( pActiveMBar != mpIconMBar ) )
{ {
if ( bAddEventHdl && mpIconSysWin )
mpIconSysWin->RemoveEventListener( maWindowEventHdl );
RemoveBubbleWindow( true ); RemoveBubbleWindow( true );
if ( pActiveMBar ) if ( pActiveMBar )
...@@ -415,7 +418,8 @@ void UpdateCheckUI::AddMenuBarIcon( SystemWindow *pSysWin ) ...@@ -415,7 +418,8 @@ void UpdateCheckUI::AddMenuBarIcon( SystemWindow *pSysWin )
} }
mpIconMBar = pActiveMBar; mpIconMBar = pActiveMBar;
mpIconSysWin = pSysWin; mpIconSysWin = pSysWin;
mpIconSysWin->AddEventListener( maWindowEventHdl ); if ( bAddEventHdl && mpIconSysWin )
mpIconSysWin->AddEventListener( maWindowEventHdl );
} }
if ( mbShowBubble && pActiveMBar ) if ( mbShowBubble && pActiveMBar )
...@@ -627,15 +631,21 @@ void UpdateCheckUI::RemoveBubbleWindow( bool bRemoveIcon ) ...@@ -627,15 +631,21 @@ void UpdateCheckUI::RemoveBubbleWindow( bool bRemoveIcon )
if ( bRemoveIcon ) if ( bRemoveIcon )
{ {
if ( mpIconSysWin && mpIconMBar && try {
( mpIconSysWin->GetMenuBar() == mpIconMBar ) ) if ( mpIconSysWin && mpIconMBar &&
{ ( mpIconSysWin->GetMenuBar() == mpIconMBar ) )
mpIconMBar->RemoveMenuBarButton( mnIconID ); {
mpIconMBar->RemoveMenuBarButton( mnIconID );
mpIconSysWin = NULL; mpIconMBar = NULL;
mnIconID = 0;
}
}
catch ( ... ) {
mpIconMBar = NULL; mpIconMBar = NULL;
mnIconID = 0; mnIconID = 0;
} }
mpIconSysWin = NULL;
} }
} }
...@@ -715,7 +725,7 @@ IMPL_LINK( UpdateCheckUI, UserEventHdl, UpdateCheckUI*, EMPTYARG ) ...@@ -715,7 +725,7 @@ IMPL_LINK( UpdateCheckUI, UserEventHdl, UpdateCheckUI*, EMPTYARG )
} }
if ( pActiveSysWin ) if ( pActiveSysWin )
AddMenuBarIcon( pActiveSysWin ); AddMenuBarIcon( pActiveSysWin, true );
return 0; return 0;
} }
...@@ -729,7 +739,10 @@ IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent ) ...@@ -729,7 +739,10 @@ IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent )
{ {
vos::OGuard aGuard( Application::GetSolarMutex() ); vos::OGuard aGuard( Application::GetSolarMutex() );
if ( mpIconSysWin == pEvent->GetWindow() ) if ( mpIconSysWin == pEvent->GetWindow() )
{
mpIconSysWin->RemoveEventListener( maWindowEventHdl );
RemoveBubbleWindow( true ); RemoveBubbleWindow( true );
}
} }
else if ( VCLEVENT_WINDOW_MENUBARADDED == nEventID ) else if ( VCLEVENT_WINDOW_MENUBARADDED == nEventID )
{ {
...@@ -740,10 +753,17 @@ IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent ) ...@@ -740,10 +753,17 @@ IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent )
SystemWindow *pSysWin = pWindow->GetSystemWindow(); SystemWindow *pSysWin = pWindow->GetSystemWindow();
if ( pSysWin ) if ( pSysWin )
{ {
AddMenuBarIcon( pSysWin ); AddMenuBarIcon( pSysWin, false );
} }
} }
} }
else if ( VCLEVENT_WINDOW_MENUBARREMOVED == nEventID )
{
vos::OGuard aGuard( Application::GetSolarMutex() );
MenuBar *pMBar = (MenuBar*) pEvent->GetData();
if ( pMBar && ( pMBar == mpIconMBar ) )
RemoveBubbleWindow( true );
}
else if ( ( nEventID == VCLEVENT_WINDOW_MOVE ) || else if ( ( nEventID == VCLEVENT_WINDOW_MOVE ) ||
( nEventID == VCLEVENT_WINDOW_RESIZE ) ) ( nEventID == VCLEVENT_WINDOW_RESIZE ) )
{ {
...@@ -779,7 +799,7 @@ IMPL_LINK( UpdateCheckUI, ApplicationEventHdl, VclSimpleEvent *, pEvent) ...@@ -779,7 +799,7 @@ IMPL_LINK( UpdateCheckUI, ApplicationEventHdl, VclSimpleEvent *, pEvent)
MenuBar *pMBar = pSysWin->GetMenuBar(); MenuBar *pMBar = pSysWin->GetMenuBar();
if ( pSysWin && pMBar ) if ( pSysWin && pMBar )
{ {
AddMenuBarIcon( pSysWin ); AddMenuBarIcon( pSysWin, true );
} }
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment