WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);
XControlModel the_Model = aShape.getControl();
//Try to query XControlAccess
XControlAccess the_access = (XControlAccess) UnoRuntime.queryInterface(
XControlAccess.class,
xTextDoc.getCurrentController());
XController cntrlr = (XController) UnoRuntime.queryInterface(
XController.class,
xTextDoc.getCurrentController());
//now get the toolkit
try {
win = cntrlr.getFrame().getContainerWindow();
//win = (XWindow) UnoRuntime.queryInterface(XWindow.class, ctrl) ;
the_win = the_access.getControl(the_Model).getPeer();
oObj = (XInterface) ((XMultiServiceFactory) Param.getMSF()).createInstance(
"com.sun.star.awt.Toolkit");
} catch (com.sun.star.uno.Exception e) {
log.println("Couldn't get toolkit");
e.printStackTrace(log);