3

我正在以编程方式绘制流程图(使用 Java UNO 运行时参考),其中我正在显示 If-Else 条件。但是在显示“ELSE”条件时我遇到了问题,因为在这种情况下,连接器在中间形状上移动(如 shwon在附图中)在此处输入图像描述

我用来绘制连接器的代码是:-

XShapes xShapes = (XShapes)
                UnoRuntime.queryInterface(XShapes.class, xDrawPage);
        XMultiServiceFactory xMsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDrawDoc);
        Object connector = xMsf.createInstance("com.sun.star.drawing.ConnectorShape"); 
        xShapes.add(UnoRuntime.queryInterface(XShape.class, connector));

XPropertySet xConnector2PropSet = (XPropertySet)UnoRuntime.queryInterface(
                XPropertySet.class, connector);
        xConnector2PropSet.setPropertyValue("EdgeKind", ConnectorType.STANDARD);
        xConnector2PropSet.setPropertyValue("StartShape", xShape1);
        xConnector2PropSet.setPropertyValue("StartGluePointIndex", new Integer(startPt));
        xConnector2PropSet.setPropertyValue("LineEndName", "Arrow");
        xConnector2PropSet.setPropertyValue("EndShape", xShape2 );
        xConnector2PropSet.setPropertyValue("EndGluePointIndex", new Integer(endPt));

请建议如何使用 Java 中的 UNO 运行时参考正确布局和路由连接器。

4

1 回答 1

5

我在 OpenOffice Draw 中遇到了同样的问题,找不到任何可能向一个连接器添加更多句柄。但是一个连接器可以以另一个连接器结束。所以我最终使用了两个连接器,第一个没有以箭头结尾(蓝色),第二个从第一个结束的地方开始(红色)。

非交叉连接器示例

于 2014-10-10T08:08:46.310 回答