Hi Jörg,

On Fri, Feb 28, 2014 at 06:47:37AM +0100, Jörg Schmidt wrote:
> Hello,
> 
> (a)
> Is there a way to remove one or several undo actions from the stack, but not 
> all actions? 
> 
> Exemple:
> 
> My undo-stack is:
> 
> Eingabe
> Attribute
> Eingabe
> 
> and I would like to have the undo-stack:
> 
> Eingabe
> Eingabe
 
That particular scenario can have a workaround only if your code is
controlling the undo context, otherwise you can only undo/redo the most
recent action. If you don't want the "Attribute" action to appear on the
undo stack, enter a hidden undo context.


> (b)
> How can I in general use the 'undo-API'? 

See http://people.apache.org/~arielch/api/UndoManager.odt

> But the following dont work for me (i get an error):
> 
> Sub Main
>   Msgbox ThisComponent.getCurrentUndoActionTitle()
> End Sub
> 
> What am I doing wrong?

The document model does not support this function; this is something as
basic as knowing how to use the API reference:

- search getCurrentUndoActionTitle() in the general index:
  http://www.openoffice.org/api/docs/common/ref/index-files/index-7.html
  getCurrentUndoActionTitle() - function in interface
  ::com::sun::star::document:: .XUndoManager
  
http://www.openoffice.org/api/docs/common/ref/com/sun/star/document/XUndoManager.html#getCurrentUndoActionTitle

- this is a function of the XUndoManager interface, how do you access
  this interface from the document model? See the interface uses:
  
http://www.openoffice.org/api/docs/common/ref/com/sun/star/document/XUndoManager-xref.html

- the interface is used as return type of
  XUndoManagerSupplier::getUndoManager()

- go to the uses of XUndoManagerSupplier
  
http://www.openoffice.org/api/docs/common/ref/com/sun/star/document/XUndoManagerSupplier-xref.html
  The interface is supported by all services implementing the document
  models

The document model implements XUndoManagerSupplier; use this interface
to access the undo manager. getCurrentUndoActionTitle() is a function of
the undo manager: the code without any check should be
ThisComponent.getUndoManager().getCurrentUndoActionTitle()


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Attachment: pgpJuDsnHzptS.pgp
Description: PGP signature

Reply via email to