diff options
author | Ocke Janssen <oj@openoffice.org> | 2011-03-10 12:59:15 +0100 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2011-03-10 12:59:15 +0100 |
commit | 27ef3ca46b4a2cf3963a5bc012b9d8278653c8ac (patch) | |
tree | 6c2ad51d24704ca3df6c1e4a89baf054d7e60f5e /wizards/com | |
parent | 3cbf819cef381f0c5137aac3e48d398d25065178 (diff) |
dba34d: remove unnescessary casts
Diffstat (limited to 'wizards/com')
116 files changed, 1036 insertions, 1231 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java index 09d2fb9831b5..32a94738da41 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java @@ -26,11 +26,7 @@ ************************************************************************/ package com.sun.star.wizards.agenda; -import java.util.Calendar; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.Vector; +import java.util.*; import com.sun.star.awt.TextEvent; @@ -201,7 +197,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data { template = calcTemplateName(templateURL); document = loadAsPreview(templateURL, false); - docMSF = ((XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document)); + docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document); xFrame.getComponentWindow().setEnable(false); xTextDocument.lockControllers(); initialize(); @@ -374,7 +370,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data { itemsCache = new Hashtable(11); - XMultiServiceFactory xmsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document); + XMultiServiceFactory xmsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, document); // Headings itemsCache.put(FILLIN_MEETING_TYPE, @@ -442,7 +438,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data /* * Get the default locale of the document, and create the date and time formatters. */ - XMultiServiceFactory docMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document); + XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document); try { Object defaults = docMSF.createInstance("com.sun.star.text.Defaults"); @@ -453,7 +449,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data calendar = Calendar.getInstance(jl); - XNumberFormatsSupplier nfs = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document); + XNumberFormatsSupplier nfs = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document); Object formatSettings = nfs.getNumberFormatSettings(); com.sun.star.util.Date date = (com.sun.star.util.Date) Helper.getUnoPropertyValue(formatSettings, "NullDate"); @@ -483,8 +479,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data initializeItems(); initializeTitles(); initializeItemsSections(); - XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document); - textSectionHandler = new TextSectionHandler(xMultiServiceFactory, (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, document)); + XMultiServiceFactory xMultiServiceFactory = UnoRuntime.queryInterface(XMultiServiceFactory.class, document); + textSectionHandler = new TextSectionHandler(xMultiServiceFactory, UnoRuntime.queryInterface(XTextDocument.class, document)); initializeTopics(); _allItems.clear(); _allItems = null; @@ -498,7 +494,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data { XTextRange item = null; - XMultiServiceFactory xmsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document); + XMultiServiceFactory xmsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, document); for (int i = 0; i < _allItems.size(); i++) { @@ -550,7 +546,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data { try { - XSearchable xSearchable = (XSearchable) UnoRuntime.queryInterface(XSearchable.class, document); + XSearchable xSearchable = UnoRuntime.queryInterface(XSearchable.class, document); XSearchDescriptor sd = xSearchable.createSearchDescriptor(); sd.setSearchString("<[^>]+>"); sd.setPropertyValue("SearchRegularExpression", Boolean.TRUE); @@ -558,12 +554,12 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data XIndexAccess ia = xSearchable.findAll(sd); - List l = new Vector(ia.getCount()); + List l = new ArrayList<XTextRange>(ia.getCount()); for (int i = 0; i < ia.getCount(); i++) { try { - l.add((XTextRange) UnoRuntime.queryInterface(XTextRange.class, ia.getByIndex(i))); + l.add(UnoRuntime.queryInterface(XTextRange.class, ia.getByIndex(i))); } catch (Exception ex) { @@ -607,20 +603,20 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data private String[] getSections(Object document, String s) { - XTextSectionsSupplier xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, document); + XTextSectionsSupplier xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, document); String[] allSections = xTextSectionsSupplier.getTextSections().getElementNames(); return getNamesWhichStartWith(allSections, s); } Object getSection(String name) throws NoSuchElementException, WrappedTargetException { - XTextSectionsSupplier xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, document); + XTextSectionsSupplier xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, document); return ((Any) (xTextSectionsSupplier.getTextSections().getByName(name))).getObject(); } Object getTable(String name) throws NoSuchElementException, WrappedTargetException { - XTextTablesSupplier xTextTablesSupplier = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, document); + XTextTablesSupplier xTextTablesSupplier = UnoRuntime.queryInterface(XTextTablesSupplier.class, document); return ((Any) xTextTablesSupplier.getTextTables().getByName(name)).getObject(); } @@ -676,7 +672,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data { return PropertyNames.EMPTY_STRING; } - int date = new Integer(d).intValue(); + int date = Integer.parseInt(d); calendar.clear(); calendar.set(date / 10000, (date % 10000) / 100 - 1, @@ -698,7 +694,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data { return PropertyNames.EMPTY_STRING; } - int time = new Integer(s).intValue(); + int time = Integer.parseInt(s); double t = ((double) (time / 1000000) / 24) + ((double) ((time % 1000000) / 1000) / (24 * 60)); return timeFormatter.convertNumberToString(timeFormat, t); @@ -722,7 +718,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data */ private void deleteHiddenSections() { - XTextSectionsSupplier xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, document); + XTextSectionsSupplier xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, document); String[] allSections = xTextSectionsSupplier.getTextSections().getElementNames(); try { @@ -733,7 +729,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data boolean visible = ((Boolean) Helper.getUnoPropertyValue(section, "IsVisible")).booleanValue(); if (!visible) { - ((XTextContent) UnoRuntime.queryInterface(XTextContent.class, section)).getAnchor().setString(PropertyNames.EMPTY_STRING); + UnoRuntime.queryInterface(XTextContent.class, section).getAnchor().setString(PropertyNames.EMPTY_STRING); } } } @@ -759,7 +755,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data try { Object minutesAllSection = getSection(SECTION_MINUTES_ALL); - XTextSection xTextSection = (XTextSection) UnoRuntime.queryInterface(XTextSection.class, minutesAllSection); + XTextSection xTextSection = UnoRuntime.queryInterface(XTextSection.class, minutesAllSection); xTextSection.getAnchor().setString(PropertyNames.EMPTY_STRING); } catch (Exception ex) @@ -777,7 +773,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data int topicStartTime = 0; try { - topicStartTime = new Integer(agenda.cp_Time).intValue(); + topicStartTime = Integer.parseInt(agenda.cp_Time); } catch (Exception ex) { @@ -936,7 +932,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data Helper.setUnoPropertyValue(placeHolder, "PlaceHolder", ph); Helper.setUnoPropertyValue(placeHolder, "Hint", hint); Helper.setUnoPropertyValue(placeHolder, "PlaceHolderType", new Short(PlaceholderType.TEXT)); - return (XTextContent) UnoRuntime.queryInterface(XTextContent.class, placeHolder); + return UnoRuntime.queryInterface(XTextContent.class, placeHolder); } @@ -1016,7 +1012,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data table = getTable(name); section = getSection(name); - XTextTable xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, table); + XTextTable xTextTable = UnoRuntime.queryInterface(XTextTable.class, table); XTextTableCursor cursor = xTextTable.createCursorByCellName("A1"); AgendaItem ai; // should this section be visible? @@ -1072,7 +1068,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data while ((!cellName.equals(cursor.getRangeName()) && (!cursor.getRangeName().startsWith("A")))) { cell = xTextTable.getCellByName(cursor.getRangeName()); - ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, cell)).setString(PropertyNames.EMPTY_STRING); + UnoRuntime.queryInterface(XTextRange.class, cell).setString(PropertyNames.EMPTY_STRING); cellName = cursor.getRangeName(); cursor.goRight((short) 1, false); } @@ -1085,7 +1081,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data return; } int rowIndex = getRowIndex(cursor); - int rowsCount = getRowCount((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table)); + int rowsCount = getRowCount(UnoRuntime.queryInterface(XTextTable.class, table)); /* now before deleteing i move the cursor up so it * does not disappear, because it will crash office. @@ -1201,7 +1197,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data } // and this is the XTable. - table = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, t)); + table = UnoRuntime.queryInterface(XTextTable.class, t); /* first I store all <*> ranges * which are in the topics table. @@ -1246,7 +1242,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data while (!cursor.getRangeName().equals(afterLastCell)) { cell = table.getCellByName(cursor.getRangeName()); - XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, cell); + XTextRange xTextRange = UnoRuntime.queryInterface(XTextRange.class, cell); // first I store the content and para style of the cell AgendaElement ae = new TextElement(xTextRange); // if the cell contains a relevant <...> @@ -1413,12 +1409,14 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data break; } // move the cursor to the needed cell... - cursor.goRight((short) cursorMoves, false); - XCell xc = table.getCellByName(cursor.getRangeName()); - // and write it ! - te.write(xc); - ((TableCellFormatter) topicCellFormats.get(cursorMoves)).format(xc); - + if ( te != null) + { + cursor.goRight((short) cursorMoves, false); + XCell xc = table.getCellByName(cursor.getRangeName()); + // and write it ! + te.write(xc); + ((TableCellFormatter) topicCellFormats.get(cursorMoves)).format(xc); + } } } @@ -1585,7 +1583,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data */ public static String[] getNamesWhichStartWith(String[] allNames, String prefix) { - Vector v = new Vector(); + ArrayList<String> v = new ArrayList<String>(); for (int i = 0; i < allNames.length; i++) { if (allNames[i].startsWith(prefix)) @@ -1594,8 +1592,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data } } String[] s = new String[v.size()]; - System.arraycopy(v.toArray(), 0, s, 0, s.length); - return s; + return v.toArray(s); } /** @@ -1605,7 +1602,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data */ public static String getName(Object obj) { - return ((XNamed) UnoRuntime.queryInterface(XNamed.class, obj)).getName(); + return UnoRuntime.queryInterface(XNamed.class, obj).getName(); } /** @@ -1616,7 +1613,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data */ public static void removeTableRows(Object table, int start, int count) { - XTableRows rows = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table)).getRows(); + XTableRows rows = UnoRuntime.queryInterface(XTextTable.class, table).getRows(); rows.removeByIndex(start, count); } @@ -1628,7 +1625,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data */ public static void insertTableRows(Object table, int start, int count) { - XTableRows rows = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table)).getRows(); + XTableRows rows = UnoRuntime.queryInterface(XTextTable.class, table).getRows(); rows.insertByIndex(start, count); } @@ -1717,12 +1714,12 @@ class ParaStyled implements AgendaElement void format(Object textRange) { XText o; - o = ((XText) UnoRuntime.queryInterface(XText.class, textRange)); + o = UnoRuntime.queryInterface(XText.class, textRange); if (o == null) { - o = ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange)).getText(); + o = UnoRuntime.queryInterface(XTextRange.class, textRange).getText(); } - XTextRange xtr = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange); + XTextRange xtr = UnoRuntime.queryInterface(XTextRange.class, textRange); XTextCursor cursor = o.createTextCursorByRange(xtr); Helper.setUnoPropertyValue(cursor, "ParaStyleName", paraStyle); @@ -1763,7 +1760,7 @@ class TextElement extends ParaStyled public void write(Object textRange) { - ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange)).setString(text); + UnoRuntime.queryInterface(XTextRange.class, textRange).setString(text); if (!text.equals(PropertyNames.EMPTY_STRING)) { super.write(textRange); @@ -1807,7 +1804,7 @@ class PlaceholderTextElement extends TextElement super.write(textRange); if (text == null || text.equals(PropertyNames.EMPTY_STRING)) { - XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange); + XTextRange xTextRange = UnoRuntime.queryInterface(XTextRange.class, textRange); try { XTextContent xTextContent = AgendaTemplate.createPlaceHolder(xmsf, placeHolderText, hint); @@ -1849,7 +1846,7 @@ class PlaceholderElement extends ParaStyled public void write(Object textRange) { - XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange); + XTextRange xTextRange = UnoRuntime.queryInterface(XTextRange.class, textRange); try { XTextContent xTextContent = AgendaTemplate.createPlaceHolder(xmsf, placeHolderText, hint); @@ -1896,8 +1893,8 @@ class AgendaItem implements AgendaElement public void write(Object tableCursor) throws Exception { - XTextTableCursor xTextTableCursor = (XTextTableCursor) UnoRuntime.queryInterface(XTextTableCursor.class, tableCursor); - XTextTable xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, table); + XTextTableCursor xTextTableCursor = UnoRuntime.queryInterface(XTextTableCursor.class, tableCursor); + XTextTable xTextTable = UnoRuntime.queryInterface(XTextTable.class, table); String cellname = xTextTableCursor.getRangeName(); Object cell = xTextTable.getCellByName(cellname); diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java index 96f8d53eafff..20ad03c428ae 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java @@ -159,7 +159,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog // create the peer XWindow xw = agendaTemplate.xFrame.getContainerWindow(); - XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xw); + XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xw); this.createWindowPeer( xWindowPeer ); // initialize roadmap @@ -185,8 +185,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog removeTerminateListener(); ex.printStackTrace(); running=false; - return; - } + } } @@ -483,7 +482,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog agendaTemplate.xTextDocument.lockControllers(); - xTextDocument = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class,agendaTemplate.document); + xTextDocument = UnoRuntime.queryInterface(XTextDocument.class,agendaTemplate.document); bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath , "writer8_template", false ); } catch (Exception e) { @@ -504,7 +503,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog agendaTemplate.finish( topicsControl.getTopicsData()); try { - XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, agendaTemplate.document); + XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, agendaTemplate.document); xStoreable.store(); } catch (Exception ex) { @@ -529,8 +528,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog loadValues[1] = new PropertyValue(); loadValues[1].Name = "InteractionHandler"; try { - XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); - loadValues[1].Value = xIH; + loadValues[1].Value = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -538,7 +536,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog //Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), agenda.cp_TemplatePath, "_default", new PropertyValue[0]); Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), sPath, "_default", new PropertyValue[0]); xTextDocument = (com.sun.star.text.XTextDocument) oDoc; - XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); + XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); ViewHandler myViewHandler = new ViewHandler(xDocMSF, xTextDocument); try { myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.OPTIMAL)); @@ -558,7 +556,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog private void closeDocument() { try { //xComponent.dispose(); - XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, agendaTemplate.xFrame); + XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, agendaTemplate.xFrame); xCloseable.close(false); } catch (CloseVetoException e) { e.printStackTrace(); diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.java b/wizards/com/sun/star/wizards/agenda/TopicsControl.java index 2361176f861f..495ac8a94040 100644 --- a/wizards/com/sun/star/wizards/agenda/TopicsControl.java +++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.java @@ -190,7 +190,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener */ static void addKeyListener(Object control, XKeyListener listener) { - XWindow xlastControl = (XWindow) UnoRuntime.queryInterface(XWindow.class, + XWindow xlastControl = UnoRuntime.queryInterface(XWindow.class, control); xlastControl.addKeyListener(listener); } @@ -200,7 +200,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener */ static void addFocusListener(Object control, XFocusListener listener) { - XWindow xlastControl = (XWindow) UnoRuntime.queryInterface(XWindow.class, + XWindow xlastControl = UnoRuntime.queryInterface(XWindow.class, control); xlastControl.addFocusListener(listener); } @@ -311,7 +311,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener */ public void focusGained(FocusEvent fe) { - XControl xc = (XControl) UnoRuntime.queryInterface(XControl.class, fe.Source); + XControl xc = UnoRuntime.queryInterface(XControl.class, fe.Source); focusGained(xc); } @@ -698,11 +698,11 @@ public class TopicsControl extends ControlScroller implements XFocusListener */ private void focus(Object textControl) { - ((XWindow) UnoRuntime.queryInterface(XWindow.class, textControl)).setFocus(); - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, textControl); + UnoRuntime.queryInterface(XWindow.class, textControl).setFocus(); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, textControl); String text = xTextComponent.getText(); xTextComponent.setSelection(new Selection(0, text.length())); - XControl xc = (XControl) UnoRuntime.queryInterface(XControl.class, textControl); + XControl xc = UnoRuntime.queryInterface(XControl.class, textControl); focusGained(xc); } @@ -876,7 +876,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener */ private Selection getSelection(Object control) { - return ((XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, control)).getSelection(); + return UnoRuntime.queryInterface(XTextComponent.class, control).getSelection(); } /** @@ -897,8 +897,8 @@ public class TopicsControl extends ControlScroller implements XFocusListener { ControlRow cr = (ControlRow) ControlGroupVector.get(guiRow); Object control = getControl(cr, eventSource); - ((XWindow) UnoRuntime.queryInterface(XWindow.class, control)).setFocus(); - ((XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, control)).setSelection(s); + UnoRuntime.queryInterface(XWindow.class, control).setFocus(); + UnoRuntime.queryInterface(XTextComponent.class, control).setSelection(s); } /** diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java index a95e773649b1..08baa26b412c 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -114,7 +114,7 @@ public abstract class Configuration public static Object getNode(String name, Object parent) throws Exception { - return ((XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, parent)).getByName(name); + return UnoRuntime.queryInterface(XNameAccess.class, parent).getByName(name); } public static void set(int value, String name, Object parent) throws Exception @@ -134,7 +134,7 @@ public abstract class Configuration public static void set(boolean value, String name, Object parent) throws Exception { - if (value == true) + if (value) { set(Boolean.TRUE, name, parent); } @@ -146,7 +146,7 @@ public abstract class Configuration public static void set(Object value, String name, Object parent) throws com.sun.star.lang.IllegalArgumentException, PropertyVetoException, UnknownPropertyException, WrappedTargetException { - ((XHierarchicalPropertySet) UnoRuntime.queryInterface(XHierarchicalPropertySet.class, parent)).setHierarchicalPropertyValue(name, value); + UnoRuntime.queryInterface(XHierarchicalPropertySet.class, parent).setHierarchicalPropertyValue(name, value); } /** Creates a new instance of RegistryEntry @@ -157,7 +157,7 @@ public abstract class Configuration */ public static Object getConfigurationNode(String name, Object parent) throws Exception { - return ((XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, parent)).getByName(name); + return UnoRuntime.queryInterface(XNameAccess.class, parent).getByName(name); } public static Object getConfigurationRoot(XMultiServiceFactory xmsf, String sPath, boolean updateable) throws com.sun.star.uno.Exception @@ -165,7 +165,7 @@ public abstract class Configuration Object oConfigProvider; oConfigProvider = xmsf.createInstance("com.sun.star.configuration.ConfigurationProvider"); - XMultiServiceFactory confMsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider); + XMultiServiceFactory confMsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider); final String sView = updateable ? "com.sun.star.configuration.ConfigurationUpdateAccess" : "com.sun.star.configuration.ConfigurationAccess"; @@ -192,7 +192,7 @@ public abstract class Configuration public static String[] getChildrenNames(Object configView) { - XNameAccess nameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, configView); + XNameAccess nameAccess = UnoRuntime.queryInterface(XNameAccess.class, configView); return nameAccess.getElementNames(); } @@ -201,8 +201,7 @@ public abstract class Configuration try { Object oProdNameAccess = getConfigurationRoot(xMSF, "org.openoffice.Setup/Product", false); - String ProductName = (String) Helper.getUnoObjectbyName(oProdNameAccess, "ooName"); - return ProductName; + return (String) Helper.getUnoObjectbyName(oProdNameAccess, "ooName"); } catch (Exception exception) { @@ -247,8 +246,7 @@ public abstract class Configuration try { Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false); - String sLinguistic = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale"); - return sLinguistic; + return (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale"); } catch (Exception exception) { @@ -273,11 +271,11 @@ public abstract class Configuration public static Object addConfigNode(Object configView, String name) throws com.sun.star.lang.WrappedTargetException, ElementExistException, NoSuchElementException, com.sun.star.uno.Exception { - XNameContainer xNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, configView); + XNameContainer xNameContainer = UnoRuntime.queryInterface(XNameContainer.class, configView); if (xNameContainer == null) { - XNameReplace xNameReplace = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, configView); + XNameReplace xNameReplace = UnoRuntime.queryInterface(XNameReplace.class, configView); return xNameReplace.getByName(name); } else @@ -287,7 +285,7 @@ public abstract class Configuration xNameContainer.removeByName(name);*/ // create a new detached set element (instance of DataSourceDescription) - XSingleServiceFactory xElementFactory = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, configView); + XSingleServiceFactory xElementFactory = UnoRuntime.queryInterface(XSingleServiceFactory.class, configView); // the new element is the result ! Object newNode = xElementFactory.createInstance(); @@ -300,7 +298,7 @@ public abstract class Configuration public static void removeNode(Object configView, String name) throws NoSuchElementException, WrappedTargetException { - XNameContainer xNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, configView); + XNameContainer xNameContainer = UnoRuntime.queryInterface(XNameContainer.class, configView); if (xNameContainer.hasByName(name)) { @@ -310,7 +308,7 @@ public abstract class Configuration public static void commit(Object configView) throws WrappedTargetException { - XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, configView); + XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, configView); xUpdateControl.commitChanges(); } @@ -319,7 +317,7 @@ public abstract class Configuration Object view = Configuration.getConfigurationRoot(xmsf, path, true); addConfigNode(path, name); node.writeConfiguration(view, param); - XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, view); + XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view); xUpdateControl.commitChanges(); } @@ -327,7 +325,7 @@ public abstract class Configuration { Object view = Configuration.getConfigurationRoot(xmsf, path, true); removeNode(view, name); - XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, view); + XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view); xUpdateControl.commitChanges(); } @@ -371,8 +369,7 @@ public abstract class Configuration { String[] snames = _xNameAccess.getElementNames(); Object oNode = _xNameAccess.getByName(snames[_index]); - XNameAccess xNameAccessNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oNode); - return xNameAccessNode; + return UnoRuntime.queryInterface(XNameAccess.class, oNode); } catch (Exception e) { @@ -387,7 +384,7 @@ public abstract class Configuration { if (_xNameAccessNode.hasByName(_SubNodeName)) { - return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(_SubNodeName)); + return UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(_SubNodeName)); } } catch (Exception e) @@ -415,7 +412,7 @@ public abstract class Configuration String curdisplayname = (String) Helper.getUnoPropertyValue(_xNameAccessNode.getByName(snames[i]), _nodename); if (curdisplayname.equals(_displayname)) { - return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i])); + return UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i])); } } } @@ -444,7 +441,7 @@ public abstract class Configuration if (curdisplayname.equals(_displayname)) { - return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i])); + return UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i])); } } } diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java index 0f9bfbf0939d..13de04381155 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.java +++ b/wizards/com/sun/star/wizards/common/Desktop.java @@ -76,7 +76,7 @@ public class Desktop try { xInterface = (com.sun.star.uno.XInterface) xMSF.createInstance("com.sun.star.frame.Desktop"); - xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface); + xDesktop = UnoRuntime.queryInterface(XDesktop.class, xInterface); } catch (Exception exception) { @@ -93,27 +93,26 @@ public class Desktop public static XFrame getActiveFrame(XMultiServiceFactory xMSF) { XDesktop xDesktop = getDesktop(xMSF); - XFramesSupplier xFrameSuppl = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop); - XFrame xFrame = xFrameSuppl.getActiveFrame(); - return xFrame; + XFramesSupplier xFrameSuppl = UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop); + return xFrameSuppl.getActiveFrame(); } public static XComponent getActiveComponent(XMultiServiceFactory _xMSF) { XFrame xFrame = getActiveFrame(_xMSF); - return (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel()); + return UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel()); } public static XTextDocument getActiveTextDocument(XMultiServiceFactory _xMSF) { XComponent xComponent = getActiveComponent(_xMSF); - return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent); + return UnoRuntime.queryInterface(XTextDocument.class, xComponent); } public static XSpreadsheetDocument getActiveSpreadsheetDocument(XMultiServiceFactory _xMSF) { XComponent xComponent = getActiveComponent(_xMSF); - return (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent); + return UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent); } public static XDispatch getDispatcher(XMultiServiceFactory xMSF, XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL) @@ -122,9 +121,8 @@ public class Desktop { com.sun.star.util.URL[] oURLArray = new com.sun.star.util.URL[1]; oURLArray[0] = oURL; - XDispatchProvider xDispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, xFrame); - XDispatch xDispatch = xDispatchProvider.queryDispatch(oURLArray[0], _stargetframe, FrameSearchFlag.ALL); // "_self" - return xDispatch; + XDispatchProvider xDispatchProvider = UnoRuntime.queryInterface(XDispatchProvider.class, xFrame); + return xDispatchProvider.queryDispatch(oURLArray[0], _stargetframe, FrameSearchFlag.ALL); // "_self" } catch (Exception e) { @@ -138,7 +136,7 @@ public class Desktop try { Object oTransformer = xMSF.createInstance("com.sun.star.util.URLTransformer"); - XURLTransformer xTransformer = (XURLTransformer) UnoRuntime.queryInterface(XURLTransformer.class, oTransformer); + XURLTransformer xTransformer = UnoRuntime.queryInterface(XURLTransformer.class, oTransformer); com.sun.star.util.URL[] oURL = new com.sun.star.util.URL[1]; oURL[0] = new com.sun.star.util.URL(); oURL[0].Complete = _sURL; @@ -182,8 +180,7 @@ public class Desktop XMultiComponentFactory componentFactory = getMultiComponentFactory(); Object xUrlResolver = componentFactory.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", null ); XUnoUrlResolver urlResolver = UnoRuntime.queryInterface(XUnoUrlResolver.class, xUrlResolver); - XMultiServiceFactory orb = UnoRuntime.queryInterface(XMultiServiceFactory.class, urlResolver.resolve( connectStr ) ); - return orb; + return UnoRuntime.queryInterface(XMultiServiceFactory.class, urlResolver.resolve( connectStr ) ); } public static String getIncrementSuffix(XNameAccess xElementContainer, String ElementName) @@ -192,10 +189,10 @@ public class Desktop int i = 1; String sIncSuffix = PropertyNames.EMPTY_STRING; String BaseName = ElementName; - while (bElementexists == true) + while (bElementexists) { bElementexists = xElementContainer.hasByName(ElementName); - if (bElementexists == true) + if (bElementexists) { i += 1; ElementName = BaseName + Integer.toString(i); @@ -214,10 +211,10 @@ public class Desktop int i = 1; String sIncSuffix = PropertyNames.EMPTY_STRING; String BaseName = ElementName; - while (bElementexists == true) + while (bElementexists) { bElementexists = xElementContainer.hasByHierarchicalName(ElementName); - if (bElementexists == true) + if (bElementexists) { i += 1; ElementName = BaseName + Integer.toString(i); @@ -235,10 +232,9 @@ public class Desktop try { int nStartFlags = com.sun.star.i18n.KParseTokens.ANY_LETTER_OR_NUMBER + com.sun.star.i18n.KParseTokens.ASC_UNDERSCORE; - int nContFlags = nStartFlags; Object ocharservice = _xMSF.createInstance("com.sun.star.i18n.CharacterClassification"); - XCharacterClassification xCharacterClassification = (XCharacterClassification) UnoRuntime.queryInterface(XCharacterClassification.class, ocharservice); - ParseResult aResult = xCharacterClassification.parsePredefinedToken(KParseType.IDENTNAME, _sString, 0, _aLocale, nStartFlags, PropertyNames.EMPTY_STRING, nContFlags, PropertyNames.SPACE); + XCharacterClassification xCharacterClassification = UnoRuntime.queryInterface(XCharacterClassification.class, ocharservice); + ParseResult aResult = xCharacterClassification.parsePredefinedToken(KParseType.IDENTNAME, _sString, 0, _aLocale, nStartFlags, PropertyNames.EMPTY_STRING, nStartFlags, PropertyNames.SPACE); return aResult.EndPos; } catch (Exception e) @@ -311,7 +307,7 @@ public class Desktop { return _sElementName; } - while (bElementexists == true) + while (bElementexists) { for (int i = 0; i < _slist.length; i++) { @@ -342,8 +338,8 @@ public class Desktop aNodePath[0] = new PropertyValue(); aNodePath[0].Name = "nodepath"; aNodePath[0].Value = KeyName; - XMultiServiceFactory xMSFConfig = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider); - if (bForUpdate == true) + XMultiServiceFactory xMSFConfig = UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider); + if (bForUpdate) { return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath); } @@ -391,8 +387,7 @@ public class Desktop { try { - String sTemplatePath = FileAccess.getOfficePath(_xMSF, "Template", "share", "/wizard"); - return sTemplatePath; + return FileAccess.getOfficePath(_xMSF, "Template", "share", "/wizard"); } catch (NoValidPathException nopathexception) { @@ -404,8 +399,7 @@ public class Desktop { try { - String sUserTemplatePath = FileAccess.getOfficePath(_xMSF, "Template", "user", PropertyNames.EMPTY_STRING); - return sUserTemplatePath; + return FileAccess.getOfficePath(_xMSF, "Template", "user", PropertyNames.EMPTY_STRING); } catch (NoValidPathException nopathexception) { @@ -417,8 +411,7 @@ public class Desktop { try { - String sBitmapPath = FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/../wizard/bitmap"); - return sBitmapPath; + return FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/../wizard/bitmap"); } catch (NoValidPathException nopathexception) { @@ -430,8 +423,7 @@ public class Desktop { try { - String sWorkPath = FileAccess.getOfficePath(_xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); - return sWorkPath; + return FileAccess.getOfficePath(_xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); } catch (NoValidPathException nopathexception) { @@ -452,7 +444,7 @@ public class Desktop } if (xPathSubst != null) { - return (XStringSubstitution) UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst); + return UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst); } else { @@ -495,7 +487,7 @@ public class Desktop { Object comp = ((Any) e.nextElement()).getObject(); - XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, comp); + XModel xModel = UnoRuntime.queryInterface(XModel.class, comp); XFrame xFrame = xModel.getCurrentController().getFrame(); if (xFrame != null && xFrame.getComponentWindow() != null) diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java index 1b5e91c6c58b..40cccba9ad75 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.java +++ b/wizards/com/sun/star/wizards/common/FileAccess.java @@ -33,6 +33,7 @@ import com.sun.star.util.XMacroExpander; // import com.sun.star.wizards.common.NoValidPathException; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.Vector; import com.sun.star.awt.VclWindowPeerAttribute; @@ -90,8 +91,7 @@ public class FileAccess } } ResultPath += PropertyNames.SEMI_COLON + sAddPath; - return; - } + } public static String deleteLastSlashfromUrl(String _sPath) { @@ -155,11 +155,11 @@ public class FileAccess try { XInterface xPathInterface = (XInterface) xMSF.createInstance("com.sun.star.util.PathSettings"); - XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, xPathInterface); + XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xPathInterface); String WritePath = PropertyNames.EMPTY_STRING; String[] ReadPaths = null; XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface); Template_writable = (String) xPropertySet.getPropertyValue(sPath + "_writable"); Template_internal = (String[]) xPropertySet.getPropertyValue(sPath + "_internal"); @@ -206,7 +206,7 @@ public class FileAccess exception.printStackTrace(System.out); ResultPath = PropertyNames.EMPTY_STRING; } - if (bexists == false) + if (!bexists) { throw new NoValidPathException(xMSF, PropertyNames.EMPTY_STRING); } @@ -229,7 +229,7 @@ public class FileAccess try { XInterface xPathInterface = (XInterface) xMSF.createInstance("com.sun.star.util.PathSettings"); - XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, xPathInterface); + XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xPathInterface); // String WritePath = PropertyNames.EMPTY_STRING; // XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); // XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface); @@ -255,10 +255,7 @@ public class FileAccess aPathList.add(sPath); } - for (int i = 0; i < Template_user.length; i++) - { - aPathList.add(Template_user[i]); - } + aPathList.addAll(Arrays.asList(Template_user)); aPathList.add(Template_writable); // WritePath = Template_writable; @@ -323,7 +320,7 @@ public class FileAccess String sPath = _sPath + "/" + aLocaleAll.toString(); XInterface xInterface = (XInterface) _xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); if (xSimpleFileAccess.exists(sPath)) { return sPath; @@ -439,7 +436,7 @@ public class FileAccess try { XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface); bExists = xSimpleFileAccess.exists(_sPath); } catch (Exception exception) @@ -456,7 +453,7 @@ public class FileAccess try { XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface); ReturnPath = _sFirstPath + _sSecondPath; bexists = xSimpleFileAccess.exists(ReturnPath); } @@ -465,7 +462,7 @@ public class FileAccess exception.printStackTrace(System.out); return PropertyNames.EMPTY_STRING; } - if (bexists == false) + if (!bexists) { throw new NoValidPathException(xMSF, PropertyNames.EMPTY_STRING); } @@ -478,20 +475,17 @@ public class FileAccess try { Resource oResource = new Resource(xMSF, "ImportWizard", "imp"); - if (oResource != null) + sNoDirCreation = oResource.getResText(1050); + String sMsgDirNotThere = oResource.getResText(1051); + String sQueryForNewCreation = oResource.getResText(1052); + String OSPath = JavaTools.convertfromURLNotation(Path); + String sQueryMessage = JavaTools.replaceSubString(sMsgDirNotThere, OSPath, "%1"); + sQueryMessage = sQueryMessage + (char) 13 + sQueryForNewCreation; + int icreate = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sQueryMessage); + if (icreate == 2) { - sNoDirCreation = oResource.getResText(1050); - String sMsgDirNotThere = oResource.getResText(1051); - String sQueryForNewCreation = oResource.getResText(1052); - String OSPath = JavaTools.convertfromURLNotation(Path); - String sQueryMessage = JavaTools.replaceSubString(sMsgDirNotThere, OSPath, "%1"); - sQueryMessage = sQueryMessage + (char) 13 + sQueryForNewCreation; - int icreate = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sQueryMessage); - if (icreate == 2) - { - xSimpleFileAccess.createFolder(Path); - return true; - } + xSimpleFileAccess.createFolder(Path); + return true; } return false; } @@ -525,7 +519,7 @@ public class FileAccess String LowerCasePath; String NewPath = Path; XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); if (baskbeforeOverwrite) { if (xSimpleFileAccess.exists(Path)) @@ -563,14 +557,13 @@ public class FileAccess if (bexists) { LowerCasePath = NewPath.toLowerCase(); - bexists = (((LowerCasePath.equals("file:///")) || (LowerCasePath.equals("file://")) || (LowerCasePath.equals("file:/")) || (LowerCasePath.equals("file:"))) == false); + bexists = (!((LowerCasePath.equals("file:///")) || (LowerCasePath.equals("file://")) || (LowerCasePath.equals("file:/")) || (LowerCasePath.equals("file:")))); } if (bexists) { - if (bSubDirexists == false) + if (!bSubDirexists) { - boolean bSubDiriscreated = createSubDirectory(xMSF, xSimpleFileAccess, SubDirPath); - return bSubDiriscreated; + return createSubDirectory(xMSF, xSimpleFileAccess, SubDirPath); } return true; } @@ -611,10 +604,10 @@ public class FileAccess java.util.Vector<String> NameVector = null; XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties"); - XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface); + XDocumentProperties xDocProps = 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); + com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false); @@ -680,7 +673,7 @@ public class FileAccess try { 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); + com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); for (int i = 0; i < _aList.size(); i++) { @@ -718,7 +711,7 @@ public class FileAccess try { XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties"); - XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface); + XDocumentProperties xDocProps = UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface); PropertyValue[] noArgs = { }; xDocProps.loadFromMedium(_sFile, noArgs); sTitle = xDocProps.getTitle(); @@ -744,7 +737,7 @@ public class FileAccess try { XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - xSimpleFileAccess = (com.sun.star.ucb.XSimpleFileAccess) UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface); + xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); } catch (com.sun.star.uno.Exception e) { @@ -818,26 +811,23 @@ public class FileAccess { //get a simple file access... Object fa = xmsf.createInstance("com.sun.star.ucb.SimpleFileAccess"); - fileAccess = (XSimpleFileAccess2) UnoRuntime.queryInterface(XSimpleFileAccess2.class, fa); + fileAccess = UnoRuntime.queryInterface(XSimpleFileAccess2.class, fa); //get the file identifier converter Object fcv = xmsf.createInstance("com.sun.star.ucb.FileContentProvider"); - filenameConverter = (XFileIdentifierConverter) UnoRuntime.queryInterface(XFileIdentifierConverter.class, fcv); + filenameConverter = UnoRuntime.queryInterface(XFileIdentifierConverter.class, fcv); } public String getURL(String parentPath, String childPath) { String parent = filenameConverter.getSystemPathFromFileURL(parentPath); File f = new File(parent, childPath); - String r = filenameConverter.getFileURLFromSystemPath(parentPath, f.getAbsolutePath()); - return r; + return filenameConverter.getFileURLFromSystemPath(parentPath, f.getAbsolutePath()); } public String getURL(String path) { File f = new File(path); - String r = filenameConverter.getFileURLFromSystemPath( - path, f.getAbsolutePath()); - return r; + return filenameConverter.getFileURLFromSystemPath(path, f.getAbsolutePath()); } public String getPath(String parentURL, String childURL) @@ -1018,8 +1008,7 @@ public class FileAccess { String filename = getFilename(path, pathSeparator); String sExtension = getExtension(filename); - String basename = filename.substring(0, filename.length() - (sExtension.length() + 1)); - return basename; + return filename.substring(0, filename.length() - (sExtension.length() + 1)); } /** @@ -1102,8 +1091,7 @@ public class FileAccess do { String filename = filename(name, extension, i++); - String u = getURL(parentDir, filename); - url = u; + url = getURL(parentDir, filename); } while (exists(url, true)); @@ -1140,13 +1128,13 @@ public class FileAccess { Vector<String> oDataVector = new Vector<String>(); Object oSimpleFileAccess = _xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess); if (xSimpleFileAccess.exists(_filepath)) { XInputStream xInputStream = xSimpleFileAccess.openFileRead(_filepath); Object oTextInputStream = _xMSF.createInstance("com.sun.star.io.TextInputStream"); - XTextInputStream xTextInputStream = (XTextInputStream) UnoRuntime.queryInterface(XTextInputStream.class, oTextInputStream); - XActiveDataSink xActiveDataSink = (XActiveDataSink) UnoRuntime.queryInterface(XActiveDataSink.class, oTextInputStream); + XTextInputStream xTextInputStream = UnoRuntime.queryInterface(XTextInputStream.class, oTextInputStream); + XActiveDataSink xActiveDataSink = UnoRuntime.queryInterface(XActiveDataSink.class, oTextInputStream); xActiveDataSink.setInputStream(xInputStream); while (!xTextInputStream.isEOF()) { diff --git a/wizards/com/sun/star/wizards/common/HelpIds.java b/wizards/com/sun/star/wizards/common/HelpIds.java index a3b577d1e52b..19a51bef3e5a 100644 --- a/wizards/com/sun/star/wizards/common/HelpIds.java +++ b/wizards/com/sun/star/wizards/common/HelpIds.java @@ -1042,6 +1042,6 @@ public class HelpIds else if ( nHelpId >= 40769 && nHelpId <= 41245 ) return array2[ nHelpId - 40769 ]; else - return new String(); + return ""; } } diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java index 0df16b360de0..b00cb3b2b485 100644 --- a/wizards/com/sun/star/wizards/common/Helper.java +++ b/wizards/com/sun/star/wizards/common/Helper.java @@ -58,15 +58,14 @@ public class Helper oCal.set(DateValue.Year, DateValue.Month, DateValue.Day); java.util.Date dTime = oCal.getTime(); long lTime = dTime.getTime(); - long lDate = lTime / (3600 * 24000); - return lDate; + return lTime / (3600 * 24000); } public static void setUnoPropertyValue(Object oUnoObject, String PropertyName, Object PropertyValue) { try { - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); if (xPSet.getPropertySetInfo().hasPropertyByName(PropertyName)) { xPSet.setPropertyValue(PropertyName, PropertyValue); @@ -87,8 +86,8 @@ public class Helper { try { - com.sun.star.container.XNameAccess xName = (com.sun.star.container.XNameAccess) UnoRuntime.queryInterface(com.sun.star.container.XNameAccess.class, oUnoObject); - if (xName.hasByName(ElementName) == true) + com.sun.star.container.XNameAccess xName = UnoRuntime.queryInterface(com.sun.star.container.XNameAccess.class, oUnoObject); + if (xName.hasByName(ElementName)) { return xName.getByName(ElementName); } @@ -126,7 +125,7 @@ public class Helper { if (oUnoObject != null) { - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); Object oObject = xPSet.getPropertyValue(PropertyName); if (AnyConverter.isVoid(oObject)) { @@ -202,10 +201,9 @@ public class Helper { if (oUnoObject != null) { - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); // Property[] aProps = xPSet.getPropertySetInfo().getProperties(); - Object oObject = xPSet.getPropertyValue(PropertyName); - return oObject; + return xPSet.getPropertyValue(PropertyName); } } catch (Exception exception) @@ -221,7 +219,7 @@ public class Helper { if (oUnoObject != null) { - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); Object oObject = xPSet.getPropertyValue(PropertyName); if (AnyConverter.isArray(oObject)) { @@ -242,11 +240,10 @@ public class Helper { if (oUnoObject != null) { - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); - if (xPSet.getPropertySetInfo().hasPropertyByName(PropertyName) == true) + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); + if (xPSet.getPropertySetInfo().hasPropertyByName(PropertyName)) { - Object oObject = xPSet.getPropertyValue(PropertyName); - return oObject; + return xPSet.getPropertyValue(PropertyName); } } return null; @@ -262,7 +259,7 @@ public class Helper { try { - com.sun.star.beans.XMultiPropertySet xMultiPSetLst = (com.sun.star.beans.XMultiPropertySet) UnoRuntime.queryInterface(com.sun.star.beans.XMultiPropertySet.class, oUnoObject); + com.sun.star.beans.XMultiPropertySet xMultiPSetLst = UnoRuntime.queryInterface(com.sun.star.beans.XMultiPropertySet.class, oUnoObject); if (xMultiPSetLst != null) { xMultiPSetLst.setPropertyValues(PropertyNames, PropertyValues); @@ -322,7 +319,7 @@ public class Helper public DateUtils(XMultiServiceFactory xmsf, Object document) throws Exception { - XMultiServiceFactory docMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document); + XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document); Object defaults = docMSF.createInstance("com.sun.star.text.Defaults"); Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale"); @@ -332,7 +329,7 @@ public class Helper calendar = Calendar.getInstance(jl); - formatSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document); + formatSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document); Object formatSettings = formatSupplier.getNumberFormatSettings(); com.sun.star.util.Date date = (com.sun.star.util.Date) Helper.getUnoPropertyValue(formatSettings, "NullDate"); @@ -379,9 +376,7 @@ public class Helper * docNullTime and date1 are in millis, but * I need a day... */ - double daysDiff = (date1 - docNullTime) / DAY_IN_MILLIS + 1; - - return daysDiff; + return (date1 - docNullTime) / DAY_IN_MILLIS + 1; } public double getDocumentDateAsDouble(DateTime date) @@ -400,9 +395,7 @@ public class Helper * docNullTime and date1 are in millis, but * I need a day... */ - double daysDiff = (date1 - docNullTime) / DAY_IN_MILLIS + 1; - - return daysDiff; + return (date1 - docNullTime) / DAY_IN_MILLIS + 1; } @@ -425,20 +418,16 @@ public class Helper public static XComponentContext getComponentContext(XMultiServiceFactory _xMSF) { // Get the path to the extension and try to add the path to the class loader - final XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xMSF); + final XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class, _xMSF); final PropertySetHelper aHelper = new PropertySetHelper(xProps); final Object aDefaultContext = aHelper.getPropertyValueAsObject("DefaultContext"); - final XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, aDefaultContext); - return xComponentContext; + return UnoRuntime.queryInterface(XComponentContext.class, aDefaultContext); } public static XMacroExpander getMacroExpander(XMultiServiceFactory _xMSF) { final XComponentContext xComponentContext = getComponentContext(_xMSF); final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander"); - XMacroExpander xExpander = (XMacroExpander) UnoRuntime.queryInterface(XMacroExpander.class, aSingleton); - // String[][] aStrListList = xProvider.getExtensionList(); -// final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner"); - return xExpander; + return UnoRuntime.queryInterface(XMacroExpander.class, aSingleton); } } diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java index a05c3a6460f7..43a66301ba27 100644 --- a/wizards/com/sun/star/wizards/common/JavaTools.java +++ b/wizards/com/sun/star/wizards/common/JavaTools.java @@ -79,10 +79,7 @@ public class JavaTools if (FirstArray != null) { String[] SecondArray = new String[FirstArray.length]; - for (int i = 0; i < FirstArray.length; i++) - { - SecondArray[i] = FirstArray[i]; - } + System.arraycopy(FirstArray, 0, SecondArray, 0, FirstArray.length); return SecondArray; } else @@ -377,7 +374,7 @@ public class JavaTools public static String[] ArrayoutofString(String MainString, String Token) { String[] StringArray; - if (MainString.equals(PropertyNames.EMPTY_STRING) == false) + if (!MainString.equals(PropertyNames.EMPTY_STRING)) { Vector StringVector = new Vector(); String LocString = null; @@ -565,38 +562,32 @@ public class JavaTools public static PropertyValue[][] removeOutdatedFields(PropertyValue[][] baselist, String[] _complist) { - PropertyValue[][] retarray = new PropertyValue[][] - { - }; if ((baselist != null) && (_complist != null)) { - Vector firstdimvector = new Vector(); - int b = 0; + ArrayList<PropertyValue[]> firstdimvector = new ArrayList<PropertyValue[]>(); for (int n = 0; n < baselist.length; n++) { - Vector secdimvector = new Vector(); - PropertyValue[] internalArray; - int a = 0; + ArrayList<PropertyValue> secdimvector = new ArrayList<PropertyValue>(); for (int m = 0; m < baselist[n].length; m++) { if (FieldInList(_complist, baselist[n][m].Name) > -1) { secdimvector.add(baselist[n][m]); - a++; } } - if (a > 0) + if (!secdimvector.isEmpty()) { - internalArray = new PropertyValue[a]; + PropertyValue[] internalArray = new PropertyValue[secdimvector.size()]; secdimvector.toArray(internalArray); firstdimvector.add(internalArray); - b++; } } - retarray = new PropertyValue[b][]; - firstdimvector.toArray(retarray); + PropertyValue[][] retarray = new PropertyValue[firstdimvector.size()][]; + return firstdimvector.toArray(retarray); } - return (retarray); + return new PropertyValue[][] + { + }; } /** @@ -621,7 +612,7 @@ public class JavaTools { if (n == 0) { - sDescList[m] = new String(); + sDescList[m] = ""; } sDescList[m] += _scomplist[n][m]; } @@ -766,7 +757,7 @@ public class JavaTools } else { - bissame = (sSecondString == null); + bissame = true; } } else diff --git a/wizards/com/sun/star/wizards/common/NamedValueCollection.java b/wizards/com/sun/star/wizards/common/NamedValueCollection.java index f8f2cd05224a..ebafcbd31e41 100644 --- a/wizards/com/sun/star/wizards/common/NamedValueCollection.java +++ b/wizards/com/sun/star/wizards/common/NamedValueCollection.java @@ -38,7 +38,7 @@ public class NamedValueCollection } @SuppressWarnings("unchecked") - public final < T extends Object > T getOrDefault( final String i_key, final T i_default ) + public final < T > T getOrDefault( final String i_key, final T i_default ) { if ( m_values.containsKey( i_key ) ) { diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java index ccfbee303f98..f4398088ff30 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -66,9 +66,9 @@ public class NumberFormatter Object oNumberFormatter = _xMSF.createInstance("com.sun.star.util.NumberFormatter"); xNumberFormats = _xNumberFormatsSupplier.getNumberFormats(); xNumberFormatSettings = _xNumberFormatsSupplier.getNumberFormatSettings(); - xNumberFormatter = (XNumberFormatter) UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter); + xNumberFormatter = UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter); xNumberFormatter.attachNumberFormatsSupplier(_xNumberFormatsSupplier); - xNumberFormatTypes = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats); + xNumberFormatTypes = UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats); } @@ -77,7 +77,7 @@ public class NumberFormatter aLocale = _aLocale; xNumberFormats = _xNumberFormatsSupplier.getNumberFormats(); xNumberFormatSettings = _xNumberFormatsSupplier.getNumberFormatSettings(); - xNumberFormatTypes = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats); + xNumberFormatTypes = UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats); } @@ -92,7 +92,7 @@ public class NumberFormatter public static XNumberFormatter createNumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier _xNumberFormatsSupplier) throws Exception { Object oNumberFormatter = _xMSF.createInstance("com.sun.star.util.NumberFormatter"); - XNumberFormatter xNumberFormatter = (XNumberFormatter) UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter); + XNumberFormatter xNumberFormatter = UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter); xNumberFormatter.attachNumberFormatsSupplier(_xNumberFormatsSupplier); return xNumberFormatter; } @@ -114,9 +114,9 @@ public class NumberFormatter */ public static int getNumberFormatterKey( Object numberFormatsSupplier, short type) { - Object numberFormatTypes = ((XNumberFormatsSupplier)UnoRuntime.queryInterface(XNumberFormatsSupplier.class,numberFormatsSupplier)).getNumberFormats(); + Object numberFormatTypes = UnoRuntime.queryInterface(XNumberFormatsSupplier.class,numberFormatsSupplier).getNumberFormats(); Locale l = new Locale(); - return ((XNumberFormatTypes)UnoRuntime.queryInterface(XNumberFormatTypes.class,numberFormatTypes)).getFormatIndex(type, l); + return UnoRuntime.queryInterface(XNumberFormatTypes.class,numberFormatTypes).getFormatIndex(type, l); } @@ -200,7 +200,7 @@ public class NumberFormatter String FormatString = AnyConverter.toString(Helper.getUnoPropertyValue(xNumberFormat, "FormatString")); Locale oLocale = (Locale) Helper.getUnoPropertyValue(xNumberFormat, "Locale"); int NewFormatKey = defineNumberFormat(FormatString, oLocale); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xFormatObject); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, _xFormatObject); xPSet.setPropertyValue("FormatsSupplier", _oNumberFormatter.xNumberFormatter.getNumberFormatsSupplier()); if (xPSet.getPropertySetInfo().hasPropertyByName("NumberFormat")) { diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java index ff3795473fee..3a1c3b4ecf0f 100644 --- a/wizards/com/sun/star/wizards/common/NumericalHelper.java +++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java @@ -735,31 +735,31 @@ public class NumericalHelper switch (aTypeObject.iType) { case BYTE_TYPE: - retValue = ((Byte) aTypeObject.aValue).toString(); + retValue = aTypeObject.aValue.toString(); break; case CHAR_TYPE: - retValue = ((Character) aTypeObject.aValue).toString(); + retValue = aTypeObject.aValue.toString(); break; case SHORT_TYPE: - retValue = ((Short) aTypeObject.aValue).toString(); + retValue = aTypeObject.aValue.toString(); break; case INT_TYPE: - retValue = ((Integer) aTypeObject.aValue).toString(); + retValue = aTypeObject.aValue.toString(); break; case LONG_TYPE: - retValue = ((Long) aTypeObject.aValue).toString(); + retValue = aTypeObject.aValue.toString(); break; case FLOAT_TYPE: - retValue = ((Float) aTypeObject.aValue).toString(); + retValue = aTypeObject.aValue.toString(); break; case DOUBLE_TYPE: - retValue = ((Double) aTypeObject.aValue).toString(); + retValue = aTypeObject.aValue.toString(); break; case STRING_TYPE: retValue = (String) aTypeObject.aValue; break; case BOOLEAN_TYPE: - retValue = ((Boolean) aTypeObject.aValue).toString(); + retValue = aTypeObject.aValue.toString(); break; case ARRAY_TYPE: retValue = new String(toByteArray((aValue))); @@ -1619,7 +1619,6 @@ public class NumericalHelper public static double roundDouble(double _dblvalue, int _ndecimals) { double dblfactor = java.lang.Math.pow(10.0, (double) _ndecimals); - double dblretvalue = ((double) ((int) (_dblvalue * dblfactor))) / dblfactor; - return dblretvalue; + return ((double) ((int) (_dblvalue * dblfactor))) / dblfactor; } } diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java index bdca296db552..bde98249f43d 100644 --- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java +++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java @@ -49,7 +49,7 @@ public class PropertySetHelper { return; } - m_xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aObj); + m_xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _aObj); } private HashMap<String, Object> getHashMap() @@ -375,7 +375,7 @@ public class PropertySetHelper if (m_xPropertySet != null) { - XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, m_xPropertySet); + XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, m_xPropertySet); if (xServiceInfo != null) { sName = xServiceInfo.getImplementationName(); diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java index 8dc660b21d07..8e93e68e6b54 100644 --- a/wizards/com/sun/star/wizards/common/Resource.java +++ b/wizards/com/sun/star/wizards/common/Resource.java @@ -61,8 +61,7 @@ public class Resource Object[][] DummyArray = new Object[1][]; Object[] nIDArray = new Object[1]; nIDArray[0] = new Integer(nID); - final String IDString = (String) xInvocation.invoke("getString", nIDArray, PointerArray, DummyArray); - return IDString; + return (String) xInvocation.invoke("getString", nIDArray, PointerArray, DummyArray); } catch (Exception exception) { @@ -80,8 +79,7 @@ public class Resource Object[] nIDArray = new Object[1]; nIDArray[0] = new Integer(nID); //Object bla = xInvocation.invoke("getStringList", nIDArray, PointerArray, DummyArray); - PropertyValue[] ResProp = (PropertyValue[]) xInvocation.invoke("getStringList", nIDArray, PointerArray, DummyArray); - return ResProp; + return (PropertyValue[]) xInvocation.invoke("getStringList", nIDArray, PointerArray, DummyArray); } catch (Exception exception) { @@ -120,7 +118,7 @@ public class Resource } else { - XInvocation xResInvoke = (XInvocation) com.sun.star.uno.UnoRuntime.queryInterface(XInvocation.class, xResource); + XInvocation xResInvoke = com.sun.star.uno.UnoRuntime.queryInterface(XInvocation.class, xResource); xResInvoke.setValue("FileName", Module); return xResInvoke; } diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java index ac3a38c9cf7d..012b33770f5c 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.java +++ b/wizards/com/sun/star/wizards/common/SystemDialog.java @@ -66,14 +66,14 @@ public class SystemDialog try { this.xMSF = xMSF; - systemDialog = (XInterface) xMSF.createInstance(ServiceName); - xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, systemDialog); - xFolderPicker = (XFolderPicker) UnoRuntime.queryInterface(XFolderPicker.class, systemDialog); - xFilterManager = (XFilterManager) UnoRuntime.queryInterface(XFilterManager.class, systemDialog); - xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, systemDialog); - xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, systemDialog); - xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, systemDialog); - xFilePickerControlAccess = (XFilePickerControlAccess) UnoRuntime.queryInterface(XFilePickerControlAccess.class, systemDialog); + systemDialog = xMSF.createInstance(ServiceName); + xFilePicker = UnoRuntime.queryInterface(XFilePicker.class, systemDialog); + xFolderPicker = UnoRuntime.queryInterface(XFolderPicker.class, systemDialog); + xFilterManager = UnoRuntime.queryInterface(XFilterManager.class, systemDialog); + xInitialize = UnoRuntime.queryInterface(XInitialization.class, systemDialog); + xExecutable = UnoRuntime.queryInterface(XExecutableDialog.class, systemDialog); + xComponent = UnoRuntime.queryInterface(XComponent.class, systemDialog); + xFilePickerControlAccess = UnoRuntime.queryInterface(XFilePickerControlAccess.class, systemDialog); xStringSubstitution = createStringSubstitution(xMSF); Short[] listAny = new Short[] { @@ -114,12 +114,7 @@ public class SystemDialog { try { - //System.out.println("SystemDialog.subst:"); - //System.out.println(path); - String s = xStringSubstitution.substituteVariables(path, false); - //System.out.println(s); - return s; - + return xStringSubstitution.substituteVariables(path, false); } catch (Exception ex) { @@ -157,7 +152,7 @@ public class SystemDialog sStorePath = null; try { - xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, new Boolean(true)); + xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, Boolean.TRUE); xFilePicker.setDefaultName(defaultName); xFilePicker.setDisplayDirectory(subst(displayDir)); if (execute(xExecutable)) @@ -351,7 +346,7 @@ public class SystemDialog return 0; } XFrame xFrame = Desktop.getActiveFrame(xMSF); - XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow()); + XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow()); return showMessageBox(xMSF, xWindowPeer, windowServiceName, windowAttribute, MessageText); } catch (Exception exception) @@ -382,15 +377,15 @@ public class SystemDialog try { XInterface xAWTToolkit = (XInterface) xMSF.createInstance("com.sun.star.awt.Toolkit"); - XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, xAWTToolkit); + XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, xAWTToolkit); com.sun.star.awt.WindowDescriptor oDescriptor = new com.sun.star.awt.WindowDescriptor(); oDescriptor.WindowServiceName = windowServiceName; oDescriptor.Parent = peer; oDescriptor.Type = com.sun.star.awt.WindowClass.MODALTOP; oDescriptor.WindowAttributes = windowAttribute; XWindowPeer xMsgPeer = xToolkit.createWindow(oDescriptor); - XMessageBox xMsgbox = (XMessageBox) UnoRuntime.queryInterface(XMessageBox.class, xMsgPeer); - XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xMsgbox); + XMessageBox xMsgbox = UnoRuntime.queryInterface(XMessageBox.class, xMsgPeer); + XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, xMsgbox); xMsgbox.setMessageText(MessageText); iMessage = xMsgbox.execute(); xComponent.dispose(); @@ -417,7 +412,7 @@ public class SystemDialog } if (xPathSubst != null) { - return (XStringSubstitution) UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XStringSubstitution.class, xPathSubst); } else diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java index aa612ad5fef1..5d032639d5e3 100644 --- a/wizards/com/sun/star/wizards/common/UCB.java +++ b/wizards/com/sun/star/wizards/common/UCB.java @@ -149,7 +149,7 @@ public class UCB throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception { - XCommandProcessor xCmdProcessor = (XCommandProcessor)UnoRuntime.queryInterface( + XCommandProcessor xCmdProcessor = UnoRuntime.queryInterface( XCommandProcessor.class, xContent); Command aCommand = new Command(); aCommand.Name = aCommandName; @@ -174,7 +174,7 @@ public class UCB XDynamicResultSet xSet; - xSet = (XDynamicResultSet)UnoRuntime.queryInterface( + xSet = UnoRuntime.queryInterface( XDynamicResultSet.class,executeCommand(xContent, "open", aArg)); XResultSet xResultSet = xSet.getStaticResultSet(); @@ -184,9 +184,9 @@ public class UCB if (xResultSet.first()) { // obtain XContentAccess interface for child content access and XRow for properties - XContentAccess xContentAccess = (XContentAccess)UnoRuntime.queryInterface( + XContentAccess xContentAccess = UnoRuntime.queryInterface( XContentAccess.class, xResultSet); - XRow xRow = (XRow)UnoRuntime.queryInterface(XRow.class, xResultSet); + XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet); do { // Obtain URL of child. @@ -195,7 +195,7 @@ public class UCB String aTitle = xRow.getString(1); if (aTitle.length() == 0 && xRow.wasNull()) { - ; //ignore + //ignore } else { @@ -228,7 +228,7 @@ public class UCB pv[0].Handle = -1; Object row = executeCommand(content,"getPropertyValues",pv); - XRow xrow = (XRow)UnoRuntime.queryInterface(XRow.class,row); + XRow xrow = UnoRuntime.queryInterface(XRow.class,row); if (type.equals(String.class)) { return xrow.getString(1); @@ -255,10 +255,10 @@ public class UCB public Object getContent(String path) throws Exception { //System.out.println("Getting Content for : " + path); - XContentIdentifier id = ((XContentIdentifierFactory) UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb)).createContentIdentifier(path); + XContentIdentifier id = UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb).createContentIdentifier(path); - return ((XContentProvider)UnoRuntime.queryInterface( - XContentProvider.class,ucb)).queryContent(id); + return UnoRuntime.queryInterface( + XContentProvider.class,ucb).queryContent(id); } public static interface Verifier diff --git a/wizards/com/sun/star/wizards/db/BlindtextCreator.java b/wizards/com/sun/star/wizards/db/BlindtextCreator.java index 308eca03e121..989fdcc916e9 100644 --- a/wizards/com/sun/star/wizards/db/BlindtextCreator.java +++ b/wizards/com/sun/star/wizards/db/BlindtextCreator.java @@ -71,7 +71,6 @@ public class BlindtextCreator String PartBlindText = BlindTextArray[0]; String NewPartBlindText; int MaxHeaderWidth; - int iWidth = FieldWidth; int Titlelength = (int) 1.1 * FieldTitle.length(); // We assume that the TableHeading is bold if (Titlelength > PartBlindText.length()) @@ -102,7 +101,7 @@ public class BlindtextCreator private static int getMaxFieldCount(boolean bIsCurLandscape) { - if (bIsCurLandscape == true) + if (bIsCurLandscape) { return 5; } diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index af4972c52e86..cb76e3b44a28 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -154,8 +154,7 @@ public class CommandMetaData extends DBMetaData String CurCommandName = CurFieldColumn.getCommandName(); CommandObject oCommand = getTableByName(CurCommandName); Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName()); - XPropertySet xColumn = UnoRuntime.queryInterface(XPropertySet.class, oColumn); - return xColumn; + return UnoRuntime.queryInterface(XPropertySet.class, oColumn); } catch (Exception exception) { @@ -335,19 +334,16 @@ public class CommandMetaData extends DBMetaData public String[] getOrderableColumns(String[] _fieldnames) { ArrayList<String> aOrderableColumns = new ArrayList<String>(); - int ncount = 0; for (int i = 0; i < _fieldnames.length; i++) { FieldColumn ofieldcolumn = getFieldColumnByFieldName(_fieldnames[i]); if (getDBDataTypeInspector().isColumnOrderable(ofieldcolumn.getXColumnPropertySet())) { aOrderableColumns.add(_fieldnames[i]); - ncount++; } } - String[] sretfieldnames = new String[ncount]; - aOrderableColumns.toArray(sretfieldnames); - return sretfieldnames; + String[] sretfieldnames = new String[aOrderableColumns.size()]; + return aOrderableColumns.toArray(sretfieldnames); } /** diff --git a/wizards/com/sun/star/wizards/db/CommandName.java b/wizards/com/sun/star/wizards/db/CommandName.java index 64e3f5cbeae5..9d8578f5c8ba 100644 --- a/wizards/com/sun/star/wizards/db/CommandName.java +++ b/wizards/com/sun/star/wizards/db/CommandName.java @@ -95,12 +95,12 @@ public class CommandName { this.DisplayName = _DisplayName; int iIndex; - if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation() == true) + if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation()) { // ...dann Catalog mit in TableName iIndex = _DisplayName.indexOf(sCatalogSep); if (iIndex >= 0) { - if (bCatalogAtStart == true) + if (bCatalogAtStart) { CatalogName = _DisplayName.substring(0, iIndex); _DisplayName = _DisplayName.substring(iIndex + 1, _DisplayName.length()); @@ -112,7 +112,7 @@ public class CommandName } } } - if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation() == true) + if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation()) { String[] NameList; NameList = new String[0]; @@ -141,7 +141,7 @@ public class CommandName { if (!CatalogName.equals(PropertyNames.EMPTY_STRING)) { - if (bCatalogAtStart == true) + if (bCatalogAtStart) { ComposedName = quoteName(CatalogName) + sCatalogSep; } @@ -162,7 +162,7 @@ public class CommandName { ComposedName += quoteName(TableName); } - if ((bCatalogAtStart == false) && (CatalogName != null)) + if ((!bCatalogAtStart) && (CatalogName != null)) { if (!CatalogName.equals(PropertyNames.EMPTY_STRING)) { diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 54a68cad17b4..afddc49c5895 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -142,7 +142,6 @@ public class DBMetaData private int iMaxColumnsInSelect; private int iMaxColumnsInGroupBy; - private int iMaxColumnsInTable; private int iMaxColumnNameLength = -1; private int iMaxTableNameLength = -1; private boolean bPasswordIsRequired; @@ -372,8 +371,7 @@ public class DBMetaData public XNameAccess getTableNamesAsNameAccess() { XTablesSupplier xDBTables = UnoRuntime.queryInterface( XTablesSupplier.class, DBConnection ); - XNameAccess xTableNames = xDBTables.getTables(); - return xTableNames; + return xDBTables.getTables(); } public String[] getQueryNames() @@ -488,7 +486,7 @@ public class DBMetaData public int getMaxColumnsInTable() throws SQLException { - iMaxColumnsInTable = xDBMetaData.getMaxColumnsInTable(); + int iMaxColumnsInTable = xDBMetaData.getMaxColumnsInTable(); if (iMaxColumnsInTable == 0) { iMaxColumnsInTable = DBMetaData.NOLIMIT; @@ -645,11 +643,6 @@ public class DBMetaData String sDataSourceName = AnyConverter.toString(Properties.getPropertyValue(curproperties, "DatabaseLocation")); return getConnection(sDataSourceName); } - else if (xConnection != null) - { - bdisposeConnection = false; - return getConnection(xConnection); - } } catch (IllegalArgumentException e) { @@ -701,7 +694,7 @@ public class DBMetaData xConnectionComponent.dispose(); } getDataSourceInterfaces(); - if (bPasswordIsRequired == false) + if (!bPasswordIsRequired) { DBConnection = _dataSource.getConnection(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); bgetConnection = true; @@ -717,7 +710,7 @@ public class DBMetaData { DBConnection = xCompleted2.connectWithCompletion( xInteractionHandler ); bgetConnection = DBConnection != null; - if (bgetConnection == false) + if (!bgetConnection) { bExitLoop = true; } @@ -731,9 +724,9 @@ public class DBMetaData bgetConnection = false; } } - while (bExitLoop == false); + while (!bExitLoop); } - if (bgetConnection == false) + if (!bgetConnection) { String sMsgConnectionImpossible = oResource.getResText(RID_DB_COMMON + 35); showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgConnectionImpossible); @@ -900,15 +893,13 @@ public class DBMetaData { XReportDocumentsSupplier xReportDocumentSuppl = UnoRuntime.queryInterface( XReportDocumentsSupplier.class, this.xModel ); xReportDocumentSuppl.getReportDocuments(); - XHierarchicalNameAccess xReportHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments() ); - return xReportHier; + return UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments() ); } public XHierarchicalNameAccess getFormDocuments() { XFormDocumentsSupplier xFormDocumentSuppl = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, xModel ); - XHierarchicalNameAccess xFormHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments() ); - return xFormHier; + return UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments() ); } public boolean hasFormDocumentByName(String _sFormName) diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java index 041aab5f5300..47a333e88dd9 100644 --- a/wizards/com/sun/star/wizards/db/FieldColumn.java +++ b/wizards/com/sun/star/wizards/db/FieldColumn.java @@ -142,8 +142,7 @@ public class FieldColumn */ private String getOnlyFieldName(String _DisplayFieldName, String _CommandName) { - final String sName = _DisplayFieldName.substring(_CommandName.length() + 1, _DisplayFieldName.length()); - return sName; + return _DisplayFieldName.substring(_CommandName.length() + 1, _DisplayFieldName.length()); } public static String composeDisplayFieldName(String _sCommandName, String _sFieldName) @@ -155,12 +154,12 @@ public class FieldColumn { try { - m_xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(m_sFieldName)); + m_xColPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(m_sFieldName)); ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1; m_nFieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type")); getTyperelatedFieldData(); - if (bFormatKeysInitialized == false) + if (!bFormatKeysInitialized) { final NumberFormatter aNumberFormatter = oCommandMetaData.getNumberFormatter(); @@ -393,67 +392,67 @@ public class FieldColumn { case DataType.BIT: // == -7; case DataType.BOOLEAN: - DefaultValue = (Object) Integer.valueOf("1"); + DefaultValue = Integer.valueOf("1"); break; case DataType.TINYINT: // == -6; - DefaultValue = (Object) Integer.valueOf("98"); + DefaultValue = Integer.valueOf("98"); break; case DataType.SMALLINT: // == 5; - DefaultValue = (Object) Integer.valueOf("987"); + DefaultValue = Integer.valueOf("987"); break; case DataType.INTEGER: // == 4; - DefaultValue = (Object) Integer.valueOf("9876"); + DefaultValue = Integer.valueOf("9876"); break; case DataType.BIGINT: // == -5; - DefaultValue = (Object) Integer.valueOf("98765"); + DefaultValue = Integer.valueOf("98765"); break; case DataType.CHAR: // == 1; - DefaultValue = (Object) String.valueOf('x'); + DefaultValue = String.valueOf('x'); break; case DataType.VARCHAR: // == 12; - DefaultValue = (Object) BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth); + DefaultValue = BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth); break; case DataType.LONGVARCHAR: // == -1; - DefaultValue = (Object) BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth); + DefaultValue = BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth); break; case DataType.NUMERIC: // == 2; - DefaultValue = (Object) Double.valueOf("9876.5"); + DefaultValue = Double.valueOf("9876.5"); break; case DataType.DECIMAL: // == 3; [mit Nachkommastellen] - DefaultValue = (Object) Double.valueOf("9876.5"); + DefaultValue = Double.valueOf("9876.5"); break; case DataType.FLOAT: // == 6; - DefaultValue = (Object) Double.valueOf("9876.5"); + DefaultValue = Double.valueOf("9876.5"); break; case DataType.REAL: // == 7; - DefaultValue = (Object) Double.valueOf("9876.5"); + DefaultValue = Double.valueOf("9876.5"); break; case DataType.DOUBLE: // == 8; - DefaultValue = (Object) Double.valueOf("9876.54"); + DefaultValue = Double.valueOf("9876.54"); break; case DataType.DATE: // == 91; - DefaultValue = (Object) Double.valueOf("42510"); + DefaultValue = Double.valueOf("42510"); break; case DataType.TIME: // == 92; - DefaultValue = (Object) Double.valueOf("10"); + DefaultValue = Double.valueOf("10"); break; case DataType.TIMESTAMP: // == 93; - DefaultValue = (Object) Double.valueOf("5454110"); + DefaultValue = Double.valueOf("5454110"); break; default: diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java index f9621fe8420d..9f2c6abbc54f 100644 --- a/wizards/com/sun/star/wizards/db/RecordParser.java +++ b/wizards/com/sun/star/wizards/db/RecordParser.java @@ -79,11 +79,11 @@ public class RecordParser extends QueryMetaData try { xRowSet = (XInterface) xMSF.createInstance("com.sun.star.sdb.RowSet"); - xRowSetColumnsSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xRowSet); - xRowSetComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xRowSet); - xExecute = (com.sun.star.sdb.XCompletedExecution) UnoRuntime.queryInterface(com.sun.star.sdb.XCompletedExecution.class, xRowSet); + xRowSetColumnsSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xRowSet); + xRowSetComponent = UnoRuntime.queryInterface(XComponent.class, xRowSet); + xExecute = UnoRuntime.queryInterface(XCompletedExecution.class, xRowSet); XInterface oInteraction = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler"); - xInteraction = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, oInteraction); + xInteraction = UnoRuntime.queryInterface(XInteractionHandler.class, oInteraction); } catch (Exception exception) { @@ -222,10 +222,10 @@ public class RecordParser extends QueryMetaData Helper.setUnoPropertyValue(xRowSet, PropertyNames.COMMAND, Command); Helper.setUnoPropertyValue(xRowSet, PropertyNames.COMMAND_TYPE, new Integer(_nCommandType)); // CommandType xExecute.executeWithCompletion(xInteraction); - com.sun.star.sdb.XResultSetAccess xResultAccess = (com.sun.star.sdb.XResultSetAccess) UnoRuntime.queryInterface(com.sun.star.sdb.XResultSetAccess.class, xRowSet); + com.sun.star.sdb.XResultSetAccess xResultAccess = UnoRuntime.queryInterface(com.sun.star.sdb.XResultSetAccess.class, xRowSet); ResultSet = xResultAccess.createResultSet(); - xResultSetRow = (com.sun.star.sdbc.XRow) UnoRuntime.queryInterface(com.sun.star.sdbc.XRow.class, ResultSet); - XColumnsSupplier xDBCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, ResultSet); + xResultSetRow = UnoRuntime.queryInterface(com.sun.star.sdbc.XRow.class, ResultSet); + XColumnsSupplier xDBCols = UnoRuntime.queryInterface(XColumnsSupplier.class, ResultSet); xColumns = xDBCols.getColumns(); setCommandType(_nCommandType); return true; @@ -241,7 +241,7 @@ public class RecordParser extends QueryMetaData { try { - if (binitializeDBColumns == true) + if (binitializeDBColumns) { initializeFieldColumns(_sFieldNames, xColumns); } diff --git a/wizards/com/sun/star/wizards/db/RelationController.java b/wizards/com/sun/star/wizards/db/RelationController.java index 6c8b212f3cfd..e5b8cb4b3775 100644 --- a/wizards/com/sun/star/wizards/db/RelationController.java +++ b/wizards/com/sun/star/wizards/db/RelationController.java @@ -73,7 +73,7 @@ public class RelationController extends CommandName String[] sTableNames = super.getCommandMetaData().getTableNames(); Vector aReferencedTableVector = new Vector(); XResultSet xResultSet = super.getCommandMetaData().xDBMetaData.getExportedKeys((getCatalogName(this)), getSchemaName(), getTableName()); - XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet); + XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet); while (xResultSet.next()) { String sForeignCatalog = xRow.getString(FKTABLE_CAT); @@ -114,7 +114,7 @@ public class RelationController extends CommandName { CommandName oLocCommandName = new CommandName(super.getCommandMetaData(), _sreferencedtablename); XResultSet xResultSet = super.getCommandMetaData().xDBMetaData.getImportedKeys(getCatalogName(oLocCommandName), oLocCommandName.getSchemaName(), oLocCommandName.getTableName()); - XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet); + XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet); boolean bleaveLoop = false; Vector aMasterFieldNamesVector = new Vector(); Vector aSlaveFieldNamesVector = new Vector(); diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 966da2722ff0..879cb216a08a 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -69,10 +69,10 @@ public class SQLQueryComposer try { this.CurDBMetaData = _CurDBMetaData; - xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, CurDBMetaData.DBConnection); + xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, CurDBMetaData.DBConnection); final Object oQueryComposer = xMSF.createInstance("com.sun.star.sdb.SingleSelectQueryComposer"); - m_xQueryAnalyzer = (XSingleSelectQueryAnalyzer) UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, oQueryComposer); - m_queryComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, m_xQueryAnalyzer); + m_xQueryAnalyzer = UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, oQueryComposer); + m_queryComposer = UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, m_xQueryAnalyzer); } catch (Exception exception) { @@ -82,12 +82,8 @@ public class SQLQueryComposer private boolean addtoSelectClause(String DisplayFieldName) throws SQLException { - if (bincludeGrouping && CurDBMetaData.xDBMetaData.supportsGroupByUnrelated() && CurDBMetaData.GroupFieldNames != null && JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, DisplayFieldName) > -1) - { - return false; + return !(bincludeGrouping && CurDBMetaData.xDBMetaData.supportsGroupByUnrelated() && CurDBMetaData.GroupFieldNames != null && JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, DisplayFieldName) > -1); } - return true; - } public String getSelectClause(boolean _baddAliasFieldNames) throws SQLException { @@ -169,7 +165,7 @@ public class SQLQueryComposer { try { - XPropertySet xColumnPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xColumnIndexAccess.getByIndex(i)); + XPropertySet xColumnPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xColumnIndexAccess.getByIndex(i)); String sName = (String) xColumnPropertySet.getPropertyValue(PropertyNames.PROPERTY_NAME); if (JavaTools.FieldInTable(CurDBMetaData.getSortFieldNames(), sName) == -1) { @@ -364,7 +360,7 @@ public class SQLQueryComposer String AliasName = ""; boolean bAliasNameexists = true; String locAliasName = _TableName; - while (bAliasNameexists == true) + while (bAliasNameexists) { bAliasNameexists = (getComposedCommandByAliasName(locAliasName) != null); if (bAliasNameexists) @@ -390,8 +386,8 @@ public class SQLQueryComposer try { Object oErrorDialog = CurDBMetaData.xMSF.createInstance("com.sun.star.sdb.ErrorMessageDialog"); - XInitialization xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oErrorDialog); - XExecutableDialog xExecute = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, oErrorDialog); + XInitialization xInitialize = UnoRuntime.queryInterface(XInitialization.class, oErrorDialog); + XExecutableDialog xExecute = UnoRuntime.queryInterface(XExecutableDialog.class, oErrorDialog); PropertyValue[] rDispatchArguments = new PropertyValue[3]; rDispatchArguments[0] = Properties.createProperty(PropertyNames.PROPERTY_TITLE, Configuration.getProductName(CurDBMetaData.xMSF) + " Base"); rDispatchArguments[1] = Properties.createProperty("ParentWindow", _xParentWindow); diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java index 80fbfd9ed906..491b724e1f09 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -156,16 +156,16 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen { try { - XKeysSupplier xKeySupplier = (XKeysSupplier) UnoRuntime.queryInterface(XKeysSupplier.class, xPropTableDataDescriptor); + XKeysSupplier xKeySupplier = UnoRuntime.queryInterface(XKeysSupplier.class, xPropTableDataDescriptor); xIndexAccessKeys = xKeySupplier.getKeys(); - XDataDescriptorFactory xKeyFac = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xIndexAccessKeys); - xKeyDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xIndexAccessKeys); - xKeyAppend = (XAppend) UnoRuntime.queryInterface(XAppend.class, xKeyFac); + XDataDescriptorFactory xKeyFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class, xIndexAccessKeys); + xKeyDrop = UnoRuntime.queryInterface(XDrop.class, xIndexAccessKeys); + xKeyAppend = UnoRuntime.queryInterface(XAppend.class, xKeyFac); xKey = xKeyFac.createDataDescriptor(); xKey.setPropertyValue("Type", new Integer(KeyType.PRIMARY)); - xKeyColumnSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xKey); - XDataDescriptorFactory xKeyColFac = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xKeyColumnSupplier.getColumns()); - xKeyColAppend = (XAppend) UnoRuntime.queryInterface(XAppend.class, xKeyColFac); + xKeyColumnSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xKey); + XDataDescriptorFactory xKeyColFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class, xKeyColumnSupplier.getColumns()); + xKeyColAppend = UnoRuntime.queryInterface(XAppend.class, xKeyColFac); removePrimaryKeys(); for (int i = 0; i < _fieldnames.length; i++) { @@ -190,7 +190,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen if (xColPropertySet.getPropertySetInfo().hasPropertyByName("IsAutoIncrement")) { xColPropertySet.setPropertyValue("Type", new Integer(nDataType)); - xColPropertySet.setPropertyValue("IsAutoIncrement", new Boolean(_bAutoincrementation)); + xColPropertySet.setPropertyValue("IsAutoIncrement", Boolean.valueOf(_bAutoincrementation)); } } } @@ -222,7 +222,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen { try { - String sColumnName = (String) AnyConverter.toString(_xToBeAppendedPropertySet.getPropertyValue(PropertyNames.PROPERTY_NAME)); + String sColumnName = AnyConverter.toString(_xToBeAppendedPropertySet.getPropertyValue(PropertyNames.PROPERTY_NAME)); if (_xColumns.hasByName(sColumnName)) { String sMessage = JavaTools.replaceSubString(sColumnAlreadyExistsMessage, sColumnName, "%FIELDNAME"); @@ -251,7 +251,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen boolean breturn = true; try { - XAppend xAppendColumns = (XAppend) UnoRuntime.queryInterface(XAppend.class, xNameAccessColumns); + XAppend xAppendColumns = UnoRuntime.queryInterface(XAppend.class, xNameAccessColumns); for (int i = 0; i < columncontainer.size(); i++) { XPropertySet xColPropertySet = getByIndex(i); @@ -269,7 +269,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen assignTableProperty(PropertyNames.PROPERTY_NAME, _tablename); assignTableProperty("CatalogName", _catalogname); assignTableProperty("SchemaName", _schemaname); - xTableContainer = (XContainer) UnoRuntime.queryInterface(XContainer.class, getTableNamesAsNameAccess()); + xTableContainer = UnoRuntime.queryInterface(XContainer.class, getTableNamesAsNameAccess()); xTableContainer.addContainerListener(this); if (keycolumncontainer.size() > 0) { @@ -331,7 +331,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen } } } - XDrop xColumnDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xNameAccessColumns); + XDrop xColumnDrop = UnoRuntime.queryInterface(XDrop.class, xNameAccessColumns); for (int i = xNameAccessColumns.getElementNames().length - 1; i >= 0; i--) { xColumnDrop.dropByIndex(i); @@ -604,7 +604,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen if (hasByName(_snewname)) { Object oColumn = getByName(_snewname); - XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn); + XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, oColumn); Property[] aColProperties = xPropertySet.getPropertySetInfo().getProperties(); for (int i = 0; i < aColProperties.length; i++) { @@ -777,7 +777,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen { try { - XPropertySet xTablePropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, arg0.Element); + XPropertySet xTablePropertySet = UnoRuntime.queryInterface(XPropertySet.class, arg0.Element); String stablename = AnyConverter.toString(xTablePropertySet.getPropertyValue(PropertyNames.PROPERTY_NAME)); String sschemaname = AnyConverter.toString(xPropTableDataDescriptor.getPropertyValue("SchemaName")); String scatalogname = AnyConverter.toString(xPropTableDataDescriptor.getPropertyValue("CatalogName")); diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java index 6e6bc358aaea..bf1a8c3a483f 100644 --- a/wizards/com/sun/star/wizards/db/TypeInspector.java +++ b/wizards/com/sun/star/wizards/db/TypeInspector.java @@ -88,15 +88,15 @@ public class TypeInspector Vector<Integer> aSearchableVector = new Vector<Integer>(); // Integer[] aIntegerDataTypes = null; // XResultSet xResultSet = xDBMetaDagetTypeInfo(); - XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet); + XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet); while (xResultSet.next()) { - aTypeNameVector.addElement(new String(xRow.getString(1))); + aTypeNameVector.addElement(xRow.getString(1)); aTypeVector.addElement(new Integer(xRow.getShort(2))); aPrecisionVector.addElement(new Integer(xRow.getInt(3))); aNullableVector.addElement(new Integer(xRow.getShort(7))); aSearchableVector.addElement(new Integer(xRow.getShort(9))); - aAutoIncrementVector.addElement(new Boolean(xRow.getBoolean(12))); + aAutoIncrementVector.addElement(Boolean.valueOf(xRow.getBoolean(12))); aMinScaleVector.addElement(new Integer(xRow.getShort(14))); aMaxScaleVector.addElement(new Integer(xRow.getShort(15))); @@ -154,12 +154,11 @@ public class TypeInspector { return ColumnValue.NO_NULLS; } - int nNullable = _nNullable; - if (nNullable == ColumnValue.NULLABLE) + if (_nNullable == ColumnValue.NULLABLE) { return nNullableInfos[i]; //probably nullability is not allowed } - return nNullable; + return _nNullable; } public int getNullability(XPropertySet _xColPropertySet) @@ -231,25 +230,19 @@ public class TypeInspector int i = JavaTools.FieldInIntTable(nDataTypeInfos, nDataType, startindex); startindex = i + 1; bleaveloop = (i < 0); - if (!bleaveloop) + if (!bleaveloop && sTypeName.equals(sDataTypeNames[i])) { - if (sTypeName.equals(sDataTypeNames[i])) + if (_bCheckNumericAttributes) { - if (_bCheckNumericAttributes) - { - if (nPrecision <= nPrecisionInfos[i]) - { - if ((nScale >= nMinScaleInfos[i]) && (nScale <= nMinScaleInfos[i])) - { - return i; - } - } - } - else + if (nPrecision <= nPrecisionInfos[i] && (nScale >= nMinScaleInfos[i]) && (nScale <= nMinScaleInfos[i]) ) { return i; } } + else + { + return i; + } } } } diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java index 8a7b10f2cefd..ce4afe5a3022 100644 --- a/wizards/com/sun/star/wizards/document/Control.java +++ b/wizards/com/sun/star/wizards/document/Control.java @@ -131,7 +131,7 @@ public class Control extends Shape { if (xFormName != null) { - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xFormName); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xFormName); String sControlName = Desktop.getUniqueName(xNameAccess, getControlName(_fieldname)); xPropertySet.setPropertyValue(PropertyNames.PROPERTY_NAME, sControlName); xFormName.insertByName(sControlName, xControlModel); @@ -280,7 +280,7 @@ public class Control extends Shape */ public XLayoutConstrains getPeer() { - return (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, xControl.getPeer()); + return UnoRuntime.queryInterface(XLayoutConstrains.class, xControl.getPeer()); } public Size getPeerSize() diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java index 22b0af405b17..5e8877374c9b 100644 --- a/wizards/com/sun/star/wizards/document/DatabaseControl.java +++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java @@ -90,7 +90,7 @@ public class DatabaseControl extends Control { bHidden = true; } - xPropColumn.setPropertyValue("Hidden", new Boolean(bHidden)); + xPropColumn.setPropertyValue("Hidden", Boolean.valueOf(bHidden)); xPropColumn.setPropertyValue("DataField", sFieldName); xPropColumn.setPropertyValue(PropertyNames.PROPERTY_LABEL, _columntitle); xPropColumn.setPropertyValue(PropertyNames.PROPERTY_WIDTH, 0); // Width of column is adjusted to Columname @@ -160,16 +160,14 @@ public class DatabaseControl extends Control if (getControlType() == FormHandler.SOIMAGECONTROL) { // return oFormHandler.getImageControlHeight(); - final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4; - return nMemofieldheight; + return oFormHandler.getControlReferenceHeight() * 4; } else { if (getFieldType() == DataType.LONGVARCHAR) { // Helper.setUnoPropertyValue(xControlModel, PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE); - final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4; - return nMemofieldheight; + return oFormHandler.getControlReferenceHeight() * 4; } else if (getControlType() == FormHandler.SOCHECKBOX) { diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index e1fab5a3301b..828ae4fc67f0 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -116,12 +116,12 @@ public class FormHandler public FormHandler(XMultiServiceFactory _xMSF, XTextDocument xTextDocument) { this.xMSF = _xMSF; - xDrawPageSupplier = (XDrawPageSupplier) UnoRuntime.queryInterface(XDrawPageSupplier.class, xTextDocument); + xDrawPageSupplier = UnoRuntime.queryInterface(XDrawPageSupplier.class, xTextDocument); xDrawPage = xDrawPageSupplier.getDrawPage(); - xFormsSupplier = (XFormsSupplier) UnoRuntime.queryInterface(XFormsSupplier.class, xDrawPage); - xShapeGrouper = (XShapeGrouper) UnoRuntime.queryInterface(XShapeGrouper.class, xDrawPage); - xControlAccess = (XControlAccess) UnoRuntime.queryInterface(XControlAccess.class, xTextDocument.getCurrentController()); - xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); + xFormsSupplier = UnoRuntime.queryInterface(XFormsSupplier.class, xDrawPage); + xShapeGrouper = UnoRuntime.queryInterface(XShapeGrouper.class, xDrawPage); + xControlAccess = UnoRuntime.queryInterface(XControlAccess.class, xTextDocument.getCurrentController()); + xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); sModelServices[SOLABEL] = "com.sun.star.form.component.FixedText"; sModelServices[SOTEXTBOX] = "com.sun.star.form.component.TextField"; sModelServices[SOCHECKBOX] = "com.sun.star.form.component.CheckBox"; @@ -164,8 +164,7 @@ public class FormHandler { if (oControlData[i].DataType == _fieldtype) { - final int nType = oControlData[i].ControlType; - return nType; + return oControlData[i].ControlType; } } return -1; @@ -192,7 +191,7 @@ public class FormHandler public void initializeBasicControlValues() { Control oLabelControl = new Control(this, SOLABEL, new Point(), new Size()); - XDevice xDevice = (XDevice) UnoRuntime.queryInterface(XDevice.class, oLabelControl.xWindowPeer); + XDevice xDevice = UnoRuntime.queryInterface(XDevice.class, oLabelControl.xWindowPeer); iXPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterX); iYPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterY); @@ -226,8 +225,7 @@ public class FormHandler { if (xNamedForm.hasByName(ControlName)) { - String ControlValue = AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue")); - return ControlValue; + return AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue")); } else { @@ -267,7 +265,7 @@ public class FormHandler public UnknownHiddenControlException(XNameAccess xNamedForm, String ControlName, String sMsgHiddenControlisMissing) { - XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xNamedForm); + XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xNamedForm); String FormName = xNamed.getName(); sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, FormName, "<REPORTFORM>"); sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, ControlName, "<CONTROLNAME>"); @@ -278,7 +276,7 @@ public class FormHandler public boolean hasFormByName(String _FormName) { xNamedFormContainer = getDocumentForms(); - xNamedForms = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNamedFormContainer); + xNamedForms = UnoRuntime.queryInterface(XNameAccess.class, xNamedFormContainer); return xNamedForms.hasByName(_FormName); } @@ -306,7 +304,7 @@ public class FormHandler { if (belongsToForm(xDrawPage.getByIndex(i), _FormName)) { - XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); + XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); xDrawPage.remove(xShape); } } @@ -335,16 +333,16 @@ public class FormHandler public boolean belongsToForm(Object _oDrawPageElement, String _FormName) { - XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement); + XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement); if (xServiceInfo.supportsService("com.sun.star.drawing.ControlShape")) { - XControlShape xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, _oDrawPageElement); + XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, _oDrawPageElement); XControlModel xControlModel = xControlShape.getControl(); - xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xControlShape.getControl()); + xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, xControlShape.getControl()); if (xServiceInfo.supportsService("com.sun.star.form.FormComponent")) { - XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, xControlModel); - XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xChild.getParent()); + XChild xChild = UnoRuntime.queryInterface(XChild.class, xControlModel); + XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xChild.getParent()); String sName = xNamed.getName(); return _FormName.equals(sName); } @@ -362,7 +360,7 @@ public class FormHandler oDBForm = xMSFDoc.createInstance("com.sun.star.form.component.Form"); _xNamedFormContainer.insertByName(_FormName, oDBForm); XNameContainer xNamedForm; - xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm); + xNamedForm = UnoRuntime.queryInterface(XNameContainer.class, oDBForm); return xNamedForm; } else @@ -395,7 +393,7 @@ public class FormHandler if (xNamedForms.hasByName(_sname)) { Object oDBForm = AnyConverter.toObject(new Type(XInterface.class), Helper.getUnoObjectbyName(xNamedForms, _sname)); - xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm); + xNamedForm = UnoRuntime.queryInterface(XNameContainer.class, oDBForm); } } catch (IllegalArgumentException e) @@ -491,7 +489,7 @@ public class FormHandler { for (int i = 0; i < this.xDrawPage.getCount(); i++) { - XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); + XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); xShape.setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos)); } } @@ -505,7 +503,7 @@ public class FormHandler { for (int i = this.xDrawPage.getCount(); i > -1; i--) { - XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); + XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); removeShape(xShape); } } @@ -517,7 +515,7 @@ public class FormHandler public void removeShape(XShape _xShape) { xDrawPage.remove(_xShape); - XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _xShape); + XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, _xShape); xComponent.dispose(); } // Destroy all Shapes in Nirwana @@ -525,7 +523,7 @@ public class FormHandler { for (int i = this.xDrawPage.getCount(); i > -1; i--) { - XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); + XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); if (xShape.getPosition().Y < this.iYNirwanaPos) { xDrawPage.remove(xShape); @@ -538,7 +536,7 @@ public class FormHandler try { Object oGroupShape = _xMSF.createInstance("com.sun.star.drawing.ShapeCollection"); - XShapes xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, oGroupShape); + XShapes xShapes = UnoRuntime.queryInterface(XShapes.class, oGroupShape); xShapes.add(_xLabelShape); xShapes.add(_xControlShape); return this.xShapeGrouper.group(xShapes); @@ -590,8 +588,8 @@ public class FormHandler { try { - XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, this.xMSFDoc.createInstance("com.sun.star.text.DocumentSettings")); - xPropertySet.setPropertyValue("DoNotCaptureDrawObjsOnPage", new Boolean(!_bCaptureObjects)); + XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, this.xMSFDoc.createInstance("com.sun.star.text.DocumentSettings")); + xPropertySet.setPropertyValue("DoNotCaptureDrawObjsOnPage", Boolean.valueOf(!_bCaptureObjects)); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java index 5e745dee7963..074ff5350a39 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.java +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java @@ -81,7 +81,7 @@ public class OfficeDocument { try { - XEventsSupplier xEventsSuppl = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class, xComponent); + XEventsSupplier xEventsSuppl = UnoRuntime.queryInterface(XEventsSupplier.class, xComponent); PropertyValue[] oEventProperties = new PropertyValue[2]; oEventProperties[0] = new PropertyValue(); oEventProperties[0].Name = "EventType"; @@ -103,8 +103,8 @@ public class OfficeDocument { if (xComponent != null) { - XModifiable xModified = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xComponent); - XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent); + XModifiable xModified = UnoRuntime.queryInterface(XModifiable.class, xComponent); + XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent); XFrame xFrame = xModel.getCurrentController().getFrame(); if (xModified.isModified()) { @@ -144,18 +144,18 @@ public class OfficeDocument try { - xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, frame); + xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, frame); /*if (frame.getName() == null || frame.getName().equals(PropertyNames.EMPTY_STRING)); frame.setName("T" + System.currentTimeMillis());*/ XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, "_self", 0, loadValues); - if (sDocumentType == "swriter") + if (sDocumentType.equals("swriter")) { - oDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent); + oDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); } - else if (sDocumentType == "scalc") + else if (sDocumentType.equals("scalc")) { - oDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent); + oDocument = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent); //TODO: // else if (sDocumentType == "simpress") // else if (sDocumentType == "sdraw") @@ -182,14 +182,14 @@ public class OfficeDocument } else { - XFrame xF = (XFrame) UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xMSF)); + XFrame xF = UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xMSF)); xFrame = xF.findFrame(FrameName, 0); if (listener != null) { - XFramesSupplier xFS = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xF); + XFramesSupplier xFS = UnoRuntime.queryInterface(XFramesSupplier.class, xF); XFrames xFF = xFS.getFrames(); xFF.remove(xFrame); - XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xF); + XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, xF); xDesktop.addTerminateListener(listener); } } @@ -201,7 +201,7 @@ public class OfficeDocument XToolkit xToolkit = null; try { - xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, xMSF.createInstance("com.sun.star.awt.Toolkit")); + xToolkit = UnoRuntime.queryInterface(XToolkit.class, xMSF.createInstance("com.sun.star.awt.Toolkit")); } catch (Exception e) { @@ -226,14 +226,14 @@ public class OfficeDocument XWindowPeer xPeer = null; try { - xPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xToolkit.createWindow(aDescriptor)); + xPeer = UnoRuntime.queryInterface(XWindowPeer.class, xToolkit.createWindow(aDescriptor)); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xPeer); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xPeer); //define some further properties of the frame window //if it's needed .-) @@ -243,7 +243,7 @@ public class OfficeDocument XFrame xFrame = null; try { - xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, xMSF.createInstance("com.sun.star.frame.Frame")); + xFrame = UnoRuntime.queryInterface(XFrame.class, xMSF.createInstance("com.sun.star.frame.Frame")); } catch (Exception e) { @@ -273,13 +273,13 @@ public class OfficeDocument //XInterface xInterface = null; try { - xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xInterface); + xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, xInterface); com.sun.star.lang.XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, sFrame, 0, xValues); - XServiceInfo xComponentService = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xComponent); + XServiceInfo xComponentService = UnoRuntime.queryInterface(XServiceInfo.class, xComponent); if (xComponentService.supportsService("com.sun.star.text.TextDocument")) { - oDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent); //TODO: write if clauses for Calc, Impress and Draw + oDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); //TODO: write if clauses for Calc, Impress and Draw } } catch (Exception exception) @@ -293,7 +293,7 @@ public class OfficeDocument { try { - XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xComponent); + XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, xComponent); PropertyValue[] oStoreProperties; if (FilterName.length() > 0) { @@ -303,13 +303,13 @@ public class OfficeDocument oStoreProperties[0].Value = FilterName; oStoreProperties[1] = new PropertyValue(); oStoreProperties[1].Name = "InteractionHandler"; - oStoreProperties[1].Value = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); + oStoreProperties[1].Value = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); } else { oStoreProperties = new PropertyValue[0]; } - if (bStoreToUrl == true) + if (bStoreToUrl) { xStoreable.storeToURL(StorePath, oStoreProperties); } @@ -330,11 +330,11 @@ public class OfficeDocument public static boolean close(XComponent xComponent) { boolean bState = false; - XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent); + XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent); if (xModel != null) { - XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, xModel); + XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, xModel); if (xCloseable != null) { @@ -351,7 +351,7 @@ public class OfficeDocument } else { - XComponent xDisposeable = (XComponent) UnoRuntime.queryInterface(XComponent.class, xModel); + XComponent xDisposeable = UnoRuntime.queryInterface(XComponent.class, xModel); xDisposeable.dispose(); bState = true; } @@ -369,9 +369,9 @@ public class OfficeDocument int colcount = datalist[0].length; if (colcount > 0) { - XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oTable); + XCellRange xCellRange = UnoRuntime.queryInterface(XCellRange.class, oTable); XCellRange xNewRange = xCellRange.getCellRangeByPosition(xpos, ypos, (colcount + xpos) - 1, (rowcount + ypos) - 1); - XCellRangeData xDataArray = (XCellRangeData) UnoRuntime.queryInterface(XCellRangeData.class, xNewRange); + XCellRangeData xDataArray = UnoRuntime.queryInterface(XCellRangeData.class, xNewRange); xDataArray.setDataArray(datalist); } } @@ -392,9 +392,9 @@ public class OfficeDocument mediaDescr[0][0].Name = PropertyNames.URL; mediaDescr[0][0].Value = url; - String type = ((XTypeDetection) UnoRuntime.queryInterface(XTypeDetection.class, typeDetect)).queryTypeByDescriptor(mediaDescr, true); + String type = UnoRuntime.queryInterface(XTypeDetection.class, typeDetect).queryTypeByDescriptor(mediaDescr, true); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect); if (type.equals(PropertyNames.EMPTY_STRING)) { return null; @@ -409,7 +409,7 @@ public class OfficeDocument throws Exception { Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection"); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect); return (PropertyValue[]) xNameAccess.getByName(type); } @@ -421,13 +421,13 @@ public class OfficeDocument */ public static int getSlideCount(Object model) { - XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier) UnoRuntime.queryInterface(XDrawPagesSupplier.class, model); + XDrawPagesSupplier xDrawPagesSupplier = UnoRuntime.queryInterface(XDrawPagesSupplier.class, model); return xDrawPagesSupplier.getDrawPages().getCount(); } public static XDocumentProperties getDocumentProperties(Object document) { - XDocumentPropertiesSupplier xDocumentPropertiesSupplier = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, document); + XDocumentPropertiesSupplier xDocumentPropertiesSupplier = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, document); return xDocumentPropertiesSupplier.getDocumentProperties(); } diff --git a/wizards/com/sun/star/wizards/document/Shape.java b/wizards/com/sun/star/wizards/document/Shape.java index b2ef1a27e662..990fe68cb916 100644 --- a/wizards/com/sun/star/wizards/document/Shape.java +++ b/wizards/com/sun/star/wizards/document/Shape.java @@ -73,8 +73,8 @@ public class Shape this.aSize = _aSize; this.oFormHandler = _oFormHandler; Object oShape = oFormHandler.xMSF.createInstance(_sServiceName); - xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, oShape); - xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oShape); + xShapes = UnoRuntime.queryInterface(XShapes.class, oShape); + xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oShape); } catch (Exception e) { @@ -92,7 +92,7 @@ public class Shape { xMSF = oFormHandler.xMSFDoc; Object oShape = xMSF.createInstance(sServiceName); - xShape = (XShape) UnoRuntime.queryInterface(XShape.class, oShape); + xShape = UnoRuntime.queryInterface(XShape.class, oShape); xShape.setPosition(aPoint); if (aSize != null) { @@ -103,8 +103,8 @@ public class Shape xShape.setSize(new Size(1000, 100)); } Helper.setUnoPropertyValue(xShape, "AnchorType", TextContentAnchorType.AT_PARAGRAPH); - xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xShape); - xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, xShape); + xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, xShape); + xControlShape = UnoRuntime.queryInterface(XControlShape.class, xShape); } catch (Exception e) diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index 0ca625062e67..7c951921bde6 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -75,7 +75,7 @@ public class TimeStampControl extends DatabaseControl xShapes.add(oDateControl.xShape); xShapes.add(oTimeControl.xShape); xShapeGroup = _oFormHandler.xShapeGrouper.group(xShapes); - xShapeGroup = (XShape) UnoRuntime.queryInterface(XShape.class, xShapeGroup); + xShapeGroup = UnoRuntime.queryInterface(XShape.class, xShapeGroup); nreldatewidth = 1.0 / ((double) getSize().Width / (double) nDateWidth); nreltimewidth = 1.0 - nreldatewidth; } @@ -87,9 +87,8 @@ public class TimeStampControl extends DatabaseControl if (_i < xShapes.getCount()) { Object oControl = xShapes.getByIndex(_i); - XControlShape xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, oControl); - XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlShape.getControl()); - return xPropertySet; + XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, oControl); + return UnoRuntime.queryInterface(XPropertySet.class, xControlShape.getControl()); } } catch (Exception e) diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.java b/wizards/com/sun/star/wizards/fax/FaxDocument.java index d429ee42d2b8..a8f383f74cef 100644 --- a/wizards/com/sun/star/wizards/fax/FaxDocument.java +++ b/wizards/com/sun/star/wizards/fax/FaxDocument.java @@ -56,8 +56,7 @@ public class FaxDocument extends TextDocument public XWindowPeer getWindowPeer() { - XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument); - return xWindowPeer; + return UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument); } public void switchElement(String sElement, boolean bState) @@ -66,7 +65,7 @@ public class FaxDocument extends TextDocument { TextSectionHandler mySectionHandler = new TextSectionHandler(xMSF, xTextDocument); Object oSection = mySectionHandler.xTextSectionsSupplier.getTextSections().getByName(sElement); - Helper.setUnoPropertyValue(oSection, "IsVisible", new Boolean(bState)); + Helper.setUnoPropertyValue(oSection, "IsVisible", Boolean.valueOf(bState)); } catch (Exception exception) @@ -88,20 +87,20 @@ public class FaxDocument extends TextDocument xTextDocument.lockControllers(); try { - XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); + XStyleFamiliesSupplier xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); com.sun.star.container.XNameAccess xNameAccess = null; xNameAccess = xStyleFamiliesSupplier.getStyleFamilies(); com.sun.star.container.XNameContainer xPageStyleCollection = null; - xPageStyleCollection = (com.sun.star.container.XNameContainer) UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles")); + xPageStyleCollection = UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles")); XText xFooterText; - XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle)); + XStyle xPageStyle = UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle)); if (bState) { - Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(true)); - xFooterText = (XText) UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText")); + Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", Boolean.TRUE); + xFooterText = UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText")); xFooterText.setString(sText); if (bPageNumber) { @@ -109,10 +108,10 @@ public class FaxDocument extends TextDocument XTextCursor myCursor = xFooterText.createTextCursor(); myCursor.gotoEnd(false); xFooterText.insertControlCharacter(myCursor, ControlCharacter.PARAGRAPH_BREAK, false); - XPropertySet xCursorPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, myCursor); + XPropertySet xCursorPSet = UnoRuntime.queryInterface(XPropertySet.class, myCursor); xCursorPSet.setPropertyValue("ParaAdjust", ParagraphAdjust.CENTER); - XTextField xPageNumberField = (XTextField) UnoRuntime.queryInterface(XTextField.class, xMSFDoc.createInstance("com.sun.star.text.TextField.PageNumber")); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageNumberField); + XTextField xPageNumberField = UnoRuntime.queryInterface(XTextField.class, xMSFDoc.createInstance("com.sun.star.text.TextField.PageNumber")); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xPageNumberField); xPSet.setPropertyValue("SubType", PageNumberType.CURRENT); xPSet.setPropertyValue("NumberingType", new Short(NumberingType.ARABIC)); xFooterText.insertTextContent(xFooterText.getEnd(), xPageNumberField, false); @@ -120,7 +119,7 @@ public class FaxDocument extends TextDocument } else { - Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(false)); + Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", Boolean.FALSE); } xTextDocument.unlockControllers(); } diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java index 36d1d4af9add..8f9cf8107c7f 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java @@ -168,7 +168,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog } XWindow xContainerWindow = myFaxDoc.xFrame.getContainerWindow(); - XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow); + XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow); createWindowPeer(xWindowPeer); //add the Roadmap to the dialog: @@ -198,8 +198,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog removeTerminateListener(); exception.printStackTrace(System.out); running = false; - return; - } + } } public void cancelWizard() @@ -250,7 +249,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog if (bSaveSuccess) { saveConfiguration(); - XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); + XInteractionHandler xIH = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); PropertyValue loadValues[] = new PropertyValue[4]; loadValues[0] = new PropertyValue(); loadValues[0].Name = "AsTemplate"; @@ -275,7 +274,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog } Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), sPath, "_default", loadValues); XTextDocument xTextDocument = (com.sun.star.text.XTextDocument) oDoc; - XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); + XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); ViewHandler myViewHandler = new ViewHandler(xDocMSF, xTextDocument); myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.OPTIMAL)); } @@ -301,7 +300,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog try { //xComponent.dispose(); - XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myFaxDoc.xFrame); + XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, myFaxDoc.xFrame); xCloseable.close(false); } catch (CloseVetoException e) @@ -352,7 +351,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog try { Object oGS = xMSF.createInstance("com.sun.star.graphic.GraphicProvider"); - XGraphicProvider xGraphicProvider = (XGraphicProvider) UnoRuntime.queryInterface(XGraphicProvider.class, oGS); + XGraphicProvider xGraphicProvider = UnoRuntime.queryInterface(XGraphicProvider.class, oGS); PropertyValue GraphicValues[] = new PropertyValue[1]; GraphicValues[0] = new PropertyValue(); @@ -424,9 +423,9 @@ public class FaxWizardDialogImpl extends FaxWizardDialog public void initializeElements() { - setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, new Boolean(myFaxDoc.hasElement("Company Logo"))); - setControlProperty("chkUseSubject", PropertyNames.PROPERTY_ENABLED, new Boolean(myFaxDoc.hasElement("Subject Line"))); - setControlProperty("chkUseDate", PropertyNames.PROPERTY_ENABLED, new Boolean(myFaxDoc.hasElement("Date"))); + setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myFaxDoc.hasElement("Company Logo"))); + setControlProperty("chkUseSubject", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myFaxDoc.hasElement("Subject Line"))); + setControlProperty("chkUseDate", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myFaxDoc.hasElement("Date"))); myFaxDoc.updateDateFields(); } @@ -448,17 +447,17 @@ public class FaxWizardDialogImpl extends FaxWizardDialog private void setDefaultForGreetingAndSalutationAndCommunication() { XTextComponent xTextComponent; - xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); + xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING)) { xTextComponent.setText(resources.SalutationLabels[0]); } - xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); + xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING)) { xTextComponent.setText(resources.GreetingLabels[0]); } - xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType); + xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType); if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING)) { xTextComponent.setText(resources.CommunicationLabels[0]); @@ -590,7 +589,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog public void txtTemplateNameTextChanged() { - XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); + XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); XDocumentProperties xDocProps = xDocPropsSuppl.getDocumentProperties(); String TitleName = txtTemplateName.getText(); xDocProps.setTitle(TitleName); @@ -769,7 +768,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog //enable/disable roadmap item for footer page XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER); - Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bFooterPossible)); + Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bFooterPossible)); } catch (Exception exception) @@ -795,14 +794,14 @@ public class FaxWizardDialogImpl extends FaxWizardDialog public void chkUseSalutationItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); myFaxDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0)); - setControlProperty("lstSalutation", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseSalutation.getState() != 0)); + setControlProperty("lstSalutation", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseSalutation.getState() != 0)); } public void lstSalutationItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); myFaxDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0)); } @@ -812,14 +811,14 @@ public class FaxWizardDialogImpl extends FaxWizardDialog public void chkUseCommunicationItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType); myFaxDoc.switchUserField("CommunicationType", xTextComponent.getText(), (chkUseCommunicationType.getState() != 0)); - setControlProperty("lstCommunicationType", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseCommunicationType.getState() != 0)); + setControlProperty("lstCommunicationType", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseCommunicationType.getState() != 0)); } public void lstCommunicationItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType); myFaxDoc.switchUserField("CommunicationType", xTextComponent.getText(), (chkUseCommunicationType.getState() != 0)); } @@ -829,14 +828,14 @@ public class FaxWizardDialogImpl extends FaxWizardDialog public void chkUseGreetingItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); myFaxDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0)); - setControlProperty("lstGreeting", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseGreeting.getState() != 0)); + setControlProperty("lstGreeting", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseGreeting.getState() != 0)); } public void lstGreetingItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); myFaxDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0)); } @@ -846,7 +845,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog private void setPossibleFooter(boolean bState) { - setControlProperty("chkUseFooter", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); + setControlProperty("chkUseFooter", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); if (!bState) { chkUseFooter.setState((short) 0); diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java index f53fef4dd90e..543a521c6ce7 100644 --- a/wizards/com/sun/star/wizards/form/CallFormWizard.java +++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java @@ -160,7 +160,7 @@ public class CallFormWizard try { - byteReturn = new String(PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } catch (Exception exception) { diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java index de1d9f55c7d0..9a5624f627c5 100644 --- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java +++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java @@ -125,14 +125,14 @@ public class DataEntrySetter boolean bAllowUpdates = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_STATE)).shortValue()) != 1; boolean bAllowDeletes = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_STATE)).shortValue()) != 1; boolean bAllowInserts = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_STATE)).shortValue()) != 1; - retProperties[0] = Properties.createProperty("AllowUpdates", new Boolean(bAllowUpdates)); - retProperties[1] = Properties.createProperty("AllowDeletes", new Boolean(bAllowDeletes)); - retProperties[2] = Properties.createProperty("AllowInserts", new Boolean(bAllowInserts)); + retProperties[0] = Properties.createProperty("AllowUpdates", Boolean.valueOf(bAllowUpdates)); + retProperties[1] = Properties.createProperty("AllowDeletes", Boolean.valueOf(bAllowDeletes)); + retProperties[2] = Properties.createProperty("AllowInserts", Boolean.valueOf(bAllowInserts)); } else { retProperties = new PropertyValue[1]; - retProperties[0] = Properties.createProperty("IgnoreResult", new Boolean(true)); + retProperties[0] = Properties.createProperty("IgnoreResult", Boolean.TRUE); } return retProperties; @@ -141,8 +141,8 @@ public class DataEntrySetter public void toggleCheckBoxes() { boolean bdisplayalldata = optDisplayAllData.getState(); - Helper.setUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_ENABLED, new Boolean(bdisplayalldata)); - Helper.setUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_ENABLED, new Boolean(bdisplayalldata)); - Helper.setUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_ENABLED, new Boolean(bdisplayalldata)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata)); } } diff --git a/wizards/com/sun/star/wizards/form/FieldLinker.java b/wizards/com/sun/star/wizards/form/FieldLinker.java index e9671aaf91c0..146173ec9097 100644 --- a/wizards/com/sun/star/wizards/form/FieldLinker.java +++ b/wizards/com/sun/star/wizards/form/FieldLinker.java @@ -48,18 +48,9 @@ public class FieldLinker extends DBLimitedFieldSelection private XFixedText[] lblMasterFields; private XListBox[] lstSlaveFields; private XListBox[] lstMasterFields; - private final int SOMASTERINDEX = 1; - private final int SOSLAVEINDEX = 0; - private int SOFIRSTLINKLST = 0; - private int SOSECLINKLST = 1; - private int SOTHIRDLINKLST = 2; - private int SOFOURTHLINKLST = 3; private int[] SOLINKLST = null; private String[] sSlaveListHeader; private String[] sMasterListHeader; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); - private String sSlaveHidString; - private String sMasterHidString; - private Integer IListBoxPosX; public FieldLinker(WizardDialog _CurUnoDialog, int iStep, int iCompPosX, int iCompPosY, int iCompWidth, int _firsthelpid) { @@ -76,31 +67,31 @@ public class FieldLinker extends DBLimitedFieldSelection lblMasterFields = new XFixedText[rowcount]; lstSlaveFields = new XListBox[rowcount]; lstMasterFields = new XListBox[rowcount]; - SOFIRSTLINKLST = 0; - SOSECLINKLST = 1; - SOTHIRDLINKLST = 2; - SOFOURTHLINKLST = 3; - IListBoxPosX = new Integer(iCompPosX + 6); + int SOFIRSTLINKLST = 0; + int SOSECLINKLST = 1; + int SOTHIRDLINKLST = 2; + int SOFOURTHLINKLST = 3; + Integer IListBoxPosX = new Integer(iCompPosX + 6); sSlaveListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 20, 4); //new String[rowcount];PropertyNames.EMPTY_STRING; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); sMasterListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 24, 4);// new String[rowcount];PropertyNames.EMPTY_STRING; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); SOLINKLST = new int[] { - SOFIRSTLINKLST, SOSECLINKLST, SOTHIRDLINKLST, SOFOURTHLINKLST + SOFIRSTLINKLST, SOSECLINKLST, SOTHIRDLINKLST, SOFOURTHLINKLST }; } - sSlaveHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2)); - sMasterHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2) + 1); + String sSlaveHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2)); + String sMasterHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2) + 1); boolean bDoEnable = (i < 2); - lblSlaveFields[i] = CurUnoDialog.insertLabel("lblSlaveFieldLink" + new Integer(i + 1).toString(), + lblSlaveFields[i] = CurUnoDialog.insertLabel("lblSlaveFieldLink" + Integer.toString(i + 1), new String[] { PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), 8, sSlaveListHeader[i], 97, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97 + Boolean.valueOf(bDoEnable), 8, sSlaveListHeader[i], 97, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97 }); - lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(), + lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + (i + 1), SOLINKLST[i], null, new ItemListenerImpl(), new String[] { "Dropdown", @@ -117,9 +108,9 @@ public class FieldLinker extends DBLimitedFieldSelection new Object[] { Boolean.TRUE, - new Boolean(bDoEnable), + Boolean.valueOf(bDoEnable), UIConsts.INTEGER_12, - sSlaveHidString, + sSlaveHidString, Short.valueOf(UnoDialog.getListBoxLineCount()), 97, new Integer(iCurPosY + 10), @@ -128,17 +119,17 @@ public class FieldLinker extends DBLimitedFieldSelection 97 }); - lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + new Integer(i + 1).toString(), + lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + Integer.toString(i + 1), new String[] { PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), 8, sMasterListHeader[i], 206, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97 + Boolean.valueOf(bDoEnable), 8, sMasterListHeader[i], 206, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97 }); - lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(), + lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + Integer.toString(i + 1), SOLINKLST[i], null, new ItemListenerImpl(), new String[] { "Dropdown", @@ -155,9 +146,9 @@ public class FieldLinker extends DBLimitedFieldSelection new Object[] { Boolean.TRUE, - new Boolean(bDoEnable), + Boolean.valueOf(bDoEnable), UIConsts.INTEGER_12, - sMasterHidString, + sMasterHidString, Short.valueOf(UnoDialog.getListBoxLineCount()), 206, new Integer(iCurPosY + 10), @@ -206,11 +197,11 @@ public class FieldLinker extends DBLimitedFieldSelection { if (i < rowcount) { - Helper.setUnoPropertyValue(UnoDialog.getModel(lblSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(lblMasterFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable)); - if (bDoEnable == false) + Helper.setUnoPropertyValue(UnoDialog.getModel(lblSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(lblMasterFields[i]), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable)); + if (!bDoEnable) { Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); @@ -238,7 +229,9 @@ public class FieldLinker extends DBLimitedFieldSelection { // short[] MasterSelList = null; // short[] SlaveSelList = null; + int SOMASTERINDEX = 1; String[] MasterLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOMASTERINDEX); + int SOSLAVEINDEX = 0; String[] SlaveLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOSLAVEINDEX); String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames); // add '-undefiened-' String[] ViewSlaveFieldNames = addNoneFieldItemToList(_AllSlaveFieldNames); diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java index 199e55d2ebb6..7cd25f012cd6 100644 --- a/wizards/com/sun/star/wizards/form/Finalizer.java +++ b/wizards/com/sun/star/wizards/form/Finalizer.java @@ -128,7 +128,7 @@ public class Finalizer public boolean getOpenForEditing() { - return optModifyForm.getState() ? true : false; + return optModifyForm.getState(); } public boolean finish() diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java index b6f6c476b84c..7d7425985f83 100644 --- a/wizards/com/sun/star/wizards/form/FormConfiguration.java +++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java @@ -151,8 +151,8 @@ public class FormConfiguration public void toggleSubFormMode() { boolean bdoEnable = (this.chkcreateSubForm.getState() == 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable && bsupportsRelations)); - Helper.setUnoPropertyValue(UnoDialog.getModel(optSelectManually), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable && bsupportsRelations)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optSelectManually), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable)); toggleSteps(); } @@ -164,7 +164,7 @@ public class FormConfiguration Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), PropertyNames.STRING_ITEM_LIST, sreferencedTables); this.CurSubFormFieldSelection = _CurSubFormFieldSelection; toggleRelationsListbox(); - Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, new Boolean(bsupportsRelations && (chkcreateSubForm.getState() == 1))); + Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bsupportsRelations && (chkcreateSubForm.getState() == 1))); } public void toggleSteps() @@ -231,8 +231,8 @@ public class FormConfiguration private void toggleRelationsListbox() { boolean bdoenable = bsupportsRelations && this.optOnExistingRelation.getState() && (chkcreateSubForm.getState() == 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(lblRelations), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(lblRelations), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable)); } public boolean hasSubForm() diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index 916c92621efa..a87478f5690a 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -126,7 +126,7 @@ public class FormControlArranger { if (LastIndex < DBControlList.length && DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX) { - return (int) ((oFormHandler.getControlReferenceHeight() - DBControlList[LastIndex].getControlHeight()) / 2); + return (oFormHandler.getControlReferenceHeight() - DBControlList[LastIndex].getControlHeight()) / 2; } return 0; } diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index 63bd67a9f0ce..f12455c264d5 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -223,8 +223,7 @@ public class FormDocument extends TextDocument nMainFormHeight = (int) (((double) getMainFieldCount() / (double) nTotalFieldCount) * ((double) (nFormHeight - SOFORMGAP) / 2)); } } - Size aMainFormSize = new Size(nFormWidth, nMainFormHeight); - return aMainFormSize; + return new Size(nFormWidth, nMainFormHeight); } private Size getSubFormSize() @@ -233,8 +232,7 @@ public class FormDocument extends TextDocument // int nSubFormFieldCount = this.oSubFormDBMetaData.FieldNames.length; // int totfieldcount = oMainFormDBMetaData.FieldNames.length + nSubFormFieldCount; int nMainFormHeight = ((ControlForm) oControlForms.get(0)).getActualFormHeight(); - Size aSubFormSize = new Size(nFormWidth, nFormHeight - nMainFormHeight - SOFORMGAP); - return aSubFormSize; + return new Size(nFormWidth, nFormHeight - nMainFormHeight - SOFORMGAP); } private Point getSubFormPoint() @@ -265,7 +263,7 @@ public class FormDocument extends TextDocument { ControlForm oMainControlForm = (ControlForm) oControlForms.get(0); ControlForm oSubControlForm = (ControlForm) oControlForms.get(1); - oSubControlForm.setFormSize(new Size(nFormWidth, (int) nFormHeight - oMainControlForm.getFormSize().Height)); + oSubControlForm.setFormSize(new Size(nFormWidth, nFormHeight - oMainControlForm.getFormSize().Height)); if (oSubControlForm.curArrangement == FormWizard.AS_GRID) { Point aPoint = oSubControlForm.oGridControl.getPosition(); @@ -378,7 +376,7 @@ public class FormDocument extends TextDocument { xFormContainer = oFormHandler.insertFormbyName(_sname); } - xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFormContainer); + xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xFormContainer); if (_sname.equals(SOMAINFORM)) { oDBMetaData = oFormDocument.oMainFormDBMetaData; diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index 101c054a2c2b..cff52f46229b 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -89,7 +89,7 @@ public class FormWizard extends DatabaseObjectWizard 210, Boolean.TRUE, "DialogForm", 102, 41, 1, new Short((short) 0), m_oResource.getResText(UIConsts.RID_FORM), 310 }); drawNaviBar(); - if (getFormResources() == true) + if (getFormResources()) { setRightPaneHeaders(m_oResource, UIConsts.RID_FORM + 90, 8); } @@ -461,7 +461,7 @@ public class FormWizard extends DatabaseObjectWizard curDBCommandFieldSelection.setModified(true); boolean benable = curDBCommandFieldSelection.getSelectedFieldNames().length > 0; enablefromStep(SOSUBFORM_PAGE, benable); - setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, new Boolean(benable)); + setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); if (benable) { if (curFormConfiguration.hasSubForm()) @@ -474,7 +474,7 @@ public class FormWizard extends DatabaseObjectWizard setStepEnabled(SOFIELDLINKER_PAGE, false); } } - setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, new Boolean(benable)); + setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); } } } diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 657ca504fcfb..9f6f6d6160dd 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -187,7 +187,7 @@ public class StyleApplier try { Object oRootNode = Configuration.getConfigurationRoot(xMSF, "org.openoffice.Office.FormWizard/FormWizard/Styles", false); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oRootNode); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oRootNode); StyleNodeNames = xNameAccess.getElementNames(); StyleNames = new String[StyleNodeNames.length]; FileNames = new String[StyleNodeNames.length]; diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index 678ed88962b0..82a063c1bb7d 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -201,7 +201,7 @@ public class UIControlArranger public void enableSubFormImageList(boolean _bdoEnable) { m_aArrangeList[1].m_aButtonList.setenabled(_bdoEnable); - CurUnoDialog.setControlProperty("lnLabelPlacment_2", PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoEnable)); + CurUnoDialog.setControlProperty("lnLabelPlacment_2", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoEnable)); } public short getAlignValue() @@ -235,9 +235,9 @@ public class UIControlArranger private void enableAlignControlGroup(boolean _bEnableAlignControlGroup) { - Helper.setUnoPropertyValue(UnoDialog.getModel(flnLabelPlacement), PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnableAlignControlGroup)); - Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnableAlignControlGroup)); - Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignRight), PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnableAlignControlGroup)); + Helper.setUnoPropertyValue(UnoDialog.getModel(flnLabelPlacement), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnableAlignControlGroup)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnableAlignControlGroup)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignRight), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnableAlignControlGroup)); } // private class ArrangeImageList implements XItemListener diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.java b/wizards/com/sun/star/wizards/letter/LetterDocument.java index 361e7d3da43d..6a024ce1113f 100644 --- a/wizards/com/sun/star/wizards/letter/LetterDocument.java +++ b/wizards/com/sun/star/wizards/letter/LetterDocument.java @@ -61,9 +61,8 @@ public class LetterDocument extends TextDocument public XWindowPeer getWindowPeer() { - XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument); - return xWindowPeer; - } + return UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument); +} public void switchElement(String sElement, boolean bState) { @@ -71,7 +70,7 @@ public class LetterDocument extends TextDocument { TextSectionHandler mySectionHandler = new TextSectionHandler(xMSF, xTextDocument); Object oSection = mySectionHandler.xTextSectionsSupplier.getTextSections().getByName(sElement); - Helper.setUnoPropertyValue(oSection, "IsVisible", new Boolean(bState)); + Helper.setUnoPropertyValue(oSection, "IsVisible", Boolean.valueOf(bState)); } catch (Exception exception) @@ -93,20 +92,20 @@ public class LetterDocument extends TextDocument try { xTextDocument.lockControllers(); - XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); + XStyleFamiliesSupplier xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); com.sun.star.container.XNameAccess xNameAccess = null; xNameAccess = xStyleFamiliesSupplier.getStyleFamilies(); com.sun.star.container.XNameContainer xPageStyleCollection = null; - xPageStyleCollection = (com.sun.star.container.XNameContainer) UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles")); + xPageStyleCollection = UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles")); XText xFooterText; - XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle)); + XStyle xPageStyle = UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle)); if (bState) { - Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(true)); - xFooterText = (XText) UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText")); + Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", Boolean.TRUE); + xFooterText = UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText")); xFooterText.setString(sText); if (bPageNumber) { @@ -114,10 +113,10 @@ public class LetterDocument extends TextDocument XTextCursor myCursor = xFooterText.createTextCursor(); myCursor.gotoEnd(false); xFooterText.insertControlCharacter(myCursor, ControlCharacter.PARAGRAPH_BREAK, false); - XPropertySet xCursorPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, myCursor); + XPropertySet xCursorPSet = UnoRuntime.queryInterface(XPropertySet.class, myCursor); xCursorPSet.setPropertyValue("ParaAdjust", ParagraphAdjust.CENTER); - XTextField xPageNumberField = (XTextField) UnoRuntime.queryInterface(XTextField.class, xMSFDoc.createInstance("com.sun.star.text.TextField.PageNumber")); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageNumberField); + XTextField xPageNumberField = UnoRuntime.queryInterface(XTextField.class, xMSFDoc.createInstance("com.sun.star.text.TextField.PageNumber")); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xPageNumberField); xPSet.setPropertyValue("SubType", PageNumberType.CURRENT); xPSet.setPropertyValue("NumberingType", new Short(NumberingType.ARABIC)); xFooterText.insertTextContent(xFooterText.getEnd(), xPageNumberField, false); @@ -125,7 +124,7 @@ public class LetterDocument extends TextDocument } else { - Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(false)); + Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", Boolean.FALSE); } xTextDocument.unlockControllers(); } @@ -259,8 +258,8 @@ public class LetterDocument extends TextDocument try { - xFrame = (XTextFrame) UnoRuntime.queryInterface(XTextFrame.class, xMSFDoc.createInstance("com.sun.star.text.TextFrame")); - xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xFrame); + xFrame = UnoRuntime.queryInterface(XTextFrame.class, xMSFDoc.createInstance("com.sun.star.text.TextFrame")); + xShape = UnoRuntime.queryInterface(XShape.class, xFrame); setFramePosition(); Helper.setUnoPropertyValue(xShape, "AnchorType", TextContentAnchorType.AT_PAGE); @@ -276,7 +275,7 @@ public class LetterDocument extends TextDocument Helper.setUnoPropertyValue(xFrame, "RightBorder", myBorder); Helper.setUnoPropertyValue(xFrame, "TopBorder", myBorder); Helper.setUnoPropertyValue(xFrame, "BottomBorder", myBorder); - Helper.setUnoPropertyValue(xFrame, "Print", new Boolean(false)); + Helper.setUnoPropertyValue(xFrame, "Print", Boolean.FALSE); XTextCursor xTextCursor = xTextDocument.getText().createTextCursor(); xTextCursor.gotoEnd(true); @@ -285,10 +284,10 @@ public class LetterDocument extends TextDocument XText xFrameText = xFrame.getText(); XTextCursor xFrameCursor = xFrameText.createTextCursor(); - XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFrameCursor); + XPropertySet xCursorProps = UnoRuntime.queryInterface(XPropertySet.class, xFrameCursor); xCursorProps.setPropertyValue("CharWeight", new Float(com.sun.star.awt.FontWeight.BOLD)); xCursorProps.setPropertyValue("CharColor", 16777215); - xCursorProps.setPropertyValue("CharFontName", new String("Albany")); + xCursorProps.setPropertyValue("CharFontName", "Albany"); xCursorProps.setPropertyValue("CharHeight", new Float(18)); xFrameText.insertString(xFrameCursor, FrameText, false); diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java index 6f4503d3936a..a7198b6ba955 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java @@ -211,7 +211,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog } XWindow xContainerWindow = myLetterDoc.xFrame.getContainerWindow(); - XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow); + XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow); createWindowPeer(xWindowPeer); //add the Roadmap to the dialog: @@ -240,8 +240,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog removeTerminateListener(); exception.printStackTrace(System.out); running = false; - return; - } + } } public void cancelWizard() @@ -311,7 +310,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog if (bSaveSuccess) { saveConfiguration(); - XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); + XInteractionHandler xIH = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); PropertyValue loadValues[] = new PropertyValue[4]; loadValues[0] = new PropertyValue(); loadValues[0].Name = "AsTemplate"; @@ -335,7 +334,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog } Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), sPath, "_default", loadValues); XTextDocument xTextDocument = (com.sun.star.text.XTextDocument) oDoc; - XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); + XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); ViewHandler myViewHandler = new ViewHandler(xDocMSF, xTextDocument); myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.OPTIMAL)); } @@ -361,7 +360,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog try { //xComponent.dispose(); - XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myLetterDoc.xFrame); + XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, myLetterDoc.xFrame); xCloseable.close(false); } catch (CloseVetoException e) @@ -734,7 +733,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog { numFooterHeight.setValue(0.1); } - BusFooter = myLetterDoc.new BusinessPaperObject("Footer", (int) myLetterDoc.DocSize.Width, (int) (numFooterHeight.getValue() * 1000), (int) 0, (int) (myLetterDoc.DocSize.Height - (numFooterHeight.getValue() * 1000))); + BusFooter = myLetterDoc.new BusinessPaperObject("Footer", myLetterDoc.DocSize.Width, (int) (numFooterHeight.getValue() * 1000), 0, (int) (myLetterDoc.DocSize.Height - (numFooterHeight.getValue() * 1000))); this.setControlProperty("numFooterHeight", PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); this.setControlProperty("lblFooterHeight", PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); setPossibleFooter(false); @@ -827,7 +826,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog //enable/disable roadmap item for footer page XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER); - Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bFooterPossible)); + Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bFooterPossible)); } catch (Exception exception) @@ -848,7 +847,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog private void setPossibleFooter(boolean bState) { - setControlProperty("chkUseFooter", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); + setControlProperty("chkUseFooter", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); chkUseFooterItemChanged(); } @@ -856,7 +855,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog { if (myLetterDoc.hasElement("Sender Address Repeated")) { - setControlProperty("chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); + setControlProperty("chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); chkUseAddressReceiverItemChanged(); } } @@ -865,7 +864,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog { if (myLetterDoc.hasElement("Company Logo")) { - setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); + setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); chkUseLogoItemChanged(); } } @@ -907,7 +906,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog public void txtTemplateNameTextChanged() { - XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); + XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); XDocumentProperties xDocProps = xDocPropsSuppl.getDocumentProperties(); String TitleName = txtTemplateName.getText(); xDocProps.setTitle(TitleName); @@ -915,14 +914,14 @@ public class LetterWizardDialogImpl extends LetterWizardDialog public void chkUseSalutationItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); myLetterDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0)); - setControlProperty("lstSalutation", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseSalutation.getState() != 0)); + setControlProperty("lstSalutation", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseSalutation.getState() != 0)); } public void lstSalutationItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); myLetterDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0)); } @@ -932,20 +931,20 @@ public class LetterWizardDialogImpl extends LetterWizardDialog public void chkUseGreetingItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); myLetterDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0)); - setControlProperty("lstGreeting", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseGreeting.getState() != 0)); + setControlProperty("lstGreeting", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseGreeting.getState() != 0)); } private void setDefaultForGreetingAndSalutation() { XTextComponent xTextComponent; - xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); + xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING)) { xTextComponent.setText(resources.SalutationLabels[0]); } - xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); + xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING)) { xTextComponent.setText(resources.GreetingLabels[0]); @@ -954,7 +953,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog public void lstGreetingItemChanged() { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting); myLetterDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0)); } @@ -1009,20 +1008,20 @@ public class LetterWizardDialogImpl extends LetterWizardDialog private void setPossibleSenderData(boolean bState) { - setControlProperty("optSenderDefine", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("optSenderPlaceholder", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("lblSenderAddress", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); + setControlProperty("optSenderDefine", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("optSenderPlaceholder", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("lblSenderAddress", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); if (!bState) { - setControlProperty("txtSenderCity", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("txtSenderName", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("txtSenderPostCode", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("txtSenderStreet", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("txtSenderCity", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("txtSenderState", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("lblSenderName", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("lblSenderStreet", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); - setControlProperty("lblPostCodeCity", PropertyNames.PROPERTY_ENABLED, new Boolean(bState)); + setControlProperty("txtSenderCity", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("txtSenderName", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("txtSenderPostCode", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("txtSenderStreet", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("txtSenderCity", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("txtSenderState", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("lblSenderName", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("lblSenderStreet", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); + setControlProperty("lblPostCodeCity", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState)); } } @@ -1149,7 +1148,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog //sLetterLangPackPath = FileAccess.combinePaths(xMSF, sTemplatePath, sLetterSubPath); 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); + com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface); nameList1 = xSimpleFileAccess.getFolderContents(sMainPath, true); nameList2 = xSimpleFileAccess.getFolderContents(sLetterPath, true); for (int i = 0; i < nameList1.length; i++) @@ -1246,7 +1245,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog if (found) { NormsVector.add(cIsoCode); - NormsPathVector.add((String) nameList[i]); + NormsPathVector.add(nameList[i]); LanguageLabelsVector.add(lc.getLanguageString(MSID)); /* Norms[z] = cIsoCode; @@ -1341,11 +1340,11 @@ public class LetterWizardDialogImpl extends LetterWizardDialog public void initializeElements() { - setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Company Logo"))); - setControlProperty("chkUseBendMarks", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Bend Marks"))); - setControlProperty("chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Sender Address Repeated"))); - setControlProperty("chkUseSubject", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Subject Line"))); - setControlProperty("chkUseSigns", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Letter Signs"))); + setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Company Logo"))); + setControlProperty("chkUseBendMarks", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Bend Marks"))); + setControlProperty("chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Sender Address Repeated"))); + setControlProperty("chkUseSubject", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Subject Line"))); + setControlProperty("chkUseSigns", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Letter Signs"))); myLetterDoc.updateDateFields(); } diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index ad11db4041d2..6caf2dfa60a2 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -164,8 +164,7 @@ public class Finalizer private String getTitle() { - final String sTitle = (String) Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text"); - return sTitle; + return (String) Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text"); } public String finish() diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java index 76e670a848be..7a0ab0d06beb 100644 --- a/wizards/com/sun/star/wizards/query/QuerySummary.java +++ b/wizards/com/sun/star/wizards/query/QuerySummary.java @@ -122,8 +122,7 @@ public class QuerySummary extends QueryMetaData sconditions = appendClauseSeparator(sconditions, PropertyNames.SPACE + sOr + PropertyNames.SPACE, i, _filterconditions.length); } } - String sreturn = sStart + sconditions; - return sreturn; + return sStart + sconditions; } return oResource.getResText(_AlternativeResID); } diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index 9d1a454f9497..f4dd3296dbce 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -77,7 +77,6 @@ public class QueryWizard extends DatabaseObjectWizard private String reslblFields; private String reslblSelFields; private String reslblTables; - private String resQueryWizard; private String reslblGroupBy; private String resmsgNonNumericAsGroupBy; private String m_createdQuery; @@ -194,7 +193,7 @@ public class QueryWizard extends DatabaseObjectWizard reslblSelFields = m_oResource.getResText(UIConsts.RID_QUERY + 50); reslblTables = m_oResource.getResText(UIConsts.RID_QUERY + 3); reslblGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 18); - resQueryWizard = m_oResource.getResText(UIConsts.RID_QUERY + 2); + String resQueryWizard = m_oResource.getResText(UIConsts.RID_QUERY + 2); resmsgNonNumericAsGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 88); Helper.setUnoPropertyValues(xDialogModel, new String[] { @@ -249,7 +248,7 @@ public class QueryWizard extends DatabaseObjectWizard switch (CurItemID) { case SOAGGREGATE_PAGE: - if (_bEnabled == true) + if (_bEnabled) { bEnabled = ((m_DBMetaData.hasNumericalFields()) && (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar())); } @@ -259,7 +258,7 @@ public class QueryWizard extends DatabaseObjectWizard break; case SOGROUPFILTER_PAGE: bEnabled = false; - if (_bEnabled == true) + if (_bEnabled) { bEnabled = (m_DBMetaData.GroupByFilterConditions.length > 0); } diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java index 31d4555757ee..8b10e96ac5a3 100644 --- a/wizards/com/sun/star/wizards/report/CallReportWizard.java +++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java @@ -118,7 +118,7 @@ public class CallReportWizard { if (sEvent.compareTo(PropertyNames.START) == 0) { - if (bWizardstartedalready != true) + if (!bWizardstartedalready) { ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext ); CurReportWizard.startReportWizard(); diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index 556c1c1cdaee..25b6da4950c3 100644 --- a/wizards/com/sun/star/wizards/report/DBColumn.java +++ b/wizards/com/sun/star/wizards/report/DBColumn.java @@ -126,7 +126,7 @@ public class DBColumn try { XCell xCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 0); - XTextRange xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell); + XTextRange xTextCell = UnoRuntime.queryInterface(XTextRange.class, xCell); String CompString = "Column"; XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell); if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString) || (_bforce)) @@ -134,7 +134,7 @@ public class DBColumn xNameCell = xCell; xNameTextCell = xTextCell; xValCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 1); - xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell); + xValTextCell = UnoRuntime.queryInterface(XTextRange.class, xValCell); xValCellCursor = TextDocument.createTextCursor(xValCell); ValColumn = _nColumn; return true; @@ -190,7 +190,7 @@ public class DBColumn for (int m = 0; m < xRows.getCount(); m++) { xCell = xCellRange.getCellByPosition(n, m); - xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell); + xTextCell = UnoRuntime.queryInterface(XTextRange.class, xCell); String CompString = TableName.substring(4); XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell); if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString)) @@ -216,12 +216,12 @@ public class DBColumn try { XNameAccess xAllTextTables = oTextTableHandler.xTextTablesSupplier.getTextTables(); - if (xAllTextTables.hasByName(TableName) == true) + if (xAllTextTables.hasByName(TableName)) { Object oTextTable = xAllTextTables.getByName(TableName); - xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oTextTable); - xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTextTable); - xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextTable); + xCellRange = UnoRuntime.queryInterface(XCellRange.class, oTextTable); + xTextTable = UnoRuntime.queryInterface(XTextTable.class, oTextTable); + xTableName = UnoRuntime.queryInterface(XNamed.class, oTextTable); xTableColumns = xTextTable.getColumns(); } } @@ -290,7 +290,7 @@ public class DBColumn try { xValCell = xCellRange.getCellByPosition(ValColumn, ValRow); - xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell); + xValTextCell = UnoRuntime.queryInterface(XTextRange.class, xValCell); modifyCellContent(CurGroupValue); if (bAlignLeft) { @@ -361,7 +361,7 @@ public class DBColumn try { Object CurGroupValue; - if (bIsGroupColumn == false && CurDBField.isNumberFormat() == false) + if (!bIsGroupColumn && !CurDBField.isNumberFormat()) { CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.getFieldWidth(), _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames()); } @@ -381,7 +381,7 @@ public class DBColumn { CharFontName = "StarSymbol"; Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName); - if (bIsGroupColumn == false) + if (!bIsGroupColumn) { Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.CENTER_value)); } @@ -390,7 +390,7 @@ public class DBColumn { if (PropertyState == com.sun.star.beans.PropertyState.DEFAULT_VALUE) { - XPropertyState xPropState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor); + XPropertyState xPropState = UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor); xPropState.setPropertyToDefault("CharFontName"); } else @@ -425,7 +425,7 @@ public class DBColumn } else { - xPropertyState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor); + xPropertyState = UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor); PropertyState = xPropertyState.getPropertyState("CharFontName"); CharFontName = AnyConverter.toString(Helper.getUnoPropertyValue(xValCellCursor, "CharFontName")); } @@ -449,7 +449,7 @@ public class DBColumn } else { - XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField); + XDependentTextField xDependent = UnoRuntime.queryInterface(XDependentTextField.class, oTextField); XPropertySet xMaster = xDependent.getTextFieldMaster(); String UserFieldName = (String) xMaster.getPropertyValue(PropertyNames.PROPERTY_NAME); boolean bIsNameCell = false; diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index a467b3dbbeab..5b80ec41e5b8 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -186,8 +186,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi calculateDialogPosition(CurReportDocument.getFrame().getComponentWindow().getPosSize()); xWindow.setVisible(true); super.xReschedule.reschedule(); - return; - } + } catch (Exception e) { Logger.getLogger(Dataimport.class.getName()).log(Level.SEVERE, null, e); diff --git a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java index b18a99c35a5b..b123bb3b06fb 100644 --- a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java +++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java @@ -53,8 +53,8 @@ public class GroupFieldHandler extends FieldSelection this.oWizardDialog = _CurUnoDialog; this.CurReportDocument = _CurReportDocument; this.CurDBMetaData = CurReportDocument.getRecordParser(); - CurUnoDialog.setControlProperty("lstFields_2", "MultiSelection", new Boolean(false)); - CurUnoDialog.setControlProperty("lstSelFields_2", "MultiSelection", new Boolean(false)); + CurUnoDialog.setControlProperty("lstFields_2", "MultiSelection", Boolean.FALSE); + CurUnoDialog.setControlProperty("lstSelFields_2", "MultiSelection", Boolean.FALSE); addFieldSelectionListener(new FieldSelectionListener()); String sNote = ReportWizard.getBlindTextNote(_CurReportDocument, _CurUnoDialog.m_oResource); CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_1", @@ -64,7 +64,7 @@ public class GroupFieldHandler extends FieldSelection }, new Object[] { - new Boolean(false), 18, sNote, new Boolean(true), 95, 158, new Integer(ReportWizard.SOGROUPPAGE), 209 + Boolean.FALSE, 18, sNote, Boolean.TRUE, 95, 158, new Integer(ReportWizard.SOGROUPPAGE), 209 }); } catch (Exception exception) @@ -113,7 +113,7 @@ public class GroupFieldHandler extends FieldSelection { emptyFieldsListBoxes(); GroupFieldVector.removeAllElements(); - CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, new Boolean(false)); + CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); } public void getGroupFieldNames(CommandMetaData CurDBMetaData) @@ -162,7 +162,7 @@ public class GroupFieldHandler extends FieldSelection int iSelCount = xSelectedFieldsListBox.getItemCount(); String[] CurGroupNames = xFieldsListBox.getItems(); CurReportDocument.liveupdate_addGroupNametoDocument(CurGroupNames, CurGroupTitle, GroupFieldVector, CurReportDocument.getReportPath(), iSelCount); - CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, new Boolean(true)); + CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); if (iSelCount >= MAXSELFIELDS) { toggleMoveButtons(false, false); @@ -178,7 +178,7 @@ public class GroupFieldHandler extends FieldSelection String[] NewSelList = xSelectedFieldsListBox.getItems(); CurReportDocument.liveupdate_removeGroupName(NewSelList, OldGroupTitle, GroupFieldVector); String[] NewSelGroupNames = xSelectedFieldsListBox.getItems(); - CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, new Boolean(NewSelGroupNames.length == 0)); + CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(NewSelGroupNames.length == 0)); // CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems()); } diff --git a/wizards/com/sun/star/wizards/report/RecordTable.java b/wizards/com/sun/star/wizards/report/RecordTable.java index b4af7f7fa94b..86b365fbac80 100644 --- a/wizards/com/sun/star/wizards/report/RecordTable.java +++ b/wizards/com/sun/star/wizards/report/RecordTable.java @@ -69,21 +69,21 @@ public class RecordTable { oTable = xAllTextTables.getByName(ReportTextDocument.TBLRECORDSECTION); } - xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable); - xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable); + xTextTable = UnoRuntime.queryInterface(XTextTable.class, oTable); + xTableName = UnoRuntime.queryInterface(XNamed.class, xTextTable); } else { - XIndexAccess xTableIndex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xAllTextTables); + XIndexAccess xTableIndex = UnoRuntime.queryInterface(XIndexAccess.class, xAllTextTables); int n = xTableIndex.getCount() - 1; Object x = xTableIndex.getByIndex(n); - xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, x); - xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable); + xTextTable = UnoRuntime.queryInterface(XTextTable.class, x); + xTableName = UnoRuntime.queryInterface(XNamed.class, xTextTable); xTableName.setName(ReportTextDocument.TBLRECORDSECTION); } xTableRows = xTextTable.getRows(); xTableColumns = xTextTable.getColumns(); - xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable); + xCellRange = UnoRuntime.queryInterface(XCellRange.class, xTextTable); } catch (Exception exception) { diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java index 6fd22abd5093..5498eb89dd55 100644 --- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java +++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java @@ -200,7 +200,7 @@ public class ReportFinalizer { String FirstCommandName = (_CurDBMetaData.getIncludedCommandNames())[0]; DefaultName = Desktop.getUniqueName(_CurDBMetaData.getReportDocuments(), FirstCommandName); - if (DefaultName.equals(OldDefaultName) == false) + if (!DefaultName.equals(OldDefaultName)) { OldDefaultName = DefaultName; } @@ -227,7 +227,7 @@ public class ReportFinalizer StoreName = getStoreName(); String StorePath; XInterface xInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); StorePath = FileAccess.getOfficePath(m_xMSF, "Temp", xSimpleFileAccess) + "/" + StoreName; return StorePath; } diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java index dac1b5f98101..0ea91a2f2a30 100644 --- a/wizards/com/sun/star/wizards/report/ReportLayouter.java +++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java @@ -195,7 +195,7 @@ public class ReportLayouter }, new Object[] { - new Short("0"), 23, 164, 158, new Boolean(false), new Integer(ReportWizard.SOTEMPLATEPAGE), 30 + new Short("0"), 23, 164, 158, Boolean.FALSE, new Integer(ReportWizard.SOTEMPLATEPAGE), 30 }); String sNote = ReportWizard.getBlindTextNote(CurReportDocument, CurUnoDialog.m_oResource); @@ -206,7 +206,7 @@ public class ReportLayouter }, new Object[] { - 34, sNote, new Boolean(true), 205, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), 99 + 34, sNote, Boolean.TRUE, 205, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), 99 }); if (m_nLandscapeState == 1) { @@ -246,7 +246,7 @@ public class ReportLayouter try { int iPos; - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(false)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); // LLA: should we lock controllers here? // CurReportDocument.getDoc().xTextDocument.lockControllers(); int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList); @@ -306,7 +306,7 @@ public class ReportLayouter e.printStackTrace(); } // CurReportDocument.getDoc().unlockallControllers(); - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(true)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); } public void disposing(EventObject eventObject) @@ -325,17 +325,17 @@ public class ReportLayouter { try { - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(false)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); // CurReportDocument.getDoc().xTextDocument.lockControllers(); boolean blandscape = (((Short) CurUnoDialog.getControlProperty("optLandscape", PropertyNames.PROPERTY_STATE)).shortValue() == 1); - CurReportDocument.setPageOrientation((blandscape == true) ? SOOPTLANDSCAPE : SOOPTPORTRAIT); + CurReportDocument.setPageOrientation((blandscape) ? SOOPTLANDSCAPE : SOOPTPORTRAIT); } catch (Exception exception) { exception.printStackTrace(System.out); } // CurReportDocument.getDoc().unlockallControllers(); - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(true)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); } } } diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index c0babfab9769..79196826def1 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -153,8 +153,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { oTextSection = xTextSections.getByName(RECORDSECTION); } - boolean bLayoutMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, ISVISIBLE)); - return bLayoutMode; + return AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, ISVISIBLE)); } catch (Exception e) { @@ -205,7 +204,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen public void createReportForm(String SOREPORTFORMNAME) { com.sun.star.container.XNameContainer xNamedForm = oFormHandler.insertFormbyName(SOREPORTFORMNAME); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNamedForm); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xNamedForm); oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND_TYPE, Integer.toString(CurDBMetaData.getCommandType())); if (CurDBMetaData.getCommandType() == CommandType.QUERY) { @@ -317,16 +316,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen for (i = 0; i < GroupCount; i++) { CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], i, TBLGROUPSECTION + (i + 1)); - if (CurDBColumn == null) - { - return false; - } - else - { - CurDBColumn.formatValueCell(); - DBColumnsVector.set(i, CurDBColumn); - replaceFieldValueInGroupTable(CurDBColumn, i); - } + CurDBColumn.formatValueCell(); + DBColumnsVector.set(i, CurDBColumn); + replaceFieldValueInGroupTable(CurDBColumn, i); } return true; } @@ -499,16 +491,8 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen oTextSectionHandler.insertTextSection(GROUPSECTION + GroupCount, sPath, GroupCount == 1); CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.getFieldName(), GroupCount - 1, TBLGROUPSECTION + (GroupCount)); CurDBColumn.formatValueCell(); - if (CurDBColumn != null) - { - DBColumnsVector.addElement(CurDBColumn); - replaceFieldValueInGroupTable(CurDBColumn, GroupCount - 1); - } - else - { - String sMessage = JavaTools.replaceSubString(sMsgTableNotExisting, TBLGROUPSECTION + (GroupCount), "<TABLENAME>"); - CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage); - } + DBColumnsVector.addElement(CurDBColumn); + replaceFieldValueInGroupTable(CurDBColumn, GroupCount - 1); } catch (Exception exception) { @@ -583,43 +567,35 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i - CurDBMetaData.GroupFieldNames.length); } - if (CurDBColumn != null) + if (CurDBColumn.xNameCell != null) { - if (CurDBColumn.xNameCell != null) + DBColumnsVector.addElement(CurDBColumn); + } + else + { + String DelFieldName; + if (i < CurDBMetaData.GroupFieldNames.length) { - DBColumnsVector.addElement(CurDBColumn); + DelFieldName = CurDBMetaData.GroupFieldNames[i]; + CurDBMetaData.GroupFieldNames = JavaTools.removefromList(CurDBMetaData.GroupFieldNames, new String[] + { + DelFieldName + }); + CurDBMetaData.GroupFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.GroupFieldColumns); } else { - String DelFieldName; - if (i < CurDBMetaData.GroupFieldNames.length) - { - DelFieldName = CurDBMetaData.GroupFieldNames[i]; - CurDBMetaData.GroupFieldNames = JavaTools.removefromList(CurDBMetaData.GroupFieldNames, new String[] - { - DelFieldName - }); - CurDBMetaData.GroupFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.GroupFieldColumns); - } - else - { - DelFieldName = CurDBMetaData.getRecordFieldName(i - CurDBMetaData.GroupFieldNames.length); - String[] aNewList = JavaTools.removefromList(CurDBMetaData.getRecordFieldNames(), new String[] - { - DelFieldName - }); - CurDBMetaData.setRecordFieldNames(aNewList); - CurDBMetaData.RecordFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.RecordFieldColumns); - CurDBMetaData.FieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.FieldColumns); + DelFieldName = CurDBMetaData.getRecordFieldName(i - CurDBMetaData.GroupFieldNames.length); + String[] aNewList = JavaTools.removefromList(CurDBMetaData.getRecordFieldNames(), new String[] + { + DelFieldName + }); + CurDBMetaData.setRecordFieldNames(aNewList); + CurDBMetaData.RecordFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.RecordFieldColumns); + CurDBMetaData.FieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.FieldColumns); - } - i--; } - } - else - { - String sMessage = JavaTools.replaceSubString(sMsgTableNotExisting, TBLGROUPSECTION + (CurDBMetaData.GroupFieldNames.length), "<TABLENAME>"); - CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage); + i--; } } java.util.Arrays.sort(CurDBMetaData.RecordFieldColumns, this); @@ -696,7 +672,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { sInvisibleSectionNames[i] = GROUPSECTION + i; } - XNameAccess xNameAccessTextSections = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextSectionHandler.xTextSectionsSupplier.getTextSections()); + XNameAccess xNameAccessTextSections = UnoRuntime.queryInterface(XNameAccess.class, oTextSectionHandler.xTextSectionsSupplier.getTextSections()); String[] sSectionNames = xNameAccessTextSections.getElementNames(); for (int i = 0; i < sSectionNames.length; i++) { @@ -723,7 +699,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen public void removeNonLayoutTextTables() { String[] sLayoutTableNames = getLayoutTextTableNames(); - XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); + XNameAccess xNameAccessTextTables = UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); String[] sTableNames = xNameAccessTextTables.getElementNames(); for (int i = 0; i < sTableNames.length; i++) { @@ -738,8 +714,8 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen public void removeLayoutTextTables() { String[] sLayoutTableNames = getLayoutTextTableNames(); - XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); - XRelativeTextContentRemove xRelativeTextContentRemove = (XRelativeTextContentRemove) UnoRuntime.queryInterface(XRelativeTextContentRemove.class, xText); + XNameAccess xNameAccessTextTables = UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); + XRelativeTextContentRemove xRelativeTextContentRemove = UnoRuntime.queryInterface(XRelativeTextContentRemove.class, xText); String[] sTableNames = xNameAccessTextTables.getElementNames(); for (int i = 0; i < sTableNames.length; i++) { @@ -748,7 +724,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { if (!sTableName.equals(sLayoutTableNames[0])) { - XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName)); + XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName)); boolean bleaveloop = false; while (!bleaveloop) { diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index 039ae870359a..6a79d0f37d84 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -189,8 +189,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion); if (CurDBColumn != null) { - boolean bIsGroupTable = (sLinkRegion.equals(ReportTextDocument.RECORDSECTION) != true); - if (bIsGroupTable == true) + boolean bIsGroupTable = (!sLinkRegion.equals(ReportTextDocument.RECORDSECTION)); + if (bIsGroupTable) { XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable(); XCellRange xCellRange = UnoRuntime.queryInterface( XCellRange.class, xTextTable ); @@ -347,7 +347,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme XTextCursor xTextCursor = ReportTextDocument.createTextCursor(getDoc().xTextDocument.getText()); xTextDocument.lockControllers(); - if (getRecordParser().ResultSet.next() == true) + if (getRecordParser().ResultSet.next()) { replaceUserFields(); Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page"); @@ -361,18 +361,18 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex); addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue); //COPYOF!!!! } - if (getRecordParser().getcurrentRecordData(DataVector) == true) + if (getRecordParser().getcurrentRecordData(DataVector)) { // int RowIndex = 1; m_bStopProcess = false; - while ((getRecordParser().ResultSet.next() == true) && (m_bStopProcess == false)) + while ((getRecordParser().ResultSet.next()) && (!m_bStopProcess)) { // RowIndex += 1; breset = false; for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++) { CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex); - if ((CurGroupValue.equals(OldGroupFieldValues[ColIndex]) == false) || (breset)) + if ((!CurGroupValue.equals(OldGroupFieldValues[ColIndex])) || (breset)) { breset = true; insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount); diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 597893986282..000f093b54d5 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -103,7 +103,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, { super(i_serviceFactory, 34320, i_wizardContext); super.addResourceHandler("Report Wizard", "dbw"); - if (getReportResources(false) == true) + if (getReportResources(false)) { Helper.setUnoPropertyValues(xDialogModel, new String[] @@ -245,7 +245,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, private void dialogFinish() { this.xComponent.dispose(); - if (bCloseDocument == true) + if (bCloseDocument) { m_reportDocument.dispose(); return; @@ -406,12 +406,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, { return false; } - if (e.hasMoreElements()) - { - return true; + return e.hasMoreElements(); } - return false; - } /** * Return the path to the "com.sun.reportdesigner" extension @@ -424,8 +420,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, final XComponentContext xComponentContext = Helper.getComponentContext(_xMSF); final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider"); XPackageInformationProvider xProvider = UnoRuntime.queryInterface(XPackageInformationProvider.class, aSingleton); - final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner"); - return sLocation; + return xProvider.getPackageLocation("com.sun.reportdesigner"); } private static XLogger m_xLogger; @@ -471,10 +466,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, { XMultiServiceFactory.class }); - m_reportDocument = (IReportDocument) aMethod.invoke(a, new Object[] - { - xMSF - }); + m_reportDocument = (IReportDocument) aMethod.invoke(a, xMSF + ); } catch (Exception e) { @@ -577,7 +570,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, public boolean getReportResources(boolean bgetProgressResourcesOnly) { sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_REPORT); - if (bgetProgressResourcesOnly == false) + if (!bgetProgressResourcesOnly) { sShowBinaryFields = m_oResource.getResText(UIConsts.RID_REPORT + 60); slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6); @@ -627,7 +620,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, bEnabled = true; } - Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); + Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled)); } } catch (com.sun.star.uno.Exception exception) @@ -639,8 +632,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, private void enableWizardSteps(String[] NewItems) { boolean bEnabled = NewItems.length > 0; - setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); - setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); + setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled)); + setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled)); enableRoadmapItems(bEnabled); // Note: Performancewise this could be improved } diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index 0e9945912425..0b55936da3fb 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -107,8 +107,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public XWindowPeer getWizardParent() { - final XWindowPeer aWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, getFrame().getComponentWindow()); - return aWindowPeer; + return UnoRuntime.queryInterface(XWindowPeer.class, getFrame().getComponentWindow()); } private XFrame m_xFrame = null; // private ReportBuilderLayouter m_aReportBuilderLayouter = null; @@ -121,8 +120,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper */ private IReportBuilderLayouter getReportBuilderLayouter() { - final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) getLayoutMap().get(m_sReportBuilderLayoutName); - return aReportBuilderLayouter; + return (IReportBuilderLayouter) getLayoutMap().get(m_sReportBuilderLayoutName); } private Object m_aReportDocument; private XPropertySet m_documentDefinition; @@ -168,8 +166,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper private XModeSelector getModeSelector() { final XController xController = getReportDefinition().getCurrentController(); - final XModeSelector xModeSelector = UnoRuntime.queryInterface(XModeSelector.class, xController); - return xModeSelector; + return UnoRuntime.queryInterface(XModeSelector.class, xController); } private void switchOffAddFieldWindow() @@ -586,8 +583,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper Object[] aParams = new Object[2]; aParams[0] = this; aParams[1] = m_resource; - final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) cTor.newInstance(aParams); - return aReportBuilderLayouter; + return (IReportBuilderLayouter) cTor.newInstance(aParams); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java index 9094807570ad..02ad2438bb59 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java @@ -53,8 +53,7 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter public String getLocalizedName() { - final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 81); - return sLocalizedName; + return getResource().getResText(UIConsts.RID_REPORT + 81); } protected void insertDetailFields() diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java index 2dc468fb09e7..51c14c42a536 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java @@ -51,8 +51,7 @@ public class ColumnarThreeColumns extends ColumnarTwoColumns public String getLocalizedName() { - final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 83); - return sLocalizedName; + return getResource().getResText(UIConsts.RID_REPORT + 83); } protected void insertDetailFields() diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java index 023d447a939f..9dd9bb78201c 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java @@ -53,8 +53,7 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter public String getLocalizedName() { - final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 82); - return sLocalizedName; + return getResource().getResText(UIConsts.RID_REPORT + 82); } protected void insertDetailFields() diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java index f2bdbcd6e428..12999090e646 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java @@ -181,7 +181,7 @@ public class DesignTemplate // is aObj a textfield // m_aDetailLabel_FD // m_aDetailTextField_FD - XFixedText aFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aObj); + XFixedText aFixedText = UnoRuntime.queryInterface(XFixedText.class, aObj); if (aFixedText != null && m_aDetailLabel == null) { @@ -189,7 +189,7 @@ public class DesignTemplate } else { - XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj); + XFormattedField aFormattedField = UnoRuntime.queryInterface(XFormattedField.class, aObj); if (aFormattedField != null && m_aDetailTextField == null) { @@ -218,7 +218,7 @@ public class DesignTemplate try { Object aGroup = xGroups.getByIndex(nGroup); - XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup); + XGroup xGroup = UnoRuntime.queryInterface(XGroup.class, aGroup); XSection xGroupSection = xGroup.getHeader(); final int nCount = xGroupSection.getCount(); @@ -227,7 +227,7 @@ public class DesignTemplate try { Object aObj = xGroupSection.getByIndex(i); - XFixedText aFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aObj); + XFixedText aFixedText = UnoRuntime.queryInterface(XFixedText.class, aObj); // is aObj a label // is aObj a textfield if (aFixedText != null && @@ -237,7 +237,7 @@ public class DesignTemplate } else { - XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj); + XFormattedField aFormattedField = UnoRuntime.queryInterface(XFormattedField.class, aObj); if (aFormattedField != null && m_aGroupTextField[nGroup] == null) { @@ -317,7 +317,7 @@ public class DesignTemplate m_xGlobalMSF = _xMSF; m_sFilename = _sPath; final Object aObj = _xMSF.createInstance("com.sun.star.report.ReportDefinition"); - m_xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj); + m_xReportDefinition = UnoRuntime.queryInterface(XReportDefinition.class, aObj); PropertyValue[] aLoadProps = new PropertyValue[2]; aLoadProps[0] = Properties.createProperty(PropertyNames.URL, _sPath); diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java index f1c02112414a..3fa72ca047b2 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java @@ -54,8 +54,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns public String getLocalizedName() { - final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 85); - return sLocalizedName; + return getResource().getResText(UIConsts.RID_REPORT + 85); } protected void insertDetailFields() diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java index b8ac18db61a4..34c2f9c10280 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java @@ -54,8 +54,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns public String getLocalizedName() { - final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 84); - return sLocalizedName; + return getResource().getResText(UIConsts.RID_REPORT + 84); } protected void insertDetailFields() diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java index e236405448f2..8d27f9e6507b 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java @@ -1,5 +1,4 @@ -/* - ************************************************************************ +/************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -210,7 +209,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter try { final Object aObj = _xSectionToClear.getByIndex(0); - final XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aObj); + final XShape aShape = UnoRuntime.queryInterface(XShape.class, aObj); _xSectionToClear.remove(aShape); } catch (com.sun.star.uno.Exception ex) @@ -295,7 +294,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter // get all Page Styles final Object aPageStylesObj = xNameAccess.getByName(_sStyleName); - final XNameAccess xContainer = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, aPageStylesObj); + final XNameAccess xContainer = UnoRuntime.queryInterface(XNameAccess.class, aPageStylesObj); // step over all Page Styles, search the one which is in use final String[] aElementNames = xContainer.getElementNames(); @@ -303,7 +302,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter { final String sName = aElementNames[i]; final Object aObj = xContainer.getByName(sName); - final XStyle xStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, aObj); + final XStyle xStyle = UnoRuntime.queryInterface(XStyle.class, aObj); if (xStyle.isInUse()) { aUsedStyle = xStyle; @@ -386,7 +385,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter { final XGroups xGroups = getReportDefinition().getGroups(); Object aGroup = xGroups.getByIndex(_nGroup); - XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup); + XGroup xGroup = UnoRuntime.queryInterface(XGroup.class, aGroup); XSection xGroupSection = xGroup.getHeader(); // copy Properties @@ -560,7 +559,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter for (int i = 0; i < _aList.length; i++) { final String sField = _aList[i]; - if (listContains(m_aGroupNames, sField) == true) + if (listContains(m_aGroupNames, sField)) { continue; } @@ -662,7 +661,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter try { final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText"); - final XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText); + final XFixedText xFixedText = UnoRuntime.queryInterface(XFixedText.class, aFixedText); int nHeight = LayoutConstants.LabelHeight; // default height of label is fixed. @@ -722,8 +721,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter if (_sName.startsWith("field:[")) { int nCloseBrace = _sName.lastIndexOf("]"); - final String sName = _sName.substring(7, nCloseBrace).trim(); - return sName; + return _sName.substring(7, nCloseBrace).trim(); } return _sName; } @@ -775,7 +773,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } _aRect.Height = nHeight; - final XReportControlModel xReportControlModel = (XReportControlModel) UnoRuntime.queryInterface(XReportControlModel.class, aField); + final XReportControlModel xReportControlModel = UnoRuntime.queryInterface(XReportControlModel.class, aField); if (xReportControlModel != null) { // #i86907# not documented right in idl description. @@ -802,7 +800,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter || nType == DataType.LONGVARBINARY) { // aField = getMSFofReportDefinition().createInstance("com.sun.star.report.ImageControl"); - final XImageControl xImageControl = (XImageControl) UnoRuntime.queryInterface(XImageControl.class, xReportControlModel); + final XImageControl xImageControl = UnoRuntime.queryInterface(XImageControl.class, xReportControlModel); if (xImageControl != null) { // xImageControl.setScaleImage(true); @@ -828,11 +826,11 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter // spezial case rpt:now() (default date format) if (_sFormattedfield.equals("rpt:now()")) { - final XFormattedField xFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, xReportControlModel); + final XFormattedField xFormattedField = UnoRuntime.queryInterface(XFormattedField.class, xReportControlModel); XNumberFormatsSupplier x = xFormattedField.getFormatsSupplier(); XNumberFormats xFormats = x.getNumberFormats(); - XNumberFormatTypes x3 = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats); + XNumberFormatTypes x3 = UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats); Locale.getDefault(); com.sun.star.lang.Locale aLocale = new com.sun.star.lang.Locale(); aLocale.Country = Locale.getDefault().getCountry(); @@ -869,8 +867,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter { if (m_xMSF == null) { - final XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, getReportDefinition()); - m_xMSF = xMSF; + m_xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, getReportDefinition()); } return m_xMSF; } @@ -893,7 +890,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter try { final Object aFixedLine = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedLine"); - final XFixedLine xFixedLine = (XFixedLine) UnoRuntime.queryInterface(XFixedLine.class, aFixedLine); + final XFixedLine xFixedLine = UnoRuntime.queryInterface(XFixedLine.class, aFixedLine); xFixedLine.setOrientation(_nOrientation); // TODO: line width is fixed @@ -1135,7 +1132,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter // XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface(XControlContainer.class, aControlContainer); final Object aFixedTextModel = getGlobalMSF().createInstance("com.sun.star.awt.UnoControlFixedTextModel"); - final XControlModel xFixedTextModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel); + final XControlModel xFixedTextModel = UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel); final PropertySetHelper aPropertySetHelper = new PropertySetHelper(xFixedTextModel); // aPropertySetHelper.showProperties(); @@ -1145,34 +1142,34 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter // XServiceInfo xServiceInfo2 = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, aUnoCtrlFixedText); // String[] sServices2 = xServiceInfo2.getSupportedServiceNames(); - final XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, aUnoCtrlFixedText); + final XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, aUnoCtrlFixedText); xWindow.setVisible(false); - final XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, aUnoCtrlFixedText); + final XControl xControl = UnoRuntime.queryInterface(XControl.class, aUnoCtrlFixedText); xControl.setModel(xFixedTextModel); - final com.sun.star.awt.XFixedText xFixedText = (com.sun.star.awt.XFixedText) UnoRuntime.queryInterface(com.sun.star.awt.XFixedText.class, aUnoCtrlFixedText); + final com.sun.star.awt.XFixedText xFixedText = UnoRuntime.queryInterface(com.sun.star.awt.XFixedText.class, aUnoCtrlFixedText); xFixedText.setText(_sText); - final XLayoutConstrains xLayoutConstraints = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, aUnoCtrlFixedText); + final XLayoutConstrains xLayoutConstraints = UnoRuntime.queryInterface(XLayoutConstrains.class, aUnoCtrlFixedText); final Size aSizeInPixel = xLayoutConstraints.getPreferredSize(); - final XWindowPeer xPeerOfReportDefinition = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, getReportDefinition().getCurrentController().getFrame().getComponentWindow()); + final XWindowPeer xPeerOfReportDefinition = UnoRuntime.queryInterface(XWindowPeer.class, getReportDefinition().getCurrentController().getFrame().getComponentWindow()); xControl.createPeer(null, xPeerOfReportDefinition); final XWindowPeer x = xControl.getPeer(); - final XUnitConversion xConversion = (XUnitConversion) UnoRuntime.queryInterface(XUnitConversion.class, x); + final XUnitConversion xConversion = UnoRuntime.queryInterface(XUnitConversion.class, x); aSizeMM_100TH = xConversion.convertSizeToLogic(aSizeInPixel, com.sun.star.util.MeasureUnit.MM_100TH); // xToolkit.createScreenCompatibleDevice(_nWidth, _nWidth). // XWindow x = getReportDefinition().getCurrentController().getFrame().getContainerWindow(); // Object aObj = _xSection.getParent(); // we don't need the created objects any longer - final XComponent xFixedTextDeleter = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFixedText); + final XComponent xFixedTextDeleter = UnoRuntime.queryInterface(XComponent.class, xFixedText); xFixedTextDeleter.dispose(); - final XComponent xFixedTextModelDeleter = (XComponent) UnoRuntime.queryInterface(XComponent.class, aFixedTextModel); + final XComponent xFixedTextModelDeleter = UnoRuntime.queryInterface(XComponent.class, aFixedTextModel); xFixedTextModelDeleter.dispose(); } catch (Exception e) @@ -1215,8 +1212,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter */ private void copyProperties(Object _aFrom, Object _aTo) { - XPropertySet xFrom = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aFrom); - XPropertySet xTo = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aTo); + XPropertySet xFrom = UnoRuntime.queryInterface(XPropertySet.class, _aFrom); + XPropertySet xTo = UnoRuntime.queryInterface(XPropertySet.class, _aTo); XPropertySetInfo xForeignPropInfo = xFrom.getPropertySetInfo(); @@ -1258,7 +1255,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter while (xEnum.hasMoreElements()) { Object aEnumObj = xEnum.nextElement(); - XReportComponent aComponent = (XReportComponent) UnoRuntime.queryInterface(XReportComponent.class, aEnumObj); + XReportComponent aComponent = UnoRuntime.queryInterface(XReportComponent.class, aEnumObj); // XCloneable aClone = (XCloneable)UnoRuntime.queryInterface(XCloneable.class, aEnumObj); if (aComponent != null) @@ -1266,7 +1263,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter Object aClone = aComponent.createClone(); if (aClone != null) { - XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aClone); + XShape aShape = UnoRuntime.queryInterface(XShape.class, aClone); // normally 'createClone' will create a real clone of the component, // but there seems some problems, we have to controll. @@ -1311,8 +1308,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter { Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } - return; - } + } else { // we won't a page header @@ -1469,10 +1465,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter aRect.Y += nLineHeight; aRect.Y += LayoutConstants.LabelHeight; - final int nWidth = nUsablePageWidth; aRect.X = getLeftPageIndent(); - aRect = insertFormattedField(xSection, "rpt:" + sNoFirstUnusedQuotes, aRect, nWidth, null, (short) com.sun.star.awt.TextAlign.CENTER); + aRect = insertFormattedField(xSection, "rpt:" + sNoFirstUnusedQuotes, aRect, nUsablePageWidth, null, (short) com.sun.star.awt.TextAlign.CENTER); aRect.Y += LayoutConstants.FormattedFieldHeight + LayoutConstants.LineHeight; xSection.setHeight(aRect.Y); @@ -1598,7 +1593,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter if (m_aFixedTextHelper == null) { final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText"); - m_aFixedTextHelper = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText); + m_aFixedTextHelper = UnoRuntime.queryInterface(XFixedText.class, aFixedText); } m_aFixedTextHelper.setLabel(_sLabel); diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java index 8df754795e63..6830d56b5107 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java @@ -44,8 +44,7 @@ public class SectionEmptyObject extends SectionObject public static SectionObject create() { - SectionEmptyObject a = new SectionEmptyObject(); - return a; + return new SectionEmptyObject(); } public FontDescriptor getFontDescriptor() diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java index ae3766fd3391..9780a1350681 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java @@ -48,8 +48,7 @@ public class SectionLabel extends SectionObject public static SectionObject create(XFixedText _aFixedText) { - final SectionLabel a = new SectionLabel(_aFixedText); - return a; + return new SectionLabel(_aFixedText); } /** diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java index 2a11fcd56f04..fc17ba0ab5aa 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java @@ -46,8 +46,7 @@ public class SectionTextField extends SectionObject public static SectionObject create(XFormattedField _aFormattedField) { - SectionTextField a = new SectionTextField(_aFormattedField); - return a; + return new SectionTextField(_aFormattedField); } public FontDescriptor getFontDescriptor() diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java index 51edc3e3ac13..c2d85fb58e61 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java @@ -55,8 +55,7 @@ public class Tabular extends ReportBuilderLayouter public String getLocalizedName() { - String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 80); - return sLocalizedName; + return getResource().getResText(UIConsts.RID_REPORT + 80); } protected void insertDetailFields() diff --git a/wizards/com/sun/star/wizards/table/CGCategory.java b/wizards/com/sun/star/wizards/table/CGCategory.java index ea74b33f09ad..228891c12927 100644 --- a/wizards/com/sun/star/wizards/table/CGCategory.java +++ b/wizards/com/sun/star/wizards/table/CGCategory.java @@ -75,9 +75,8 @@ public class CGCategory { try { - xNameAccessTablesNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNameAccessCurBusinessNode.getByName("Tables")); - String[] sTableNames = Configuration.getNodeDisplayNames(xNameAccessTablesNode); - return sTableNames; + xNameAccessTablesNode = UnoRuntime.queryInterface(XNameAccess.class, xNameAccessCurBusinessNode.getByName("Tables")); + return Configuration.getNodeDisplayNames(xNameAccessTablesNode); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java index 21174d59ff74..e3c5c690fad3 100644 --- a/wizards/com/sun/star/wizards/table/CallTableWizard.java +++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java @@ -167,7 +167,7 @@ public class CallTableWizard try { - byteReturn = new String(PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } catch (Exception exception) { diff --git a/wizards/com/sun/star/wizards/table/FieldDescription.java b/wizards/com/sun/star/wizards/table/FieldDescription.java index 70fa37f18a2f..95e556f920b7 100644 --- a/wizards/com/sun/star/wizards/table/FieldDescription.java +++ b/wizards/com/sun/star/wizards/table/FieldDescription.java @@ -132,7 +132,7 @@ public class FieldDescription { try { - xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xNameAccessFieldNode); + xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _xNameAccessFieldNode); // Integer Index = (Integer) xPropertySet.getPropertyValue("Index"); if (propertyexists(PropertyNames.PROPERTY_NAME)) { @@ -140,21 +140,21 @@ public class FieldDescription } if (propertyexists("Type")) { - aPropertyValues.addElement(Properties.createProperty("Type", (Integer) xPropertySet.getPropertyValue("Type"))); + aPropertyValues.addElement(Properties.createProperty("Type", xPropertySet.getPropertyValue("Type"))); } if (propertyexists("Scale")) { - aPropertyValues.addElement(Properties.createProperty("Scale", (Integer) xPropertySet.getPropertyValue("Scale"))); + aPropertyValues.addElement(Properties.createProperty("Scale", xPropertySet.getPropertyValue("Scale"))); // Scale = } if (propertyexists("Precision")) { - aPropertyValues.addElement(Properties.createProperty("Precision", (Integer) xPropertySet.getPropertyValue("Precision"))); + aPropertyValues.addElement(Properties.createProperty("Precision", xPropertySet.getPropertyValue("Precision"))); // Precision = (Integer) xPropertySet.getPropertyValue("Precision"); } if (propertyexists("DefaultValue")) { - aPropertyValues.addElement(Properties.createProperty("DefaultValue", (Boolean) xPropertySet.getPropertyValue("DefaultValue")));// DefaultValue = (Boolean) xPropertySet.getPropertyValue("DefaultValue"); + aPropertyValues.addElement(Properties.createProperty("DefaultValue", xPropertySet.getPropertyValue("DefaultValue")));// DefaultValue = (Boolean) xPropertySet.getPropertyValue("DefaultValue"); //Type = 4; // TODO wo ist der Fehler?(Integer) xPropertySet.getPropertyValue("Type"); } } diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java index dbf2aeb730b7..d19a6e0eb21d 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -233,9 +233,9 @@ public class FieldFormatter implements XItemListener benableShiftUpButton = (iselpos != 0); benableShiftDownButton = (iselpos != ilistcount - 1); } - Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftUp), PropertyNames.PROPERTY_ENABLED, new Boolean(benableShiftUpButton)); - Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftDown), PropertyNames.PROPERTY_ENABLED, new Boolean(benableShiftDownButton)); - Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(blistispopulated)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftUp), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableShiftUpButton)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftDown), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableShiftDownButton)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(blistispopulated)); CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, blistispopulated); } @@ -298,10 +298,10 @@ public class FieldFormatter implements XItemListener else { Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", PropertyNames.EMPTY_STRING); - Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(benable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, benable); } - Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(benable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); CurUnoDialog.setControlVisible("oColumnDescriptor", benable); CurUnoDialog.repaintDialogStep(); } @@ -379,7 +379,7 @@ public class FieldFormatter implements XItemListener public boolean updateColumnofColumnDescriptor() { Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column"); - XPropertySet xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn); + XPropertySet xColPropertySet = UnoRuntime.queryInterface(XPropertySet.class, oColumn); if (xColPropertySet != null) { curTableDescriptor.modifyColumn(txtfieldname.getText(), xColPropertySet); @@ -401,8 +401,7 @@ public class FieldFormatter implements XItemListener public XPropertySet clonePropertySet(XPropertySet _xPropertySet) { - XPropertySet xlocpropertyset = null; - return xlocpropertyset; + return null; } public void itemStateChanged(ItemEvent arg0) diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index 34c880c3bab5..6246b3ef037f 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -260,16 +260,16 @@ public class PrimaryKeyHandler implements XFieldSelectionListener public void togglePrimeKeyFields() { boolean bdoEnable = (this.chkcreatePrimaryKey.getState() == 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, new Boolean(bAutoPrimaryKeysupportsAutoIncrmentation && bdoEnable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(optUseExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(optUseSeveral), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bAutoPrimaryKeysupportsAutoIncrmentation && bdoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optUseExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optUseSeveral), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable)); //toggle subcontrols of the radiobuttons... toggleAutomaticAutoValueCheckBox(); boolean benableSinglePrimekeyControls = bdoEnable && optUseExisting.getState(); toggleSinglePrimeKeyFields(benableSinglePrimekeyControls); boolean benableSeveralPrimekeyControls = bdoEnable && optUseSeveral.getState(); - curPrimaryKeySelection.toggleListboxControls(new Boolean(benableSeveralPrimekeyControls)); + curPrimaryKeySelection.toggleListboxControls(Boolean.valueOf(benableSeveralPrimekeyControls)); // toggle the following steps of the dialog... if (!bdoEnable) { @@ -354,7 +354,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener String selfieldname = lstSinglePrimeKey.getSelectedItem(); boolean bdoenable = isAutoIncrementatable(selfieldname); CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, lstSinglePrimeKey.getSelectedItemPos() != -1); - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable)); XPropertySet xColPropertySet = curTableDescriptor.getByName(selfieldname); boolean bIsAutoIncremented = ((Boolean) xColPropertySet.getPropertyValue("IsAutoIncrement")).booleanValue(); if (bIsAutoIncremented) @@ -378,7 +378,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener { boolean bisAutomaticMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED)); boolean bdoenable = bAutoPrimaryKeysupportsAutoIncrmentation && optAddAutomatically.getState() && bisAutomaticMode; - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable)); } catch (IllegalArgumentException e) { @@ -388,17 +388,17 @@ public class PrimaryKeyHandler implements XFieldSelectionListener private void toggleSinglePrimeKeyFields(boolean _bdoenable) { - Helper.setUnoPropertyValue(UnoDialog.getModel(lblPrimeFieldName), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(lblPrimeFieldName), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable)); boolean bdoenableAutoValueCheckBox = (isAutoIncrementatable(lstSinglePrimeKey.getSelectedItem()) && _bdoenable); - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenableAutoValueCheckBox)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenableAutoValueCheckBox)); } private void toggleSeveralPrimeKeyFields() { boolean bdoEnable = (this.optUseSeveral.getState()); - curPrimaryKeySelection.toggleListboxControls(new Boolean(bdoEnable)); + curPrimaryKeySelection.toggleListboxControls(Boolean.valueOf(bdoEnable)); } public String[] getPrimaryKeyFields(TableDescriptor _curtabledescriptor) diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 8c2b52cf5244..3ee366eb761a 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -26,6 +26,7 @@ ************************************************************************/ package com.sun.star.wizards.table; +import java.util.ArrayList; import java.util.Vector; import com.sun.star.awt.ItemEvent; @@ -207,8 +208,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X public String[] getSelectedFieldNames() { String[] displayfieldnames = super.getSelectedFieldNames(); - Vector<String> afieldnameVector = new Vector<String>(); - int a = 0; + ArrayList<String> afieldnameVector = new ArrayList<String>(); for (int i = 0; i < displayfieldnames.length; i++) { try @@ -216,8 +216,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(displayfieldnames[i]); if (ofielddescription != null) { - afieldnameVector.addElement(ofielddescription.getName()); - a++; + afieldnameVector.add(ofielddescription.getName()); } } catch (RuntimeException e) @@ -225,9 +224,8 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X e.printStackTrace(System.out); } } - String[] fieldnames = new String[a]; - afieldnameVector.toArray(fieldnames); - return fieldnames; + String[] fieldnames = new String[afieldnameVector.size()]; + return afieldnameVector.toArray(fieldnames); } public boolean iscompleted() diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index deb38a044f76..d5f4c706b174 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -88,7 +88,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, drawNaviBar(); fielditems = new Hashtable(); //TODO if reportResouces cannot be gotten dispose officedocument - if (getTableResources() == true) + if (getTableResources()) { setRightPaneHeaders(m_oResource, UIConsts.RID_TABLE + 8, 4); } diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java index 732dcf777acd..6e873c049167 100644 --- a/wizards/com/sun/star/wizards/text/TextDocument.java +++ b/wizards/com/sun/star/wizards/text/TextDocument.java @@ -112,7 +112,7 @@ public class TextDocument xFrame = OfficeDocument.createNewFrame(xMSF, listener); xTextDocument = loadAsPreview(_sPreviewURL, true); - xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument); + xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument); if (bShowStatusIndicator) { @@ -127,10 +127,10 @@ public class TextDocument this.xMSF = xMSF; XDesktop xDesktop = Desktop.getDesktop(xMSF); - XFramesSupplier xFrameSupplier = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop); + XFramesSupplier xFrameSupplier = UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop); xFrame = xFrameSupplier.getActiveFrame(); - xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel()); - xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent); + xComponent = UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel()); + xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); if (bShowStatusIndicator) { @@ -153,7 +153,7 @@ public class TextDocument { m_identifier = _identifier; } - }; + } // creates an instance of TextDocument containing a blank text document public TextDocument(XMultiServiceFactory xMSF, ModuleIdentifier _moduleIdentifier, boolean bShowStatusIndicator) @@ -163,19 +163,19 @@ public class TextDocument try { // create the empty document, and set its module identifier - xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, + xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xMSF.createInstance("com.sun.star.text.TextDocument")); - XLoadable xLoadable = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, xTextDocument); + XLoadable xLoadable = UnoRuntime.queryInterface(XLoadable.class, xTextDocument); xLoadable.initNew(); - XModule xModule = (XModule) UnoRuntime.queryInterface(XModule.class, + XModule xModule = UnoRuntime.queryInterface(XModule.class, xTextDocument); xModule.setIdentifier(_moduleIdentifier.getIdentifier()); // load the document into a blank frame XDesktop xDesktop = Desktop.getDesktop(xMSF); - XComponentLoader xLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xDesktop); + XComponentLoader xLoader = UnoRuntime.queryInterface(XComponentLoader.class, xDesktop); PropertyValue[] loadArgs = new PropertyValue[] { new PropertyValue("Model", -1, xTextDocument, com.sun.star.beans.PropertyState.DIRECT_VALUE) @@ -184,7 +184,7 @@ public class TextDocument // remember some things for later usage xFrame = xTextDocument.getCurrentController().getFrame(); - xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument); + xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument); } catch (Exception e) { @@ -204,21 +204,21 @@ public class TextDocument { this.xMSF = xMSF; xFrame = _textDocument.getCurrentController().getFrame(); - xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _textDocument); - xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent); + xComponent = UnoRuntime.queryInterface(XComponent.class, _textDocument); + xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); //PosSize = xFrame.getComponentWindow().getPosSize(); if (bshowStatusIndicator) { - XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame); + XStatusIndicatorFactory xStatusIndicatorFactory = UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame); xProgressBar = xStatusIndicatorFactory.createStatusIndicator(); xProgressBar.start(PropertyNames.EMPTY_STRING, 100); xProgressBar.setValue(5); } - xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow()); - xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); - xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument); + xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow()); + xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); + xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument); - XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); + XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); m_xDocProps = xDocPropsSuppl.getDocumentProperties(); CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale"); xText = xTextDocument.getText(); @@ -226,19 +226,19 @@ public class TextDocument private void init() { - xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow()); - xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); - xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument); - XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); + xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow()); + xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); + xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument); + XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); m_xDocProps = xDocPropsSuppl.getDocumentProperties(); CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale"); - xStorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); + xStorable = UnoRuntime.queryInterface(XStorable.class, xTextDocument); xText = xTextDocument.getText(); } private void showStatusIndicator() { - XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame); + XStatusIndicatorFactory xStatusIndicatorFactory = UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame); xProgressBar = xStatusIndicatorFactory.createStatusIndicator(); xProgressBar.start(PropertyNames.EMPTY_STRING, 100); xProgressBar.setValue(5); @@ -263,7 +263,7 @@ public class TextDocument { try { - XModifiable xModi = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xTextDocument); + XModifiable xModi = UnoRuntime.queryInterface(XModifiable.class, xTextDocument); xModi.setModified(false); } catch (PropertyVetoException e1) @@ -274,7 +274,7 @@ public class TextDocument Object oDoc = OfficeDocument.load(xFrame, sDefaultTemplate, "_self", loadValues); xTextDocument = (com.sun.star.text.XTextDocument) oDoc; DocSize = getPageSize(); - xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); + xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); ViewHandler myViewHandler = new ViewHandler(xMSFDoc, xTextDocument); try @@ -297,12 +297,12 @@ public class TextDocument { try { - XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); + XStyleFamiliesSupplier xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); com.sun.star.container.XNameAccess xNameAccess = null; xNameAccess = xStyleFamiliesSupplier.getStyleFamilies(); com.sun.star.container.XNameContainer xPageStyleCollection = null; - xPageStyleCollection = (com.sun.star.container.XNameContainer) UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles")); - XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName("First Page")); + xPageStyleCollection = UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles")); + XStyle xPageStyle = UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName("First Page")); return (Size) Helper.getUnoPropertyValue(xPageStyle, "Size"); } @@ -322,23 +322,22 @@ public class TextDocument xFrame = OfficeDocument.createNewFrame(xMSF, listener); Object oDoc = OfficeDocument.load(xFrame, URL, "_self", xArgs); xTextDocument = (XTextDocument) oDoc; - xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument); + xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument); XWindow xWindow = xFrame.getComponentWindow(); - xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow()); - xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); - xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument); + xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow()); + xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); + xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument); - XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); + XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); m_xDocProps = xDocPropsSuppl.getDocumentProperties(); CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale"); } public static XTextCursor createTextCursor(Object oCursorContainer) { - XSimpleText xText = (XSimpleText) UnoRuntime.queryInterface(XSimpleText.class, oCursorContainer); - XTextCursor xTextCursor = xText.createTextCursor(); - return xTextCursor; + XSimpleText xText = UnoRuntime.queryInterface(XSimpleText.class, oCursorContainer); + return xText.createTextCursor(); } // Todo: This method is unsecure because the last index is not necessarily the last section @@ -357,7 +356,7 @@ public class TextDocument xTextCursor.gotoStart(false); com.sun.star.wizards.common.Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page"); xTextCursor.setString(ScaleString); - XTextViewCursorSupplier xViewCursor = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController()); + XTextViewCursorSupplier xViewCursor = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController()); XTextViewCursor xTextViewCursor = xViewCursor.getViewCursor(); xTextViewCursor.gotoStart(false); int iFirstPos = xTextViewCursor.getPosition().X; @@ -373,7 +372,7 @@ public class TextDocument public void unlockallControllers() { - while (xTextDocument.hasControllersLocked() == true) + while (xTextDocument.hasControllersLocked()) { xTextDocument.unlockControllers(); } @@ -381,7 +380,7 @@ public class TextDocument public void refresh() { - XRefreshable xRefreshable = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, xTextDocument); + XRefreshable xRefreshable = UnoRuntime.queryInterface(XRefreshable.class, xTextDocument); xRefreshable.refresh(); } @@ -397,10 +396,10 @@ public class TextDocument try { Object uD = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.UserProfile/Data", false); - XNameAccess xNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, uD); + XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, uD); Object gn = xNA.getByName("givenname"); Object sn = xNA.getByName("sn"); - String fullname = (String) gn + PropertyNames.SPACE + (String) sn; + String fullname = gn + PropertyNames.SPACE + sn; Calendar cal = new GregorianCalendar(); int year = cal.get(Calendar.YEAR); @@ -414,7 +413,7 @@ public class TextDocument int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY); String myDate = du.format(ff, currentDate); - XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); + XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); XDocumentProperties xDocProps2 = xDocPropsSuppl.getDocumentProperties(); xDocProps2.setAuthor(fullname); xDocProps2.setModifiedBy(fullname); @@ -450,7 +449,7 @@ public class TextDocument { try { - XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextContent); + XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextContent); xText.removeTextContent(xTextContent); return true; } @@ -470,11 +469,11 @@ public class TextDocument */ public static int getPageCount(Object model) { - XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, model); + XModel xModel = UnoRuntime.queryInterface(XModel.class, model); XController xController = xModel.getCurrentController(); - XTextViewCursorSupplier xTextVCS = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController); + XTextViewCursorSupplier xTextVCS = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController); XTextViewCursor xTextVC = xTextVCS.getViewCursor(); - XPageCursor xPC = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class, xTextVC); + XPageCursor xPC = UnoRuntime.queryInterface(XPageCursor.class, xTextVC); xPC.jumpToLastPage(); return xPC.getPage(); } diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java index 8236ddb86d3a..78de28073f37 100644 --- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java +++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java @@ -65,12 +65,12 @@ public class TextFieldHandler public TextFieldHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument) { this.xMSFDoc = xMSF; - xTextFieldsSupplier = (XTextFieldsSupplier) UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument); + xTextFieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument); } public void refreshTextFields() { - XRefreshable xUp = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, xTextFieldsSupplier.getTextFields()); + XRefreshable xUp = UnoRuntime.queryInterface(XRefreshable.class, xTextFieldsSupplier.getTextFields()); xUp.refresh(); } @@ -86,10 +86,9 @@ public class TextFieldHandler } else { - XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField); + XDependentTextField xDependent = UnoRuntime.queryInterface(XDependentTextField.class, oTextField); XPropertySet xMaster = xDependent.getTextFieldMaster(); - String UserFieldContent = (String) xMaster.getPropertyValue("Content"); - return UserFieldContent; + return (String) xMaster.getPropertyValue("Content"); } } catch (com.sun.star.uno.Exception exception) @@ -104,12 +103,12 @@ public class TextFieldHandler try { XInterface xField = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextField.User"); - XDependentTextField xDepField = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, xField); - XTextContent xFieldContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xField); + XDependentTextField xDepField = UnoRuntime.queryInterface(XDependentTextField.class, xField); + XTextContent xFieldContent = UnoRuntime.queryInterface(XTextContent.class, xField); if (xTextFieldsSupplier.getTextFieldMasters().hasByName("com.sun.star.text.FieldMaster.User." + FieldName)) { Object oMaster = xTextFieldsSupplier.getTextFieldMasters().getByName("com.sun.star.text.FieldMaster.User." + FieldName); - XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oMaster); + XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, oMaster); xComponent.dispose(); } XPropertySet xPSet = createUserField(FieldName, FieldTitle); @@ -138,7 +137,7 @@ public class TextFieldHandler public XPropertySet createUserField(String FieldName, String FieldTitle) throws com.sun.star.uno.Exception { Object oMaster = xMSFDoc.createInstance("com.sun.star.text.FieldMaster.User"); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oMaster); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oMaster); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, FieldName); xPSet.setPropertyValue("Content", FieldTitle); @@ -160,7 +159,7 @@ public class TextFieldHandler while (xEnum.hasMoreElements()) { Object oTextField = xEnum.nextElement(); - XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField); + XDependentTextField xDependent = UnoRuntime.queryInterface(XDependentTextField.class, oTextField); XPropertySet xPropertySet = xDependent.getTextFieldMaster(); if (xPropertySet.getPropertySetInfo().hasPropertyByName(_PropertyName)) { @@ -235,16 +234,16 @@ public class TextFieldHandler while (xEnum.hasMoreElements()) { Object oTextField = xEnum.nextElement(); - XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField); + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, oTextField); if (xSI.supportsService("com.sun.star.text.TextField.ExtendedUser")) { - XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField); + XUpdatable xUp = UnoRuntime.queryInterface(XUpdatable.class, oTextField); xUp.update(); } if (xSI.supportsService("com.sun.star.text.TextField.User")) { - XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField); + XUpdatable xUp = UnoRuntime.queryInterface(XUpdatable.class, oTextField); xUp.update(); } } @@ -270,11 +269,11 @@ public class TextFieldHandler while (xEnum.hasMoreElements()) { Object oTextField = xEnum.nextElement(); - XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField); + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, oTextField); if (xSI.supportsService("com.sun.star.text.TextField.DateTime")) { - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTextField); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oTextField); xPSet.setPropertyValue("IsFixed", Boolean.FALSE); xPSet.setPropertyValue("DateTimeValue", dt); } @@ -294,11 +293,11 @@ public class TextFieldHandler while (xEnum.hasMoreElements()) { Object oTextField = xEnum.nextElement(); - XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField); + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, oTextField); if (xSI.supportsService("com.sun.star.text.TextField.DateTime")) { - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTextField); - xPSet.setPropertyValue("IsFixed", new Boolean(_bSetFixed)); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oTextField); + xPSet.setPropertyValue("IsFixed", Boolean.valueOf(_bSetFixed)); } } } diff --git a/wizards/com/sun/star/wizards/text/TextFrameHandler.java b/wizards/com/sun/star/wizards/text/TextFrameHandler.java index 562444a1ad84..babaf21120e3 100644 --- a/wizards/com/sun/star/wizards/text/TextFrameHandler.java +++ b/wizards/com/sun/star/wizards/text/TextFrameHandler.java @@ -39,12 +39,11 @@ public class TextFrameHandler public static XTextFrame getFrameByName(String sFrameName, XTextDocument xTD) throws NoSuchElementException, WrappedTargetException { - XTextFramesSupplier xFrameSupplier = (XTextFramesSupplier) UnoRuntime.queryInterface(XTextFramesSupplier.class, xTD); + XTextFramesSupplier xFrameSupplier = UnoRuntime.queryInterface(XTextFramesSupplier.class, xTD); if (xFrameSupplier.getTextFrames().hasByName(sFrameName)) { Object oTextFrame = xFrameSupplier.getTextFrames().getByName(sFrameName); - XTextFrame xTextFrame = (XTextFrame) UnoRuntime.queryInterface(XTextFrame.class, oTextFrame); - return xTextFrame; + return UnoRuntime.queryInterface(XTextFrame.class, oTextFrame); } return null; } diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.java b/wizards/com/sun/star/wizards/text/TextSectionHandler.java index b948b2a60d4b..b20d016f8ee8 100644 --- a/wizards/com/sun/star/wizards/text/TextSectionHandler.java +++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java @@ -59,7 +59,7 @@ public class TextSectionHandler this.xMSFDoc = xMSF; this.xTextDocument = xTextDocument; xText = xTextDocument.getText(); - xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDocument); + xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDocument); } public void removeTextSectionbyName(String SectionName) @@ -67,7 +67,7 @@ public class TextSectionHandler try { XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections(); - if (xAllTextSections.hasByName(SectionName) == true) + if (xAllTextSections.hasByName(SectionName)) { Object oTextSection = xTextSectionsSupplier.getTextSections().getByName(SectionName); removeTextSection(oTextSection); @@ -89,7 +89,7 @@ public class TextSectionHandler { try { - XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections()); + XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections()); Object oTextSection = xAllTextSections.getByIndex(xAllTextSections.getCount() - 1); removeTextSection(oTextSection); } @@ -103,7 +103,7 @@ public class TextSectionHandler { try { - XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, _oTextSection); + XTextContent xTextContentTextSection = UnoRuntime.queryInterface(XTextContent.class, _oTextSection); xText.removeTextContent(xTextContentTextSection); } catch (Exception exception) @@ -116,12 +116,12 @@ public class TextSectionHandler { try { - XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections()); + XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections()); int TextSectionCount = xAllTextSections.getCount(); for (int i = TextSectionCount - 1; i >= 0; i--) { - XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i)); - XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection); + XTextContent xTextContentTextSection = UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i)); + XPropertySet xTextSectionPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection); boolean bRemoveTextSection = (!AnyConverter.toBoolean(xTextSectionPropertySet.getPropertyValue("IsVisible"))); if (bRemoveTextSection) { @@ -139,12 +139,12 @@ public class TextSectionHandler { try { - XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections()); + XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections()); int TextSectionCount = xAllTextSections.getCount(); for (int i = TextSectionCount - 1; i >= 0; i--) { - XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i)); - XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection); + XTextContent xTextContentTextSection = UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i)); + XPropertySet xTextSectionPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection); xText.removeTextContent(xTextContentTextSection); } } @@ -159,7 +159,7 @@ public class TextSectionHandler try { Object oTextSection; - XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections()); + XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections()); int iSectionCount = xAllTextSections.getCount(); SectionFileLink oSectionLink = new SectionFileLink(); oSectionLink.FileURL = PropertyNames.EMPTY_STRING; @@ -218,7 +218,7 @@ public class TextSectionHandler { oSectionLink, SectionName }); - XNamed xSectionName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextSection); + XNamed xSectionName = UnoRuntime.queryInterface(XNamed.class, oTextSection); String NewSectionName = xSectionName.getName(); if (NewSectionName.compareTo(SectionName) != 0) { @@ -252,14 +252,14 @@ public class TextSectionHandler try { Object xTextSection; - if (xTextSectionsSupplier.getTextSections().hasByName(sectionName) == true) + if (xTextSectionsSupplier.getTextSections().hasByName(sectionName)) { xTextSection = xTextSectionsSupplier.getTextSections().getByName(sectionName); } else { xTextSection = xMSFDoc.createInstance("com.sun.star.text.TextSection"); - XTextContent xTextContentSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection); + XTextContent xTextContentSection = UnoRuntime.queryInterface(XTextContent.class, xTextSection); position.getText().insertTextContent(position, xTextContentSection, false); } linkSectiontoTemplate(xTextSection, templateName, sectionName); diff --git a/wizards/com/sun/star/wizards/text/TextStyleHandler.java b/wizards/com/sun/star/wizards/text/TextStyleHandler.java index 82da36f16019..e9f6cd737e7d 100644 --- a/wizards/com/sun/star/wizards/text/TextStyleHandler.java +++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java @@ -50,21 +50,21 @@ public class TextStyleHandler { this.xMSFDoc = xMSF; this.xTextDocument = xTextDocument; - xStyleFamiliesSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); + xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); } public void loadStyleTemplates(String sTemplateUrl, String OptionString) { try { - XStyleLoader xStyleLoader = (XStyleLoader) UnoRuntime.queryInterface(XStyleLoader.class, xStyleFamiliesSupplier.getStyleFamilies()); + XStyleLoader xStyleLoader = UnoRuntime.queryInterface(XStyleLoader.class, xStyleFamiliesSupplier.getStyleFamilies()); com.sun.star.beans.PropertyValue[] StyleOptions = xStyleLoader.getStyleLoaderOptions(); String CurOptionName = PropertyNames.EMPTY_STRING; int PropCount = StyleOptions.length; for (int i = 0; i < PropCount; i++) { CurOptionName = StyleOptions[i].Name; - StyleOptions[i].Value = new Boolean((CurOptionName.compareTo(OptionString) == 0) || (CurOptionName.compareTo("OverwriteStyles") == 0)); + StyleOptions[i].Value = Boolean.valueOf((CurOptionName.compareTo(OptionString) == 0) || (CurOptionName.compareTo("OverwriteStyles") == 0)); } xStyleLoader.loadStylesFromURL(sTemplateUrl, StyleOptions); } @@ -80,10 +80,10 @@ public class TextStyleHandler { XPropertySet xPropertySet = null; Object oStyleFamily = xStyleFamiliesSupplier.getStyleFamilies().getByName(sStyleFamily); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oStyleFamily); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oStyleFamily); if (xNameAccess.hasByName(sStyleName)) { - xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess.getByName(sStyleName)); + xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xNameAccess.getByName(sStyleName)); } return xPropertySet; } @@ -98,7 +98,7 @@ public class TextStyleHandler { try { - _xPropPageStyle.setPropertyValue("IsLandscape", new Boolean(_bIsLandscape)); + _xPropPageStyle.setPropertyValue("IsLandscape", Boolean.valueOf(_bIsLandscape)); Size aPageSize = (Size) AnyConverter.toObject(Size.class, _xPropPageStyle.getPropertyValue("Size")); int nPageWidth = aPageSize.Width; int nPageHeight = aPageSize.Height; diff --git a/wizards/com/sun/star/wizards/text/TextTableHandler.java b/wizards/com/sun/star/wizards/text/TextTableHandler.java index d3646a7cfa37..ab7e46a62c0a 100644 --- a/wizards/com/sun/star/wizards/text/TextTableHandler.java +++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java @@ -69,9 +69,9 @@ public class TextTableHandler this.xMSFDoc = xMSF; this.xTextDocument = xTextDocument; xText = xTextDocument.getText(); - xTextTablesSupplier = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument); - xSimpleText = (XSimpleText) UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText()); - XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument); + xTextTablesSupplier = UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument); + xSimpleText = UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText()); + XNumberFormatsSupplier xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument); aCharLocale = (Locale) Helper.getUnoStructValue((Object) xTextDocument, "CharLocale"); oNumberFormatter = new NumberFormatter(xNumberFormatsSupplier, aCharLocale); } @@ -95,7 +95,7 @@ public class TextTableHandler if (xAllTextTables.hasByName(_sTableName)) { Object oTable = xAllTextTables.getByName(_sTableName); - xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable); + xTextTable = UnoRuntime.queryInterface(XTextTable.class, oTable); } } catch (Exception exception) @@ -109,11 +109,10 @@ public class TextTableHandler { try { - XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables()); + XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables()); int MaxIndex = xAllTextTables.getCount() - 1; Object oTable = xAllTextTables.getByIndex(MaxIndex); - XTextTable xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable); - return xTextTable; + return UnoRuntime.queryInterface(XTextTable.class, oTable); } catch (Exception exception) { @@ -127,7 +126,7 @@ public class TextTableHandler try { com.sun.star.uno.XInterface xTextTable = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextTable"); - XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextTable); + XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, xTextTable); if (xTextCursor == null) { xTextCursor = xTextDocument.getText().createTextCursor(); @@ -145,7 +144,7 @@ public class TextTableHandler { try { - XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables()); + XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables()); int TextTableCount = xAllTextTables.getCount(); for (int i = TextTableCount - 1; i >= 0; i--) { @@ -162,7 +161,7 @@ public class TextTableHandler { try { - XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables()); + XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables()); Object oTextTable = xAllTextTables.getByIndex(xAllTextTables.getCount() - 1); removeTextTable(oTextTable); } @@ -176,7 +175,7 @@ public class TextTableHandler { try { - XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTable); + XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, oTextTable); xTextDocument.getText().removeTextContent(xTextContentTable); } catch (Exception exception) @@ -190,7 +189,7 @@ public class TextTableHandler try { XNameAccess xAllTextTables = xTextTablesSupplier.getTextTables(); - if (xAllTextTables.hasByName(TableName) == true) + if (xAllTextTables.hasByName(TableName)) { removeTextTable(xAllTextTables.getByName(TableName)); } @@ -209,7 +208,7 @@ public class TextTableHandler if (xTextTableNames.hasByName(OldTableName)) { Object oTextTable = xTextTableNames.getByName(OldTableName); - XNamed xTextTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextTable); + XNamed xTextTableName = UnoRuntime.queryInterface(XNamed.class, oTextTable); xTextTableName.setName(NewTableName); } } @@ -236,10 +235,10 @@ public class TextTableHandler { XFrame xFrame = this.xTextDocument.getCurrentController().getFrame(); int ColCount = xTextTable.getColumns().getCount(); - XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable); + XCellRange xCellRange = UnoRuntime.queryInterface(XCellRange.class, xTextTable); XCellRange xLocCellRange = xCellRange.getCellRangeByPosition(0, 0, ColCount - 1, 1); short iHoriOrient = AnyConverter.toShort(Helper.getUnoPropertyValue(xTextTable, "HoriOrient")); - XSelectionSupplier xSelection = (XSelectionSupplier) UnoRuntime.queryInterface(XSelectionSupplier.class, xTextDocument.getCurrentController()); + XSelectionSupplier xSelection = UnoRuntime.queryInterface(XSelectionSupplier.class, xTextDocument.getCurrentController()); xSelection.select(xLocCellRange); Desktop.dispatchURL(_xMSF, ".Uno:DistributeColumns", xFrame); Desktop.dispatchURL(_xMSF, ".Uno:SetOptimalColumnWidth", xFrame); diff --git a/wizards/com/sun/star/wizards/text/ViewHandler.java b/wizards/com/sun/star/wizards/text/ViewHandler.java index e29ad10cfbb1..d234f26e2bfe 100644 --- a/wizards/com/sun/star/wizards/text/ViewHandler.java +++ b/wizards/com/sun/star/wizards/text/ViewHandler.java @@ -59,26 +59,26 @@ public class ViewHandler { this.xMSFDoc = xMSF; this.xTextDocument = xTextDocument; - xTextViewCursorSupplier = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController()); - xViewSettingsSupplier = (XViewSettingsSupplier) UnoRuntime.queryInterface(XViewSettingsSupplier.class, xTextDocument.getCurrentController()); - xStyleFamiliesSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); + xTextViewCursorSupplier = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController()); + xViewSettingsSupplier = UnoRuntime.queryInterface(XViewSettingsSupplier.class, xTextDocument.getCurrentController()); + xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument); } public void selectFirstPage(TextTableHandler oTextTableHandler) { try { - XPageCursor xPageCursor = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class, xTextViewCursorSupplier.getViewCursor()); - XTextCursor xViewTextCursor = (XTextCursor) UnoRuntime.queryInterface(XTextCursor.class, xPageCursor); + XPageCursor xPageCursor = UnoRuntime.queryInterface(XPageCursor.class, xTextViewCursorSupplier.getViewCursor()); + XTextCursor xViewTextCursor = UnoRuntime.queryInterface(XTextCursor.class, xPageCursor); xPageCursor.jumpToFirstPage(); xPageCursor.jumpToStartOfPage(); Helper.setUnoPropertyValue(xPageCursor, "PageDescName", "First Page"); Object oPageStyles = xStyleFamiliesSupplier.getStyleFamilies().getByName("PageStyles"); - XNameAccess xName = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oPageStyles); + XNameAccess xName = UnoRuntime.queryInterface(XNameAccess.class, oPageStyles); Object oPageStyle = xName.getByName("First Page"); - XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); - XTextContent xTextTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextTables.getByIndex(0)); - XTextRange xRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xTextTable.getAnchor().getText()); + XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); + XTextContent xTextTable = UnoRuntime.queryInterface(XTextContent.class, xAllTextTables.getByIndex(0)); + XTextRange xRange = UnoRuntime.queryInterface(XTextRange.class, xTextTable.getAnchor().getText()); xViewTextCursor.gotoRange(xRange, false); // if (xPageCursor.getPage() == (short) 1) { // Helper.setUnoPropertyValue(xTextTable, "PageDescName", "First Page"); diff --git a/wizards/com/sun/star/wizards/ui/AggregateComponent.java b/wizards/com/sun/star/wizards/ui/AggregateComponent.java index 2940e89a6ae4..aeebc069addc 100644 --- a/wizards/com/sun/star/wizards/ui/AggregateComponent.java +++ b/wizards/com/sun/star/wizards/ui/AggregateComponent.java @@ -26,6 +26,7 @@ ************************************************************************/ package com.sun.star.wizards.ui; +import java.util.ArrayList; import java.util.Vector; import com.sun.star.wizards.common.*; import com.sun.star.wizards.db.*; @@ -44,7 +45,6 @@ public class AggregateComponent extends ControlScroller { "SUM", "AVG", "MIN", "MAX" }; - ; QueryMetaData CurDBMetaData; XButton optDetailQuery; XButton optSummaryQuery; @@ -79,7 +79,6 @@ public class AggregateComponent extends ControlScroller { curHelpID = _firstHelpID; this.CurDBMetaData = _CurDBMetaData; - ; Count = 1; optDetailQuery = CurUnoDialog.insertRadioButton("optDetailQuery", 0, new ActionListenerImpl(), new String[] @@ -280,14 +279,14 @@ public class AggregateComponent extends ControlScroller ControlRow curcontrolrow = null; boolean biscomplete = true; CurDBMetaData.Type = getQueryType(); - CurUnoDialog.setControlProperty("btnminus", PropertyNames.PROPERTY_ENABLED, new Boolean((super.getTotalFieldCount() > 0) && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY))); + CurUnoDialog.setControlProperty("btnminus", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf((super.getTotalFieldCount() > 0) && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY))); int fieldcount = super.getCurFieldCount(); if (fieldcount > 0) { curcontrolrow = (ControlRow) ControlRowVector.elementAt(super.getCurFieldCount() - 1); biscomplete = curcontrolrow.isComplete(); } - CurUnoDialog.setControlProperty("btnplus", PropertyNames.PROPERTY_ENABLED, new Boolean(biscomplete && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY))); + CurUnoDialog.setControlProperty("btnplus", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(biscomplete && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY))); togglefollowingDialogSteps(); } @@ -295,8 +294,8 @@ public class AggregateComponent extends ControlScroller { CurDBMetaData.Type = getQueryType(); boolean benableComponent = isAggregateComponentEnabled(); - CurUnoDialog.setControlProperty("lblAggregate", PropertyNames.PROPERTY_ENABLED, new Boolean(benableComponent)); - CurUnoDialog.setControlProperty("lblFieldnames", PropertyNames.PROPERTY_ENABLED, new Boolean(benableComponent)); + CurUnoDialog.setControlProperty("lblAggregate", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableComponent)); + CurUnoDialog.setControlProperty("lblFieldnames", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableComponent)); toggleButtons(); super.toggleComponent(benableComponent); super.toggleControls(benableComponent); @@ -370,11 +369,10 @@ public class AggregateComponent extends ControlScroller CurDBMetaData.Type = getQueryType(); if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY) { - Vector aggregatevector = new Vector(); + ArrayList<String[]> aggregatevector = new ArrayList<String[]>(); PropertyValue[][] aggregatelist = this.getScrollFieldValues(); PropertyValue[] currowproperties; PropertyValue curaggregateproperty; - int a = 0; if (CurDBMetaData.AggregateFieldNames != null) { for (int i = 0; i < aggregatelist.length; i++) @@ -390,12 +388,11 @@ public class AggregateComponent extends ControlScroller curaggregatename[0] = CurDBMetaData.NumericFieldNames[iselfield[0]]; curaggregatename[1] = this.sFunctionOperators[iselfunction[0]]; aggregatevector.add(curaggregatename); - a++; } } } } - CurDBMetaData.AggregateFieldNames = new String[a][2]; + CurDBMetaData.AggregateFieldNames = new String[aggregatevector.size()][2]; aggregatevector.toArray(CurDBMetaData.AggregateFieldNames); } diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java index 4436c5dbfe95..e85343f42464 100644 --- a/wizards/com/sun/star/wizards/ui/ButtonList.java +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -219,7 +219,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener for (int c = 0; c < cols; c++) { XButton aButton = createButton(dialog, r, c); - XControl aControl = (XControl)UnoRuntime.queryInterface(XControl.class, aButton); + XControl aControl = UnoRuntime.queryInterface(XControl.class, aButton); m_aButtons[r * cols + c] = aControl; } } @@ -269,7 +269,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener m_aButtonWidth }); - XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, aButton); + XWindow win = UnoRuntime.queryInterface(XWindow.class, aButton); win.setEnable(true); win.setVisible(true); return aButton; @@ -277,14 +277,12 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener private int getButtonPosX(int _col) { - final int nXPos = pos.Width + _col * (m_aButtonSize.Width + gap.Width) + gap.Width; - return nXPos; + return pos.Width + _col * (m_aButtonSize.Width + gap.Width) + gap.Width; } private int getButtonPosY(int _row) { - final int nYPos = pos.Height + _row * (m_aButtonSize.Height + gap.Height) + gap.Height; - return nYPos; + return pos.Height + _row * (m_aButtonSize.Height + gap.Height) + gap.Height; } private void refreshImages() @@ -308,7 +306,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener { if (oResources.length == 1) { - Helper.setUnoPropertyValue(m_aButtons[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, (String) oResources[0]); + Helper.setUnoPropertyValue(m_aButtons[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, oResources[0]); } else if (oResources.length == 2) { @@ -350,7 +348,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener private transient java.util.ArrayList<XItemListener> m_aItemListenerList; private void setVisible(Object control, boolean visible) { - final XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, control); + final XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, control); xWindow.setVisible(visible); } @@ -719,8 +717,8 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener private void enableButtons() { - enable(btnNext, new Boolean(pageStart + rows * cols < listModel.getSize())); - enable(btnBack, new Boolean(pageStart > 0)); + enable(btnNext, Boolean.valueOf(pageStart + rows * cols < listModel.getSize())); + enable(btnBack, Boolean.valueOf(pageStart > 0)); } private void enable(Object control, Boolean enable) @@ -730,7 +728,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener private Object getModel(Object control) { - return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel(); + return UnoRuntime.queryInterface(XControl.class, control).getModel(); } private void setBorder(Object control, Short border) @@ -893,7 +891,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener // check which Button is pressed. String sControlName = aHelper.getPropertyValueAsString(PropertyNames.PROPERTY_NAME, PropertyNames.EMPTY_STRING); final String sButton = sControlName.substring(7 + m_aControlName.length()); - int nButton = new Integer(sButton).intValue(); + int nButton = Integer.parseInt(sButton); // int image = getImageFromEvent(event); int index = getIndexFor(nButton); diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java index b97fb6f5e84f..14a5f88796ba 100644 --- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java @@ -320,7 +320,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator else { emptyFieldsListBoxes(); - iSelArray = new short[] { (short) iSelPos }; + iSelArray = new short[] {iSelPos}; } Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, iSelArray); toggleCommandListBox(true); @@ -366,8 +366,8 @@ public class CommandFieldSelection extends FieldSelection implements Comparator public void toggleCommandListBox(boolean _bdoenable) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlblTable), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(xlblTable), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable)); } public String getSelectedCommandName() @@ -444,7 +444,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator } if (_bReadOnly) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.READ_ONLY, new Boolean(_selitem.length() > 0)); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.READ_ONLY, Boolean.valueOf(_selitem.length() > 0)); } } @@ -467,7 +467,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator } if (_bReadOnly) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.READ_ONLY, new Boolean(_selitem.length() > 0)); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.READ_ONLY, Boolean.valueOf(_selitem.length() > 0)); } toggleListboxButtons((short)-1,(short)-1); } diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.java b/wizards/com/sun/star/wizards/ui/ControlScroller.java index f25616098a26..59b01fee772b 100644 --- a/wizards/com/sun/star/wizards/ui/ControlScroller.java +++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java @@ -132,7 +132,7 @@ public abstract class ControlScroller }, new Object[] { - new Short((short) 0), new Boolean(true), new Integer(ScrollHeight), HelpIds.getHelpIdString(curHelpIndex), new Integer(ScrollBarOrientation.VERTICAL), new Integer(iCompPosX + iCompWidth - iScrollBarWidth - 1), new Integer(iCompPosY + 1), IStep, new Integer(iScrollBarWidth) + new Short((short) 0), Boolean.TRUE, new Integer(ScrollHeight), HelpIds.getHelpIdString(curHelpIndex), new Integer(ScrollBarOrientation.VERTICAL), new Integer(iCompPosX + iCompWidth - iScrollBarWidth - 1), new Integer(iCompPosY + 1), IStep, new Integer(iScrollBarWidth) }); scrollfields = new Vector(); int ypos = iStartPosY + SORELFIRSTPOSY; @@ -171,7 +171,7 @@ public abstract class ControlScroller ntotfieldcount = _ntotfieldcount; setCurFieldCount(); nscrollvalue = 0; - Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("ScrollValue"), new Integer(nscrollvalue)); + Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "ScrollValue", new Integer(nscrollvalue)); if (ntotfieldcount > nblockincrement) { Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[] @@ -243,7 +243,7 @@ public abstract class ControlScroller { if (_nscrollvalue >= 0) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("ScrollValue"), new Integer(_nscrollvalue)); + Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "ScrollValue", new Integer(_nscrollvalue)); scrollControls(); } } @@ -299,7 +299,7 @@ public abstract class ControlScroller protected void toggleComponent(boolean _bdoenable) { boolean bdoenable = _bdoenable && (ntotfieldcount > nblockincrement); - CurUnoDialog.setControlProperty("TitleScrollBar" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable)); + CurUnoDialog.setControlProperty("TitleScrollBar" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable)); } protected void toggleControls(boolean _bdoenable) @@ -310,7 +310,7 @@ public abstract class ControlScroller for (int m = 0; m < curproperties.length; m++) { PropertyValue curproperty = curproperties[m]; - CurUnoDialog.setControlProperty(curproperty.Name, PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable)); + CurUnoDialog.setControlProperty(curproperty.Name, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable)); } } @@ -324,7 +324,7 @@ public abstract class ControlScroller protected void setLineIncrementation(int _nlineincrement) { this.nlineincrement = _nlineincrement; - Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("LineIncrement"), new Integer(nlineincrement)); + Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "LineIncrement", new Integer(nlineincrement)); } @@ -341,7 +341,7 @@ public abstract class ControlScroller PropertyNames.PROPERTY_ENABLED, "BlockIncrement", "ScrollValueMax" }, new Object[] { - new Boolean(ntotfieldcount > nblockincrement), new Integer(nblockincrement), new Integer(ntotfieldcount - nblockincrement) + Boolean.valueOf(ntotfieldcount > nblockincrement), new Integer(nblockincrement), new Integer(ntotfieldcount - nblockincrement) }); } @@ -395,12 +395,10 @@ public abstract class ControlScroller { if (guiRow + nscrollvalue < scrollfields.size()) { - PropertyValue pv = fieldInfo( + return fieldInfo( ((PropertyValue[]) scrollfields.elementAt(guiRow + nscrollvalue))[column], ((PropertyValue[]) scrollfields.elementAt(guiRow))[column]); //System.out.println("getting field info for : " + guiRow + "/" + column + ":" + pv.Value + "(" + pv.Name + ")" ); - - return pv; } else { @@ -451,7 +449,7 @@ public abstract class ControlScroller { Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname)); String propertyname = UnoDialog.getDisplayProperty(oControlModel); - if (propertyname != PropertyNames.EMPTY_STRING) + if (!propertyname.equals(PropertyNames.EMPTY_STRING)) { CurUnoDialog.setControlProperty(controlname, propertyname, newvalue); } @@ -461,7 +459,7 @@ public abstract class ControlScroller { Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname)); String propertyname = UnoDialog.getDisplayProperty(oControlModel); - if (propertyname != PropertyNames.EMPTY_STRING) + if (!propertyname.equals(PropertyNames.EMPTY_STRING)) { return CurUnoDialog.getControlProperty(controlname, propertyname); } diff --git a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java index dfe5ff93f6a2..1bf70e77faa6 100644 --- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java @@ -91,7 +91,7 @@ public abstract class DBLimitedFieldSelection protected void moveupSelectedItems(int CurIndex, boolean bDoEnable) { // short iNextItemPos; - if ((bDoEnable == false) && (MAXSELINDEX > CurIndex)) + if ((!bDoEnable) && (MAXSELINDEX > CurIndex)) { for (int i = CurIndex; i < MAXSELINDEX; i++) { @@ -113,10 +113,7 @@ public abstract class DBLimitedFieldSelection int FieldCount = _FieldNames.length; String[] ViewFieldNames = new String[FieldCount + 1]; ViewFieldNames[0] = sNoField; - for (int i = 0; i < FieldCount; i++) - { - ViewFieldNames[i + 1] = _FieldNames[i]; - } + System.arraycopy(_FieldNames, 0, ViewFieldNames, 1, FieldCount); return ViewFieldNames; } diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.java b/wizards/com/sun/star/wizards/ui/DocumentPreview.java index 3489ca0235b3..db7a3fd959fc 100644 --- a/wizards/com/sun/star/wizards/ui/DocumentPreview.java +++ b/wizards/com/sun/star/wizards/ui/DocumentPreview.java @@ -76,7 +76,7 @@ public class DocumentPreview { //((XWindow)UnoRuntime.queryInterface(XWindow.class,control)).addPaintListener(this); - xControl = (XControl) UnoRuntime.queryInterface(XControl.class, control); + xControl = UnoRuntime.queryInterface(XControl.class, control); //register this object as a listener, to close the frame when disposing. //((XComponent) UnoRuntime.queryInterface(XComponent.class, control)).addEventListener(this); @@ -99,7 +99,7 @@ public class DocumentPreview protected XComponent setDocument(String url, PropertyValue[] lArgs) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException { loadArgs = lArgs; - XComponentLoader xCompLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xFrame); + XComponentLoader xCompLoader = UnoRuntime.queryInterface(XComponentLoader.class, xFrame); xFrame.activate(); return xComponent = xCompLoader.loadComponentFromURL(url, "_self", 0, loadArgs); } @@ -116,7 +116,7 @@ public class DocumentPreview { if (xFrame != null) { - ((XCloseable) UnoRuntime.queryInterface(XCloseable.class, xFrame)).close(false); + UnoRuntime.queryInterface(XCloseable.class, xFrame).close(false); } } @@ -149,11 +149,11 @@ public class DocumentPreview public void createPreviewFrame(XMultiServiceFactory xmsf, XControl xControl) throws com.sun.star.uno.Exception, com.sun.star.lang.IllegalArgumentException { XWindowPeer controlPeer = xControl.getPeer(); - XWindow controlWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xControl); + XWindow controlWindow = UnoRuntime.queryInterface(XWindow.class, xControl); Rectangle r = controlWindow.getPosSize(); Object toolkit = xmsf.createInstance("com.sun.star.awt.Toolkit"); - XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, toolkit); + XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, toolkit); WindowDescriptor aDescriptor = new WindowDescriptor(); aDescriptor.Type = WindowClass.SIMPLE; @@ -164,9 +164,9 @@ public class DocumentPreview aDescriptor.WindowAttributes = VclWindowPeerAttribute.CLIPCHILDREN | WindowAttribute.SHOW; XWindowPeer xPeer = xToolkit.createWindow(aDescriptor); - xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xPeer); + xWindow = UnoRuntime.queryInterface(XWindow.class, xPeer); Object frame = xmsf.createInstance("com.sun.star.frame.Frame"); - xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, frame); + xFrame = UnoRuntime.queryInterface(XFrame.class, frame); // XFrame xF = (XFrame) UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xmsf)); // xFrame = xF.findFrame("_blank", 0); xFrame.initialize(xWindow); diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java index 1a4ef1bf75e7..9083b13ec49f 100644 --- a/wizards/com/sun/star/wizards/ui/FieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java @@ -210,7 +210,7 @@ public class FieldSelection SelListBoxPosX = new Integer(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist); IStep = new Integer(_iStep); - if (bshowFourButtons == true) + if (bshowFourButtons) { ShiftButtonCount = 4; } @@ -254,7 +254,7 @@ public class FieldSelection Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth }); - if (bshowFourButtons == true) + if (bshowFourButtons) { btnmoveall = CurUnoDialog.insertButton("cmdMoveAll" + sIncSuffix, SOCMDMOVEALL, new ActionListenerImpl(), new String[] @@ -276,7 +276,7 @@ public class FieldSelection Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth }); - if (bshowFourButtons == true) + if (bshowFourButtons) { btnremoveall = CurUnoDialog.insertButton("cmdRemoveAll" + sIncSuffix, SOCMDREMOVEALL, new ActionListenerImpl(), new String[] @@ -427,7 +427,7 @@ public class FieldSelection CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable); CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable); - if (BDoEnable.booleanValue() == true) + if (BDoEnable.booleanValue()) { toggleListboxButtons((short) - 1, (short) - 1); } @@ -466,11 +466,11 @@ public class FieldSelection bmoveUpenabled = ((iSelIndices[0] > 0) && (iSelIndices.length == 1)); bmoveDownenabled = (((iSelIndices[SelListBoxSelLength - 1]) < (short) (SelectCount - 1)) && (iSelIndices.length == 1)); } - CurUnoDialog.setControlProperty("cmdRemoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(SelectCount >= 1)); - CurUnoDialog.setControlProperty("cmdRemoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(bSelectSelected)); + CurUnoDialog.setControlProperty("cmdRemoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(SelectCount >= 1)); + CurUnoDialog.setControlProperty("cmdRemoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bSelectSelected)); toggleMoveButtons((FieldCount >= 1), bIsFieldSelected); - CurUnoDialog.setControlProperty("cmdMoveUp" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(bmoveUpenabled)); - CurUnoDialog.setControlProperty("cmdMoveDown" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(bmoveDownenabled)); + CurUnoDialog.setControlProperty("cmdMoveUp" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bmoveUpenabled)); + CurUnoDialog.setControlProperty("cmdMoveDown" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bmoveDownenabled)); } catch (Exception exception) { @@ -482,8 +482,8 @@ public class FieldSelection { boolean btoggleMoveAll = (((xFieldsListBox.getItemCount() + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveAll)); boolean btoggleMoveSelected = (((xFieldsListBox.getSelectedItems().length + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveSelected)); - CurUnoDialog.setControlProperty("cmdMoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(btoggleMoveAll)); - CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(btoggleMoveSelected)); + CurUnoDialog.setControlProperty("cmdMoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(btoggleMoveAll)); + CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(btoggleMoveSelected)); } public void setMultipleMode(boolean _bisMultiple) diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index 1bc24f71ac41..8c8ee10a1a83 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -137,7 +137,7 @@ public class FilterComponent case SO_FOURTHFIELDNAME: sControlName = getControlName(EventObject.Source); String sControlNameSuffix = sIncSuffix + "_" + getIndexNumber(sControlName); - XListBox xCurFieldListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName)); + XListBox xCurFieldListBox = UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName)); String CurDisplayFieldName = xCurFieldListBox.getSelectedItem(); FieldColumn CurFieldColumn = new FieldColumn(oQueryMetaData, CurDisplayFieldName); @@ -198,8 +198,7 @@ public class FilterComponent public static String getIndexNumber(String _sStr) { - String sLastNumber = _sStr.substring(_sStr.length() - 1, _sStr.length()); - return sLastNumber; + return _sStr.substring(_sStr.length() - 1, _sStr.length()); } /** @@ -223,10 +222,9 @@ public class FilterComponent { try { - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, _oSourceevent); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel()); - final String sName = AnyConverter.toString(xPSet.getPropertyValue(PropertyNames.PROPERTY_NAME)); - return sName; + XControl xControl = UnoRuntime.queryInterface(XControl.class, _oSourceevent); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel()); + return AnyConverter.toString(xPSet.getPropertyValue(PropertyNames.PROPERTY_NAME)); } catch (Exception e) { @@ -246,7 +244,7 @@ public class FilterComponent try { final String serviceName = "com.sun.star.beans.PropertyBag"; - final XPropertyContainer column = (XPropertyContainer) UnoRuntime.queryInterface(XPropertyContainer.class, oQueryMetaData.xMSF.createInstance(serviceName)); + final XPropertyContainer column = UnoRuntime.queryInterface(XPropertyContainer.class, oQueryMetaData.xMSF.createInstance(serviceName)); column.addProperty("Type", PropertyAttribute.BOUND, DataType.VARCHAR); column.addProperty(PropertyNames.PROPERTY_NAME, PropertyAttribute.BOUND, PropertyNames.EMPTY_STRING); @@ -288,7 +286,7 @@ public class FilterComponent || (operator == SQLFilterOperator.NOT_SQLNULL) || AnyConverter.isVoid(value)) { - column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), new String()); + column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), ""); value = new Any(new Type(TypeClass.VOID), null); } else @@ -362,7 +360,7 @@ public class FilterComponent { boolean bisany = true; int ifilterstate = SOI_MATCHALL; - bisany = (this.optMatchAny.getState()) == true; + bisany = (this.optMatchAny.getState()); if (bisany) { ifilterstate = SOI_MATCHANY; @@ -563,7 +561,7 @@ public class FilterComponent m_bEnabled = _bEnabled; // Label Field - ControlElements[0] = (XInterface) CurUnoDialog.insertLabel("lblFieldNames" + sCompSuffix, + ControlElements[0] = CurUnoDialog.insertLabel("lblFieldNames" + sCompSuffix, new String[] { PropertyNames.PROPERTY_ENABLED, @@ -588,7 +586,7 @@ public class FilterComponent }); // Label Operator - ControlElements[1] = (XInterface) CurUnoDialog.insertLabel("lblOperators" + sCompSuffix, + ControlElements[1] = CurUnoDialog.insertLabel("lblOperators" + sCompSuffix, new String[] { PropertyNames.PROPERTY_ENABLED, @@ -613,7 +611,7 @@ public class FilterComponent }); // Label Value - ControlElements[2] = (XInterface) CurUnoDialog.insertLabel("lblValue" + sCompSuffix, + ControlElements[2] = CurUnoDialog.insertLabel("lblValue" + sCompSuffix, new String[] { PropertyNames.PROPERTY_ENABLED, @@ -638,7 +636,7 @@ public class FilterComponent }); // Listbox Fields - ControlElements[SOLSTFIELDNAME] = (XInterface) CurUnoDialog.insertListBox("lstFieldName" + sCompSuffix, SO_FIELDNAMELIST[Index], null, new ItemListenerImpl(), + ControlElements[SOLSTFIELDNAME] = CurUnoDialog.insertListBox("lstFieldName" + sCompSuffix, SO_FIELDNAMELIST[Index], null, new ItemListenerImpl(), new String[] { PropertyNames.PROPERTY_ENABLED, @@ -667,7 +665,7 @@ public class FilterComponent }); // Listbox Operators - ControlElements[SOLSTOPERATOR] = (XInterface) CurUnoDialog.insertListBox("lstOperator" + sCompSuffix, SO_CONDITIONLIST[Index], null, new ItemListenerImpl(), + ControlElements[SOLSTOPERATOR] = CurUnoDialog.insertListBox("lstOperator" + sCompSuffix, SO_CONDITIONLIST[Index], null, new ItemListenerImpl(), new String[] { PropertyNames.PROPERTY_ENABLED, @@ -696,7 +694,7 @@ public class FilterComponent Short.valueOf(curtabindex++), Integer.valueOf(nOperatorWidth) }); - ControlElements[SOTXTVALUE] = (XInterface) CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SO_TEXTFIELDLIST[Index], new TextListenerImpl(), + ControlElements[SOTXTVALUE] = CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SO_TEXTFIELDLIST[Index], new TextListenerImpl(), new String[] { PropertyNames.PROPERTY_ENABLED, @@ -778,9 +776,9 @@ public class FilterComponent { try { - XListBox xFieldsListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTFIELDNAME]); + XListBox xFieldsListBox = UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTFIELDNAME]); xFieldsListBox.selectItem(_filtercondition.Name, true); - XListBox xOperatorListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTOPERATOR]); + XListBox xOperatorListBox = UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTOPERATOR]); xOperatorListBox.selectItemPos((short) (_filtercondition.Handle - 1), true); if (AnyConverter.isString(_filtercondition.Value)) diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java index 5ee289ecf8a4..02e7668db727 100644 --- a/wizards/com/sun/star/wizards/ui/ImageList.java +++ b/wizards/com/sun/star/wizards/ui/ImageList.java @@ -222,7 +222,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener new Integer(selectionWidth) }); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, grbxSelectedImage); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, grbxSelectedImage); xWindow.addMouseListener(new OMouseListener()); final String[] pNames1 = new String[] @@ -366,7 +366,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener m_imageWidth }); - XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, image); + XWindow win = UnoRuntime.queryInterface(XWindow.class, image); win.addMouseListener(uiEventListener); win.addKeyListener(imageKeyListener); //uiEventListener.add(imageName,EventNames.EVENT_MOUSE_ENTERED,METHOD_MOUSE_ENTER_IMAGE); @@ -408,7 +408,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener { if (oResources.length == 1) { - Helper.setUnoPropertyValue(m_aImages[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, (String) oResources[0]); + Helper.setUnoPropertyValue(m_aImages[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, oResources[0]); } else if (oResources.length == 2) { @@ -500,7 +500,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener private void setVisible(Object control, boolean visible) { - ((XWindow) UnoRuntime.queryInterface(XWindow.class, control)).setVisible(visible); + UnoRuntime.queryInterface(XWindow.class, control).setVisible(visible); } /** @@ -861,8 +861,8 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener private void enableButtons() { - enable(btnNext, new Boolean(pageStart + rows * cols < listModel.getSize())); - enable(btnBack, new Boolean(pageStart > 0)); + enable(btnNext, Boolean.valueOf(pageStart + rows * cols < listModel.getSize())); + enable(btnBack, Boolean.valueOf(pageStart > 0)); } private void enable(Object control, Boolean enable) @@ -872,7 +872,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener private Object getModel(Object control) { - return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel(); + return UnoRuntime.queryInterface(XControl.class, control).getModel(); } /* @@ -1081,7 +1081,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener { Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop", Boolean.TRUE); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, m_aImages[image]); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, m_aImages[image]); xWindow.setFocus(); } diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.java b/wizards/com/sun/star/wizards/ui/PathSelection.java index 249a47a6b803..fbeb54f84f35 100755 --- a/wizards/com/sun/star/wizards/ui/PathSelection.java +++ b/wizards/com/sun/star/wizards/ui/PathSelection.java @@ -81,7 +81,7 @@ public class PathSelection PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(Enabled), 8, LabelText, new Integer(XPos), new Integer(YPos), new Integer(DialogStep), new Short(CurTabIndex), new Integer(Width) + Boolean.valueOf(Enabled), 8, LabelText, new Integer(XPos), new Integer(YPos), new Integer(DialogStep), new Short(CurTabIndex), new Integer(Width) }); xSaveTextBox = CurUnoDialog.insertTextField("txtSavePath", "callXPathSelectionListener", this, new String[] @@ -89,7 +89,7 @@ public class PathSelection PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(Enabled), 12, TxtHelpURL, new Integer(XPos), new Integer(YPos + 10), new Integer(DialogStep), new Short((short) (CurTabIndex + 1)), new Integer(Width - 26) + Boolean.valueOf(Enabled), 12, TxtHelpURL, new Integer(XPos), new Integer(YPos + 10), new Integer(DialogStep), new Short((short) (CurTabIndex + 1)), new Integer(Width - 26) }); //CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.READ_ONLY, Boolean.TRUE); CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); @@ -98,7 +98,7 @@ public class PathSelection PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(Enabled), 14, BtnHelpURL, "...", new Integer(XPos + Width - 16), new Integer(YPos + 9), new Integer(DialogStep), new Short((short) (CurTabIndex + 2)), 16 + Boolean.valueOf(Enabled), 14, BtnHelpURL, "...", new Integer(XPos + Width - 16), new Integer(YPos + 9), new Integer(DialogStep), new Short((short) (CurTabIndex + 2)), 16 }); } diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.java b/wizards/com/sun/star/wizards/ui/PeerConfig.java index a13a02f0153c..1fed4a961f7a 100644 --- a/wizards/com/sun/star/wizards/ui/PeerConfig.java +++ b/wizards/com/sun/star/wizards/ui/PeerConfig.java @@ -115,7 +115,7 @@ public class PeerConfig implements XWindowListener for (int i = 0; i < this.m_aPeerTasks.size(); i++) { PeerTask aPeerTask = (PeerTask) m_aPeerTasks.elementAt(i); - XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, aPeerTask.xControl.getPeer()); + XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, aPeerTask.xControl.getPeer()); for (int n = 0; n < aPeerTask.propnames.length; n++) { xVclWindowPeer.setProperty(aPeerTask.propnames[n], aPeerTask.propvalues[n]); @@ -167,7 +167,7 @@ public class PeerConfig implements XWindowListener */ public void setAccessibleName(Object oAPIControl, String _saccessname) { - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oAPIControl); + XControl xControl = UnoRuntime.queryInterface(XControl.class, oAPIControl); setPeerProperties(xControl, new String[] { "AccessibleName" @@ -196,7 +196,7 @@ public class PeerConfig implements XWindowListener */ public void setPeerProperties(Object oAPIControl, String[] _propnames, Object[] _propvalues) { - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oAPIControl); + XControl xControl = UnoRuntime.queryInterface(XControl.class, oAPIControl); setPeerProperties(xControl, _propnames, _propvalues); } diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java index bf1576525947..50ffa59a254c 100644 --- a/wizards/com/sun/star/wizards/ui/SortingComponent.java +++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java @@ -61,10 +61,10 @@ public class SortingComponent public void itemStateChanged(ItemEvent EventObject) { - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(false)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); int ikey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList); enableNextSortListBox(ikey); - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(true)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); } public void disposing(com.sun.star.lang.EventObject eventObject) @@ -97,16 +97,16 @@ public class SortingComponent for (int i = 0; i < 4; i++) { bDoEnable = (i < 2); - CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lblSort" + new Integer(i + 1).toString(), new String[] + CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lblSort" + Integer.toString(i + 1), new String[] { PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), 8, sSortHeader[i], 0, ICompPosX, new Integer(iCurPosY), IStep, new Short(curtabindex++), ICompWidth + Boolean.valueOf(bDoEnable), 8, sSortHeader[i], 0, ICompPosX, new Integer(iCurPosY), IStep, new Short(curtabindex++), ICompWidth }); HIDString = HelpIds.getHelpIdString(FirstHelpIndex); - xSortListBox[i] = CurUnoDialog.insertListBox("lstSort" + new Integer(i + 1).toString(), SOSORTLST[i], null, new ItemListenerImpl(), new String[] + xSortListBox[i] = CurUnoDialog.insertListBox("lstSort" + Integer.toString(i + 1), SOSORTLST[i], null, new ItemListenerImpl(), new String[] { "Dropdown", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] @@ -165,10 +165,7 @@ public class SortingComponent int FieldCount = _FieldNames.length; String[] ViewFieldNames = new String[FieldCount + 1]; ViewFieldNames[0] = sNoSorting; - for (int i = 0; i < FieldCount; i++) - { - ViewFieldNames[i + 1] = _FieldNames[i]; - } + System.arraycopy(_FieldNames, 0, ViewFieldNames, 1, FieldCount); short[] SelList = null; for (int i = 0; i < 4; i++) { @@ -186,8 +183,8 @@ public class SortingComponent (short) 0 }; } - CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), PropertyNames.STRING_ITEM_LIST, ViewFieldNames); - CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), PropertyNames.SELECTED_ITEMS, SelList); + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 1), PropertyNames.STRING_ITEM_LIST, ViewFieldNames); + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 1), PropertyNames.SELECTED_ITEMS, SelList); toggleSortListBox(i, (i <= _SortFieldNames.length)); } } @@ -211,7 +208,7 @@ public class SortingComponent */ public void setReadOnly(int _index, boolean _breadonly) { - CurUnoDialog.setControlProperty("lstSort" + new Integer(_index + 1).toString(), PropertyNames.READ_ONLY, new Boolean(_breadonly)); + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(_index + 1), PropertyNames.READ_ONLY, Boolean.valueOf(_breadonly)); } /** @@ -265,7 +262,7 @@ public class SortingComponent { CurFieldName = xSortListBox[i].getSelectedItem(); SortDescriptions.add(CurFieldName); - iCurState = ((Short) CurUnoDialog.getControlProperty("optAscend" + new Integer(i + 1).toString(), PropertyNames.PROPERTY_STATE)).shortValue(); + iCurState = ((Short) CurUnoDialog.getControlProperty("optAscend" + Integer.toString(i + 1), PropertyNames.PROPERTY_STATE)).shortValue(); SortFieldNames.add(new String[]{CurFieldName,iCurState == 1 ? PropertyNames.ASC :"DESC" }); } } @@ -303,7 +300,7 @@ public class SortingComponent toggleSortListBox(i, (false)); if (i < MaxSortIndex) { - CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), PropertyNames.SELECTED_ITEMS, new short[] + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 2), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); @@ -319,22 +316,22 @@ public class SortingComponent private void moveupSortItems(int CurIndex, boolean bDoEnable) { short iNextItemPos; - if ((bDoEnable == false) && (MAXSORTCRITERIAINDEX > CurIndex)) + if ((!bDoEnable) && (MAXSORTCRITERIAINDEX > CurIndex)) { for (int i = CurIndex; i < MAXSORTCRITERIAINDEX; i++) { iNextItemPos = xSortListBox[i + 1].getSelectedItemPos(); if (iNextItemPos != 0) { - CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), PropertyNames.SELECTED_ITEMS, new short[] + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 1), PropertyNames.SELECTED_ITEMS, new short[] { iNextItemPos }); - CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), PropertyNames.SELECTED_ITEMS, new short[] + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 2), PropertyNames.SELECTED_ITEMS, new short[] { }); toggleSortListBox(i, true); - CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), PropertyNames.SELECTED_ITEMS, new short[] + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 2), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); @@ -357,13 +354,13 @@ public class SortingComponent { if (CurIndex < xSortListBox.length) { - CurUnoDialog.setControlProperty("lblSort" + new Integer(CurIndex + 1).toString(), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable)); - CurUnoDialog.setControlProperty("lstSort" + new Integer(CurIndex + 1).toString(), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable)); - CurUnoDialog.setControlProperty("optAscend" + new Integer(CurIndex + 1).toString(), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable)); - CurUnoDialog.setControlProperty("optDescend" + new Integer(CurIndex + 1).toString(), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable)); - if (bDoEnable == false) + CurUnoDialog.setControlProperty("lblSort" + Integer.toString(CurIndex + 1), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable)); + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(CurIndex + 1), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable)); + CurUnoDialog.setControlProperty("optAscend" + Integer.toString(CurIndex + 1), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable)); + CurUnoDialog.setControlProperty("optDescend" + Integer.toString(CurIndex + 1), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable)); + if (!bDoEnable) { - CurUnoDialog.setControlProperty("lstSort" + new Integer(CurIndex + 1).toString(), PropertyNames.SELECTED_ITEMS, new short[] + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(CurIndex + 1), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); diff --git a/wizards/com/sun/star/wizards/ui/TitlesComponent.java b/wizards/com/sun/star/wizards/ui/TitlesComponent.java index 6ef9557b158f..4858c22a221d 100644 --- a/wizards/com/sun/star/wizards/ui/TitlesComponent.java +++ b/wizards/com/sun/star/wizards/ui/TitlesComponent.java @@ -111,7 +111,7 @@ public class TitlesComponent extends ControlScroller }, new Object[] { - 16, new Boolean(true), new Integer(iLabelPosX), new Integer(_iCompPosY + 1), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 30 + 16, Boolean.TRUE, new Integer(iLabelPosX), new Integer(_iCompPosY + 1), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 30 }); xTextComponent = CurUnoDialog.insertTextField(stextfieldname, 0, null, diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java index 1798986a563a..7149503dfd6d 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -82,19 +82,19 @@ public class UnoDialog implements EventNames this.xMSF = xMSF; ControlList = new Hashtable(); xDialogModel = (XInterface) xMSF.createInstance("com.sun.star.awt.UnoControlDialogModel"); - XMultiPropertySet xMultiPSetDlg = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, xDialogModel); + XMultiPropertySet xMultiPSetDlg = UnoRuntime.queryInterface(XMultiPropertySet.class, xDialogModel); xMultiPSetDlg.setPropertyValues(PropertyNames, PropertyValues); - MSFDialogModel = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xDialogModel); + MSFDialogModel = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDialogModel); xUnoDialog = (XInterface) xMSF.createInstance("com.sun.star.awt.UnoControlDialog"); - xControl = (XControl) UnoRuntime.queryInterface(XControl.class, xUnoDialog); - XControlModel xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, xDialogModel); + xControl = UnoRuntime.queryInterface(XControl.class, xUnoDialog); + XControlModel xControlModel = UnoRuntime.queryInterface(XControlModel.class, xDialogModel); xControl.setModel(xControlModel); - xPSetDlg = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDialogModel); - xDlgContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, xUnoDialog); - xDlgNames = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xDialogModel); + xPSetDlg = UnoRuntime.queryInterface(XPropertySet.class, xDialogModel); + xDlgContainer = UnoRuntime.queryInterface(XControlContainer.class, xUnoDialog); + xDlgNames = UnoRuntime.queryInterface(XNameContainer.class, xDialogModel); // xDlgNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDialogModel); - xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xUnoDialog); - xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xUnoDialog); + xComponent = UnoRuntime.queryInterface(XComponent.class, xUnoDialog); + xWindow = UnoRuntime.queryInterface(XWindow.class, xUnoDialog); // setPeerConfiguration(); // LLA: will be done, if really used! } @@ -107,9 +107,9 @@ public class UnoDialog implements EventNames public int getControlKey(Object EventObject, Hashtable ControlList) { int iKey; - XControl xContrl = (XControl) UnoRuntime.queryInterface(XControl.class, EventObject); + XControl xContrl = UnoRuntime.queryInterface(XControl.class, EventObject); XControlModel xControlModel = xContrl.getModel(); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); try { String sName = (String) xPSet.getPropertyValue(PropertyNames.PROPERTY_NAME); @@ -142,7 +142,7 @@ public class UnoDialog implements EventNames { if (m_xDlgNameAccess == null) { - m_xDlgNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDialogModel); + m_xDlgNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xDialogModel); } return m_xDlgNameAccess; } @@ -152,12 +152,12 @@ public class UnoDialog implements EventNames { if (PropertyValue != null) { - if (getDlgNameAccess().hasByName(ControlName) == false) + if (!getDlgNameAccess().hasByName(ControlName)) { return; } Object xControlModel = getDlgNameAccess().getByName(ControlName); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); if (AnyConverter.isArray(PropertyValue)) { com.sun.star.uno.Type seqType = new com.sun.star.uno.Type(PropertyValue.getClass()); @@ -187,12 +187,12 @@ public class UnoDialog implements EventNames { if (PropertyValues != null) { - if (getDlgNameAccess().hasByName(ControlName) == false) + if (!getDlgNameAccess().hasByName(ControlName)) { return; } Object xControlModel = getDlgNameAccess().getByName(ControlName); - XMultiPropertySet xMultiPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, xControlModel); + XMultiPropertySet xMultiPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, xControlModel); xMultiPSet.setPropertyValues(PropertyNames, PropertyValues); } } @@ -207,12 +207,8 @@ public class UnoDialog implements EventNames try { Object xControlModel = getDlgNameAccess().getByName(ControlName); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); - Object oPropValue = xPSet.getPropertyValue(PropertyName); - // if (AnyConverter.isArray(oPropValue)) - // return Helper.getArrayValue(oPropValue); - // else - return oPropValue; + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); + return xPSet.getPropertyValue(PropertyName); } catch (com.sun.star.uno.Exception exception) { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException, @@ -226,7 +222,7 @@ public class UnoDialog implements EventNames try { Object xControlModel = getDlgNameAccess().getByName(ControlName); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); Property[] allProps = xPSet.getPropertySetInfo().getProperties(); for (int i = 0; i < allProps.length; i++) { @@ -243,20 +239,19 @@ public class UnoDialog implements EventNames public double getMAPConversionFactor(String ControlName) { XControl xControl2 = xDlgContainer.getControl(ControlName); - XView xView = (XView) UnoRuntime.queryInterface(XView.class, xControl2); + XView xView = UnoRuntime.queryInterface(XView.class, xControl2); Size aSize = xView.getSize(); double dblMAPWidth = (double) (((Integer) Helper.getUnoPropertyValue(xControl2.getModel(), PropertyNames.PROPERTY_WIDTH)).intValue()); - double dblFactor = (((double) (aSize.Width)) / dblMAPWidth); - return dblFactor; + return (((double) (aSize.Width)) / dblMAPWidth); } public Size getpreferredLabelSize(String LabelName, String sLabel) { XControl xControl2 = xDlgContainer.getControl(LabelName); - XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, xControl2); + XFixedText xFixedText = UnoRuntime.queryInterface(XFixedText.class, xControl2); String OldText = xFixedText.getText(); xFixedText.setText(sLabel); - XLayoutConstrains xLayoutConstrains = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, xControl2); + XLayoutConstrains xLayoutConstrains = UnoRuntime.queryInterface(XLayoutConstrains.class, xControl2); Size aSize = xLayoutConstrains.getPreferredSize(); xFixedText.setText(OldText); return aSize; @@ -307,10 +302,10 @@ public class UnoDialog implements EventNames try { Object oFixedText = insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", sName, sPropNames, oPropValues); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFixedText); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oFixedText); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - Object oLabel = xDlgContainer.getControl(new String(sName)); - return (XFixedText) UnoRuntime.queryInterface(XFixedText.class, oLabel); + Object oLabel = xDlgContainer.getControl(sName); + return UnoRuntime.queryInterface(XFixedText.class, oLabel); } catch (java.lang.Exception ex) { @@ -334,10 +329,10 @@ public class UnoDialog implements EventNames public XButton insertButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception { Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlButtonModel", sName, sProperties, sValues); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oButtonModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oButtonModel); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - Object objectButton = xDlgContainer.getControl(new String(sName)); - XButton xButton = (XButton) UnoRuntime.queryInterface(XButton.class, objectButton); + Object objectButton = xDlgContainer.getControl(sName); + XButton xButton = UnoRuntime.queryInterface(XButton.class, objectButton); if (xActionListener != null) { xButton.addActionListener(xActionListener); @@ -353,10 +348,10 @@ public class UnoDialog implements EventNames public void insertCheckBox(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception { Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlCheckBoxModel", sName, sProperties, sValues); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oButtonModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oButtonModel); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - Object objectCheckBox = xDlgContainer.getControl(new String(sName)); - XCheckBox xCheckBox = (XCheckBox) UnoRuntime.queryInterface(XCheckBox.class, objectCheckBox); + Object objectCheckBox = xDlgContainer.getControl(sName); + XCheckBox xCheckBox = UnoRuntime.queryInterface(XCheckBox.class, objectCheckBox); if (xItemListener != null) { xCheckBox.addItemListener(xItemListener); @@ -371,10 +366,10 @@ public class UnoDialog implements EventNames public void insertNumericField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception { Object oNumericFieldModel = insertControlModel("com.sun.star.awt.UnoControlNumericFieldModel", sName, sProperties, sValues); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oNumericFieldModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oNumericFieldModel); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - Object objectNumericField = xDlgContainer.getControl(new String(sName)); - XTextComponent xNumericField = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, objectNumericField); + Object objectNumericField = xDlgContainer.getControl(sName); + XTextComponent xNumericField = UnoRuntime.queryInterface(XTextComponent.class, objectNumericField); if (xTextListener != null) { xNumericField.addTextListener(xTextListener); @@ -391,10 +386,10 @@ public class UnoDialog implements EventNames try { Object oScrollModel = insertControlModel("com.sun.star.awt.UnoControlScrollBarModel", sName, sProperties, sValues); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oScrollModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oScrollModel); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - Object oScrollBar = xDlgContainer.getControl(new String(sName)); - XScrollBar xScrollBar = (XScrollBar) UnoRuntime.queryInterface(XScrollBar.class, oScrollBar); + Object oScrollBar = xDlgContainer.getControl(sName); + XScrollBar xScrollBar = UnoRuntime.queryInterface(XScrollBar.class, oScrollBar); if (xAdjustmentListener != null) { xScrollBar.addAdjustmentListener(xAdjustmentListener); @@ -415,14 +410,12 @@ public class UnoDialog implements EventNames public XTextComponent insertTextField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) { - XTextComponent xTextBox = insertEditField("com.sun.star.awt.UnoControlEditModel", sName, iControlKey, xTextListener, sProperties, sValues); - return xTextBox; + return insertEditField("com.sun.star.awt.UnoControlEditModel", sName, iControlKey, xTextListener, sProperties, sValues); } public XTextComponent insertFormattedField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) { - XTextComponent xTextBox = insertEditField("com.sun.star.awt.UnoControlFormattedFieldModel", sName, iControlKey, xTextListener, sProperties, sValues); - return xTextBox; + return insertEditField("com.sun.star.awt.UnoControlFormattedFieldModel", sName, iControlKey, xTextListener, sProperties, sValues); } public XTextComponent insertEditField(String ServiceName, String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) @@ -430,10 +423,10 @@ public class UnoDialog implements EventNames try { XInterface xTextModel = insertControlModel(ServiceName, sName, sProperties, sValues); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xTextModel); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - XControl xTextField = xDlgContainer.getControl(new String(sName)); - XTextComponent xTextBox = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xTextField); + XControl xTextField = xDlgContainer.getControl(sName); + XTextComponent xTextBox = UnoRuntime.queryInterface(XTextComponent.class, xTextField); if (xTextListener != null) { xTextBox.addTextListener(xTextListener); @@ -452,10 +445,10 @@ public class UnoDialog implements EventNames public XListBox insertListBox(String sName, int iControlKey, XActionListener xActionListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception { XInterface xListBoxModel = insertControlModel("com.sun.star.awt.UnoControlListBoxModel", sName, sProperties, sValues); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xListBoxModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xListBoxModel); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - XControl xControlListBox = xDlgContainer.getControl(new String(sName)); - XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, xControlListBox); + XControl xControlListBox = xDlgContainer.getControl(sName); + XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, xControlListBox); if (xItemListener != null) { xListBox.addItemListener(xItemListener); @@ -472,17 +465,17 @@ public class UnoDialog implements EventNames public XComboBox insertComboBox(String sName, int iControlKey, XActionListener xActionListener, XTextListener xTextListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception { XInterface xComboBoxModel = insertControlModel("com.sun.star.awt.UnoControlComboBoxModel", sName, sProperties, sValues); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xComboBoxModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xComboBoxModel); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - XControl xControlComboBox = xDlgContainer.getControl(new String(sName)); - XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, xControlComboBox); + XControl xControlComboBox = xDlgContainer.getControl(sName); + XComboBox xComboBox = UnoRuntime.queryInterface(XComboBox.class, xControlComboBox); if (xItemListener != null) { xComboBox.addItemListener(xItemListener); } if (xTextListener != null) { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xComboBox); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox); xTextComponent.addTextListener(xTextListener); } if (xActionListener != null) @@ -517,7 +510,7 @@ public class UnoDialog implements EventNames try { XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues); - XButton xButton = (com.sun.star.awt.XButton) UnoRuntime.queryInterface(XButton.class, xRadioButton); + XButton xButton = UnoRuntime.queryInterface(XButton.class, xRadioButton); if (xActionListener != null) { xButton.addActionListener(xActionListener); @@ -544,11 +537,10 @@ public class UnoDialog implements EventNames try { XInterface oRadioButtonModel = insertControlModel("com.sun.star.awt.UnoControlRadioButtonModel", sName, sProperties, sValues); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRadioButtonModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oRadioButtonModel); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - XControl xControlRadioButton = xDlgContainer.getControl(new String(sName)); - XRadioButton xRadioButton = (XRadioButton) UnoRuntime.queryInterface(XRadioButton.class, xControlRadioButton); - return xRadioButton; + XControl xControlRadioButton = xDlgContainer.getControl(sName); + return UnoRuntime.queryInterface(XRadioButton.class, xControlRadioButton); } catch (com.sun.star.uno.Exception exception) { @@ -647,7 +639,7 @@ public class UnoDialog implements EventNames public void setFocus(String ControlName) { Object oFocusControl = xDlgContainer.getControl(ControlName); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oFocusControl); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, oFocusControl); xWindow.setFocus(); } @@ -735,10 +727,10 @@ public class UnoDialog implements EventNames { createWindowPeer(); } - xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer); + xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer); // xVclWindowPeer.setProperty("AutoMnemonics", new Boolean(true)); - this.BisHighContrastModeActivated = new Boolean(this.isHighContrastModeActivated()); - xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, xUnoDialog); + this.BisHighContrastModeActivated = Boolean.valueOf(this.isHighContrastModeActivated()); + xDialog = UnoRuntime.queryInterface(XDialog.class, xUnoDialog); return xDialog.execute(); } @@ -749,8 +741,8 @@ public class UnoDialog implements EventNames { createWindowPeer(); } - XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer); - xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, xUnoDialog); + XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer); + xDialog = UnoRuntime.queryInterface(XDialog.class, xUnoDialog); this.xWindow.setVisible(true); } @@ -774,7 +766,7 @@ public class UnoDialog implements EventNames */ public short executeDialog(XInterface xComponent) throws com.sun.star.uno.Exception { - XFrame frame = (XFrame) UnoRuntime.queryInterface(XFrame.class, xComponent); + XFrame frame = UnoRuntime.queryInterface(XFrame.class, xComponent); if (frame != null) { XWindow w = frame.getComponentWindow(); @@ -801,10 +793,10 @@ public class UnoDialog implements EventNames public void setAutoMnemonic(String ControlName, boolean bValue) { Object oControl = xDlgContainer.getControl(ControlName); - xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oControl); + xControl = UnoRuntime.queryInterface(XControl.class, oControl); XWindowPeer xWindowPeer = xControl.getPeer(); - XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xControl.getPeer()); - xVclWindowPeer.setProperty("AutoMnemonics", new Boolean(bValue)); + XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xControl.getPeer()); + xVclWindowPeer.setProperty("AutoMnemonics", Boolean.valueOf(bValue)); } public void modifyFontWeight(String ControlName, float FontWeight) @@ -828,10 +820,10 @@ public class UnoDialog implements EventNames Object tk = xMSF.createInstance("com.sun.star.awt.Toolkit"); if (parentPeer == null) { - parentPeer = ((XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk)).getDesktopWindow(); + parentPeer = UnoRuntime.queryInterface(XToolkit.class, tk).getDesktopWindow(); } - XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk); - xReschedule = (XReschedule) UnoRuntime.queryInterface(XReschedule.class, xToolkit); + XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, tk); + xReschedule = UnoRuntime.queryInterface(XReschedule.class, xToolkit); // TEUER! xControl.createPeer(xToolkit, parentPeer); xWindowPeer = xControl.getPeer(); @@ -855,7 +847,7 @@ public class UnoDialog implements EventNames public void deletefirstListboxEntry(String ListBoxName, String DelEntryName) { XControl xListControl = xDlgContainer.getControl(ListBoxName); - XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, xListControl); + XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, xListControl); String FirstItem = xListBox.getItem((short) 0); if (FirstItem.equals(DelEntryName)) { @@ -872,17 +864,16 @@ public class UnoDialog implements EventNames public void setPeerProperty(String ControlName, String PropertyName, Object PropertyValue) { Object oControl = xDlgContainer.getControl(ControlName); - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oControl); + XControl xControl = UnoRuntime.queryInterface(XControl.class, oControl); XWindowPeer xControlPeer = xControl.getPeer(); - XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xControlPeer); + XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xControlPeer); xVclWindowPeer.setProperty(PropertyName, PropertyValue); } public static Object getModel(Object control) { - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, control); - XControlModel xModel = xControl.getModel(); - return xModel; + XControl xControl = UnoRuntime.queryInterface(XControl.class, control); + return xControl.getModel(); } public static void setEnabled(Object control, boolean enabled) @@ -902,7 +893,7 @@ public class UnoDialog implements EventNames */ public static int getControlModelType(Object oControlModel) { - XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oControlModel); + XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oControlModel); if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlFixedTextModel")) { return UIConsts.CONTROLTYPE.FIXEDTEXT; @@ -988,7 +979,7 @@ public class UnoDialog implements EventNames */ public static String getDisplayProperty(Object oControlModel) { - XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oControlModel); + XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oControlModel); int itype = getControlModelType(oControlModel); return getDisplayProperty(itype); } @@ -1075,7 +1066,7 @@ public class UnoDialog implements EventNames int nBlue = getBlueColorShare(nUIColor); int nLuminance = ((nBlue * 28 + nGreen * 151 + nRed * 77) / 256); boolean bisactivated = (nLuminance <= 25); - BisHighContrastModeActivated = new Boolean(bisactivated); + BisHighContrastModeActivated = Boolean.valueOf(bisactivated); return bisactivated; } else @@ -1091,9 +1082,9 @@ public class UnoDialog implements EventNames public static int getRedColorShare(int _nColor) { - int nRed = (int) _nColor / 65536; + int nRed = _nColor / 65536; int nRedModulo = _nColor % 65536; - int nGreen = (int) (nRedModulo / 256); + int nGreen = nRedModulo / 256; int nGreenModulo = (nRedModulo % 256); int nBlue = nGreenModulo; return nRed; @@ -1101,17 +1092,17 @@ public class UnoDialog implements EventNames public static int getGreenColorShare(int _nColor) { - int nRed = (int) _nColor / 65536; + int nRed = _nColor / 65536; int nRedModulo = _nColor % 65536; - int nGreen = (int) (nRedModulo / 256); + int nGreen = nRedModulo / 256; return nGreen; } public static int getBlueColorShare(int _nColor) { - int nRed = (int) _nColor / 65536; + int nRed = _nColor / 65536; int nRedModulo = _nColor % 65536; - int nGreen = (int) (nRedModulo / 256); + int nGreen = nRedModulo / 256; int nGreenModulo = (nRedModulo % 256); int nBlue = nGreenModulo; return nBlue; diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java index c42fd453f957..a938b16213f5 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java @@ -134,7 +134,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames } if (textChanged != null) { - XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xComboBox); + XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox); xTextComponent.addTextListener((XTextListener) guiEventListener); guiEventListener.add(sName, EVENT_TEXT_CHANGED, textChanged, eventTarget); } @@ -186,7 +186,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames public XControl insertTitledBox(String sName, String[] sPropNames, Object[] oPropValues) { Object oTitledBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues); - return (XControl) UnoRuntime.queryInterface(XControl.class, oTitledBox); + return UnoRuntime.queryInterface(XControl.class, oTitledBox); } public XTextComponent insertTextField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) @@ -307,25 +307,25 @@ public class UnoDialog2 extends UnoDialog implements EventNames public XControl insertFixedLine(String sName, String[] sPropNames, Object[] oPropValues) { Object oLine = insertControlModel2("com.sun.star.awt.UnoControlFixedLineModel", sName, sPropNames, oPropValues); - return (XControl) UnoRuntime.queryInterface(XControl.class, oLine); + return UnoRuntime.queryInterface(XControl.class, oLine); } public XScrollBar insertScrollBar(String sName, String[] sPropNames, Object[] oPropValues) { Object oScrollBar = insertControlModel2("com.sun.star.awt.UnoControlScrollBarModel", sName, sPropNames, oPropValues); - return (XScrollBar) UnoRuntime.queryInterface(XScrollBar.class, oScrollBar); + return UnoRuntime.queryInterface(XScrollBar.class, oScrollBar); } public XProgressBar insertProgressBar(String sName, String[] sPropNames, Object[] oPropValues) { Object oProgressBar = insertControlModel2("com.sun.star.awt.UnoControlProgressBarModel", sName, sPropNames, oPropValues); - return (XProgressBar) UnoRuntime.queryInterface(XProgressBar.class, oProgressBar); + return UnoRuntime.queryInterface(XProgressBar.class, oProgressBar); } public XControl insertGroupBox(String sName, String[] sPropNames, Object[] oPropValues) { Object oGroupBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues); - return (XControl) UnoRuntime.queryInterface(XControl.class, oGroupBox); + return UnoRuntime.queryInterface(XControl.class, oGroupBox); } public Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues) @@ -347,8 +347,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames { ex.printStackTrace(); } - final Object aObj = xDlgContainer.getControl(componentName); - return aObj; + return xDlgContainer.getControl(componentName); } private void setControlPropertiesDebug(Object model, String[] names, Object[] values) @@ -374,8 +373,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames public static Object getControlModel(Object unoControl) { - Object obj = ((XControl) UnoRuntime.queryInterface(XControl.class, unoControl)).getModel(); - return obj; + return UnoRuntime.queryInterface(XControl.class, unoControl).getModel(); } public int showMessageBox(String windowServiceName, int windowAttribute, String MessageText) diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index 9af5fc560a82..5273994741c6 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -109,7 +109,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL { try { - XTopWindow top = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class, xWindow); + XTopWindow top = UnoRuntime.queryInterface(XTopWindow.class, xWindow); if (top != null) { top.toFront(); @@ -178,12 +178,12 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL public void setRoadmapInteractive(boolean _bInteractive) { - Helper.setUnoPropertyValue(oRoadmap, "Activated", new Boolean(_bInteractive)); + Helper.setUnoPropertyValue(oRoadmap, "Activated", Boolean.valueOf(_bInteractive)); } public void setRoadmapComplete(boolean bComplete) { - Helper.setUnoPropertyValue(oRoadmap, "Complete", new Boolean(bComplete)); + Helper.setUnoPropertyValue(oRoadmap, "Complete", Boolean.valueOf(bComplete)); } public boolean isRoadmapComplete() @@ -254,18 +254,18 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL Boolean.TRUE, 85 }); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oRoadmap); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, "rdmNavi"); - xSSFRoadmap = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmap); - xIndexContRoadmap = (XIndexContainer) UnoRuntime.queryInterface(XIndexContainer.class, oRoadmap); + xSSFRoadmap = UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmap); + xIndexContRoadmap = UnoRuntime.queryInterface(XIndexContainer.class, oRoadmap); // XPropertySet xPropRoadmapModel = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap); // xPropRoadmapModel.addPropertyChangeListener("CurrentItemID", new WizardDialog.RoadmapItemListener(this.xDialogModel)); MethodInvocation mi = new MethodInvocation("itemStateChanged", this, com.sun.star.awt.ItemEvent.class); getGuiEventListener().add("rdmNavi", EventNames.EVENT_ITEM_CHANGED, mi); xRoadmapControl = this.xDlgContainer.getControl("rdmNavi"); - xRoadmapBroadcaster = (XItemEventBroadcaster) UnoRuntime.queryInterface(XItemEventBroadcaster.class, xRoadmapControl); + xRoadmapBroadcaster = UnoRuntime.queryInterface(XItemEventBroadcaster.class, xRoadmapControl); xRoadmapBroadcaster.addItemListener((XItemListener) getGuiEventListener()); // xRoadmapControl = this.xDlgContainer.getControl("rdmNavi"); @@ -310,11 +310,10 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL { Object oRoadmapItem = xSSFRoadmap.createInstance(); Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_LABEL, _sLabel); - Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnabled)); + Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnabled)); Helper.setUnoPropertyValue(oRoadmapItem, "ID", new Integer(_CurItemID)); xIndexContRoadmap.insertByIndex(Index, oRoadmapItem); - int NextIndex = Index + 1; - return NextIndex; + return Index + 1; } catch (com.sun.star.uno.Exception exception) { @@ -588,7 +587,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL XInterface xRoadmapItem = getRoadmapItemByID(_nStep); if (xRoadmapItem != null) { - Helper.setUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); + Helper.setUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled)); } } diff --git a/wizards/com/sun/star/wizards/ui/event/AbstractListener.java b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java index bbe9cee2eb86..464282a56f7d 100644 --- a/wizards/com/sun/star/wizards/ui/event/AbstractListener.java +++ b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java @@ -128,7 +128,7 @@ public class AbstractListener */ public static String getEventSourceName(EventObject eventObject) { - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, eventObject.Source); + XControl xControl = UnoRuntime.queryInterface(XControl.class, eventObject.Source); return (String) Helper.getUnoPropertyValue(xControl.getModel(), PropertyNames.PROPERTY_NAME, String.class); } } diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java index 63213e444dc9..7da0981104ba 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java @@ -347,7 +347,7 @@ public abstract class DataAware { */ public void set(Object value, Object target) { try { - setMethod.invoke(target, new Object[] {value}); + setMethod.invoke(target, value); } catch (IllegalAccessException ex1) { ex1.printStackTrace(); } catch (InvocationTargetException ex2) { diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java index 4dc917a76ad3..7d0d4194f892 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java @@ -460,7 +460,7 @@ public class DataAwareFields } else if (value instanceof String) { - return ((String) value).equals(TRUE); + return value.equals(TRUE); } else if (value instanceof short[]) { diff --git a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java index b29b960d4c06..73980b9afdd1 100644 --- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java +++ b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java @@ -64,7 +64,7 @@ public class ListModelBinder implements ListDataListener public ListModelBinder(Object unoListBox, ListModel listModel_) { - unoList = (XListBox) UnoRuntime.queryInterface(XListBox.class, unoListBox); + unoList = UnoRuntime.queryInterface(XListBox.class, unoListBox); unoListModel = UnoDataAware.getModel(unoListBox); setListModel(listModel_); } @@ -100,7 +100,7 @@ public class ListModelBinder implements ListDataListener protected void remove(short i1, short i2) { - unoList.removeItems((short) i1, (short) (i2 - i1 + 1)); + unoList.removeItems(i1, (short) (i2 - i1 + 1)); } protected void insert(short i) @@ -180,7 +180,7 @@ public class ListModelBinder implements ListDataListener public static void fillList(Object list, Object[] items, Renderer renderer) { - XListBox xlist = (XListBox) UnoRuntime.queryInterface(XListBox.class, list); + XListBox xlist = UnoRuntime.queryInterface(XListBox.class, list); Helper.setUnoPropertyValue(UnoDataAware.getModel(list), PropertyNames.STRING_ITEM_LIST, new String[] { }); @@ -195,7 +195,7 @@ public class ListModelBinder implements ListDataListener public static void fillComboBox(Object list, Object[] items, Renderer renderer) { - XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, list); + XComboBox xComboBox = UnoRuntime.queryInterface(XComboBox.class, list); Helper.setUnoPropertyValue(UnoDataAware.getModel(list), PropertyNames.STRING_ITEM_LIST, new String[] { }); diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java index c45a496c7849..2f86de798bfd 100644 --- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java +++ b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java @@ -86,10 +86,8 @@ public class MethodInvocation { if (mWithParam) { - return mMethod.invoke(mObject, new Object[] - { - (Object) param - }); + return mMethod.invoke(mObject, (Object) param + ); } else { diff --git a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java index b2a9b0197357..ed8bf03642a4 100644 --- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java @@ -47,7 +47,7 @@ public class RadioDataAware extends DataAware radioButtons = new XRadioButton[radioButs.length]; for (int i = 0; i < radioButs.length; i++) { - radioButtons[i] = (XRadioButton) UnoRuntime.queryInterface(XRadioButton.class, radioButs[i]); + radioButtons[i] = UnoRuntime.queryInterface(XRadioButton.class, radioButs[i]); } } diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java index 5ab0a8f20743..f97ae8f24577 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java @@ -152,7 +152,7 @@ public class UnoDataAware extends DataAware private static UnoDataAware attachTextControl(Object data, String prop, Object unoText, final Listener listener, String unoProperty, boolean field, Object value) { - XTextComponent text = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, unoText); + XTextComponent text = UnoRuntime.queryInterface(XTextComponent.class, unoText); final UnoDataAware uda = new UnoDataAware(data, field ? DataAwareFields.getFieldValueFor(data, prop, value) @@ -199,7 +199,7 @@ public class UnoDataAware extends DataAware public static UnoDataAware attachCheckBox(Object data, String prop, Object checkBox, final Listener listener, boolean field) { - XCheckBox xcheckBox = ((XCheckBox) UnoRuntime.queryInterface(XCheckBox.class, checkBox)); + XCheckBox xcheckBox = UnoRuntime.queryInterface(XCheckBox.class, checkBox); final UnoDataAware uda = new UnoDataAware(data, field ? DataAwareFields.getFieldValueFor(data, prop, new Short((short) 0)) @@ -239,7 +239,7 @@ public class UnoDataAware extends DataAware public static UnoDataAware attachListBox(Object data, String prop, Object listBox, final Listener listener, boolean field) { - XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, listBox); + XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, listBox); final UnoDataAware uda = new UnoDataAware(data, field ? DataAwareFields.getFieldValueFor(data, prop, new short[0]) @@ -251,7 +251,7 @@ public class UnoDataAware extends DataAware public static Object getModel(Object control) { - return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel(); + return UnoRuntime.queryInterface(XControl.class, control).getModel(); } public static void setEnabled(Object control, boolean enabled) diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java index c4101f30c92c..f707690394ea 100644 --- a/wizards/com/sun/star/wizards/web/FTPDialog.java +++ b/wizards/com/sun/star/wizards/web/FTPDialog.java @@ -326,7 +326,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID }, new Object[] { - new Boolean(false), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_TXT_PATH), "txtDir", INTEGER_12, 113, new Short((short) 11), resources.restxtDir_value, 184 + Boolean.FALSE, INTEGER_12, HelpIds.getHelpIdString(HID_FTP_TXT_PATH), "txtDir", INTEGER_12, 113, new Short((short) 11), resources.restxtDir_value, 184 }); btnDir = insertButton("btnDir", "chooseDirectory", PROPNAMES_BUTTON, @@ -708,10 +708,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID private String imageUrl(String s) { - String t = imagesDirectory + s; - //System.out.println(t); - return t; - + return imagesDirectory + s; } /** diff --git a/wizards/com/sun/star/wizards/web/Process.java b/wizards/com/sun/star/wizards/web/Process.java index 3140d3dc328c..f861a82865e3 100644 --- a/wizards/com/sun/star/wizards/web/Process.java +++ b/wizards/com/sun/star/wizards/web/Process.java @@ -164,13 +164,12 @@ public class Process implements WebWizardConst, ProcessErrors { } int publish = countPublish(); - int taskSteps = + return TASKS_IN_PREPARE + TASKS_IN_EXPORT + docs * TASKS_PER_DOC + TASKS_IN_GENERATE + xsl * TASKS_PER_XSL + TASKS_IN_PUBLISH + publish * TASKS_PER_PUBLISH + TASKS_IN_FINISHUP; - return taskSteps; } /** @@ -241,8 +240,7 @@ public class Process implements WebWizardConst, ProcessErrors { try { - String s = FileAccess.getOfficePath(xmsf, "Temp", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); - return s; + return FileAccess.getOfficePath(xmsf, "Temp", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.java b/wizards/com/sun/star/wizards/web/WWD_Events.java index f4b657854592..b37e0fff39e6 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.java +++ b/wizards/com/sun/star/wizards/web/WWD_Events.java @@ -81,11 +81,11 @@ public abstract class WWD_Events extends WWD_Startup { super(xmsf); Create c = new Create(); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkFTP); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, chkFTP); xWindow.addKeyListener(c); - xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkLocalDir); + xWindow = UnoRuntime.queryInterface(XWindow.class, chkLocalDir); xWindow.addKeyListener(c); - xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkZip); + xWindow = UnoRuntime.queryInterface(XWindow.class, chkZip); xWindow.addKeyListener(c); } @@ -310,7 +310,7 @@ public abstract class WWD_Events extends WWD_Startup { fillExportList(settings.getExporters(doc.appType)); } - else; // do nothing + selectedDoc = s; @@ -1204,7 +1204,7 @@ public abstract class WWD_Events extends WWD_Startup //if (xCloseable != null) // xCloseable.close(false); - XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myFrame); + XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, myFrame); if (xCloseable != null) { xCloseable.close(false); @@ -1301,6 +1301,6 @@ public abstract class WWD_Events extends WWD_Startup task.advance(false); } } - }; + } } diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.java b/wizards/com/sun/star/wizards/web/WWD_Startup.java index f75740363a93..c3bae2a10bc4 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.java +++ b/wizards/com/sun/star/wizards/web/WWD_Startup.java @@ -254,7 +254,7 @@ public abstract class WWD_Startup extends WWD_General this.buildStep7(proxies, exclamationURL); buildStepX(); - this.xMSF = xMSF; + this.xMSF = xmsf; XDesktop xDesktop = Desktop.getDesktop(xMSF); myFrame = OfficeDocument.createNewFrame(xMSF, this); Object doc = OfficeDocument.createNewDocument(myFrame, "swriter", false, true); @@ -388,7 +388,7 @@ public abstract class WWD_Startup extends WWD_General private XFrame getFrame(Object model) { - XModel xmodel = (XModel) UnoRuntime.queryInterface(XModel.class, model); + XModel xmodel = UnoRuntime.queryInterface(XModel.class, model); return xmodel.getCurrentController().getFrame(); } @@ -412,7 +412,7 @@ public abstract class WWD_Startup extends WWD_General //XWindow xContainerWindow = myFrame.getContainerWindow(); XWindow xContainerWindow = myFrame.getComponentWindow(); - XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow); + XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow); createWindowPeer(xWindowPeer); @@ -595,7 +595,7 @@ public abstract class WWD_Startup extends WWD_General //page 2 : document properties - docListDA = (UnoDataAware) UnoDataAware.attachListBox(this, "SelectedDoc", lstDocuments, null, false); + docListDA = UnoDataAware.attachListBox(this, "SelectedDoc", lstDocuments, null, false); docListDA.disableControls(new Object[] { /*btnDocDown, btnDocUp, */ diff --git a/wizards/com/sun/star/wizards/web/data/CGDesign.java b/wizards/com/sun/star/wizards/web/data/CGDesign.java index 00c1ea10b949..4644eb96899f 100644 --- a/wizards/com/sun/star/wizards/web/data/CGDesign.java +++ b/wizards/com/sun/star/wizards/web/data/CGDesign.java @@ -72,7 +72,7 @@ public class CGDesign extends ConfigGroup implements XMLProvider public void setStyle(short[] newStyle) { - Object o = ((CGStyle) ((CGSettings) root).cp_Styles.getElementAt(newStyle[0])); + Object o = ((CGSettings) root).cp_Styles.getElementAt(newStyle[0]); cp_Style = (String) ((CGSettings) root).cp_Styles.getKey(o); } diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.java b/wizards/com/sun/star/wizards/web/data/CGDocument.java index 76affdb36d5a..e3612acf88f3 100644 --- a/wizards/com/sun/star/wizards/web/data/CGDocument.java +++ b/wizards/com/sun/star/wizards/web/data/CGDocument.java @@ -177,8 +177,8 @@ public class CGDocument extends ConfigSetItem implements XMLProvider 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(); + XComponent component = UnoRuntime.queryInterface(XComponentLoader.class, desktop).loadComponentFromURL(cp_URL, "_default", 0, props); + xProps = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, component).getDocumentProperties(); } task.advance(true); //4 @@ -243,13 +243,13 @@ public class CGDocument extends ConfigSetItem implements XMLProvider //System.out.println(appType); isSOOpenable = - (appType == TypeDetection.WRITER_DOC || appType == TypeDetection.CALC_DOC || appType == TypeDetection.IMPRESS_DOC || appType == TypeDetection.DRAW_DOC) || appType == TypeDetection.HTML_DOC; + (appType.equals(TypeDetection.WRITER_DOC) || appType.equals(TypeDetection.CALC_DOC) || appType.equals(TypeDetection.IMPRESS_DOC) || appType.equals(TypeDetection.DRAW_DOC)) || appType.equals(TypeDetection.HTML_DOC); // String[] parts = media.split("_"); // line removed because of compatibility to JDK13 String[] parts = JavaTools.ArrayoutofString(media, "_"); - isSODocument = parts.length < 2 ? false : isSOOpenable && (parts[1].startsWith("Star")); + isSODocument = parts.length >= 2 && isSOOpenable && (parts[1].startsWith("Star")); } diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.java b/wizards/com/sun/star/wizards/web/data/CGSettings.java index 4102c2f87dbf..60e711c3c2ae 100644 --- a/wizards/com/sun/star/wizards/web/data/CGSettings.java +++ b/wizards/com/sun/star/wizards/web/data/CGSettings.java @@ -124,7 +124,7 @@ public class CGSettings extends ConfigGroup } } } - return (CGExporter[]) v.toArray(EMPTY_ARRAY_1); + return (CGExporter[]) v.toArray(new CGExporter[v.size()]); } /** @@ -141,7 +141,7 @@ public class CGSettings extends ConfigGroup private void calcExportersTargetTypeNames(XMultiServiceFactory xmsf) throws Exception { Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection"); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect); for (int i = 0; i < cp_Exporters.getSize(); i++) { calcExporterTargetTypeName(xNameAccess, (CGExporter) cp_Exporters.getElementAt(i)); diff --git a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java index 97b1109add01..4f35c69e935b 100644 --- a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java +++ b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java @@ -73,7 +73,7 @@ public abstract class AbstractExporter implements Exporter { props.put("FilterData", filterData); } - XStorable xs = ((XStorable) UnoRuntime.queryInterface(XStorable.class, officeDocument)); + XStorable xs = UnoRuntime.queryInterface(XStorable.class, officeDocument); PropertyValue[] o = props.getProperties(); xs.storeToURL(targetUrl, o); } @@ -110,7 +110,7 @@ public abstract class AbstractExporter implements Exporter props.put("Hidden", Boolean.TRUE); props.put("MacroExecutionMode", new Short(MacroExecMode.NEVER_EXECUTE)); props.put("UpdateDocMode", new Short(UpdateDocMode.NO_UPDATE)); - document = ((XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop)).loadComponentFromURL(doc.cp_URL, "_blank", 0, props.getProperties()); + document = UnoRuntime.queryInterface(XComponentLoader.class, desktop).loadComponentFromURL(doc.cp_URL, "_blank", 0, props.getProperties()); } catch (com.sun.star.lang.IllegalArgumentException iaex) { @@ -134,7 +134,7 @@ public abstract class AbstractExporter implements Exporter (XComponent) UnoRuntime.queryInterface(XComponent.class, doc));*/ try { - XCloseable xc = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, doc); + XCloseable xc = UnoRuntime.queryInterface(XCloseable.class, doc); xc.close(false); } catch (Exception ex) |