Peter.Schulte | 2 Jan 2006 13:41
Picon

Antwort: Re: How to check non-editable nodes within commands?


I have made some further investigations and I have found 2 reasons for my problem:

Reason 1:
In order to move sections from "right to  left" I use the command decrSectionLevel within my macro command. DecrSectionLevel is a command written in Java provided in the product, which obviously does not use the API "isEditable". You can simply reproduce the problem if you call this command on a section within a referenced part of a document. The command seems to do its job but it cannot be because the changes are in the referenced part. Furthermore the action cannot be undone.

Reason 2:
In order to move chapters or sections up and down I use an expanded version of docb.moveItemUp/docb.moveItemDown. If you have a chapter as a referenced part of a document and if you mark this part (that means the whole chapter) then the following happens:

- the chapter is cut
- the content (not the reference) of the chapter is pasted before/after

The problem is that I do not know in my command if the marked element is a reference or not. If you mark a part of a part, the cut-command does not work. But if you mark the whole part, the cut-command works and puts the content (not the reference) into the clipboard.
Fortunately you can see that the grey background disappeared (that means the referenced element is no longer referenced) and that this command can be undone.

I hope you can understand my descriptions.

Best Regards
Peter Schulte


--
XMLmind XML Editor Support List
xmleditor-support <at> xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support
Hussein Shafie | 3 Jan 2006 14:13
Favicon

Re: Antwort: Re: How to check non-editable nodes within commands?

Peter.Schulte <at> gad.de wrote:
> 
> I have made some further investigations and I have found 2 reasons for
> my problem:
> 
> Reason 1:
> In order to move sections from "right to  left" I use the command
> decrSectionLevel within my macro command. DecrSectionLevel is a command
> written in Java provided in the product, which obviously does not use
> the API "isEditable". You can simply reproduce the problem if you call
> this command on a section within a referenced part of a document. The
> command seems to do its job but it cannot be because the changes are in
> the referenced part. Furthermore the action cannot be undone.

This is obviously a bug in the incrSectionLevel/decrSectionLevel
commands. It will be fixed in next release.

> Reason 2:
> In order to move chapters or sections up and down I use an expanded
> version of docb.moveItemUp/docb.moveItemDown. If you have a chapter as a
> referenced part of a document and if you mark this part (that means the
> whole chapter) then the following happens:
> 
> - the chapter is cut
> - the content (not the reference) of the chapter is pasted before/after
> 
> The problem is that I do not know in my command if the marked element is
> a reference or not. If you mark a part of a part, the cut-command does
> not work. But if you mark the whole part, the cut-command works and puts
> the content (not the reference) into the clipboard.

This is not a bug. What you described works as expected:

* The chapter you want to cut is read-only, but not its book parent.
Therefore cutting the chapter is indeed possible.

* Command "cut", just like the plain "copy" command, and unlike command
"copyAsReference", is not ``reference-enabled''. Therefore what is being
copied to the clipboard is plain XML nodes (and not a ``reference'').

> Fortunately you can see that the grey background disappeared (that means
> the referenced element is no longer referenced) and that this command
> can be undone.

Do not hesitate to suggest the tool you need to solve your problem (a
way to test in a macro if a node is editable?). We'll try to implement
it in next release.

--
XMLmind XML Editor Support List
xmleditor-support <at> xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Peter.Schulte | 4 Jan 2006 08:53
Picon

Antwort: Re: Antwort: Re: How to check non-editable nodes within commands?


Hi,

please find my remarks below:

Hussein Shafie <hussein <at> xmlmind.com> schrieb am 03.01.2006 14:13:43:

> Peter.Schulte <at> gad.de wrote:
> >
> > I have made some further investigations and I have found 2 reasons for
> > my problem:
> >
> > Reason 1:
> > In order to move sections from "right to  left" I use the command
> > decrSectionLevel within my macro command. DecrSectionLevel is a command
> > written in Java provided in the product, which obviously does not use
> > the API "isEditable". You can simply reproduce the problem if you call
> > this command on a section within a referenced part of a document. The
> > command seems to do its job but it cannot be because the changes are in
> > the referenced part. Furthermore the action cannot be undone.
>
> This is obviously a bug in the incrSectionLevel/decrSectionLevel
> commands. It will be fixed in next release.
>
Ok. Thank you

>
> > Reason 2:
> > In order to move chapters or sections up and down I use an expanded
> > version of docb.moveItemUp/docb.moveItemDown. If you have a chapter as a
> > referenced part of a document and if you mark this part (that means the
> > whole chapter) then the following happens:
> >
> > - the chapter is cut
> > - the content (not the reference) of the chapter is pasted before/after
> >
> > The problem is that I do not know in my command if the marked element is
> > a reference or not. If you mark a part of a part, the cut-command does
> > not work. But if you mark the whole part, the cut-command works and puts
> > the content (not the reference) into the clipboard.
>
> This is not a bug. What you described works as expected:
>
> * The chapter you want to cut is read-only, but not its book parent.
> Therefore cutting the chapter is indeed possible.
>
Yes, you are right.

> * Command "cut", just like the plain "copy" command, and unlike command
> "copyAsReference", is not ``reference-enabled''. Therefore what is being
> copied to the clipboard is plain XML nodes (and not a ``reference'').
>
That's right. (I think you mean "copyAsInclusion".)

>
> > Fortunately you can see that the grey background disappeared (that means
> > the referenced element is no longer referenced) and that this command
> > can be undone.
>
> Do not hesitate to suggest the tool you need to solve your problem (a
> way to test in a macro if a node is editable?). We'll try to implement
> it in next release.

What I would like to have is a "reference-enabling" of the command "cut".
My suggestion is an additional optional parameter for this command such like "useReferenceIfPossible" (You will find a better term.). So I could simply call the cut-command with this parameter and later on I could call the paste-command, which is already able to paste references. If the cut finds a marked reference then it would copy the reference to the clipboard otherwise the marked node or just plain text.
The copy command could get the same additional parameter. The functionality would be a little bit different from copyAsInclusion.
The latter command explicitly marks the clipboard content as being a reference.

What do you think about that?

Best Regards
Peter

--
XMLmind XML Editor Support List
xmleditor-support <at> xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support
Hussein Shafie | 4 Jan 2006 12:47
Favicon

Re: Antwort: Re: Antwort: Re: How to check non-editable nodes within commands?

Peter.Schulte <at> gad.de wrote:
>> Do not hesitate to suggest the tool you need to solve your problem (a
>> way to test in a macro if a node is editable?). We'll try to implement
>> it in next release.
> 
> What I would like to have is a "reference-enabling" of the command "cut".
> My suggestion is an additional optional parameter for this command such
> like "useReferenceIfPossible" (You will find a better term.). So I could
> simply call the cut-command with this parameter and later on I could
> call the paste-command, which is already able to paste references. If
> the cut finds a marked reference then it would copy the reference to the
> clipboard otherwise the marked node or just plain text.
> The copy command could get the same additional parameter. The
> functionality would be a little bit different from copyAsInclusion.
> The latter command explicitly marks the clipboard content as being a
> reference.
> 
> What do you think about that?

We agree with you.

If we have enough time, we'll implement "cutInclusionEnabled", a variant
of command "cut", in next release 3.1. Otherwise, it will be added to
the release after 3.1.

Command "cutInclusionEnabled" will work as plain command "cut" except
that if it cuts an element included from an external document (e.g. a
chapter included in a book), it will copy a reference (and not plain XML
nodes) to the clipboard. Unlike current behavior, we feel that this is
what the user expects XXE to do.

Moreover, XXE will do for new command "cutInclusionEnabled" what it does
for command "pasteInclusionEnabled"
(http://www.xmlmind.com/xmleditor/_distrib/doc/commands/pasteInclusionEnabled.html):
When XXE starts, it registers command "pasteInclusionEnabled" as
"paste". Therefore, when you think you use command "paste", in fact, you
use command "pasteInclusionEnabled".

--
XMLmind XML Editor Support List
xmleditor-support <at> xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support


Gmane