Issue 118882 - [From Symphony] Cannot do nothing if two select data range dialog is shrunk
Summary: [From Symphony] Cannot do nothing if two select data range dialog is shrunk
Status: CONFIRMED
Alias: None
Product: Calc
Classification: Application
Component: ui (show other issues)
Version: 3.4.0 Beta (OOo)
Hardware: PC Windows 7
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-07 06:28 UTC by Yan Ji
Modified: 2017-05-20 11:55 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Fix patch for Bug 118882 (1.14 KB, patch)
2012-08-01 04:20 UTC, pengyunquan
yunquanp: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Yan Ji 2012-02-07 06:28:13 UTC
1. Launch Calc.
2. Click "Inserte->Chart", click "Finish" button in guide dialog
3. Select the chart(in edit mode), choose "Data Range" in context menu.
4. Click the shrink button.
5. New another Calc document.
6. Click "Insert->Chart", click "Next" button at this time.
7. Click the shrink button to select data rang.

Defect: Focus get lost, you cannot do anything except kill soffice.bin
Comment 1 pengyunquan 2012-08-01 04:20:12 UTC
Created attachment 78794 [details]
Fix patch for Bug 118882

Root case : On creation of the 2nd Spreadsheet document, a ScSimpleRefDlgWrapper object will be constructed. In its constructor, there are several lines of code cause this problem:
	if(bAutoReOpen && pViewShell)
		pWindow = pViewShell->CreateRefDialog( p, this, pInfo, pParentP, WID_SIMPLE_REF);

	if (!pWindow)
	{
		SC_MOD()->SetRefDialog( nId, sal_False );
	}
 The 2nd document does not have a reference picker dialog, so "SC_MOD()->SetRefDialog( nId, sal_False );" is executed, which clears ScModule's reference status.  This is an incorrect action, because the 1st document still has a reference dialog open, and ScModule should keep reference status while there are one document is in reference picking status.  On the 2nd document's creation, only its own reference status should be cleared, so we should call "pViewFrm->SetChildWindow( nId, sal_False );" instead of "SC_MOD()->SetRefDialog( nId, sal_False );". 
    Let's see other child dialog wrappers' constructor. In "ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper(...)", it is "pViewShell->GetViewFrame()->SetChildWindow( nId, sal_False );" not "SC_MOD()->SetRefDialog( nId, sal_False );". As a result, it does not cause this problem.
    Why "SC_MOD()->SetRefDialog( nId, sal_False );" cause frozen problem? Because once ScModule's reference picking status is cleared, when mouse is clicked on one cell in the 1st document, the ScModule does not think this is a reference picking action, and the ScModule thinks it is a normal mouse click on cell which will cause ScCellShell be activated and ScChartShell will be deactivated. As a result, reference picker dialog will be destroyed, and its parent dialog( Chart Range dialog ) will be set as foreground dialog. The original parent dialog of the Chart Range dialog is the CharWindow, but now the ChartWindow is destroyed when ScChartShell is deactivated, the ChartRange dialog will be reparented to ScGridWindow. in VCL, reparent a frame window will destroy the system window handle( HWND ), and recreated a new HWND. But the window position is not inherited from the original HWND, so when show the new window, system API "GetWindowRect" get rectangle as "Rectangle(0,0,0,0)". As a result, we can not see the new foreground ChartRange dialog, but it is a modal dialog whick locks the document, and the ScGridWindow can not respond to the user events. The document looks like frozen. By the way, we can not close the invisible foreground dialog (Chart Range dialog ) by pressing "Esc" key, because when this dialog is reparented to ScGridWindow VCL calls "ShowWindow( .., SW_NOACTVATE)", which means the foreground dialog does not get focus. It is a invisible modal dialog without focus, which locks the docuemt and can not be closed via "Esc" key.
Comment 2 pengyunquan 2012-08-02 06:59:41 UTC
(In reply to comment #1)
> Created attachment 78794 [details]
> Fix patch for Bug 118882
> 
> Root case : On creation of the 2nd Spreadsheet document, a
> ScSimpleRefDlgWrapper object will be constructed. In its constructor, there
> are several lines of code cause this problem:
> 	if(bAutoReOpen && pViewShell)
> 		pWindow = pViewShell->CreateRefDialog( p, this, pInfo, pParentP,
> WID_SIMPLE_REF);
> 
> 	if (!pWindow)
> 	{
> 		SC_MOD()->SetRefDialog( nId, sal_False );
> 	}
>  The 2nd document does not have a reference picker dialog, so
> "SC_MOD()->SetRefDialog( nId, sal_False );" is executed, which clears
> ScModule's reference status.  This is an incorrect action, because the 1st
> document still has a reference dialog open, and ScModule should keep
> reference status while there are one document is in reference picking
> status.  On the 2nd document's creation, only its own reference status
> should be cleared, so we should call "pViewFrm->SetChildWindow( nId,
> sal_False );" instead of "SC_MOD()->SetRefDialog( nId, sal_False );". 
>     Let's see other child dialog wrappers' constructor. In
> "ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper(...)", it is
> "pViewShell->GetViewFrame()->SetChildWindow( nId, sal_False );" not
> "SC_MOD()->SetRefDialog( nId, sal_False );". As a result, it does not cause
> this problem.
>     Why "SC_MOD()->SetRefDialog( nId, sal_False );" cause frozen problem?
> Because once ScModule's reference picking status is cleared, when mouse is
> clicked on one cell in the 1st document, the ScModule does not think this is
> a reference picking action, and the ScModule thinks it is a normal mouse
> click on cell which will cause ScCellShell be activated and ScChartShell
> will be deactivated. As a result, reference picker dialog will be destroyed,
> and its parent dialog( Chart Range dialog ) will be set as foreground
> dialog. The original parent dialog of the Chart Range dialog is the
> CharWindow, but now the ChartWindow is destroyed when ScChartShell is
> deactivated, the ChartRange dialog will be reparented to ScGridWindow. in
> VCL, reparent a frame window will destroy the system window handle( HWND ),
> and recreated a new HWND. But the window position is not inherited from the
> original HWND, so when show the new window, system API "GetWindowRect" get
> rectangle as "Rectangle(0,0,0,0)". As a result, we can not see the new
> foreground ChartRange dialog, but it is a modal dialog whick locks the
> document, and the ScGridWindow can not respond to the user events. The
> document looks like frozen. By the way, we can not close the invisible
> foreground dialog (Chart Range dialog ) by pressing "Esc" key, because when
> this dialog is reparented to ScGridWindow VCL calls "ShowWindow( ..,
> SW_NOACTVATE)", which means the foreground dialog does not get focus. It is
> a invisible modal dialog without focus, which locks the docuemt and can not
> be closed via "Esc" key.

(In reply to comment #1)
> Created attachment 78794 [details]
> Fix patch for Bug 118882
> 
> Root case : On creation of the 2nd Spreadsheet document, a
> ScSimpleRefDlgWrapper object will be constructed. In its constructor, there
> are several lines of code cause this problem:
> 	if(bAutoReOpen && pViewShell)
> 		pWindow = pViewShell->CreateRefDialog( p, this, pInfo, pParentP,
> WID_SIMPLE_REF);
> 
> 	if (!pWindow)
> 	{
> 		SC_MOD()->SetRefDialog( nId, sal_False );
> 	}
>  The 2nd document does not have a reference picker dialog, so
> "SC_MOD()->SetRefDialog( nId, sal_False );" is executed, which clears
> ScModule's reference status.  This is an incorrect action, because the 1st
> document still has a reference dialog open, and ScModule should keep
> reference status while there are one document is in reference picking
> status.  On the 2nd document's creation, only its own reference status
> should be cleared, so we should call "pViewFrm->SetChildWindow( nId,
> sal_False );" instead of "SC_MOD()->SetRefDialog( nId, sal_False );". 
>     Let's see other child dialog wrappers' constructor. In
> "ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper(...)", it is
> "pViewShell->GetViewFrame()->SetChildWindow( nId, sal_False );" not
> "SC_MOD()->SetRefDialog( nId, sal_False );". As a result, it does not cause
> this problem.
>     Why "SC_MOD()->SetRefDialog( nId, sal_False );" cause frozen problem?
> Because once ScModule's reference picking status is cleared, when mouse is
> clicked on one cell in the 1st document, the ScModule does not think this is
> a reference picking action, and the ScModule thinks it is a normal mouse
> click on cell which will cause ScCellShell be activated and ScChartShell
> will be deactivated. As a result, reference picker dialog will be destroyed,
> and its parent dialog( Chart Range dialog ) will be set as foreground
> dialog. The original parent dialog of the Chart Range dialog is the
> CharWindow, but now the ChartWindow is destroyed when ScChartShell is
> deactivated, the ChartRange dialog will be reparented to ScGridWindow. in
> VCL, reparent a frame window will destroy the system window handle( HWND ),
> and recreated a new HWND. But the window position is not inherited from the
> original HWND, so when show the new window, system API "GetWindowRect" get
> rectangle as "Rectangle(0,0,0,0)". As a result, we can not see the new
> foreground ChartRange dialog, but it is a modal dialog whick locks the
> document, and the ScGridWindow can not respond to the user events. The
> document looks like frozen. By the way, we can not close the invisible
> foreground dialog (Chart Range dialog ) by pressing "Esc" key, because when
> this dialog is reparented to ScGridWindow VCL calls "ShowWindow( ..,
> SW_NOACTVATE)", which means the foreground dialog does not get focus. It is
> a invisible modal dialog without focus, which locks the docuemt and can not
> be closed via "Esc" key.

(In reply to comment #1)
> Created attachment 78794 [details]
> Fix patch for Bug 118882
> 
> Root case : On creation of the 2nd Spreadsheet document, a
> ScSimpleRefDlgWrapper object will be constructed. In its constructor, there
> are several lines of code cause this problem:
> 	if(bAutoReOpen && pViewShell)
> 		pWindow = pViewShell->CreateRefDialog( p, this, pInfo, pParentP,
> WID_SIMPLE_REF);
> 
> 	if (!pWindow)
> 	{
> 		SC_MOD()->SetRefDialog( nId, sal_False );
> 	}
>  The 2nd document does not have a reference picker dialog, so
> "SC_MOD()->SetRefDialog( nId, sal_False );" is executed, which clears
> ScModule's reference status.  This is an incorrect action, because the 1st
> document still has a reference dialog open, and ScModule should keep
> reference status while there are one document is in reference picking
> status.  On the 2nd document's creation, only its own reference status
> should be cleared, so we should call "pViewFrm->SetChildWindow( nId,
> sal_False );" instead of "SC_MOD()->SetRefDialog( nId, sal_False );". 
>     Let's see other child dialog wrappers' constructor. In
> "ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper(...)", it is
> "pViewShell->GetViewFrame()->SetChildWindow( nId, sal_False );" not
> "SC_MOD()->SetRefDialog( nId, sal_False );". As a result, it does not cause
> this problem.
>     Why "SC_MOD()->SetRefDialog( nId, sal_False );" cause frozen problem?
> Because once ScModule's reference picking status is cleared, when mouse is
> clicked on one cell in the 1st document, the ScModule does not think this is
> a reference picking action, and the ScModule thinks it is a normal mouse
> click on cell which will cause ScCellShell be activated and ScChartShell
> will be deactivated. As a result, reference picker dialog will be destroyed,
> and its parent dialog( Chart Range dialog ) will be set as foreground
> dialog. The original parent dialog of the Chart Range dialog is the
> CharWindow, but now the ChartWindow is destroyed when ScChartShell is
> deactivated, the ChartRange dialog will be reparented to ScGridWindow. in
> VCL, reparent a frame window will destroy the system window handle( HWND ),
> and recreated a new HWND. But the window position is not inherited from the
> original HWND, so when show the new window, system API "GetWindowRect" get
> rectangle as "Rectangle(0,0,0,0)". As a result, we can not see the new
> foreground ChartRange dialog, but it is a modal dialog whick locks the
> document, and the ScGridWindow can not respond to the user events. The
> document looks like frozen. By the way, we can not close the invisible
> foreground dialog (Chart Range dialog ) by pressing "Esc" key, because when
> this dialog is reparented to ScGridWindow VCL calls "ShowWindow( ..,
> SW_NOACTVATE)", which means the foreground dialog does not get focus. It is
> a invisible modal dialog without focus, which locks the docuemt and can not
> be closed via "Esc" key.

Sorry, my fix is for Bug 120441. Bug 118882 still has other problem. I'll continue taking care of 118882