mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-05 04:38:10 +08:00
DocFormatter : performance fix
This commit is contained in:
parent
bb247c84dd
commit
e01d7097cd
@ -136,6 +136,8 @@ public class DocFormatter extends AbstractFormatter {
|
|||||||
}
|
}
|
||||||
saveXComponent(xComponent, ooos, filterName);
|
saveXComponent(xComponent, ooos, filterName);
|
||||||
closeXComponent(xComponent);
|
closeXComponent(xComponent);
|
||||||
|
|
||||||
|
officeComponent.getOfficeConnection().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillTables() throws com.sun.star.uno.Exception {
|
private void fillTables() throws com.sun.star.uno.Exception {
|
||||||
|
@ -16,14 +16,17 @@ import com.sun.star.frame.XDispatchHelper;
|
|||||||
import com.sun.star.lang.XMultiComponentFactory;
|
import com.sun.star.lang.XMultiComponentFactory;
|
||||||
import com.sun.star.uno.Exception;
|
import com.sun.star.uno.Exception;
|
||||||
import com.sun.star.uno.XComponentContext;
|
import com.sun.star.uno.XComponentContext;
|
||||||
|
import ooo.connector.BootstrapSocketConnector;
|
||||||
|
|
||||||
import static com.haulmont.cuba.report.formatters.oo.ODTUnoConverter.*;
|
import static com.haulmont.cuba.report.formatters.oo.ODTUnoConverter.*;
|
||||||
|
|
||||||
public class OOOConnection {
|
public class OOOConnection {
|
||||||
private XComponentContext xComponentContext;
|
private XComponentContext xComponentContext;
|
||||||
|
private BootstrapSocketConnector bsc;
|
||||||
|
|
||||||
public OOOConnection(XComponentContext xComponentContext) {
|
public OOOConnection(XComponentContext xComponentContext, BootstrapSocketConnector bsc) {
|
||||||
this.xComponentContext = xComponentContext;
|
this.xComponentContext = xComponentContext;
|
||||||
|
this.bsc = bsc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XMultiComponentFactory getXMultiComponentFactory() {
|
public XMultiComponentFactory getXMultiComponentFactory() {
|
||||||
@ -49,4 +52,11 @@ public class OOOConnection {
|
|||||||
public XComponentContext getxComponentContext() {
|
public XComponentContext getxComponentContext() {
|
||||||
return xComponentContext;
|
return xComponentContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
if (bsc != null) {
|
||||||
|
bsc.disconnect();
|
||||||
|
bsc = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,9 @@ import ooo.connector.BootstrapSocketConnector;
|
|||||||
|
|
||||||
public class OOOConnector {
|
public class OOOConnector {
|
||||||
public static OOOConnection createConnection(String openOfficePath) throws BootstrapException {
|
public static OOOConnection createConnection(String openOfficePath) throws BootstrapException {
|
||||||
XComponentContext xComponentContext = new BootstrapSocketConnector(openOfficePath).connect();
|
BootstrapSocketConnector bsc = new BootstrapSocketConnector(openOfficePath);
|
||||||
OOOConnection oooConnection = new OOOConnection(xComponentContext);
|
XComponentContext xComponentContext = bsc.connect();
|
||||||
|
OOOConnection oooConnection = new OOOConnection(xComponentContext, bsc);
|
||||||
return oooConnection;
|
return oooConnection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user