You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@openoffice.apache.org by Amenel VOGLOZIN <wa...@yahoo.fr> on 2014/12/05 14:18:36 UTC

[EXT][GUI] Autoclosing of a dialog when exiting the application

Dear all,
I wrote an extension that was meant to provide a more liberal replacement to the list of recently opened documents. All features are exposed in a modal dialog that gets opened through a menu item. The dialog contains action buttons for managing the items in the (unbounded as of now) list. One of the buttons is a "Open" button, which, because of the Grid API, can only operate on one single file.
The problematic scenario to which I'm trying to find a solution is this one:   
   - user launches OpenOffice; there is one window frame (with Minimize, Maximize/restore, and Close buttons)   

   - user uses a menu item to open the dialog of the extension; there are then one dialog window and one frame
   - user selects a document in the Grid list of the extension and clicks the Open button; the extension uses an XComponentLoader to load the file
   - after the file has loaded, there are two frames (one forefront frame with the opened file and one background frame with the dialog still opened)
   - user works on the file and presses the Close button in the upper right hand corner of the forefront frame
   - all windows (the two frames and the dialog) disappear from the screen
   - user thinks the process is terminated but Process Explorer shows that soffice.bin has actually entered a mode where it keeps a CPU core at 100% usage, indefinitely.   

By various tests, I determined that the reason behind the never-ending closing is that the dialog window wasn't closed.
Therefore, the solution is to have the dialog close automatically when the user exits the application. Since I was already intercepting the OnCloseApp to save data, I thought I could just as well close the dialog there but that created another problem that manifests itself in two ways:   
   - when in NetBeans debug mode, I see in the output that an EXCEPTION_ACCESS_VIOLATION error occurred in vcl.dll.
   - when the extension is installed in an instance of OO, everything seems to happen normally but on the next launch, the document recovery window opens.
My guess is that closing the dialog while handling OnCloseApp fails because the parent window (or some resources) have already been freed when the OnCloseApp event is notified. The sequence of events that I get is: OnPrepareViewClosing, OnPrepareUnload, OnViewClosed, OnUnload, OnUnfocus, OnCloseApp. I can't close the dialog when I get an OnPrepareViewClosing event because there might be times when this event doesn't mean an OnCloseApp will happen later on in the sequence.

Questions:   
   - does anyone see a way to properly (and automatically) close the dialog of my extension at application exit time? I'm looking for the appropriate place where to hook in and close the dialog.   

   - is it possible to avert an app exit sequence which was triggered by the user?   


Thank you.


Re: [EXT][GUI] Autoclosing of a dialog when exiting the application

Posted by Amenel VOGLOZIN <wa...@yahoo.fr>.
Hi Oliver,
Yes, I need a dialog because of the amount of information to display. I think that whether it be modal or not won't change the problem.
I'll investigate using the FrameActionListener. For now, I have resorted to closing the dialog each time the Open button is clicked and the file/files is/are opened.

Thanks.
      De : Oliver Brinzing <Ol...@gmx.de>
 À : api@openoffice.apache.org 
 Envoyé le : Vendredi 5 décembre 2014 16h28
 Objet : Re: [EXT][GUI] Autoclosing of a dialog when exiting the application
   
Hi, Amenel,

it seeems "OnCloseApp" is fired as last event if the last frame is closed
(if quickstart is not enabled) or if quickstart is closed (if there is no other frame).

Do you need a modal dialog?
maybe a sidebar integration could be the better solution? or try using a "window"

maybe it can help adding a frameactionlistener to retrive frame actionevents:
https://www.openoffice.org/api/docs/common/ref/com/sun/star/frame/FrameAction.html

Regards

Oliver

-- 




---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org



  

Re: [EXT][GUI] Autoclosing of a dialog when exiting the application

Posted by Oliver Brinzing <Ol...@gmx.de>.
Hi, Amenel,

it seeems "OnCloseApp" is fired as last event if the last frame is closed
(if quickstart is not enabled) or if quickstart is closed (if there is no other frame).

Do you need a modal dialog?
maybe a sidebar integration could be the better solution? or try using a "window"

maybe it can help adding a frameactionlistener to retrive frame actionevents:
https://www.openoffice.org/api/docs/common/ref/com/sun/star/frame/FrameAction.html

Regards

Oliver

-- 


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org