Rossmann, Josef (LNG-VIE) wrote:
>
> A last question: Is there a possibility to store a value from loading until
> closing a document? (in this case it's the canwrite flag of the file..)
>
Sure, there are many ways to do this.
--> In a Java[tm] command:
You can add a property to the document loaded from the file of interest.
---
import com.xmlmind.xmledit.doc.Document;
protected Object doExecuteCommand(DocumentView docView,
String parameter, int x, int y) {
...
Document doc = docView.getDocument();
doc.putProperty("canWrite", Boolean.TRUE);
...
}
---
See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmledit/doc/Tree.html#putProperty(java.lang.Object,%20java.lang.Object)
--> In a macro-command:
You can create a variable which is specific to the document view and
hence to the document (a document may have several views, a view is a
view of a single document).
<macro>
...
<set variable="view:canWrite" expression="..."
xmlns:view="http://www.xmlmind.com/xmleditor/namespace/scope/view" />
...
</macro>
And then in another macro, executed in the context of the *same*
*document* *view*:
<macro>
...
<get expression="...$view:canWrite..."
xmlns:view="http://www.xmlmind.com/xmleditor/namespace/scope/view" />
...
</macro>
See http://www.xmlmind.com/xmleditor/_distrib/doc/commands/xpath_vars.html