Congree API for XMetaL© XMAX and Proxy Editor Manual
This documentation describes the implementation of the Congree API for XMetaL XMAX.
Note:
In the following text, JustSystems XMetaL XMAX is abbreviated as "XMAX".
Introduction
To integrate Congree in an application using the editor JustSystems XMetaL© XMAX (short: "XMAX"), the Congree API for ISV applications should be used. Please read this article carefully before proceeding.
The XMAX editor is supported by Congree out of the box.
How to use
The Congree Authoring Client plugin for XMAX provides its own implementation of the ICongreeBootstrapper interface. The ICongreeBootstrapper for XMAX is implemented by the co-class XMaxComShim.
|
The ProgId for the co-class XMaxComShim is Congree.Plugin.XMetal.XMax.ComShim.
According to the example from the article Congree API for ISV applications, the application should initially create the Congree bootstrapper.
In case of XMAX it should be like this:
var xMaxComShim = new XMaxComShim(); ICongreeBootstrapper bootstrapper = (ICongreeBootstrapper)xMaxComShim; .... // editorControlInstance is instance of the ActiveX XMax control var controlContext = bootstrapper.CreateControlContext(editorControlInstance, placeholders); ...
Since the Internet Explorer (IE) supports ActiveX, it is possible to demonstrate how to host and integrate the XMAX control and Congree in an IE html page.
<html> <head> <title>Example of integration XMax and Congree Client</title> <style type="text/css"> .panel { margin: 5px; background-color: gray } </style> </head> <body onload="CreateControlContext()" onunload="OnUnload()"> <table style="width: 100%; height: 640px"> <tr> <td colspan="2"> <!-- Placeholder for Toolbar --> <object id="ToolbarPlaceHolder" classid="clsid:D07DB8E1-43C9-4D6F-94A1-1F2B060A22E0" height="50"> <param name="ClientID" value="Congree.GenericToolbar" /> </object> </td> </tr> <tr> <td> <table> <tr> <!-- XMax control --> <object id="XMaxControl" classid="clsid:55EC30BE-EA43-45C4-ABD7-DDA7F6943D46" style="width: 100%; height: 50%" /> </tr> <tr> <!-- Placeholder for Authoring Memory panel --> <object class="panel" id="AuthoringMemoryPlaceHolder" classid="clsid:D07DB8E1-43C9-4D6F-94A1-1F2B060A22E0" style="width: 100%; height: 50%"> <param name="ClientID" value="Congree.AuthoringMemory.Panel" /> </object> </tr> </table> </td> <td style="width: 30%"> <!-- Placeholder for Linguistic panel --> <object class="panel" id="LinguisticPlaceHolder" classid="clsid:D07DB8E1-43C9-4D6F-94A1-1F2B060A22E0" style="width: 100%; height: 100%"> <param name="ClientID" value="Congree.Linguistic.Panel" /> </object> </td> </tr> </table> <hr /> <input id="OpenFile" type="file" onchange="loadDocument()" style="width: 640px" /> </body> <script type="text/javascript"> var controlContext = null; // create Congree bootstrapper for XMax var congreeApplication = new ActiveXObject("Congree.Plugin.XMetal.XMax.ComShim"); function CreateControlContext() { var xmax = document.all["XMaxControl"]; if (congreeApplication != null && xmax != null) { var placeHolders = [ document.all["ToolbarPlaceHolder"], document.all["LinguisticPlaceHolder"], document.all["AuthoringMemoryPlaceHolder"] ]; // create control context controlContext = congreeApplication.CreateControlContext(xmax, JS2VBArray(placeHolders)); } } function OnUnload() { if (controlContext != null) { controlContext.Close(); controlContext = null; } if (congreeApplication != null) { congreeApplication.Destroy(); congreeApplication = null; } } function loadDocument() { var xmax = document.all["XMaxControl"]; xmax.LoadFromFile(document.all["OpenFile"].value); controlContext.UpdatePlaceholders(); } function JS2VBArray(objJsArray) { var dictionary = new ActiveXObject("Scripting.Dictionary"); for (var i = 0; i < objJsArray.length; i++) { dictionary.add(i, objJsArray[i]); } return dictionary.Items(); } </script> </html>
Load this Example.html page using the IE (remark: please allow IE to use embedded ActiveX controls). Than you will see the Browse button.
Click Browse and select a file which can be loaded via XMAX. Then log in to Congree via the Congree toolbar.
Fig.1 shows Congree integrated into XMAX, which is hosted in an IE page:
Fig.1 HTML example
Integration into XMAX version 12 and higher
When you integrate Сongree into XMAX 12 and higher, an issue occurs that leads to an error in the depths of the editor.
To prevent this problem, the XMAX control should be initialized before the Congree bootstrapper will be created.