Examples of XFilePicker


Examples of com.sun.star.ui.dialogs.XFilePicker

        String sStorePath = "";
        XComponent xComponent = null;
        try {
            // the filepicker is instantiated with the global Multicomponentfactory...
            Object oFilePicker = m_xMCF.createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", m_xContext);
            XFilePicker xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, oFilePicker);
           
            // the defaultname is the initially proposed filename..
            xFilePicker.setDefaultName("MyExampleDocument");
           
            // set the initial displaydirectory. In this example the user template directory is used
            Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext);
            XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings);
            String sTemplateUrl = (String) xPropertySet.getPropertyValue("Template_writable");
            xFilePicker.setDisplayDirectory(sTemplateUrl);
           
            // set the filters of the dialog. The filternames may be retrieved from
            // http://wiki.services.openoffice.org/wiki/Framework/Article/Filter
            XFilterManager xFilterManager = (XFilterManager) UnoRuntime.queryInterface(XFilterManager.class, xFilePicker);
            xFilterManager.appendFilter("OpenDocument Text Template", "writer8_template");
            xFilterManager.appendFilter("OpenDocument Text", "writer8");
           
            // choose the template that defines the capabilities of the filepicker dialog
            XInitialization xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, xFilePicker);
            Short[] listAny = new Short[] { new Short(com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION)};
            xInitialize.initialize(listAny);
           
            // add a control to the dialog to add the extension automatically to the filename...
            XFilePickerControlAccess xFilePickerControlAccess = (XFilePickerControlAccess) UnoRuntime.queryInterface(XFilePickerControlAccess.class, xFilePicker);
            xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, new Boolean(true));
           
            xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFilePicker);
           
            // execute the dialog...
            XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker);
            short nResult = xExecutable.execute();
           
            // query the resulting path of the dialog...
            if (nResult == com.sun.star.ui.dialogs.ExecutableDialogResults.OK){
                String[] sPathList = xFilePicker.getFiles();
                if (sPathList.length > 0){
                    sStorePath = sPathList[0];
                }
            }
        } catch (com.sun.star.uno.Exception exception) {
View Full Code Here

Examples of com.sun.star.ui.dialogs.XFilePicker

        String sStorePath = "";
        XComponent xComponent = null;
        try {
            // the filepicker is instantiated with the global Multicomponentfactory...
            Object oFilePicker = m_xMCF.createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", m_xContext);
            XFilePicker xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, oFilePicker);
           
            // the defaultname is the initially proposed filename..
            xFilePicker.setDefaultName("MyExampleDocument");
           
            // set the initial displaydirectory. In this example the user template directory is used
            Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext);
            XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings);
            String sTemplateUrl = (String) xPropertySet.getPropertyValue("Template_writable");
            xFilePicker.setDisplayDirectory(sTemplateUrl);
           
            // set the filters of the dialog. The filternames may be retrieved from
            // http://wiki.services.openoffice.org/wiki/Framework/Article/Filter
            XFilterManager xFilterManager = (XFilterManager) UnoRuntime.queryInterface(XFilterManager.class, xFilePicker);
            xFilterManager.appendFilter("OpenDocument Text Template", "writer8_template");
            xFilterManager.appendFilter("OpenDocument Text", "writer8");
           
            // choose the template that defines the capabilities of the filepicker dialog
            XInitialization xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, xFilePicker);
            Short[] listAny = new Short[] { new Short(com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION)};
            xInitialize.initialize(listAny);
           
            // add a control to the dialog to add the extension automatically to the filename...
            XFilePickerControlAccess xFilePickerControlAccess = (XFilePickerControlAccess) UnoRuntime.queryInterface(XFilePickerControlAccess.class, xFilePicker);
            xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, new Boolean(true));
           
            xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFilePicker);
           
            // execute the dialog...
            XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker);
            short nResult = xExecutable.execute();
           
            // query the resulting path of the dialog...
            if (nResult == com.sun.star.ui.dialogs.ExecutableDialogResults.OK){
                String[] sPathList = xFilePicker.getFiles();
                if (sPathList.length > 0){
                    sStorePath = sPathList[0];
                }
            }
        } catch (com.sun.star.uno.Exception exception) {
View Full Code Here

Examples of com.sun.star.ui.dialogs.XFilePicker

        String sStorePath = "";
        XComponent xComponent = null;
        try {
            XMultiComponentFactory  xMCF = m_xContext.getServiceManager();
            Object oFilePicker = xMCF.createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", m_xContext);
            XFilePicker xFilePicker = (XFilePicker)UnoRuntime.queryInterface(XFilePicker.class, oFilePicker);
            if(m_sWorkUrl.equals("")){
                Object oPathSettings = xMCF.createInstanceWithContext("com.sun.star.util.PathSettings", m_xContext);
                XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, oPathSettings);
                m_sWorkUrl = (String) xPropertySet.getPropertyValue("Work");
            }
            xFilePicker.setDisplayDirectory(m_sWorkUrl);
           
            // choose the template that defines the capabilities of the filepicker dialog
            XInitialization xInitialize = (XInitialization)UnoRuntime.queryInterface(XInitialization.class, xFilePicker);
            Short[] listAny = new Short[] { new Short(com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION)};
            xInitialize.initialize(listAny);
           
            String fileName = getController().getDiagram().getDiagramTypeName();
            xFilePicker.setDefaultName(fileName);
           
            // add a control to the dialog to add the extension automatically to the filename...
            XFilePickerControlAccess xFilePickerControlAccess =(XFilePickerControlAccess)UnoRuntime.queryInterface(XFilePickerControlAccess.class, xFilePicker);
            xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, new Boolean(true));
           
            XFilterManager xFilterManager = (XFilterManager)UnoRuntime.queryInterface(XFilterManager.class, xFilePicker);
            xFilterManager.appendFilter("PNG - Portable Network Graphic", ".png");
            xFilterManager.appendFilter("JPEG - Joint Photographic Experts Group", ".jpg");
            xFilterManager.appendFilter("GIF - Graphics Interchange Format", ".gif");
           
            xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFilePicker);
            XExecutableDialog xExecutable = (XExecutableDialog)UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker);
            short nResult = xExecutable.execute();
            if (nResult == com.sun.star.ui.dialogs.ExecutableDialogResults.OK){
                m_sWorkUrl = xFilePicker.getDisplayDirectory();
                String[] sPathList = xFilePicker.getFiles();
                if (sPathList.length > 0){
                    sStorePath = sPathList[0];
                }
            }
        } catch (com.sun.star.uno.Exception ex) {
View Full Code Here

Examples of com.sun.star.ui.dialogs.XFilePicker

        String sStorePath = "";
        XComponent xComponent = null;
        try {
            // the filepicker is instantiated with the global Multicomponentfactory...
            Object oFilePicker = m_xMCF.createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", m_xContext);
            XFilePicker xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, oFilePicker);
           
            // the defaultname is the initially proposed filename..
            xFilePicker.setDefaultName("MyExampleDocument");
           
            // set the initial displaydirectory. In this example the user template directory is used
            Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext);
            XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings);
            String sTemplateUrl = (String) xPropertySet.getPropertyValue("Template_writable");
            xFilePicker.setDisplayDirectory(sTemplateUrl);
           
            // set the filters of the dialog. The filternames may be retrieved from
            // http://wiki.services.openoffice.org/wiki/Framework/Article/Filter
            XFilterManager xFilterManager = (XFilterManager) UnoRuntime.queryInterface(XFilterManager.class, xFilePicker);
            xFilterManager.appendFilter("OpenDocument Text Template", "writer8_template");
            xFilterManager.appendFilter("OpenDocument Text", "writer8");
           
            // choose the template that defines the capabilities of the filepicker dialog
            XInitialization xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, xFilePicker);
            Short[] listAny = new Short[] { new Short(com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION)};
            xInitialize.initialize(listAny);
           
            // add a control to the dialog to add the extension automatically to the filename...
            XFilePickerControlAccess xFilePickerControlAccess = (XFilePickerControlAccess) UnoRuntime.queryInterface(XFilePickerControlAccess.class, xFilePicker);
            xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, new Boolean(true));
           
            xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFilePicker);
           
            // execute the dialog...
            XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker);
            short nResult = xExecutable.execute();
           
            // query the resulting path of the dialog...
            if (nResult == com.sun.star.ui.dialogs.ExecutableDialogResults.OK){
                String[] sPathList = xFilePicker.getFiles();
                if (sPathList.length > 0){
                    sStorePath = sPathList[0];
                }
            }
        } catch (com.sun.star.uno.Exception exception) {
View Full Code Here

Examples of com.sun.star.ui.dialogs.XFilePicker

        String sStorePath = "";
        XComponent xComponent = null;
        try {
            // the filepicker is instantiated with the global Multicomponentfactory...
            Object oFilePicker = m_xMCF.createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", m_xContext);
            XFilePicker xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, oFilePicker);
           
            // the defaultname is the initially proposed filename..
            xFilePicker.setDefaultName("MyExampleDocument");
           
            // set the initial displaydirectory. In this example the user template directory is used
            Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext);
            XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings);
            String sTemplateUrl = (String) xPropertySet.getPropertyValue("Template_writable");
            xFilePicker.setDisplayDirectory(sTemplateUrl);
           
            // set the filters of the dialog. The filternames may be retrieved from
            // http://wiki.services.openoffice.org/wiki/Framework/Article/Filter
            XFilterManager xFilterManager = (XFilterManager) UnoRuntime.queryInterface(XFilterManager.class, xFilePicker);
            xFilterManager.appendFilter("OpenDocument Text Template", "writer8_template");
            xFilterManager.appendFilter("OpenDocument Text", "writer8");
           
            // choose the template that defines the capabilities of the filepicker dialog
            XInitialization xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, xFilePicker);
            Short[] listAny = new Short[] { new Short(com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION)};
            xInitialize.initialize(listAny);
           
            // add a control to the dialog to add the extension automatically to the filename...
            XFilePickerControlAccess xFilePickerControlAccess = (XFilePickerControlAccess) UnoRuntime.queryInterface(XFilePickerControlAccess.class, xFilePicker);
            xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, new Boolean(true));
           
            xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFilePicker);
           
            // execute the dialog...
            XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker);
            short nResult = xExecutable.execute();
           
            // query the resulting path of the dialog...
            if (nResult == com.sun.star.ui.dialogs.ExecutableDialogResults.OK){
                String[] sPathList = xFilePicker.getFiles();
                if (sPathList.length > 0){
                    sStorePath = sPathList[0];
                }
            }
        } catch (com.sun.star.uno.Exception exception) {
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.