https://bugs.documentfoundation.org/show_bug.cgi?id=100756

            Bug ID: 100756
           Summary: FileOpen: Opening documents via LibreOffice (from
                    other applications)
           Product: LibreOffice
           Version: 5.0.6.3 release
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 126061
  --> https://bugs.documentfoundation.org/attachment.cgi?id=126061&action=edit
Testprogram and Screenshot

We are using Java Uno API to open documents from other applications with LO
Calc. Since LO 4.4 this process takes a long time (from LO 4.4 up to LO 5.1.4).
LO 4.3.7 is the last "normal" working version.

LO 4.3.7 - 33821 Milliseconds
LO 5.0.6 - 128793 Milliseconds
LO 5.1.4 - 147996 Milliseconds
(Attachment: cmd.jpg)

Steps to reproduce:
1) copy the file (attachment: Libreofficetest.jar) into c:\temp
2) open a command prompt window
3) goto c:\temp and paste:
java -cp Libreofficetest.jar;"C:\Program Files (x86)\LibreOffice
4\URE\java\java_uno.jar";"C:\Program Files (x86)\LibreOffice
4\URE\java\juh.jar";"C:\Program Files (x86)\LibreOffice
4\URE\java\jurt.jar";"C:\Program Files (x86)\LibreOffice
4\program\classes\unoil.jar";"C:\Program Files (x86)\LibreOffice
4\URE\java\unoloader.jar";"C:\Program Files (x86)\LibreOffice
4\URE\java\ridl.jar" test/TestLibreOffice
4) hit enter (LO 4.3.7) 

or

java -cp Libreofficetest.jar;"C:\Program Files (x86)\LibreOffice
5\program\classes\java_uno.jar";"C:\Program Files (x86)\LibreOffice
5\program\classes\juh.jar";"C:\Program Files (x86)\LibreOffice
5\program\classes\jurt.jar";"C:\Program Files (x86)\LibreOffice
5\program\classes\unoil.jar";"C:\Program Files (x86)\LibreOffice
5\program\classes\unoloader.jar";"C:\Program Files (x86)\LibreOffice
5\program\classes\ridl.jar" test/TestLibreOffice

(Lo 5.0.6 and 5.1.4)

5) Don't close LO!
6) you should see in the cmd-window: Time to fill Spreadsheet: XXXXX
milliseconds




Code "Libreofficetest.jar":

package test;

import java.util.Date;

import com.sun.star.beans.PropertyValue;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.sheet.XSpreadsheet;
import com.sun.star.sheet.XSpreadsheetDocument;
import com.sun.star.table.XCell;
import com.sun.star.text.XText;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;

public class TestLibreOffice {

        public static void main(String[] args) {
                try {
                        // Connect to Libreoffice and create a new Spreadsheet.
                        XComponentContext xContext = Bootstrap.bootstrap();
                        XMultiComponentFactory xMCF =
xContext.getServiceManager();
                        Object oDesktop =
xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
                        // query the desktop object for the XComponentLoader
                        XComponentLoader xCLoader = (XComponentLoader)
UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);
                        PropertyValue[] lProperties = new PropertyValue[2];
                        XComponent xComp =
xCLoader.loadComponentFromURL("private:factory/scalc", "_blank", 0,
lProperties);
                        XSpreadsheetDocument document = (XSpreadsheetDocument)
UnoRuntime.queryInterface(XSpreadsheetDocument.class,
                                        xComp);
                        // Deactivate Recalculation and Screenupdates to
improve
                        // performance.
                        com.sun.star.sheet.XCalculatable xCalculateable =
(com.sun.star.sheet.XCalculatable) UnoRuntime
                                       
.queryInterface(com.sun.star.sheet.XCalculatable.class, document);
                        xCalculateable.enableAutomaticCalculation(false);
                        com.sun.star.frame.XModel xModel =
(com.sun.star.frame.XModel) UnoRuntime
                                       
.queryInterface(com.sun.star.frame.XModel.class, document);
                        xModel.lockControllers();

                        com.sun.star.document.XActionLockable xActionLockable =
(com.sun.star.document.XActionLockable) UnoRuntime
                                       
.queryInterface(com.sun.star.document.XActionLockable.class, document);

                        xActionLockable.addActionLock();
                        Object obj =
document.getSheets().getByName(document.getSheets().getElementNames()[0]);
                        XSpreadsheet sheet =
UnoRuntime.queryInterface(XSpreadsheet.class, obj);
                        long time = new Date().getTime();
                        // Fille the Spreadsheet with some values in a loop.
                        for (int row = 1; row < 1000; row++) {
                                for (int col = 1; col < 20; col++) {
                                        XCell cell =
sheet.getCellByPosition(col, row);
                                        XText xCellText = (XText)
UnoRuntime.queryInterface(XText.class, cell);
                                       
xCellText.insertString(xCellText.createTextCursor(), new Integer(row +
col).toString(), false);
                                }
                        }
                        // Report how long it took to fill the Spreadsheet.
                        System.out.println("Time to fill Spreadsheet:" + (new
Date().getTime() - time) + " milliseconds");
                        // Reenable Autoupdates
                        xActionLockable.removeActionLock();
                        xModel.unlockControllers();
                        xCalculateable.enableAutomaticCalculation(true);
                        System.exit(0);
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
}




LibreOffice 5.0.6, Win 7 PRO SP1 64 Bit, German, different Hardware and
different Users
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) Client VM (build 25.91-b14, mixed mode, sharing)

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to