Package com.sun.star.document

Examples of com.sun.star.document.XDocumentProperties


            Object oDP =
//                xMSF.createInstanceWithContext(
//                    "com.sun.star.document.DocumentProperties", xContext);
                xMSF.createInstance("com.sun.star.document.DocumentProperties");
            XDocumentProperties xDP = (XDocumentProperties)
                UnoRuntime.queryInterface(XDocumentProperties.class, oDP);

            log.println("...done");


            log.println("Checking initialize ...");

            XDocumentProperties xDP2 = (XDocumentProperties)
                UnoRuntime.queryInterface(XDocumentProperties.class,
                    xMSF.createInstance(
                        "com.sun.star.document.DocumentProperties"));
            XInitialization xInit = (XInitialization)
                UnoRuntime.queryInterface(XInitialization.class, xDP2);
            xInit.initialize(new Object[] { });

            log.println("...done");

            log.println("Checking storing default-initialized meta data ...");

//            xDP2.storeToMedium(temp + "EMPTY.odt", mimeArgs);
            xDP2.storeToMedium("", mimeEmptyArgs);

            log.println("...done");

            log.println("Checking loading default-initialized meta data ...");

//            xDP2.loadFromMedium(temp + "EMPTY.odt", noArgs);
            xDP2.loadFromMedium("", mimeEmptyArgs);
            assure ("Author", "".equals(xDP2.getAuthor()));

            log.println("...done");

            log.println("(Not) Checking preservation of custom meta data ...");

            xDP2.loadFromMedium(util.utils.getFullTestURL("CUSTOM.odt"),
                noArgs);
            assure ("Author", "".equals(xDP2.getAuthor()));
            xDP2.storeToMedium(temp + "CUSTOM.odt", mimeArgs);

            //FIXME: now what? comparing for binary equality seems useless
            // we could unzip the written file and grep for the custom stuff
            // but would that work on windows...
View Full Code Here


            Object oDP =
//                xMSF.createInstanceWithContext(
//                    "com.sun.star.document.DocumentProperties", xContext);
                xMSF.createInstance("com.sun.star.document.DocumentProperties");
            XDocumentProperties xDP = (XDocumentProperties)
                UnoRuntime.queryInterface(XDocumentProperties.class, oDP);

            log.println("...done");


            log.println("Checking initialize ...");

            XDocumentProperties xDP2 = (XDocumentProperties)
                UnoRuntime.queryInterface(XDocumentProperties.class,
                    xMSF.createInstance(
                        "com.sun.star.document.DocumentProperties"));
            XInitialization xInit = (XInitialization)
                UnoRuntime.queryInterface(XInitialization.class, xDP2);
            xInit.initialize(new Object[] { });

            log.println("...done");

            log.println("Checking storing default-initialized meta data ...");

//            xDP2.storeToMedium(temp + "EMPTY.odt", mimeArgs);
            xDP2.storeToMedium("", mimeEmptyArgs);

            log.println("...done");

            log.println("Checking loading default-initialized meta data ...");

//            xDP2.loadFromMedium(temp + "EMPTY.odt", noArgs);
            xDP2.loadFromMedium("", mimeEmptyArgs);
            assure ("Author", "".equals(xDP2.getAuthor()));

            log.println("...done");

            log.println("(Not) Checking preservation of custom meta data ...");

            xDP2.loadFromMedium(util.utils.getFullTestURL("CUSTOM.odt"),
                noArgs);
            assure ("Author", "".equals(xDP2.getAuthor()));
            xDP2.storeToMedium(temp + "CUSTOM.odt", mimeArgs);

            //FIXME: now what? comparing for binary equality seems useless
            // we could unzip the written file and grep for the custom stuff
            // but would that work on windows...
View Full Code Here

        {
            java.util.Vector<String> TitleVector = null;
            java.util.Vector<String> NameVector = null;

            XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
            XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);

            XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
            com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = (com.sun.star.ucb.XSimpleFileAccess) UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface);

            String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false);

            TitleVector = new java.util.Vector<String>(/*nameList.length*/);
            NameVector = new java.util.Vector<String>(nameList.length);

            FilterName = FilterName == null || FilterName.equals("") ? null : FilterName + "-";

            String fileName = "";
            PropertyValue[] noArgs = { };
            for (int i = 0; i < nameList.length; i++)
            {
                fileName = getFilename(nameList[i]);

                if (FilterName == null || fileName.startsWith(FilterName))
                {
                    xDocProps.loadFromMedium(nameList[i], noArgs);
                    NameVector.addElement(nameList[i]);
                    TitleVector.addElement(xDocProps.getTitle());
                }
            }
            String[] LocNameList = new String[NameVector.size()];
            String[] LocTitleList = new String[TitleVector.size()];

View Full Code Here

    {
        String sTitle = "";
        try
        {
            XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
            XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);
            PropertyValue[] noArgs = { };
            xDocProps.loadFromMedium(_sFile, noArgs);
            sTitle = xDocProps.getTitle();
        }
        catch (Exception e)
        {
        }
        return sTitle;
View Full Code Here

            DateUtils du = new DateUtils(xMSF, this.xTextDocument);
            int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY);
            String myDate = du.format(ff, currentDate);

            XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
            XDocumentProperties xDocProps2 = xDocPropsSuppl.getDocumentProperties();
            xDocProps2.setAuthor(fullname);
            xDocProps2.setModifiedBy(fullname);
            String description = xDocProps2.getDescription();
            description = description + " " + TemplateDescription;
            description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>");
            description = JavaTools.replaceSubString(description, myDate, "<current_date>");
            xDocProps2.setDescription(description);
        }
        catch (NoSuchElementException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here

        /* if the type is a star office convertable document
         * We try to open the document to get some properties
         */

        XDocumentProperties xProps = null;

        task.advance(true); //3

        if (isSOOpenable)
        { // for documents which are openable through SO, use DocumentProperties service.
            XDesktop desktop = Desktop.getDesktop(xmsf);
            PropertyValue[] props = new PropertyValue[3];
            props[0] = Properties.createProperty("Hidden", Boolean.TRUE);
            props[1] = Properties.createProperty("MacroExecutionMode", new Short(MacroExecMode.NEVER_EXECUTE));
            props[2] = Properties.createProperty("UpdateDocMode", new Short(UpdateDocMode.NO_UPDATE));
            XComponent component = ((XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop)).loadComponentFromURL(cp_URL, "_default", 0, props);
            xProps = ((XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, component)).getDocumentProperties();
        }

        task.advance(true); //4   

        //now use the object to read some document properties.
        if (xProps != null)
        {
            title = xProps.getTitle();
            description = xProps.getDescription();
            author = xProps.getAuthor();
            createDate = xProps.getCreationDate();
            updateDate = xProps.getModificationDate();
        }
        else
        { //get some information from OS.
            title = localFilename;
            updateDate = getSettings().getFileAccess(xmsf).getLastModified(cp_URL);
View Full Code Here

        {
            java.util.Vector TitleVector = null;
            java.util.Vector NameVector = null;

            XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
            XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);

            XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
            com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = (com.sun.star.ucb.XSimpleFileAccess) UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface);

            String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false);

            TitleVector = new java.util.Vector(nameList.length);
            NameVector = new java.util.Vector(nameList.length);

            FilterName = FilterName == null || FilterName.equals("") ? null : FilterName + "-";

            String fileName = "";
            PropertyValue[] noArgs = { };
            for (int i = 0; i < nameList.length; i++)
            {
                fileName = getFilename(nameList[i]);

                if (FilterName == null || fileName.startsWith(FilterName))
                {
                    xDocProps.loadFromMedium(nameList[i], noArgs);
                    NameVector.addElement(nameList[i]);
                    TitleVector.addElement(xDocProps.getTitle());
                }
            }
            String[] LocNameList = new String[NameVector.size()];
            String[] LocTitleList = new String[TitleVector.size()];
View Full Code Here

    {
        String sTitle = "";
        try
        {
            XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
            XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);
            PropertyValue[] noArgs = { };
            xDocProps.loadFromMedium(_sFile, noArgs);
            sTitle = xDocProps.getTitle();
        }
        catch (Exception e)
        {
        }
        return sTitle;
View Full Code Here

        {
            java.util.Vector<String> TitleVector = null;
            java.util.Vector<String> NameVector = null;

            XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
            XDocumentProperties xDocProps = UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);

            XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
            com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);

            String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false);

            TitleVector = new java.util.Vector<String>(/*nameList.length*/);
            NameVector = new java.util.Vector<String>(nameList.length);

            FilterName = FilterName == null || FilterName.equals(PropertyNames.EMPTY_STRING) ? null : FilterName + "-";

            String fileName = PropertyNames.EMPTY_STRING;
            PropertyValue[] noArgs = { };
            for (int i = 0; i < nameList.length; i++)
            {
                fileName = getFilename(nameList[i]);

                if (FilterName == null || fileName.startsWith(FilterName))
                {
                    xDocProps.loadFromMedium(nameList[i], noArgs);
                    NameVector.addElement(nameList[i]);
                    TitleVector.addElement(xDocProps.getTitle());
                }
            }
            String[] LocNameList = new String[NameVector.size()];
            String[] LocTitleList = new String[TitleVector.size()];

View Full Code Here

    {
        String sTitle = PropertyNames.EMPTY_STRING;
        try
        {
            XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
            XDocumentProperties xDocProps = UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);
            PropertyValue[] noArgs = { };
            xDocProps.loadFromMedium(_sFile, noArgs);
            sTitle = xDocProps.getTitle();
        }
        catch (Exception e)
        {
        }
        return sTitle;
View Full Code Here

TOP

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

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.