You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by pengyunquan <pe...@gmail.com> on 2012/08/02 09:04:28 UTC

[Call for review] Bug 120441 - [Freeze]With data range picker shrink in first document, AOO frozen if switch focus back from another SC doc

Hi, all

I have a fix for bug
120441<https://issues.apache.org/ooo/show_bug.cgi?id=120441>

https://issues.apache.org/ooo/show_bug.cgi?id=120441

Can anyone help me to review the fix?

    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.



Thanks,