Package com.sun.star.document

Examples of com.sun.star.document.XExporter


        try {
            oObj = (XInterface) xMSF.createInstanceWithArguments(
                "com.sun.star.comp.Impress.XMLStylesExporter",
                new Object[] {arg});
            XExporter xEx = (XExporter)
                UnoRuntime.queryInterface(XExporter.class,oObj);
            xEx.setSourceDocument(xImpressDoc);

            // Obtaining and changing property values
            XStyleFamiliesSupplier styleSup = (XStyleFamiliesSupplier)
                UnoRuntime.queryInterface
                (XStyleFamiliesSupplier.class, xImpressDoc) ;
View Full Code Here


        Any arg = new Any(new Type(XDocumentHandler.class), xDocHandWriter);
        XInterface oExp = (XInterface)xMSF.createInstanceWithArguments(
            "com.sun.star.comp." + docType + ".XML" + exportType + "Exporter",
            new Object[] {arg});

        XExporter xExp = (XExporter) UnoRuntime.queryInterface
            (XExporter.class, oExp) ;
        xExp.setSourceDocument(xDoc) ;

        XFilter filter = (XFilter) UnoRuntime.queryInterface(XFilter.class, oExp) ;
        filter.filter(XMLTools.createMediaDescriptor(
            new String[] {"FilterName"},
            new Object[] {"Custom filter"})) ;
View Full Code Here

    if (mDesc == null && !dummy) throw new StatusException(
                                    Status.failed("Relation not found.")) ;
            sourceDoc = (XComponent)tEnv.getObjRelation("SourceDocument");
        try {
            if (sourceDoc != null) {
                XExporter xEx = (XExporter)UnoRuntime.queryInterface(
                                                    XExporter.class,oObj);
                xEx.setSourceDocument(sourceDoc);
            }
        }
        catch (com.sun.star.lang.IllegalArgumentException e) {}
  }
View Full Code Here

        xComponent = Helper.createDocument( xServiceFactory,
          sUrl.toString(), "_blank", 0, pPropValues );
  
        Object GraphicExportFilter = xServiceFactory.createInstance
          ("com.sun.star.drawing.GraphicExportFilter");
        XExporter xExporter = (XExporter)
          UnoRuntime.queryInterface( XExporter.class, GraphicExportFilter );

        PropertyValue aProps[] = new PropertyValue[2];
        aProps[0] = new PropertyValue();
        aProps[0].Name = "MediaType";
        aProps[0].Value = "image/gif";

/* some graphics e.g. the Windows Metafile does not have a Media Type, for this case
        aProps[0].Name = "FilterName";  // it is possible to set a FilterName
        aProps[0].Value = "WMF";
*/
        java.io.File destFile = new java.io.File(args[1]);
        StringBuffer destUrl = new StringBuffer("file:///");
        destUrl.append(destFile.getCanonicalPath().replace('\\', '/'));
               
        aProps[1] = new PropertyValue();
        aProps[1].Name = "URL";
        aProps[1].Value = destUrl.toString();//args[ 1 ];
       
        int nPageIndex = Integer.parseInt( args[ 2 ] );
        if ( nPageIndex < PageHelper.getDrawPageCount( xComponent ) &&
                   nPageIndex > 1 )
        {
          XDrawPage xPage = PageHelper.getDrawPageByIndex( xComponent, nPageIndex );
          XComponent xComp = (XComponent)
            UnoRuntime.queryInterface( XComponent.class, xPage );
          xExporter.setSourceDocument( xComp );
          XFilter xFilter = (XFilter)
            UnoRuntime.queryInterface( XFilter.class, xExporter );
          xFilter.filter( aProps );
          System.out.println( "*** graphics on page \"" + nPageIndex + "\" from file \"" +
                                        args[0] + "\" exported under the name \""
View Full Code Here

  private File export(IShape shape, IDrawingDocument drawingDocument)
      throws java.lang.Exception {
    Object graphicExportFilter = drawingDocument.getServiceProvider()
        .createService("com.sun.star.drawing.GraphicExportFilter"); //$NON-NLS-1$

    XExporter xExporter = (XExporter) UnoRuntime.queryInterface(
        XExporter.class, graphicExportFilter);
    XComponent xComp = (XComponent) UnoRuntime.queryInterface(
        XComponent.class, shape.getXShape());
    xExporter.setSourceDocument(xComp);

    File destionation = ImageRepresentation.allocateTempImage("png"); //$NON-NLS-1$
    StringBuffer destUrl = new StringBuffer("file:///"); //$NON-NLS-1$
    destUrl.append(destionation.getCanonicalPath().replace('\\', '/'));
View Full Code Here

    public void export(){
        String sURL = getGui().raiseSaveAsDialog();
        String ext = sURL.substring(sURL.length() - 3);
        try {
            Object GraphicExportFilter = m_xContext.getServiceManager().createInstanceWithContext("com.sun.star.drawing.GraphicExportFilter", m_xContext);
            XExporter xExporter = (XExporter)UnoRuntime.queryInterface(XExporter.class, GraphicExportFilter);
            XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class, getDiagram().getGroupShape());
            xExporter.setSourceDocument(xComp);
            PropertyValue aProps[] = new PropertyValue[2];
            aProps[0] = new PropertyValue();
            aProps[0].Name = "MediaType";
            aProps[0].Value = "image/" + ext;
            aProps[1] = new PropertyValue();
View Full Code Here

                                                pPropValues );
           
            Object GraphicExportFilter =
                xOfficeContext.getServiceManager().createInstanceWithContext(
                    "com.sun.star.drawing.GraphicExportFilter", xOfficeContext);
            XExporter xExporter = (XExporter)
                UnoRuntime.queryInterface( XExporter.class, GraphicExportFilter );
           
            PropertyValue aProps[] = new PropertyValue[2];
            aProps[0] = new PropertyValue();
            aProps[0].Name = "MediaType";
            aProps[0].Value = "image/gif";
           
            /* some graphics e.g. the Windows Metafile does not have a Media Type,
               for this case
               aProps[0].Name = "FilterName"; // it is possible to set a FilterName
               aProps[0].Value = "WMF";
            */
            java.io.File destFile = new java.io.File(args[1]);
            java.net.URL destUrl = destFile.toURL();
           
            aProps[1] = new PropertyValue();
            aProps[1].Name = "URL";
            aProps[1].Value = destUrl.toString();//args[ 1 ];
           
            int nPageIndex = Integer.parseInt( args[ 2 ] );
            if ( nPageIndex < PageHelper.getDrawPageCount( xComponent ) &&
                 nPageIndex > 1 )
      {
                XDrawPage xPage = PageHelper.getDrawPageByIndex( xComponent,
                                                                 nPageIndex );
                XComponent xComp = (XComponent)
                    UnoRuntime.queryInterface( XComponent.class, xPage );
                xExporter.setSourceDocument( xComp );
                XFilter xFilter = (XFilter)
                    UnoRuntime.queryInterface( XFilter.class, xExporter );
                xFilter.filter( aProps );
                System.out.println( "*** graphics on page \"" + nPageIndex
                                    + "\" from file \"" + args[0]
View Full Code Here

        Any arg = new Any(new Type(XDocumentHandler.class), xDocHandWriter);
        XInterface oExp = (XInterface)xMSF.createInstanceWithArguments(
            "com.sun.star.comp." + docType + ".XML" + exportType + "Exporter",
            new Object[] {arg});

        XExporter xExp = (XExporter) UnoRuntime.queryInterface
            (XExporter.class, oExp) ;
        xExp.setSourceDocument(xDoc) ;

        XFilter filter = (XFilter) UnoRuntime.queryInterface(XFilter.class, oExp) ;
        filter.filter(XMLTools.createMediaDescriptor(
            new String[] {"FilterName"},
            new Object[] {"Custom filter"})) ;
View Full Code Here

        try {
            oObj = (XInterface) xMSF.createInstanceWithArguments(
                "com.sun.star.comp.Chart.XMLContentExporter",
                new Object[] {arg});
            XExporter xEx = (XExporter)
                UnoRuntime.queryInterface(XExporter.class,oObj);
            xEx.setSourceDocument(xChartDoc);

            Object oTitle = xChartDoc.getTitle() ;
            XPropertySet xTitleProp = (XPropertySet) UnoRuntime.queryInterface
                (XPropertySet.class, oTitle) ;
            xTitleProp.setPropertyValue("String", exportStr) ;
View Full Code Here

        try {
            oObj = (XInterface) xMSF.createInstanceWithArguments(
                "com.sun.star.comp.Impress.XMLContentExporter",
                new Object[] {arg});
            XExporter xEx = (XExporter)
                UnoRuntime.queryInterface(XExporter.class,oObj);
            xEx.setSourceDocument(xImpressDoc);

            // assigning a draw page a new name
            XDrawPagesSupplier xPagesSup = (XDrawPagesSupplier)
                UnoRuntime.queryInterface
                (XDrawPagesSupplier.class, xImpressDoc) ;
View Full Code Here

TOP

Related Classes of com.sun.star.document.XExporter

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.