summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-08-19 11:46:23 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-08-19 11:46:23 +0000
commite75ce92cf8185376f3c45c8ed6616967b920841e (patch)
tree38bc2da5b9f6bc8bdd9aa21e8ec35cbc617c0c04
parent557bafe1460688a1e05a9fcd1acb927ed35b943c (diff)
INTEGRATION: CWS gh15 (1.36.4); FILE MERGED
2008/07/22 09:47:23 gh 1.36.4.5: RESYNC: (1.36-1.39); FILE MERGED 2008/05/02 15:00:15 gh 1.36.4.4: #132232#close menu before calling slot 2008/05/02 10:56:30 gh 1.36.4.3: #144122#close ToolBox Menubutton menu on second call to OpenMenu 2008/05/02 10:54:31 gh 1.36.4.2: #i79207#part 1 2008/04/30 12:08:45 gh 1.36.4.1: #i82396#resetapplication to backingwindow
-rw-r--r--automation/source/server/statemnt.cxx147
1 files changed, 99 insertions, 48 deletions
diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx
index 4c0c37861..fb6ae9761 100644
--- a/automation/source/server/statemnt.cxx
+++ b/automation/source/server/statemnt.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: statemnt.cxx,v $
- * $Revision: 1.39 $
+ * $Revision: 1.40 $
*
* This file is part of OpenOffice.org.
*
@@ -161,6 +161,8 @@ Dir *StatementCommand::pDir = NULL;
pfunc_osl_printDebugMessage StatementCommand::pOriginal_osl_DebugMessageFunc = NULL;
+#define RESET_APPLICATION_TO_BACKING_WINDOW
+
#define SET_WINP_CLOSING(pWin) \
pWindowWaitPointer = pWin; \
@@ -456,10 +458,12 @@ StatementSlot::StatementSlot()
: nAnzahl( 0 )
, pItemArr(NULL)
, nFunctionId( 0 )
+, bMenuClosed(FALSE)
{}
StatementSlot::StatementSlot( ULONG nSlot, SfxPoolItem* pItem )
: pItemArr(NULL)
+, bMenuClosed(FALSE)
{
QueStatement( NULL );
nFunctionId = USHORT(nSlot);
@@ -586,6 +590,37 @@ BOOL StatementSlot::Execute()
m_pDbgWin->AddText( "\n" );
#endif
+ PopupMenu *pPopup = NULL;
+ MenuBar *pMenuBar = NULL;
+ Menu *pMenu;
+
+ GetCurrentMenues( pPopup, pMenuBar, pMenu );
+ if ( pPopup )
+ {
+ if ( !bMenuClosed )
+ {
+ pPopup->EndExecute(0);
+ aSubMenuId1 = SmartId();
+ aSubMenuId2 = SmartId();
+ aSubMenuId3 = SmartId();
+ pMenuWindow = NULL;
+ bMenuClosed = TRUE;
+#if OSL_DEBUG_LEVEL > 1
+ m_pDbgWin->AddText( "Closed contextmenu\n" );
+#endif
+ return FALSE;
+ }
+ else if ( nRetryCount-- )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ m_pDbgWin->AddText( "Waiting for contextmenu to close\n" );
+#endif
+ return FALSE;
+ }
+ else
+ ReportError( GEN_RES_STR0( S_MENU_NOT_CLOSING ) );
+ }
+
Advance();
if ( !IsError )
@@ -2780,51 +2815,17 @@ BOOL StatementCommand::Execute()
MenuBar *pMenuBar = NULL;
Menu *pMenu;
- if ( WinPtrValid( pMenuWindow ) )
- pMenuBar = pMenuWindow->GetMenuBar();
-
- if ( pMenuBar ) // use MenuBar as base
- pMenu = pMenuBar;
- else // use contextmenu as base
- {
- pMenu = PopupMenu::GetActivePopupMenu();
- pPopup = PopupMenu::GetActivePopupMenu();
- }
-
- if ( !pMenu )
- {
- ReportError( GEN_RES_STR0( S_NO_POPUP ) );
- break;
- }
-
- if ( aSubMenuId1.GetNum() )
- {
- pPopup = pMenu->GetPopupMenu(
- sal::static_int_cast< USHORT >(aSubMenuId1.GetNum()));
- pMenu = pPopup;
- }
-
- if ( pMenu && aSubMenuId2.GetNum() )
- {
- pPopup = pMenu->GetPopupMenu(
- sal::static_int_cast< USHORT >(aSubMenuId2.GetNum()));
- pMenu = pPopup;
- }
-
- if ( pMenu && aSubMenuId3.GetNum() )
- {
- pPopup = pMenu->GetPopupMenu(
- sal::static_int_cast< USHORT >(aSubMenuId3.GetNum()));
- pMenu = pPopup;
- }
+ USHORT nErr = GetCurrentMenues( pPopup, pMenuBar, pMenu );
if ( !pMenu )
{
- ReportError( GEN_RES_STR0( S_NO_SUBMENU ) );
+ if ( nErr == 1 )
+ ReportError( GEN_RES_STR0( S_NO_POPUP ) );
+ else
+ ReportError( GEN_RES_STR0( S_NO_SUBMENU ) );
break;
}
-
USHORT nItemCount = 0;
switch ( nMethodId )
{
@@ -3751,6 +3752,45 @@ BOOL StatementList::ValueOK( SmartId aId, String aBezeichnung, ULONG nValue, ULO
return TRUE;
}
+USHORT StatementList::GetCurrentMenues( PopupMenu *&pPopup, MenuBar *&pMenuBar, Menu *&pMenu )
+{
+ if ( WinPtrValid( pMenuWindow ) )
+ pMenuBar = pMenuWindow->GetMenuBar();
+
+ if ( pMenuBar ) // use MenuBar as base
+ pMenu = pMenuBar;
+ else // use contextmenu as base
+ {
+ pMenu = PopupMenu::GetActivePopupMenu();
+ pPopup = PopupMenu::GetActivePopupMenu();
+ }
+
+ if ( !pMenu )
+ return 1;
+
+ if ( aSubMenuId1.GetNum() )
+ {
+ pPopup = pMenu->GetPopupMenu(
+ sal::static_int_cast< USHORT >(aSubMenuId1.GetNum()));
+ pMenu = pPopup;
+ }
+
+ if ( pMenu && aSubMenuId2.GetNum() )
+ {
+ pPopup = pMenu->GetPopupMenu(
+ sal::static_int_cast< USHORT >(aSubMenuId2.GetNum()));
+ pMenu = pPopup;
+ }
+
+ if ( pMenu && aSubMenuId3.GetNum() )
+ {
+ pPopup = pMenu->GetPopupMenu(
+ sal::static_int_cast< USHORT >(aSubMenuId3.GetNum()));
+ pMenu = pPopup;
+ }
+
+ return 0;
+}
void StatementControl::AnimateMouse( Window *pControl, TTHotSpots aWohin )
{
@@ -4530,7 +4570,7 @@ BOOL StatementControl::HandleCommonMethods( Window *pControl )
BOOL StatementControl::Execute()
{
Window *pControl;
- BOOL bNormalWeiter = TRUE;
+ BOOL bStatementDone = TRUE;
if ( IsError )
@@ -5407,7 +5447,8 @@ BOOL StatementControl::Execute()
Rectangle aRect = pTB->GetItemPosDropDownRect( nItemPos );
AnimateMouse( pControl, aRect.Center() );
MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
- ImplMouseButtonDown( pTB, aMEvnt, FORCE_DIRECT_CALL );
+ ImplMouseButtonDown( pTB, aMEvnt);
+ ImplMouseButtonUp( pTB, aMEvnt);
// Das Fenster ist offen.
aSubMenuId1 = SmartId();
@@ -6248,9 +6289,6 @@ protected:
MoreDialog:
switch( nMethodId )
{
-
- // (Rect GetRect)
-
case M_AnimateMouse :
AnimateMouse( pControl, MitteOben);
break;
@@ -6272,7 +6310,6 @@ protected:
}
case M_Cancel:
{
-// Window *pChild = ImpGetChild( pControl, WINDOW_CANCELBUTTON );
Window *pChild = GetWinByRT( pControl, WINDOW_CANCELBUTTON );
if( ControlOK( pChild, "Cancel Button" ) )
{
@@ -6536,12 +6573,26 @@ protected:
#if OSL_DEBUG_LEVEL > 1
m_pDbgWin->AddText( "\n" );
#endif
- if (bNormalWeiter)
+ if ( bStatementDone )
{
SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) );
delete this;
}
- return bNormalWeiter;
+ else
+ {
+ if ( nRetryCount-- )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ m_pDbgWin->AddText( CUniString("Reschedule command (requed) (").Append( UniString::CreateFromInt32(nRetryCount) ).AppendAscii(")\n") );
+#endif
+ QueStatement( this ); // will que at the start of the list
+ }
+ else
+ {
+ bStatementDone=TRUE;
+ }
+ }
+ return bStatementDone;
#define FINISH_NEXT
#define FINISH_SAME