[Solved] Disable OpenOffice.org during progressbar

The Application Programming Interface and the OASIS Open Document Format

[Solved] Disable OpenOffice.org during progressbar

Postby bcris » Sat Oct 01, 2011 11:09 am

When saving a Calc document I need to do some additional processing based on the cells containing formulas. This processing can last relatively long if the document contains a lot of formulas. To show the user that something is happening (so that he/she doesn't think that Open Office is blocked) I implemented a progressbar with the following code:

Code: Select all   Expand viewCollapse view
XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
       
XStatusIndicator xStatusIndicator = xStatusIndicatorFactory.createStatusIndicator();

xStatusIndicator.start("Analysing sheet " + getName() + "...", noOfFormulas);
   
XEnumeration xFormulaEnum = getFormulaEnumeration(worksheet);
int currentFormulaIndex = 0;
while (xFormulaEnum.hasMoreElements()) {
   Object formulaCell = xFormulaEnum.nextElement();

   // do something with the formula cell

   xStatusIndicator.setValue(++currentFormulaIndex);
}

xStatusIndicator.end();



The problem I'm having is that during the processing the user can work further with Open Office (for example add new formulas or save again). Is there a way to disable all Open Office functionalities during the time the progressbar is shown and updated (so during the time the "while" cycle in the code above is processed) ?

Without a progressbar this works fine, the user can't do anything until the processing is over but than in some cases when the processing takes longer, the Open Office will be shown as "frozen" and the user might be inclined to terminate it from the task manager...

Thanks in advance for any ideas / workarounds !
Last edited by Hagar Delest on Sun Oct 02, 2011 8:58 pm, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 3.3 on Windows XP SP3
bcris
 
Posts: 21
Joined: Wed Aug 17, 2011 3:51 pm

Re: Disable Open Office during progressbar

Postby floris v » Sat Oct 01, 2011 11:19 am

Also found here: http://www.oooforum.org/forum/viewtopic.phtml?t=131531

Can't you put the progress bar in a modal dialog box, so that the user input is blocked as long as the dialog box is open? And if you regularly update the progress bar, the user can surely see that OOo isn't just hanging? Or am I missing something?
AOO 4.1.6 op Linux Mint
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
floris v
Moderator
 
Posts: 4192
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Disable Open Office during progressbar

Postby bcris » Sat Oct 01, 2011 3:32 pm

Thank you for your answer !

Yes, that would be an alternative. In this case it won't be the standard Open Office progress bar, but an own implementation with an own modal dialog box as you suggested, but it would solve the problem. If there is no independent possibility to disable/enable the Open Office functionalities that I could use in combination with the standard progress bar from Open Office I will implement it with a modal dialog box.
OpenOffice 3.3 on Windows XP SP3
bcris
 
Posts: 21
Joined: Wed Aug 17, 2011 3:51 pm

Re: Disable Open Office during progressbar

Postby ms777 » Sat Oct 01, 2011 6:15 pm

... you may want to try lockControllers() at the beginning and unlockControllers at the end, These are from interface ::com::sun::star::frame:: .XModel
ms777
Volunteer
 
Posts: 131
Joined: Mon Oct 08, 2007 1:33 am

Re: Disable Open Office during progressbar

Postby hanya » Sat Oct 01, 2011 6:24 pm

Set the container window of your document disable, prevents all operations by uses except for the title bar.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
hanya
Volunteer
 
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Disable OpenOffice.org during progressbar

Postby bcris » Sun Oct 02, 2011 10:27 am

Thank you both for your answers !

@ms777: I tried the lockControllers() method from the XModel but it only provides partial coverage.

@hanya: disabling the container window of the document works exactly as I need it in my scenario, it even prevents the user from closing the document !

Thanks again & Best regards !
OpenOffice 3.3 on Windows XP SP3
bcris
 
Posts: 21
Joined: Wed Aug 17, 2011 3:51 pm

Re: Disable OpenOffice.org during progressbar

Postby bcris » Sun Oct 02, 2011 6:55 pm

Solved
OpenOffice 3.3 on Windows XP SP3
bcris
 
Posts: 21
Joined: Wed Aug 17, 2011 3:51 pm


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest