Examples of XDocumentInfoSupplier


Examples of com.sun.star.document.XDocumentInfoSupplier

            XExporter xEx = (XExporter) UnoRuntime.queryInterface
                (XExporter.class,oObj);
            xEx.setSourceDocument(xMathDoc);

            // setting a new name and value for user info field
            XDocumentInfoSupplier xDocInfoSup = (XDocumentInfoSupplier)
                UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xMathDoc) ;
            XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo() ;
            xDocInfo.setUserFieldName((short) 0, expName) ;
            xDocInfo.setUserFieldValue((short) 0, expValue) ;
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log) ;
            throw new StatusException("Can't create component.", e) ;
View Full Code Here

Examples of com.sun.star.document.XDocumentInfoSupplier

            System.out.println("Opening a Writer document");
            xTextDoc = WriterTools.createTextDoc(m_xMSF);
            System.out.println("... done");

            XDocumentInfoSupplier xDocInfoSup = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDoc);
            XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo();
            XPropertyContainer xPropContainer = UnoRuntime.queryInterface(XPropertyContainer.class, xDocInfo);

            System.out.println("Trying to add a existing property");

            boolean worked = addProperty(xPropContainer, "Author", (short) 0, "");
            assertTrue("Could set an existing property", !worked);
            System.out.println("...done");

            System.out.println("Trying to add a integer property");
            worked = addProperty(xPropContainer, "intValue", com.sun.star.beans.PropertyAttribute.READONLY, new Integer(17));
            assertTrue("Couldn't set an integer property", worked);
            System.out.println("...done");

            System.out.println("Trying to add a double property");
            worked = addProperty(xPropContainer, "doubleValue", com.sun.star.beans.PropertyAttribute.REMOVEABLE, new Double(17.7));
            assertTrue("Couldn't set an double property", worked);
            System.out.println("...done");

            System.out.println("Trying to add a boolean property");
            worked = addProperty(xPropContainer, "booleanValue", com.sun.star.beans.PropertyAttribute.REMOVEABLE, Boolean.TRUE);
            assertTrue("Couldn't set an boolean property", worked);
            System.out.println("...done");

            System.out.println("Trying to add a date property");
            worked = addProperty(xPropContainer, "dateValue", com.sun.star.beans.PropertyAttribute.REMOVEABLE, new Date());
            assertTrue("Couldn't set an date property", worked);
            System.out.println("...done");

            System.out.println("trying to remove a read only Property");
            try
            {
                xPropContainer.removeProperty("intValue");
                fail("Could remove read only property");
            }
            catch (Exception e)
            {
                System.out.println("\tException was thrown " + e);
                System.out.println("\t...OK");
            }
            System.out.println("...done");

            XPropertySet xProps2 = UnoRuntime.queryInterface(XPropertySet.class, xPropContainer);
            showPropertySet(xProps2);


            System.out.println("Storing the document");
            try
            {
                XStorable store = UnoRuntime.queryInterface(XStorable.class, xTextDoc);
                store.storeToURL(sTempDocument, new PropertyValue[] {});
                DesktopTools.closeDoc(xTextDoc);
            }
            catch (Exception e)
            {
                fail("Couldn't store document");
            }

            System.out.println("...done");
        }


        if (true)
        {
            System.out.println("loading the document");

            try
            {
                XComponentLoader xCL = UnoRuntime.queryInterface(XComponentLoader.class, m_xMSF.createInstance("com.sun.star.frame.Desktop"));
                XComponent xComp = xCL.loadComponentFromURL(sTempDocument, "_blank", 0, new PropertyValue[] {});
                xTextDocSecond = UnoRuntime.queryInterface(XTextDocument.class, xComp);
            }
            catch (Exception e)
            {
                fail("Couldn't load document");
            }

            System.out.println("...done");

            XDocumentInfoSupplier xDocInfoSup = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDocSecond);
            XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo();
            XPropertyContainer xPropContainer = UnoRuntime.queryInterface(XPropertyContainer.class, xDocInfo);

            XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class, xDocInfo);
            showPropertySet(xProps);
View Full Code Here

Examples of com.sun.star.document.XDocumentInfoSupplier

            XExporter xEx = (XExporter) UnoRuntime.queryInterface
                (XExporter.class,oObj);
            xEx.setSourceDocument(xSheetDoc);

            // Obtaining and changing property values
            XDocumentInfoSupplier infoSup = (XDocumentInfoSupplier)
                UnoRuntime.queryInterface (XDocumentInfoSupplier.class,
                xSheetDoc) ;
            XPropertySet docInfo = (XPropertySet) UnoRuntime.queryInterface
                (XPropertySet.class, infoSup.getDocumentInfo()) ;
            docInfo.setPropertyValue("Title", "TestDocument");
           
            log.println("fill sheet 1 with contnet...");
            util.CalcTools.fillCalcSheetWithContent(xSheetDoc,1, 3, 3, 50, 50);
           
View Full Code Here

Examples of com.sun.star.document.XDocumentInfoSupplier

                {"end", "office:meta"},
            {"end", "office:document-meta"}} ;

        tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;

        XDocumentInfoSupplier infoSup = (XDocumentInfoSupplier)
            UnoRuntime.queryInterface
            (XDocumentInfoSupplier.class, xImpressDoc) ;
        final XPropertySet docInfo = (XPropertySet) UnoRuntime.queryInterface
            (XPropertySet.class, infoSup.getDocumentInfo()) ;
        final PrintWriter logF = log ;

        tEnv.addObjRelation("XDocumentHandler.ImportChecker",
            new ifc.xml.sax._XDocumentHandler.ImportChecker() {
                public boolean checkImport() {
View Full Code Here

Examples of com.sun.star.document.XDocumentInfoSupplier

            {"end", "office:meta"},
            {"end", "office:document-meta"}} ;

        tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;

        XDocumentInfoSupplier infoSup = (XDocumentInfoSupplier)
            UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xSheetDoc) ;
        final XPropertySet docInfo = (XPropertySet) UnoRuntime.queryInterface
            (XPropertySet.class, infoSup.getDocumentInfo()) ;
        final PrintWriter logF = log ;

        tEnv.addObjRelation("XDocumentHandler.ImportChecker",
            new ifc.xml.sax._XDocumentHandler.ImportChecker() {
                public boolean checkImport() {
View Full Code Here

Examples of com.sun.star.document.XDocumentInfoSupplier

    }
   
    protected static String GetDocTitle( XModel xDoc )
    {
        String sTitle = "";
        XDocumentInfoSupplier xDocInfoSup = ( XDocumentInfoSupplier ) UnoRuntime.queryInterface( XDocumentInfoSupplier.class, xDoc );
        XPropertySet xPropSet = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, xDocInfoSup.getDocumentInfo() );
        try
        {
            sTitle = ( String ) xPropSet.getPropertyValue( "Title" );
        } catch ( Exception ex )
        {
View Full Code Here

Examples of com.sun.star.document.XDocumentInfoSupplier

        return sTitle;
    }
   
    protected static void SetDocTitle( XModel xDoc, String sTitle )
    {
        XDocumentInfoSupplier xDocInfoSup = ( XDocumentInfoSupplier ) UnoRuntime.queryInterface( XDocumentInfoSupplier.class, xDoc );
        if ( xDocInfoSup != null )
        {
            XPropertySet xPropSet = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, xDocInfoSup.getDocumentInfo() );
            if ( xPropSet != null )
            {
                try
                {
                    xPropSet.setPropertyValue( "Title", sTitle );
View Full Code Here

Examples of com.sun.star.document.XDocumentInfoSupplier

            XExporter xEx = (XExporter) UnoRuntime.queryInterface
                (XExporter.class,oObj);
            xEx.setSourceDocument(xMathDoc);

            // setting a new name and value for user info field
            XDocumentInfoSupplier xDocInfoSup = (XDocumentInfoSupplier)
                UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xMathDoc) ;
            XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo() ;
            xDocInfo.setUserFieldName((short) 0, expName) ;
            xDocInfo.setUserFieldValue((short) 0, expValue) ;
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log) ;
            throw new StatusException("Can't create component.", e) ;
View Full Code Here

Examples of com.sun.star.document.XDocumentInfoSupplier

            {"end", "office:meta"},
            {"end", "office:document-meta"}} ;

        tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;

        XDocumentInfoSupplier infoSup = (XDocumentInfoSupplier)
            UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xSheetDoc) ;
        final XPropertySet docInfo = (XPropertySet) UnoRuntime.queryInterface
            (XPropertySet.class, infoSup.getDocumentInfo()) ;
        final PrintWriter logF = log ;

        tEnv.addObjRelation("XDocumentHandler.ImportChecker",
            new ifc.xml.sax._XDocumentHandler.ImportChecker() {
                public boolean checkImport() {
View Full Code Here

Examples of com.sun.star.document.XDocumentInfoSupplier

        XInterface oObj = null;
        final String impName = "XMLMetaImporter" ;
        final String impValue = "XMLMetaImporter_Value" ;
        final String impTitle = "XMLMetaImporter Title" ;

        final XDocumentInfoSupplier xDocInfoSup ;
        try {
            oObj = (XInterface)xMSF.createInstance(
                    "com.sun.star.comp.Math.XMLMetaImporter");

            xDocInfoSup = (XDocumentInfoSupplier) UnoRuntime.queryInterface
                (XDocumentInfoSupplier.class, xMathDoc) ;
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Unexpected exception", e);
        }

        TestEnvironment tEnv = new TestEnvironment(oObj);

        tEnv.addObjRelation("TargetDocument",xMathDoc);

        String[][] xml = new String[][] {
            {"start", "office:document-meta",
                "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
                "xmlns:meta", "CDATA", "http://openoffice.org/2000/meta",
                "xmlns:xlink", "CDATA", "http://www.w3.org/1999/xlink",
                "xmlns:dc", "CDATA", "http://purl.org/dc/elements/1.1/"
            },
            {"start", "office:meta"},
            {"start", "dc:title"},
            {"chars", impTitle},
            {"end", "dc:title"},
            {"start", "meta:user-defined",
                "meta:name", "CDATA", impName},
            {"chars", impValue},
            {"end", "meta:user-defined"},
            {"end", "office:meta"},
            {"end", "office:document-meta"}} ;

        tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;

        final PrintWriter logF = log ;

        tEnv.addObjRelation("XDocumentHandler.ImportChecker",
            new ifc.xml.sax._XDocumentHandler.ImportChecker() {
                public boolean checkImport() {
                    try {
                        XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo() ;
                        XPropertySet xDocInfoProp = (XPropertySet)
                            UnoRuntime.queryInterface
                            (XPropertySet.class, xDocInfo) ;
                        boolean result = false ;
                        for (short i = 0; i < xDocInfo.getUserFieldCount(); i++) {
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.