Hi! Is there some work going on currently on an undo API for extensions?
Since I did not find any trace of it, I think I will try to create this API myself. I am not very familiar with how undo works in OpenOffice.org, so I do not have a specification draft, but I have a wishlist: a) denote a series of actions as a single undoable action (with a custom name!) b) hide an action from the undo mechanism c) clear the undo stack d) customized undo (Hide the operations from the undo as in b), and add a custom named action to the undo stack. If the user wants to undo this step, call a callback provided by the extension.) I cannot tell if these are even possible -- this is why I am writing to this mailing list. Also please add any more wishes, maybe I will be able to "make them come true" :). So you know where I am coming from: I am a developer of EuroOffice (http://www.multiracio.com/eurooffice/). EuroOffice is primarily a set of extensions, but we also have a custom built (and open-source) OpenOffice.org application by this name. The purpose of our own build is exactly that this way we can add functionality needed by our extensions, and then hope that it makes its way into a next version of OpenOffice.org. In this case if I manage to create some sort of undo API we can test it ourselves and release a new version of EuroOffice that includes it. If it works out we would also release a patch that OpenOffice.org could consider accepting. And since I am primarily developing extensions these days I see how much an undo API would be needed. Any extension right now has a high chance of messing up the undo stack. Consider for example an extension, that changes part A of the document whenever part B changes. Now if the user changes part B, the extension will change part A. If the user presses Ctrl-Z, the change to part A will be undone. The user wanted to undo the change to part B, so they press Ctrl-Z again. Now the change in part B will be undone, which triggers the extension and it changes part A again. It is confusing enough this way, but if parts A and B are the same, it is not just confusing, but then every press of Ctrl-Z puts a new undo action on the stack effectively crippling the undo functionality. But simpler extensions, that do not trigger on changes to the document, but just create or modify something are also likely to flood the undo stack with hundreds of small changes. So far I have glimpsed at svtools/source/undo/undo.cxx. As little as exposing the methods of SfxUndoManager in this file would be useful (I see a Clear method, so an extension could at least clear the undo stack altogether instead of turning undo confusing and frustrating). This would take care of c). I think a) is doable as well -- just create some UndoAction that can contain other UndoActions (I see an unimplemented Merge method, maybe it is implemented someplace else or I could finish it). Can you tell if b) and d) are possible? Thank you for any advice! Best regards, Daniel Darabos (this is the last communication I have found on the topic:) Date: Mon, 29 Aug 2005 09:08:58 +0200 From: Mathias Bauer <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [api-dev] Any way to combine multiple actions into one undo-able action ? Patrik Fimml wrote: > Mathias Bauer wrote: >> CPH wrote: >> > Hi, >> > I have a button on my UI which performs several actions thru API calls. >> > Is ther anyway which I can get all of these actions to be considered one >> > atomic action by the Undo/Redo mechanism ? >> >> Not ATM. But we are currently discussing new APIs for "Q". I'm somewhat >> involved into that and I will take your question as a feature >> enhancement request. :-) >> >> My understanding is that you want to do something like: >> >> set mark on undo stack >> execute API calls >> set another mark on undo stack >> >> and then you would expect that calling "Undo" would undo *all* the >> changes you made, and of course a following "Redo" would do the opposite. >> >> The same way we want to make macros "undoable" in one step. > > That was in October 2003. Is it possible now to do such things? We had to do a lot of things for OOo2.0 (as you might have seen from how long it took to approach the final version) and an API for Undo wasn't on the priority list, so it was dropped. It's still on the list for the next version and this time API funtionality in general has a higher priority. But that's not a promise. :-) Ciao, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]