Examples of XStorable


Examples of com.sun.star.frame.XStorable

        {
      Object object = getFactory().createInstance("com.sun.star.frame.Desktop");
      XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, object);
      XComponent xComponent = xComponentLoader.loadComponentFromURL(m_database.getDocumentURL(), "_blank",FrameSearchFlag.ALL, new PropertyValue[0]);
      m_database.close();
      XStorable storable = (XStorable)UnoRuntime.queryInterface(XStorable.class,xComponent);
      storable.store();
            XCloseable close = (XCloseable)UnoRuntime.queryInterface(XCloseable.class,xComponent);
            close.close(true);
        }
        catch ( Exception e )
        {
View Full Code Here

Examples of com.sun.star.frame.XStorable

            aOverwrite.Name = "Overwrite";
            aOverwrite.Value = Boolean.TRUE;
            aPropertyList.add(aOverwrite);

            // store the document in an other directory
            XStorable aStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, _xComponent);
            if (aStorable != null)
            {
                log.println("store document as URL: '" + sOutputURL + "'");
                try
                {
                    aStorable.storeAsURL(sOutputURL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
                }
                catch (com.sun.star.io.IOException e)
                {
                    log.println("ERROR: Exception caught");
                    log.println("Can't write document URL: '" + sOutputURL + "'");
View Full Code Here

Examples of com.sun.star.frame.XStorable

            XComponentLoader loader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class,xFrame);
            XComponent xComp  = null;
            xComp = loader.loadComponentFromURL(fName, "_blank", 0, properties);

            XTextDocument textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,xComp);
            XStorable storable = (XStorable) UnoRuntime.queryInterface(
                XStorable.class, xComp) ;
            /*XStorable storable = (XStorable) UnoRuntime.queryInterface(
                XStorable.class, xFrame.getController().getModel()) ; */
            PropertyValue[] propertyValue = new PropertyValue[ 3 ];
            propertyValue[0] = new com.sun.star.beans.PropertyValue();
            propertyValue[0].Name = "Overwrite";
            propertyValue[0].Value = Boolean.valueOf(true);
            propertyValue[1] = new com.sun.star.beans.PropertyValue();
            propertyValue[1].Name = "FilterName";
            propertyValue[1].Value = filterName;
            propertyValue[2]=new PropertyValue();
            propertyValue[2].Value="AsTemplate";
            propertyValue[2].Value=Boolean.valueOf(true);           
            //XOutputStreamToByteArrayAdapter outputStream = new XOutputStreamToByteArrayAdapter();
            //propertyValue[2] = new com.sun.star.beans.PropertyValue();
            //propertyValue[2].Name = "OutputStream";
            //propertyValue[2].Value = outputStream;
            try {
                storable.storeToURL( newFName, propertyValue );
            } catch (ErrorCodeIOException ecie) {
                System.out.println(ecie.ErrCode);
            }
//            storable.storeToURL( "private:stream", propertyValue );
//            outputStream.closeOutput();
View Full Code Here

Examples of com.sun.star.frame.XStorable

            XComponentLoader loader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class,xFrame);
            XComponent xComp  = null;
            xComp = loader.loadComponentFromURL(fName, "_blank", 0, properties);

            XTextDocument textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,xComp);
            XStorable storable = (XStorable) UnoRuntime.queryInterface(
                XStorable.class, xComp) ;
            /*XStorable storable = (XStorable) UnoRuntime.queryInterface(
                XStorable.class, xFrame.getController().getModel()) ; */
            PropertyValue[] propertyValue = new PropertyValue[ 3 ];
            propertyValue[0] = new com.sun.star.beans.PropertyValue();
            propertyValue[0].Name = "Overwrite";
            propertyValue[0].Value = Boolean.valueOf(true);
            propertyValue[1] = new com.sun.star.beans.PropertyValue();
            propertyValue[1].Name = "FilterName";
            propertyValue[1].Value = destinationFormats.getFilterName();
            propertyValue[2]=new PropertyValue();
            propertyValue[2].Value="AsTemplate";
            propertyValue[2].Value=Boolean.valueOf(true);           
            //XOutputStreamToByteArrayAdapter outputStream = new XOutputStreamToByteArrayAdapter();
            //propertyValue[2] = new com.sun.star.beans.PropertyValue();
            //propertyValue[2].Name = "OutputStream";
            //propertyValue[2].Value = outputStream;
            try {
                storable.storeToURL( newFName, propertyValue );
            } catch (ErrorCodeIOException ecie) {
                System.out.println(ecie.ErrCode);
            }
//            storable.storeToURL( "private:stream", propertyValue );
//            outputStream.closeOutput();
View Full Code Here

Examples of com.sun.star.frame.XStorable

    }

    private boolean storeToDisk() {
        // OK, here we will have small sample of wrong behavior, this means exception driven control flow... but it's easier ;p
        boolean result = true;
        XStorable storable = (XStorable) UnoRuntime.queryInterface(
                XStorable.class, m_xFrame.getController().getModel()) ;       
        try {
            storable.store();
        } catch (IOException ioe) {
            result = false;
        }
        return result;
    }
View Full Code Here

Examples of com.sun.star.frame.XStorable

  /**
   * Sauvegarde le document
   */
  public void save() {
    try {
      XStorable xStorable = unoCast(XStorable.class, component);
      xStorable.storeAsURL(xStorable.getLocation(), null);
      // Attention : ne pas utiliser la methode store, elle verole le
      // fichier
    } catch (Exception e) {
      throw new ImpressException(e);
    }
View Full Code Here

Examples of com.sun.star.frame.XStorable

    }
  }

  public void exportPdf() {
    try {
      XStorable xStorable = unoCast(XStorable.class, component);

      // Set properties for conversions
      PropertyValue[] convertProperties = new PropertyValue[2];

      convertProperties[0] = new PropertyValue();
      convertProperties[0].Name = "Overwrite";
      convertProperties[0].Value = true;

      convertProperties[1] = new PropertyValue();
      convertProperties[1].Name = "FilterName";
      convertProperties[1].Value = "writer_pdf_Export";

      String docLocation = xStorable.getLocation();
      String pdfLocation = docLocation.substring(0, docLocation
          .lastIndexOf('.'))
          + ".pdf";
      xStorable.storeToURL(pdfLocation, convertProperties);
    } catch (Exception e) {
      throw new ImpressException(e);
    }
  }
View Full Code Here

Examples of com.sun.star.frame.XStorable

            // Loading the wanted document
            Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(stringUrl, "_blank", 0, propertyvalue);

            // Getting an object that will offer a simple way to store a document to a URL.
            XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, objectDocumentToStore);

            // Preparing properties for comparing the document
            propertyvalue = new PropertyValue[ 1 ];
            // Setting the flag for overwriting
            propertyvalue[ 0 ] = new PropertyValue();
            propertyvalue[ 0 ].Name = "URL";
            propertyvalue[ 0 ].Value = stringOriginalFile;
            // Setting the filter name
            //propertyvalue[ 1 ] = new PropertyValue();
            //propertyvalue[ 1 ].Name = "FilterName";
            //propertyvalue[ 1 ].Value = context.get("convertFilterName");
            XFrame frame = desktop.getCurrentFrame();
            //XFrame frame = (XFrame) UnoRuntime.queryInterface(XFrame.class, desktop);
            Object dispatchHelperObj = xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.DispatchHelper", xcomponentcontext);
            XDispatchHelper dispatchHelper = (XDispatchHelper) UnoRuntime.queryInterface(XDispatchHelper.class, dispatchHelperObj);
            XDispatchProvider dispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, frame);
            dispatchHelper.executeDispatch(dispatchProvider, ".uno:CompareDocuments", "", 0, propertyvalue);

            // Preparing properties for storing the document
            propertyvalue = new PropertyValue[ 1 ];
            // Setting the flag for overwriting
            propertyvalue[ 0 ] = new PropertyValue();
            propertyvalue[ 0 ].Name = "Overwrite";
            propertyvalue[ 0 ].Value = Boolean.valueOf(true);
            // Setting the filter name
            //propertyvalue[ 1 ] = new PropertyValue();
            //propertyvalue[ 1 ].Name = "FilterName";
            //propertyvalue[ 1 ].Value = context.get("convertFilterName");

            Debug.logInfo("stringOutFile: "+stringOutFile, module);
            // Storing and converting the document
            xstorable.storeToURL(stringOutFile, propertyvalue);

            // Getting the method dispose() for closing the document
            XComponent xcomponent = (XComponent) UnoRuntime.queryInterface(XComponent.class,
            xstorable);
View Full Code Here

Examples of com.sun.star.frame.XStorable

        String stringUrl = convertToUrl(fileInPath, xcomponentcontext);
        Debug.logInfo("stringUrl:" + stringUrl, module);
        Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(stringUrl, "_blank", 0, propertyvalue);

        // Getting an object that will offer a simple way to store a document to a URL.
        XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, objectDocumentToStore);

        // Preparing properties for converting the document
        propertyvalue = new PropertyValue[ 3 ];
        // Setting the flag for overwriting
        propertyvalue[ 0 ] = new PropertyValue();
        propertyvalue[ 0 ].Name = "Overwrite";
        propertyvalue[ 0 ].Value = Boolean.valueOf(true);
        // Setting the filter name
        // Preparing properties for converting the document
        String filterName = getFilterNameFromMimeType(outputMimeType);

        propertyvalue[ 1 ] = new PropertyValue();
        propertyvalue[ 1 ].Name = "FilterName";
        propertyvalue[ 1 ].Value = filterName;

        propertyvalue[2] = new PropertyValue();
        propertyvalue[2].Name = "CompressionMode";
        propertyvalue[2].Value = "1";

        // Storing and converting the document
        //File newFile = new File(stringConvertedFile);
        //newFile.createNewFile();

        String stringConvertedFile = convertToUrl(fileOutPath, xcomponentcontext);
        Debug.logInfo("stringConvertedFile: "+stringConvertedFile, module);
        xstorable.storeToURL(stringConvertedFile, propertyvalue);

        // Getting the method dispose() for closing the document
        XComponent xcomponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xstorable);

        // Closing the converted document
View Full Code Here

Examples of com.sun.star.frame.XStorable

        if (objectDocumentToStore == null) {
            Debug.logError("Could not get objectDocumentToStore object from xcomponentloader.loadComponentFromURL", module);
        }

        // Getting an object that will offer a simple way to store a document to a URL.
        XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, objectDocumentToStore);
        if (xstorable == null) {
            Debug.logError("Could not get XStorable object from UnoRuntime.queryInterface", module);
        }

        // Preparing properties for converting the document
        String filterName = getFilterNameFromMimeType(outputMimeType);
        propertyvalue = new PropertyValue[4];

        propertyvalue[0] = new PropertyValue();
        propertyvalue[0].Name = "OutputStream";
        OpenOfficeByteArrayOutputStream os = new OpenOfficeByteArrayOutputStream();
        propertyvalue[0].Value = os;
        // Setting the filter name
        propertyvalue[1] = new PropertyValue();
        propertyvalue[1].Name = "FilterName";
        propertyvalue[1].Value = filterName;
        // Setting the flag for overwriting
        propertyvalue[3] = new PropertyValue();
        propertyvalue[3].Name = "Overwrite";
        propertyvalue[3].Value = Boolean.TRUE;
        // For PDFs
        propertyvalue[2] = new PropertyValue();
        propertyvalue[2].Name = "CompressionMode";
        propertyvalue[2].Value = "1";

        xstorable.storeToURL("private:stream", propertyvalue);
        //xstorable.storeToURL("file:///home/byersa/testdoc1_file.pdf", propertyvalue);

        // Getting the method dispose() for closing the document
        XComponent xcomponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xstorable);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.