Some questions about "undo"

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Some questions about "undo"

Jörg Schmidt-2
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


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

I find in the Internet the example:
https://forum.openoffice.org/en/forum/viewtopic.php?f=25&t=57068&p=251657&hilit=getCurrentUndoActionTitle#p251657

But the following dont work for me (i get an error):

Sub Main
  Msgbox ThisComponent.getCurrentUndoActionTitle()
End Sub

What am I doing wrong?


(I have tested with OOo 3.3.0 and AOO 4.0.0)


Greetings,
Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Some questions about "undo"

Ariel Constenla-Haile-2
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

attachment0 (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Some questions about "undo"

Jörg Schmidt-2
Hello Ariel, *,  

> From: Ariel Constenla-Haile [mailto:[hidden email]]

> That particular scenario can have a workaround only if your code is
> controlling the undo context,

oh yes, that helps me a lot.

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

Thank you.

> The document model does not support this function;

yes, that's clear.

This is only a spelling mistake, I meant the code:

Msgbox ThisComponent.getUndoManager().getCurrentUndoActionTitle()

(this code did not work in OOo 3.3.0 and I was angry and had falsely tried also
the other code, and then copied by mistake in my post)

My mistake was not clean to distinguish between OOo 3.3.0 and AOO 4.0.0. In OOo
3.3.0 the code does not work and I have carelessly he claims did not do well in
AOO 4.0.0.


summarized:

I've tested and in AOO4.0.1 the following code works:

oUndo.enterHiddenUndoContext()

and can dissolve my problem.

in:
http://www.openoffice.org/api/docs/common/ref/com/sun/star/document/XUndoManager.h
tml

I find no evidence for the version of the OO interface "XUndoManager" works.

Earlier there were in the IDL-reference for always indicative of the form "since
OOo xy".

Is that no longer so?
If yes, how can I know if something is a mistake or a non-existing function? And
how do I know at what point is a specific feature available?



Greetings,
Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Some questions about "undo"

Ariel Constenla-Haile-2
Hi Jörg,

On Thu, Mar 06, 2014 at 10:37:10AM +0100, Jörg Schmidt wrote:

> in:
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/document/XUndoManager.h
> tml
>
> I find no evidence for the version of the OO interface "XUndoManager" works.
>
> Earlier there were in the IDL-reference for always indicative of the form "since
> OOo xy".
>
> Is that no longer so?
This looks like an omission from the developer, you might want to submit
a bug.

The undo API seems to be new in 3.4 Beta:
http://permalink.gmane.org/gmane.comp.openoffice.announce.interface/1218

> If yes, how can I know if something is a mistake or a non-existing function? And
> how do I know at what point is a specific feature available?

Besides the @since tag in the IDL, you can check at runtime using
introspection; the simplest way in Basic is the HasUnoInterfaces
function, more complex stuff in the reflexion module
http://www.openoffice.org/api/docs/common/ref/com/sun/star/reflection/module-ix.html


Regards
--
Ariel Constenla-Haile
La Plata, Argentina

attachment0 (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Some questions about "undo"

Jörg Schmidt-2
> From: Ariel Constenla-Haile [mailto:[hidden email]]

> This looks like an omission from the developer, you might
> want to submit
> a bug.

No, I think not.

Please consider the following example:
http://www.openoffice.org/api/docs/common/ref/com/sun/star/util/PathSettings.html 

I do not think there the entry "Since OOo 1.1.2" an error hint is, but rather the
entry is intentional.  

> The undo API seems to be new in 3.4 Beta:
> http://permalink.gmane.org/gmane.comp.openoffice.announce.inte
> rface/1218

Thank you
 
> > If yes, how can I know if something is a mistake or a
> non-existing function? And
> > how do I know at what point is a specific feature available?
>
> Besides the @since tag in the IDL, you can check at runtime using
> introspection; the simplest way in Basic is the HasUnoInterfaces
> function,

Yes, i know this, but it is unsuitable since I must to install each program
version first and then check.
I'm not too lazy to do that, but rather we are talking about professional things
and time is money.


 

Greetings,
Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Some questions about "undo"

Jürgen Schmidt-3
On 3/6/14 7:56 PM, Jörg Schmidt wrote:

>> From: Ariel Constenla-Haile [mailto:[hidden email]]
>
>> This looks like an omission from the developer, you might
>> want to submit
>> a bug.
>
> No, I think not.
>
> Please consider the following example:
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/util/PathSettings.html 
>
> I do not think there the entry "Since OOo 1.1.2" an error hint is, but rather the
> entry is intentional.  
>
>> The undo API seems to be new in 3.4 Beta:
>> http://permalink.gmane.org/gmane.comp.openoffice.announce.inte
>> rface/1218
>
> Thank you
>  
>>> If yes, how can I know if something is a mistake or a
>> non-existing function? And
>>> how do I know at what point is a specific feature available?
>>
>> Besides the @since tag in the IDL, you can check at runtime using
>> introspection; the simplest way in Basic is the HasUnoInterfaces
>> function,
>
> Yes, i know this, but it is unsuitable since I must to install each program
> version first and then check.
> I'm not too lazy to do that, but rather we are talking about professional things
> and time is money.

feel free to report back and change the IDL when you have figured out
since when the APIs are available.

The since tag was not always used as intended by all developers ...

Juergen

>
>
>  
>
> Greetings,
> Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Some questions about "undo"

Bernard Marcelly
Hello,
For your information, the rework of the Undo manager was done in january 2011.
See <https://issues.apache.org/ooo/show_bug.cgi?id=33781>

See also the messages titled "info/CWS undoapi: ..." in the archives of the
defunct interface-announce mailing-list.
<http://www.mail-archive.com/interface-announce%40openoffice.org/>

Regards
   Bernard


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Some questions about "undo"

Ariel Constenla-Haile-2
In reply to this post by Jörg Schmidt-2
On Thu, Mar 06, 2014 at 07:56:49PM +0100, Jörg Schmidt wrote:

> > From: Ariel Constenla-Haile [mailto:[hidden email]]
>
> > This looks like an omission from the developer, you might
> > want to submit
> > a bug.
>
> No, I think not.
>
> Please consider the following example:
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/util/PathSettings.html 
>
> I do not think there the entry "Since OOo 1.1.2" an error hint is, but rather the
> entry is intentional.  
That's precisely what "omission from the developer" meant: the @since
tag is not an automated feature, the developer must write it explicitly
in the IDL file, hence the omission in this case.

>
> > The undo API seems to be new in 3.4 Beta:
> > http://permalink.gmane.org/gmane.comp.openoffice.announce.interface/1218

With more exactitud, the integration of the undoapi CWS took place in
2011-01-28 (3.3 was released on 26th January 2011):

Changeset: 274602 (62ffe2f76cf3) CWS-TOOLING: integrate CWS undoapi
User: Vladimir Glazunov <[hidden email]>
Date: 2011-01-28 11:59:17 +0100 (2011-01-28)
Parent: 274370 (8b4b777816a5) CWS-TOOLING: integrate CWS os147
        274601 (51f1e1ceb095) undoapi: pulled and merged DEV300.m98
Child:  274621 (3b5ad50f5e72) CWS-TOOLING: integrate CWS tabcontrol


Regards
--
Ariel Constenla-Haile
La Plata, Argentina

attachment0 (836 bytes) Download Attachment