Package ag.ion.bion.officelayer.application

Examples of ag.ion.bion.officelayer.application.IOfficeApplication


   *   that the finish request was refused
   *
   * @author Andreas Br�ker
   */
  public boolean performFinish() {
    IOfficeApplication officeApplication = EditorCorePlugin.getDefault().getManagedLocalOfficeApplication();
    if(!officeApplication.isActive()) {     
      NOAUIPlugin.startLocalOfficeApplication(getShell(), officeApplication);
    }
    if(officeApplication.isActive()) {
      INewDocumentRequest newDocumentRequest = getNewDocumentRequest();
      ConstructNewDocumentOperation constructNewDocumentOperation = new ConstructNewDocumentOperation(officeApplication,
          newDocumentRequest);
      try {
        getContainer().run(true, true, constructNewDocumentOperation);
View Full Code Here


        IOfficeApplication.LOCAL_APPLICATION);
    hashMap.put(IOfficeApplication.APPLICATION_HOME_KEY, officeHome);

    try {
      System.out.println("Activating OpenOffice.org connection ...");
      final IOfficeApplication application = OfficeApplicationRuntime
          .getApplication(hashMap);
      application.activate();
      final Frame frame = new Frame();
      frame.setVisible(true);
      frame.setSize(400, 400);
      frame.validate();
      Panel panel = new Panel(new BorderLayout());
      frame.add(panel);
      panel.setVisible(true);
      frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          frame.dispose();
          document.close();
          file.delete();
          try {
            System.out
                .println("Deactivating OpenOffice.org connection ...");
            application.deactivate();
          } catch (OfficeApplicationException applicationException) {
          }
        }
      });

      System.out.println("Constructing document for test ...");
      IFrame officeFrame = application.getDesktopService()
          .constructNewOfficeFrame(panel);
      document = application.getDocumentService()
          .constructNewHiddenDocument(IDocument.WRITER);
      System.out.println("Document for test constructed.");
      file = new File("OfficeBeanTest.odt");
      document.getPersistenceService().store(new FileOutputStream(file));
      document.close();
      System.out.println("Loading document for test ...");
      document = application.getDocumentService().loadDocument(
          officeFrame, new FileInputStream(file),
          new DocumentDescriptor());
      System.out.println("Document for test loaded.");
      frame.validate();
      officeFrame.getXFrame().getController().suspend(true);
      document.close();

      frame.dispose();
      document.close();
      file.delete();
      try {
        System.out
            .println("Deactivating OpenOffice.org connection ...");
        application.deactivate();
      } catch (OfficeApplicationException applicationException) {
      }
    } catch (Throwable throwable) {
      throwable.printStackTrace();
      fail(throwable.getMessage());
View Full Code Here

* @author Miriam Sutter
*/
public class ETextTableTest extends TestCase {

  public void testETextTable() {
    IOfficeApplication officeApplication = OfficeApplicationRuntime.getLocalOfficeApplication();
    ITextDocument docu = null;
    try {
 
      LocalOfficeApplicationConfiguration localOfficeApplicationConfiguration = new LocalOfficeApplicationConfiguration();
      localOfficeApplicationConfiguration.setPort("8101");
      localOfficeApplicationConfiguration.setApplicationHomePath("d:\\Programme\\OpenOffice.org1.1.3");
      officeApplication.setConfiguration(localOfficeApplicationConfiguration);
      officeApplication.activate();
      docu = (ITextDocument)officeApplication.getDocumentService().loadDocument("file:///d:/java/eclipse/workspace/officeapi/test/testETables.sxw");
     
      ITextTable table = docu.getTextTableService().getTextTables()[0];
      ETextTable textTable = new ETextTable(docu,table);
     
      textTable.addRows(200); //o.k.
     
      textTable.getCell(10,1).setCellFormula("<A100>+<B3>");
      textTable.getCell(10,2).setCellFormula("<A100:A200>+<B3:B7>");
//      textTable.addRows(1,10);  // o.k.
//      textTable.addRows(100,10); //o.k.
////      textTable.addRows(1,82); // o.k.
////      textTable.addRows(1,83); // o.k.
////       
////      textTable.addRows(100,82); // o.k.
////       
//      textTable.addRows(1,220); // o.k.
//      textTable.addRows(100,220); // o.k.
       
//        IETextTableCellRange tableCellRange = textTable.getCellRange(0,100,5,110);
//        Object[][] objects = tableCellRange.getData();
//        for(int i = 0; i < objects.length; i++) {
//          for(int j = 0; j < objects[i].length; j++) {
//            objects[i][j] = i + "/" + j;
//          }
//        }
//        tableCellRange.setData(objects);
//        System.out.println(textTable.getColumn(0).getCellRange().getRangeName().getRangeName());
//        System.out.println(textTable.getColumn(0).getCellRange().getCells()[0].getName().getName());;
//        System.out.println(textTable.getRow(7).getCellRange().getRangeName().getRangeName());
//        System.out.println(textTable.getRows()[7].getCellRange().getRangeName().getRangeName());
//        System.out.println(textTable.getCellRange(0,30,5,50).getRangeName().getRangeName());
//       
//        System.out.println(textTable.getColumn(0).getCellRange().getRangeName().getRangeName());
       
//        System.out.println(textTable.getCellRange(0,30,5,150).getRangeName().getRangeName());
//        System.out.println(textTable.getCellRange(0,0,textTable.getColumnCount()-1,textTable.getRowCount()-1).getRangeName().getRangeName());
//        System.out.println(textTable.getColumn(0).getCellRange().getCell(0,200,textTable.getColumnCount()).getName().getName());
//        System.out.println(textTable.getColumn(0).getCellRange().getCell(0,125,textTable.getColumnCount()).getTableCell().getTextService().getText().getText());
//       
//        ITextTable[] textTables = textTable.getTextTableManagement().getTextTables();
//        for(int i = 0; i < textTables.length; i++) {
//          System.out.println(textTables[i].getName());
//        }
        docu.close();
      }
      catch (Exception excep) {
        try {
          docu.close();
          officeApplication.deactivate();
        }
        catch(Exception e) {
          fail();
        }
        fail();
View Full Code Here

        IOfficeApplication.REMOTE_APPLICATION);
    hashMap.put(IOfficeApplication.APPLICATION_HOST_KEY, host);
    hashMap.put(IOfficeApplication.APPLICATION_PORT_KEY, port);

    try {
      IOfficeApplication officeApplication = OfficeApplicationRuntime
          .getApplication(hashMap);
      officeApplication.activate();

      System.out.println("Constructing a new writer document ...");
      ITextDocument textDocument = (ITextDocument) officeApplication
          .getDocumentService()
          .constructNewDocument(IDocument.WRITER,
              DocumentDescriptor.DEFAULT_HIDDEN);
      System.out
          .println("Inserting text into the new writer document ...");
      textDocument.getTextService().getText().setText(
          "This is a NOA test.");
      System.out.println("Storing new writer document ...");
      textDocument.getPersistenceService().store(
          new FileOutputStream("noatest.odt"));
      textDocument.close();
      officeApplication.deactivate();

    } catch (Throwable throwable) {
      throwable.printStackTrace();
    }
    System.out.println("NOA Remote Write Test successfully.");
View Full Code Here

  public static void main(String[] args) {       
    try {
      HashMap configuration = new HashMap();
      configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, OPEN_OFFICE_ORG_PATH);
      configuration.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
      final IOfficeApplication officeAplication = OfficeApplicationRuntime.getApplication(configuration)
     
      officeAplication.setConfiguration(configuration);
      officeAplication.activate();
     
      final Frame frame = new Frame();
      frame.setVisible(true);
      frame.setSize(400, 400);
      frame.validate();
      Panel panel = new Panel(new BorderLayout());
      frame.add(panel)
      panel.setVisible(true);
      frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent windowEvent) {
          frame.dispose();
          try {
            officeAplication.deactivate();
          }
          catch (OfficeApplicationException applicationException) {           
          }
        }       
      });
     
      IFrame officeFrame = officeAplication.getDesktopService().constructNewOfficeFrame(panel);
      officeAplication.getDocumentService().constructNewDocument(officeFrame, IDocument.WRITER, DocumentDescriptor.DEFAULT);
      frame.validate();
     
      //Now it is time to disable two commands in the frame
      officeFrame.disableDispatch(GlobalCommands.CLOSE_DOCUMENT);
      officeFrame.disableDispatch(GlobalCommands.QUIT_APPLICATION);
View Full Code Here

    try {     
      Frame frame = SWT_AWT.new_Frame(composite);     
      frame.setVisible(true);
      Panel panel = new Panel(new BorderLayout());
      frame.add(panel);
      IOfficeApplication officeApplication = getOfficeApplication(parent.getShell());
      if(officeApplication.isActive()) {
        IFrame officeFrame = officeApplication.getDesktopService().constructNewOfficeFrame(panel);
        setFrame(officeFrame);
       
        //resfresh file if possible
        if(editorInput instanceof IFileEditorInput) {
          IFile fileToRefresh = ((IFileEditorInput)editorInput).getFile();
View Full Code Here

    frame.updateDispatches();
  }

  @Override
  public ITutorialDocument loadDocument(IFile file) {
    IOfficeApplication officeApplication = EditorCorePlugin.getDefault()
        .getManagedLocalOfficeApplication();

    IDocument document = null;
    String path = file.getLocation().toString();
    try {
      document = officeApplication.getDocumentService().loadDocument(
          path, DocumentDescriptor.DEFAULT_HIDDEN);
    } catch (OfficeApplicationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (NOAException e) {
View Full Code Here

   *
   * @author Andreas Br�ker
   * @date 12.07.2006
   */
  protected IOfficeApplication getOfficeApplication() {
    IOfficeApplication officeApplication = EditorCorePlugin.getDefault().getManagedLocalOfficeApplication();
    NOAUIPlugin.startLocalOfficeApplication(Display.getCurrent().getActiveShell(), officeApplication);
    return officeApplication;
  }
View Full Code Here

* @author Miriam Sutter
*/
public class ETextTableTest extends TestCase {

  public void testETextTable() {
    IOfficeApplication officeApplication = OfficeApplicationRuntime
        .getLocalOfficeApplication();
    ITextDocument docu = null;
    try {

      LocalOfficeApplicationConfiguration localOfficeApplicationConfiguration = new LocalOfficeApplicationConfiguration();
      localOfficeApplicationConfiguration.setPort("8101");
      localOfficeApplicationConfiguration
          .setApplicationHomePath("d:\\Programme\\OpenOffice.org1.1.3");
      officeApplication
          .setConfiguration(localOfficeApplicationConfiguration);
      officeApplication.activate();
      docu = (ITextDocument) officeApplication
          .getDocumentService()
          .loadDocument(
              "file:///d:/java/eclipse/workspace/officeapi/test/testETables.sxw");

      ITextTable table = docu.getTextTableService().getTextTables()[0];
      ETextTable textTable = new ETextTable(docu, table);

      textTable.addRows(200); // o.k.

      textTable.getCell(10, 1).setCellFormula("<A100>+<B3>");
      textTable.getCell(10, 2).setCellFormula("<A100:A200>+<B3:B7>");
      // textTable.addRows(1,10); // o.k.
      // textTable.addRows(100,10); //o.k.
      // // textTable.addRows(1,82); // o.k.
      // // textTable.addRows(1,83); // o.k.
      // //
      // // textTable.addRows(100,82); // o.k.
      // //
      // textTable.addRows(1,220); // o.k.
      // textTable.addRows(100,220); // o.k.

      // IETextTableCellRange tableCellRange =
      // textTable.getCellRange(0,100,5,110);
      // Object[][] objects = tableCellRange.getData();
      // for(int i = 0; i < objects.length; i++) {
      // for(int j = 0; j < objects[i].length; j++) {
      // objects[i][j] = i + "/" + j;
      // }
      // }
      // tableCellRange.setData(objects);
      // System.out.println(textTable.getColumn(0).getCellRange().getRangeName().getRangeName());
      // System.out.println(textTable.getColumn(0).getCellRange().getCells()[0].getName().getName());;
      // System.out.println(textTable.getRow(7).getCellRange().getRangeName().getRangeName());
      // System.out.println(textTable.getRows()[7].getCellRange().getRangeName().getRangeName());
      // System.out.println(textTable.getCellRange(0,30,5,50).getRangeName().getRangeName());
      //       
      // System.out.println(textTable.getColumn(0).getCellRange().getRangeName().getRangeName());

      // System.out.println(textTable.getCellRange(0,30,5,150).getRangeName().getRangeName());
      // System.out.println(textTable.getCellRange(0,0,textTable.getColumnCount()-1,textTable.getRowCount()-1).getRangeName().getRangeName());
      // System.out.println(textTable.getColumn(0).getCellRange().getCell(0,200,textTable.getColumnCount()).getName().getName());
      // System.out.println(textTable.getColumn(0).getCellRange().getCell(0,125,textTable.getColumnCount()).getTableCell().getTextService().getText().getText());
      //       
      // ITextTable[] textTables =
      // textTable.getTextTableManagement().getTextTables();
      // for(int i = 0; i < textTables.length; i++) {
      // System.out.println(textTables[i].getName());
      // }
      docu.close();
    } catch (Exception excep) {
      try {
        docu.close();
        officeApplication.deactivate();
      } catch (Exception e) {
        fail();
      }
      fail();
    }
View Full Code Here

TOP

Related Classes of ag.ion.bion.officelayer.application.IOfficeApplication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.