diff options
Diffstat (limited to 'odk/examples/DevelopersGuide/GUI/SystemDialog.java')
-rw-r--r-- | odk/examples/DevelopersGuide/GUI/SystemDialog.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/odk/examples/DevelopersGuide/GUI/SystemDialog.java b/odk/examples/DevelopersGuide/GUI/SystemDialog.java index 861d075a1df2..bad6a8f0db9f 100644 --- a/odk/examples/DevelopersGuide/GUI/SystemDialog.java +++ b/odk/examples/DevelopersGuide/GUI/SystemDialog.java @@ -80,36 +80,36 @@ public class SystemDialog { 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); + 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); + 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 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); + XInitialization xInitialize = 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 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); + xComponent = UnoRuntime.queryInterface(XComponent.class, xFilePicker); // execute the dialog... - XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker); + XExecutableDialog xExecutable = UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker); short nResult = xExecutable.execute(); // query the resulting path of the dialog... @@ -135,7 +135,7 @@ public class SystemDialog { try{ // retrieve the configured Work path... Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext); - XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings); + XPropertySet xPropertySet = com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings); sWorkUrl = (String) xPropertySet.getPropertyValue("Work"); } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(); @@ -158,8 +158,8 @@ public class SystemDialog { // instantiate the folder picker and retrieve the necessary interfaces... Object oFolderPicker = m_xMCF.createInstanceWithContext("com.sun.star.ui.dialogs.FolderPicker", m_xContext); XFolderPicker2 xFolderPicker = UnoRuntime.queryInterface(XFolderPicker2.class, oFolderPicker); - XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, oFolderPicker); - xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oFolderPicker); + XExecutableDialog xExecutable = UnoRuntime.queryInterface(XExecutableDialog.class, oFolderPicker); + xComponent = UnoRuntime.queryInterface(XComponent.class, oFolderPicker); xFolderPicker.setDisplayDirectory(_sDisplayDirectory); // set the dialog title... xFolderPicker.setTitle(_sTitle); |