summaryrefslogtreecommitdiff
path: root/xmerge
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-04 20:10:45 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-04 20:10:45 +0100
commit327ed70fa568c0ea3944a5c714479dca03d5f3d5 (patch)
treed50cc33b0004d2763f182b4fd7b81541f697b4b5 /xmerge
parent95b3a6c722dd39668ac812d39ee7b4c6a78ac01e (diff)
Mechanically sanitize indentation
Change-Id: Ide8817aff3a6b5d07b56b54cecb36f7dc1407743
Diffstat (limited to 'xmerge')
-rw-r--r--xmerge/source/bridge/java/XMergeBridge.java685
1 files changed, 328 insertions, 357 deletions
diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java
index 6cf8497dd9eb..06d3b4b10564 100644
--- a/xmerge/source/bridge/java/XMergeBridge.java
+++ b/xmerge/source/bridge/java/XMergeBridge.java
@@ -21,7 +21,6 @@
* http://api.libreoffice.org/docs/common/ref/com/sun/star/module-ix.html
*/
-
/*Java Uno Helper Classes*/
import java.io.File;
import java.io.FileOutputStream;
@@ -61,14 +60,12 @@ import com.sun.star.xml.sax.InputSource;
import com.sun.star.xml.sax.XDocumentHandler;
import com.sun.star.xml.sax.XParser;
-
/** This outer class provides an inner class to implement the service
* description and a method to instantiate the
* component on demand (__getServiceFactory()).
*/
public class XMergeBridge {
-
private static XMultiServiceFactory xMSF;
private static XInputStream xInStream =null;
private static XOutputStream xOutStream=null;
@@ -83,29 +80,27 @@ public class XMergeBridge {
* of the service description. It implements the needed interfaces.
*/
public static class _XMergeBridge implements
- XImportFilter,
- XExportFilter,
- XServiceName,
- XServiceInfo,
- XDocumentHandler,
- XTypeProvider {
+ XImportFilter,
+ XExportFilter,
+ XServiceName,
+ XServiceInfo,
+ XDocumentHandler,
+ XTypeProvider {
/** The component will be registered under this name.
*/
private static final String __serviceName = "com.sun.star.documentconversion.XMergeBridge";
-
-
public com.sun.star.uno.Type[] getTypes() {
Type[] typeReturn = {};
try {
typeReturn = new Type[] {
- new Type( XTypeProvider.class ),
- new Type( XImportFilter.class ),
- new Type( XExportFilter.class ),
- new Type( XServiceName.class ),
- new Type( XServiceInfo.class ) };
+ new Type( XTypeProvider.class ),
+ new Type( XImportFilter.class ),
+ new Type( XExportFilter.class ),
+ new Type( XServiceName.class ),
+ new Type( XServiceInfo.class ) };
}
catch( Exception exception ) {
@@ -114,419 +109,395 @@ public class XMergeBridge {
return typeReturn;
}
- private String getFileName(String origName)
- {
- String name;
- if (origName !=null)
+ private String getFileName(String origName)
{
- if(origName.equalsIgnoreCase(""))
- name = "OutFile";
- else {
- if (origName.lastIndexOf("/")>=0){
- origName=origName.substring(origName.lastIndexOf("/")+1,origName.length());
- }
- if (origName.lastIndexOf(".")>=0){
- name = origName.substring(0,(origName.lastIndexOf(".")));
+ String name;
+ if (origName !=null)
+ {
+ if(origName.equalsIgnoreCase(""))
+ name = "OutFile";
+ else {
+ if (origName.lastIndexOf("/")>=0){
+ origName=origName.substring(origName.lastIndexOf("/")+1,origName.length());
+ }
+ if (origName.lastIndexOf(".")>=0){
+ name = origName.substring(0,(origName.lastIndexOf(".")));
+ }
+ else{
+ name=origName;
+ }
+ }
}
else{
- name=origName;
+ name = "OutFile";
}
+ return name;
}
- }
- else{
- name = "OutFile";
- }
- return name;
- }
-
+ public boolean importer(com.sun.star.beans.PropertyValue[] aSourceData,
+ com.sun.star.xml.sax.XDocumentHandler xDocHandler,
+ String[] msUserData) throws com.sun.star.uno.RuntimeException {
- public boolean importer(com.sun.star.beans.PropertyValue[] aSourceData,
- com.sun.star.xml.sax.XDocumentHandler xDocHandler,
- String[] msUserData) throws com.sun.star.uno.RuntimeException {
-
- sFileName="";
- sURL="";
- udJarPath=msUserData[1];
- offMime =msUserData[4];
- sdMime = msUserData[5];
- com.sun.star.io.XInputStream xis=null;
- com.sun.star.beans.PropertyValue[] pValue = aSourceData;
-
- for (int i = 0 ; i < pValue.length; i++)
- {
+ sFileName="";
+ sURL="";
+ udJarPath=msUserData[1];
+ offMime =msUserData[4];
+ sdMime = msUserData[5];
+ com.sun.star.io.XInputStream xis=null;
+ com.sun.star.beans.PropertyValue[] pValue = aSourceData;
+
+ for (int i = 0 ; i < pValue.length; i++)
+ {
- try{
- if (pValue[i].Name.equals("InputStream")){
- xis=(com.sun.star.io.XInputStream)AnyConverter.toObject(new Type(com.sun.star.io.XInputStream.class), pValue[i].Value);
- }
- if (pValue[i].Name.equals("FileName")){
- sFileName=(String)AnyConverter.toObject(new Type(String.class), pValue[i].Value);
- }
+ try{
+ if (pValue[i].Name.equals("InputStream")){
+ xis=(com.sun.star.io.XInputStream)AnyConverter.toObject(new Type(com.sun.star.io.XInputStream.class), pValue[i].Value);
+ }
+ if (pValue[i].Name.equals("FileName")){
+ sFileName=(String)AnyConverter.toObject(new Type(String.class), pValue[i].Value);
+ }
- }
- catch(com.sun.star.lang.IllegalArgumentException AnyExec){
- System.out.println("\nIllegalArgumentException "+AnyExec);
- }
+ }
+ catch(com.sun.star.lang.IllegalArgumentException AnyExec){
+ System.out.println("\nIllegalArgumentException "+AnyExec);
+ }
+ }
+ try{
+
+ Object xCfgMgrObj=xMSF.createInstance("com.sun.star.config.SpecialConfigManager");
+ XConfigManager xCfgMgr = UnoRuntime.queryInterface(
+ XConfigManager.class , xCfgMgrObj );
+ String PathString=xCfgMgr.substituteVariables("$(progurl)" );
+ PathString= PathString.concat("/");
+ udJarPath= PathString.concat(udJarPath);
+
+ Object xPipeObj=xMSF.createInstance("com.sun.star.io.Pipe");
+ xInStream = UnoRuntime.queryInterface(
+ XInputStream.class , xPipeObj );
+ xOutStream = UnoRuntime.queryInterface(
+ XOutputStream.class , xPipeObj );
+ convert (xis,xOutStream,false,udJarPath,sFileName,offMime,sdMime);
+ Object xSaxParserObj=xMSF.createInstance("com.sun.star.xml.sax.Parser");
+
+ XParser xParser = UnoRuntime.queryInterface(
+ XParser.class , xSaxParserObj );
+ xOutStream.closeOutput();
+ InputSource aInput = new InputSource();
+ if (sFileName==null){
+ sFileName="";
+ }
+ aInput.sSystemId = sFileName;
+ aInput.aInputStream =xInStream;
+ xParser.setDocumentHandler ( xDocHandler );
+
+ xParser.parseStream ( aInput );
+ xOutStream.closeOutput();
+ xInStream.closeInput();
+ }
+ catch (IOException e){
+ return false;
+ }
+ catch (Exception e){
+ return false;
+ }
+ return true;
}
+ public boolean exporter(com.sun.star.beans.PropertyValue[] aSourceData,
+ String[] msUserData) throws com.sun.star.uno.RuntimeException{
- try{
-
- Object xCfgMgrObj=xMSF.createInstance("com.sun.star.config.SpecialConfigManager");
- XConfigManager xCfgMgr = UnoRuntime.queryInterface(
- XConfigManager.class , xCfgMgrObj );
- String PathString=xCfgMgr.substituteVariables("$(progurl)" );
- PathString= PathString.concat("/");
- udJarPath= PathString.concat(udJarPath);
-
- Object xPipeObj=xMSF.createInstance("com.sun.star.io.Pipe");
- xInStream = UnoRuntime.queryInterface(
- XInputStream.class , xPipeObj );
- xOutStream = UnoRuntime.queryInterface(
- XOutputStream.class , xPipeObj );
- convert (xis,xOutStream,false,udJarPath,sFileName,offMime,sdMime);
- Object xSaxParserObj=xMSF.createInstance("com.sun.star.xml.sax.Parser");
-
- XParser xParser = UnoRuntime.queryInterface(
- XParser.class , xSaxParserObj );
- xOutStream.closeOutput();
- InputSource aInput = new InputSource();
- if (sFileName==null){
- sFileName="";
- }
- aInput.sSystemId = sFileName;
- aInput.aInputStream =xInStream;
- xParser.setDocumentHandler ( xDocHandler );
+ sFileName=null;
+ sURL=null;
+ udJarPath=msUserData[1];
+ offMime =msUserData[4];
+ sdMime = msUserData[5];
- xParser.parseStream ( aInput );
- xOutStream.closeOutput();
- xInStream.closeInput();
+ com.sun.star.beans.PropertyValue[] pValue = aSourceData;
+ for (int i = 0 ; i < pValue.length; i++)
+ {
- }
- catch (IOException e){
- return false;
- }
- catch (Exception e){
- return false;
- }
- return true;
- }
+ try{
+ if (pValue[i].Name.equals("OutputStream")){
+ xos=(com.sun.star.io.XOutputStream)AnyConverter.toObject(new Type(com.sun.star.io.XOutputStream.class), pValue[i].Value);
+ }
+
+ if (pValue[i].Name.equals("FileName")){
+ sFileName=(String)AnyConverter.toObject(new Type(String.class), pValue[i].Value);
+ }
+
+ if (pValue[i].Name.equals("URL")){
+ sURL=(String)AnyConverter.toObject(new Type(String.class), pValue[i].Value);
+ }
+ }
+ catch(com.sun.star.lang.IllegalArgumentException AnyExec){
+ System.out.println("\nIllegalArgumentException "+AnyExec);
+ }
+ }
- public boolean exporter(com.sun.star.beans.PropertyValue[] aSourceData,
- String[] msUserData) throws com.sun.star.uno.RuntimeException{
+ if (sURL==null){
+ sURL="";
+ }
- sFileName=null;
- sURL=null;
- udJarPath=msUserData[1];
- offMime =msUserData[4];
- sdMime = msUserData[5];
+ try{
- com.sun.star.beans.PropertyValue[] pValue = aSourceData;
- for (int i = 0 ; i < pValue.length; i++)
- {
+ Object xCfgMgrObj=xMSF.createInstance("com.sun.star.config.SpecialConfigManager");
+ XConfigManager xCfgMgr = UnoRuntime.queryInterface(
+ XConfigManager.class , xCfgMgrObj );
+ String PathString=xCfgMgr.substituteVariables("$(progurl)" );
+ PathString= PathString.concat("/");
+ udJarPath= PathString.concat(udJarPath);
- try{
- if (pValue[i].Name.equals("OutputStream")){
- xos=(com.sun.star.io.XOutputStream)AnyConverter.toObject(new Type(com.sun.star.io.XOutputStream.class), pValue[i].Value);
+ Object xPipeObj=xMSF.createInstance("com.sun.star.io.Pipe");
+ xInStream = UnoRuntime.queryInterface(
+ XInputStream.class , xPipeObj );
+ xOutStream = UnoRuntime.queryInterface(
+ XOutputStream.class , xPipeObj );
}
-
- if (pValue[i].Name.equals("FileName")){
- sFileName=(String)AnyConverter.toObject(new Type(String.class), pValue[i].Value);
+ catch (Exception e){
+ System.out.println("Exception "+e);
+ return false;
}
- if (pValue[i].Name.equals("URL")){
- sURL=(String)AnyConverter.toObject(new Type(String.class), pValue[i].Value);
- }
- }
- catch(com.sun.star.lang.IllegalArgumentException AnyExec){
- System.out.println("\nIllegalArgumentException "+AnyExec);
+ return true;
}
- }
-
- if (sURL==null){
- sURL="";
+ private String needsMask(String origString){
+ if (origString.contains("&")) {
+ origString = origString.replace("&","&amp;");
+ }
+ if (origString.contains("\"")) {
+ origString = origString.replace("\"","&quot;");
+ }
+ if (origString.contains("<")) {
+ origString = origString.replace("<","&lt;");
+ }
+ if (origString.contains(">")) {
+ origString = origString.replace(">","&gt;");
+ }
+ return origString;
}
- try{
-
- Object xCfgMgrObj=xMSF.createInstance("com.sun.star.config.SpecialConfigManager");
- XConfigManager xCfgMgr = UnoRuntime.queryInterface(
- XConfigManager.class , xCfgMgrObj );
-
- String PathString=xCfgMgr.substituteVariables("$(progurl)" );
- PathString= PathString.concat("/");
- udJarPath= PathString.concat(udJarPath);
-
- Object xPipeObj=xMSF.createInstance("com.sun.star.io.Pipe");
- xInStream = UnoRuntime.queryInterface(
- XInputStream.class , xPipeObj );
- xOutStream = UnoRuntime.queryInterface(
- XOutputStream.class , xPipeObj );
- }
- catch (Exception e){
- System.out.println("Exception "+e);
- return false;
+ public void startDocument () {
}
- return true;
- }
+ public void endDocument()throws com.sun.star.uno.RuntimeException
+ {
+ try{
+ xOutStream.closeOutput();
+ convert (xInStream,xos,true,udJarPath,sURL,offMime,sdMime);
+ }
+ catch (IOException e){
+ throw new com.sun.star.uno.RuntimeException(e);
- private String needsMask(String origString){
- if (origString.contains("&")) {
- origString = origString.replace("&","&amp;");
- }
- if (origString.contains("\"")) {
- origString = origString.replace("\"","&quot;");
- }
- if (origString.contains("<")) {
- origString = origString.replace("<","&lt;");
- }
- if (origString.contains(">")) {
- origString = origString.replace(">","&gt;");
+ }
+ catch (Exception e){
+ throw new com.sun.star.uno.RuntimeException(e);
+
+ }
}
- return origString;
- }
+ public void startElement (String str, com.sun.star.xml.sax.XAttributeList xattribs)
+ {
+ str="<".concat(str);
+ if (xattribs !=null)
+ {
+ str= str.concat(" ");
+ int len=xattribs.getLength();
+ for (short i=0;i<len;i++)
+ {
+ str=str.concat(xattribs.getNameByIndex(i));
+ str=str.concat("=\"");
+ str=str.concat(needsMask(xattribs.getValueByIndex(i)));
+ str=str.concat("\" ");
+ }
+ }
+ str=str.concat(">");
- public void startDocument () {
- }
+ try{
+ xOutStream.writeBytes(str.getBytes("UTF-8"));
+ }
+ catch (Exception e){
+ System.out.println("\n"+e);
+ }
- public void endDocument()throws com.sun.star.uno.RuntimeException
- {
+ }
- try{
- xOutStream.closeOutput();
- convert (xInStream,xos,true,udJarPath,sURL,offMime,sdMime);
+ public void endElement(String str){
- }
- catch (IOException e){
- throw new com.sun.star.uno.RuntimeException(e);
+ str="</".concat(str);
+ str=str.concat(">");
+ try{
+ xOutStream.writeBytes(str.getBytes("UTF-8"));
- }
- catch (Exception e){
- throw new com.sun.star.uno.RuntimeException(e);
+ }
+ catch (Exception e){
+ System.out.println("\n"+e);
+ }
}
- }
-
+ public void characters(String str){
+ str=needsMask(str);
+ try{
+ xOutStream.writeBytes(str.getBytes("UTF-8"));
+ }
+ catch (Exception e){
+ System.out.println("\n"+e);
+ }
+ }
- public void startElement (String str, com.sun.star.xml.sax.XAttributeList xattribs)
- {
+ public void ignorableWhitespace(String str){
- str="<".concat(str);
- if (xattribs !=null)
- {
- str= str.concat(" ");
- int len=xattribs.getLength();
- for (short i=0;i<len;i++)
- {
- str=str.concat(xattribs.getNameByIndex(i));
- str=str.concat("=\"");
- str=str.concat(needsMask(xattribs.getValueByIndex(i)));
- str=str.concat("\" ");
- }
}
- str=str.concat(">");
+ public void processingInstruction(String aTarget, String aData){
- try{
- xOutStream.writeBytes(str.getBytes("UTF-8"));
}
- catch (Exception e){
- System.out.println("\n"+e);
- }
-
- }
- public void endElement(String str){
+ public void setDocumentLocator(com.sun.star.xml.sax.XLocator xLocator){
- str="</".concat(str);
- str=str.concat(">");
- try{
- xOutStream.writeBytes(str.getBytes("UTF-8"));
-
- }
- catch (Exception e){
- System.out.println("\n"+e);
}
+ private void convert (com.sun.star.io.XInputStream xml,com.sun.star.io.XOutputStream device,
+ boolean convertFromOffice,String pluginUrl,String FileName,String offMime,String sdMime) throws com.sun.star.uno.RuntimeException, IOException {
- }
- public void characters(String str){
- str=needsMask(str);
- try{
- xOutStream.writeBytes(str.getBytes("UTF-8"));
- }
- catch (Exception e){
- System.out.println("\n"+e);
- }
+ String jarName = pluginUrl;
+ String name= getFileName(FileName);
+ Iterator<ConverterInfo> ciEnum= null;
- }
+ XInputStreamToInputStreamAdapter xis =new XInputStreamToInputStreamAdapter(xml);
- public void ignorableWhitespace(String str){
+ XOutputStreamToOutputStreamAdapter newxos =new XOutputStreamToOutputStreamAdapter(device);
+ try{
+ ConverterInfoReader cir = new ConverterInfoReader(jarName,false);
+ ciEnum =cir.getConverterInfoEnumeration();
+ }
+ catch (ParserConfigurationException pexc){
+ System.out.println("Error:"+pexc);
+ }
+ catch ( org.xml.sax.SAXException pexc){
+ System.out.println("Error:"+pexc);
+ }
+ catch(Exception e){
+ System.out.println("Error:"+e);
+ }
+ ConverterInfoMgr. removeByJar(jarName);
+ if (convertFromOffice)
+ {
+ try {
- }
- public void processingInstruction(String aTarget, String aData){
+ //Check to see if jar contains a plugin Impl
- }
+ ConverterInfoMgr.addPlugIn(ciEnum);
+ ConverterFactory cf = new ConverterFactory();
- public void setDocumentLocator(com.sun.star.xml.sax.XLocator xLocator){
+ Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),false);
+ if (cv == null) {
+ System.out.println("\nNo plug-in exists to convert from <staroffice/sxw> to <specified format> ");
- }
+ }
+ else
+ {
+ cv.addInputStream(name,xis,false);
+ ConvertData dataOut = cv.convert();
+ Iterator<Object> docEnum = dataOut.getDocumentEnumeration();
+ if (docEnum.hasNext()){
+ Document docOut = (Document)docEnum.next();
+ docOut.write(newxos);
+ newxos.flush();
+ newxos.close();
+ int i=1;
+ while (docEnum.hasNext() && sURL.startsWith("file:")) {
+ URI uri=new URI(sURL);
+ String newFileName= getPath(uri);
- private void convert (com.sun.star.io.XInputStream xml,com.sun.star.io.XOutputStream device,
- boolean convertFromOffice,String pluginUrl,String FileName,String offMime,String sdMime) throws com.sun.star.uno.RuntimeException, IOException {
+ File newFile;
+ if (newFileName.lastIndexOf(".")!=-1){
+ newFile =new File(newFileName.substring(0,newFileName.lastIndexOf("."))+String.valueOf(i)+newFileName.substring(newFileName.lastIndexOf(".")));
+ }
+ else{
+ newFile =new File(newFileName.concat(String.valueOf(i)));
+ }
- String jarName = pluginUrl;
- String name= getFileName(FileName);
+ FileOutputStream fos = new FileOutputStream(newFile);
+ docOut = (Document)docEnum.next();
+ docOut.write(fos);
+ fos.flush();
+ fos.close();
+ i++;
- Iterator<ConverterInfo> ciEnum= null;
+ }
- XInputStreamToInputStreamAdapter xis =new XInputStreamToInputStreamAdapter(xml);
+ }
+ }
+ ConverterInfoMgr.removeByJar(jarName);
+ }
+ catch (Exception ex1) {
+ IOException ex2 = new IOException();
+ ex2.initCause(ex1);
+ throw ex2;
+ }
+ }
+ else{
+ try {
+ //Check to see if jar contains a plugin Impl
+ ConverterInfoMgr.addPlugIn(ciEnum);
+ ConverterFactory cf = new ConverterFactory();
+ Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),true);
+ if (cv == null) {
+ System.out.println("\nNo plug-in exists to convert to <staroffice/sxw> from <specified format>");
+ }
+ else
+ {
+
+ cv.addInputStream(name,xis,false);
+ ConvertData dataIn = cv.convert();
+ Iterator<Object> docEnum = dataIn.getDocumentEnumeration();
+ while (docEnum.hasNext()) {
+ OfficeDocument docIn = (OfficeDocument)docEnum.next();
+
+ docIn.write(newxos,false);
+ }
+ newxos.close();
+ }
+ ConverterInfoMgr.removeByJar(jarName);
+ }
+ catch (StackOverflowError sOE){
+ System.out.println("\nERROR : Stack Overflow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n");
+ }
+ catch (Exception ex1) {
+ IOException ex2 = new IOException();
+ ex2.initCause(ex1);
+ throw ex2;
+ }
- XOutputStreamToOutputStreamAdapter newxos =new XOutputStreamToOutputStreamAdapter(device);
- try{
- ConverterInfoReader cir = new ConverterInfoReader(jarName,false);
- ciEnum =cir.getConverterInfoEnumeration();
- }
- catch (ParserConfigurationException pexc){
- System.out.println("Error:"+pexc);
- }
- catch ( org.xml.sax.SAXException pexc){
- System.out.println("Error:"+pexc);
- }
- catch(Exception e){
- System.out.println("Error:"+e);
- }
- ConverterInfoMgr. removeByJar(jarName);
- if (convertFromOffice)
- {
-
- try {
-
- //Check to see if jar contains a plugin Impl
-
- ConverterInfoMgr.addPlugIn(ciEnum);
- ConverterFactory cf = new ConverterFactory();
-
- Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),false);
- if (cv == null) {
- System.out.println("\nNo plug-in exists to convert from <staroffice/sxw> to <specified format> ");
-
- }
- else
- {
- cv.addInputStream(name,xis,false);
- ConvertData dataOut = cv.convert();
-
- Iterator<Object> docEnum = dataOut.getDocumentEnumeration();
-
- if (docEnum.hasNext()){
- Document docOut = (Document)docEnum.next();
- docOut.write(newxos);
-
- newxos.flush();
- newxos.close();
-
-
- int i=1;
- while (docEnum.hasNext() && sURL.startsWith("file:")) {
-
- URI uri=new URI(sURL);
- String newFileName= getPath(uri);
-
- File newFile;
- if (newFileName.lastIndexOf(".")!=-1){
- newFile =new File(newFileName.substring(0,newFileName.lastIndexOf("."))+String.valueOf(i)+newFileName.substring(newFileName.lastIndexOf(".")));
- }
- else{
- newFile =new File(newFileName.concat(String.valueOf(i)));
- }
-
- FileOutputStream fos = new FileOutputStream(newFile);
- docOut = (Document)docEnum.next();
- docOut.write(fos);
- fos.flush();
- fos.close();
- i++;
-
- }
-
- }
- }
- ConverterInfoMgr.removeByJar(jarName);
- }
- catch (Exception ex1) {
- IOException ex2 = new IOException();
- ex2.initCause(ex1);
- throw ex2;
- }
- }
- else{
-
- try {
- //Check to see if jar contains a plugin Impl
- ConverterInfoMgr.addPlugIn(ciEnum);
- ConverterFactory cf = new ConverterFactory();
- Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),true);
- if (cv == null) {
- System.out.println("\nNo plug-in exists to convert to <staroffice/sxw> from <specified format>");
- }
- else
- {
-
- cv.addInputStream(name,xis,false);
- ConvertData dataIn = cv.convert();
- Iterator<Object> docEnum = dataIn.getDocumentEnumeration();
- while (docEnum.hasNext()) {
- OfficeDocument docIn = (OfficeDocument)docEnum.next();
-
- docIn.write(newxos,false);
- }
- newxos.close();
- }
- ConverterInfoMgr.removeByJar(jarName);
- }
- catch (StackOverflowError sOE){
- System.out.println("\nERROR : Stack Overflow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n");
- }
- catch (Exception ex1) {
- IOException ex2 = new IOException();
- ex2.initCause(ex1);
- throw ex2;
- }
-
-
- }
+ }
- }
+ }
private String getPath(URI uri){
- String path = uri.getPath();
- String opSys=System.getProperty("os.name");
- if(opSys.contains("Windows")){
- path= path.replace('/','\\');
- path = path.substring(1);
+ String path = uri.getPath();
+ String opSys=System.getProperty("os.name");
+ if(opSys.contains("Windows")){
+ path= path.replace('/','\\');
+ path = path.substring(1);
+ }
+ return path;
}
- return path;
- }
// Implement methods from interface XTypeProvider
public byte[] getImplementationId() {
@@ -568,15 +539,15 @@ public class XMergeBridge {
* @see com.sun.star.comp.loader.JavaLoader
*/
public static XSingleServiceFactory __getServiceFactory(String implName,
- XMultiServiceFactory multiFactory,
- XRegistryKey regKey) {
- xMSF= multiFactory;
+ XMultiServiceFactory multiFactory,
+ XRegistryKey regKey) {
+ xMSF= multiFactory;
XSingleServiceFactory xSingleServiceFactory = null;
if (implName.equals(_XMergeBridge.class.getName()) ) {
xSingleServiceFactory = FactoryHelper.getServiceFactory(_XMergeBridge.class,
- _XMergeBridge.__serviceName,
- multiFactory,
- regKey);
+ _XMergeBridge.__serviceName,
+ multiFactory,
+ regKey);
}
return xSingleServiceFactory;